diff options
author | Daniel Sanders <daniel_l_sanders@apple.com> | 2017-04-22 14:31:28 +0000 |
---|---|---|
committer | Daniel Sanders <daniel_l_sanders@apple.com> | 2017-04-22 14:31:28 +0000 |
commit | 3016d3c6c95ff2510c695e05782165524c61b5c3 (patch) | |
tree | 9e0271d9921f67d10700370dfb3cd2723cab2830 /llvm/utils | |
parent | d57681b703259c8a87877edcb90db79b01ebc71b (diff) | |
download | bcm5719-llvm-3016d3c6c95ff2510c695e05782165524c61b5c3.tar.gz bcm5719-llvm-3016d3c6c95ff2510c695e05782165524c61b5c3.zip |
[globalisel][tablegen] Fix PR32733 by checking which instruction operands belong to.
canMutate() was returning true when the operands were all in the same order as
the matched instruction. However, it wasn't checking the operands were actually
on that instruction. This worked when we could only match a single instruction
but the addition of nested instruction matching led to cases where the operands
could be split across multiple instructions. canMutate() now returns false if
operands belong to instructions other than the root of the match.
llvm-svn: 301077
Diffstat (limited to 'llvm/utils')
-rw-r--r-- | llvm/utils/TableGen/GlobalISelEmitter.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp index 0c77167d4cc..488bf8d312b 100644 --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -1014,8 +1014,9 @@ private: bool canMutate() const { for (const auto &Renderer : enumerate(OperandRenderers)) { if (const auto *Copy = dyn_cast<CopyRenderer>(&*Renderer.value())) { - if (Matched.getOperand(Copy->getSymbolicName()).getOperandIndex() != - Renderer.index()) + const OperandMatcher &OM = Matched.getOperand(Copy->getSymbolicName()); + if (&Matched != &OM.getInstructionMatcher() || + OM.getOperandIndex() != Renderer.index()) return false; } else return false; |