1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[globalisel][tablegen] Fix future undefined behaviour in r316463.

I missed a dereference of `Matched` that preceeded the new check. Thanks to
Justin Bogner for spotting it.

llvm-svn: 316480
This commit is contained in:
Daniel Sanders 2017-10-24 18:11:54 +00:00
parent d5cead992a
commit bf3dbd40ec

View File

@ -1758,13 +1758,16 @@ private:
/// True if the instruction can be built solely by mutating the opcode.
bool canMutate(RuleMatcher &Rule) const {
if (!Matched)
return false;
if (OperandRenderers.size() != Matched->getNumOperands())
return false;
for (const auto &Renderer : enumerate(OperandRenderers)) {
if (const auto *Copy = dyn_cast<CopyRenderer>(&*Renderer.value())) {
const OperandMatcher &OM = Rule.getOperandMatcher(Copy->getSymbolicName());
if ((Matched != nullptr && Matched != &OM.getInstructionMatcher()) ||
if (Matched != &OM.getInstructionMatcher() ||
OM.getOperandIndex() != Renderer.index())
return false;
} else