[llvm] r316480 - [globalisel][tablegen] Fix future undefined behaviour in r316463.
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 11:11:55 PDT 2017
Author: dsanders
Date: Tue Oct 24 11:11:54 2017
New Revision: 316480
URL: http://llvm.org/viewvc/llvm-project?rev=316480&view=rev
Log:
[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.
Modified:
llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
Modified: llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp?rev=316480&r1=316479&r2=316480&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp Tue Oct 24 11:11:54 2017
@@ -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
More information about the llvm-commits
mailing list