summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2018-01-19 17:46:27 +0000
committerJoel Galenson <jgalenson@google.com>2018-01-19 17:46:27 +0000
commitdbc724f764deaac6c2a3fb9f7c9cfa557797e4da (patch)
treee06320bb22e24d595d1b45fbc96f81f872cf9ee1 /llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
parentbfb02aec5a86de2ee8b4a88f03675e50a8e03460 (diff)
downloadbcm5719-llvm-dbc724f764deaac6c2a3fb9f7c9cfa557797e4da.tar.gz
bcm5719-llvm-dbc724f764deaac6c2a3fb9f7c9cfa557797e4da.zip
[ARM] Fix perf regression in compare optimization.
Fix a performance regression caused by r322737. While trying to make it easier to replace compares with existing adds and subtracts, I accidentally stopped it from doing so in some cases. This should fix that. I'm also fixing another potential bug in that commit. Differential Revision: https://reviews.llvm.org/D42263 llvm-svn: 322972
Diffstat (limited to 'llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
index 9981b0586d6..45724df9619 100644
--- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -2736,7 +2736,7 @@ bool ARMBaseInstrInfo::optimizeCompareInstr(
}
I = CmpInstr;
E = MI;
- } else {
+ } else if (E != B) {
// Allow the loop below to search E (which was initially MI). Since MI and
// SubAdd have different tests, even if that instruction could not be MI, it
// could still potentially be SubAdd.
@@ -2763,8 +2763,7 @@ bool ARMBaseInstrInfo::optimizeCompareInstr(
return false;
if (I == B)
- // The 'and' is below the comparison instruction.
- return false;
+ break;
}
// Return false if no candidates exist.
OpenPOWER on IntegriCloud