diff options
author | Eli Friedman <efriedma@quicinc.com> | 2019-03-22 20:49:15 +0000 |
---|---|---|
committer | Eli Friedman <efriedma@quicinc.com> | 2019-03-22 20:49:15 +0000 |
commit | b906bba576e6260d17430114179f09f4cec378f1 (patch) | |
tree | c374e8f5658a2d6777f3511aba0800e814786c7d /llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | |
parent | ce1ed55a4a4a6ec49a7fa4dc411de24147aacab5 (diff) | |
download | bcm5719-llvm-b906bba576e6260d17430114179f09f4cec378f1.tar.gz bcm5719-llvm-b906bba576e6260d17430114179f09f4cec378f1.zip |
[ARM] Don't form "ands" when it isn't scheduled correctly.
In r322972/r323136, the iteration here was changed to catch cases at the
beginning of a basic block... but we accidentally deleted an important
safety check. Restore that check to the way it was.
Fixes https://bugs.llvm.org/show_bug.cgi?id=41116
Differential Revision: https://reviews.llvm.org/D59680
llvm-svn: 356809
Diffstat (limited to 'llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp index 3250ee5ef85..12a2d7a1d5e 100644 --- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp +++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -2869,7 +2869,15 @@ bool ARMBaseInstrInfo::optimizeCompareInstr( // change. We can't do this transformation. return false; - } while (I != B); + if (I == B) { + // In some cases, we scan the use-list of an instruction for an AND; + // that AND is in the same BB, but may not be scheduled before the + // corresponding TST. In that case, bail out. + // + // FIXME: We could try to reschedule the AND. + return false; + } + } while (true); // Return false if no candidates exist. if (!MI && !SubAdd) |