summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff options
context:
space:
mode:
authorChen Zheng <czhengsz@cn.ibm.com>2019-07-25 01:22:08 +0000
committerChen Zheng <czhengsz@cn.ibm.com>2019-07-25 01:22:08 +0000
commita2d74d3d9021c3130291b0d4a264ce214211b168 (patch)
treed9a821a21b7f84d705765baf305bcca3f66815ed /llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
parente9be72a3b3b941203360373b675328f07b6759c1 (diff)
downloadbcm5719-llvm-a2d74d3d9021c3130291b0d4a264ce214211b168.tar.gz
bcm5719-llvm-a2d74d3d9021c3130291b0d4a264ce214211b168.zip
[PowerPC] exclude more icmps in LSR which is converted in later hardware loop pass
Differential Revision: https://reviews.llvm.org/D64795 llvm-svn: 366976
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 59a387a186b..e756baa773d 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -3265,12 +3265,12 @@ void LSRInstance::CollectFixupsAndInitialFormulae() {
// requirements for both N and i at the same time. Limiting this code to
// equality icmps is not a problem because all interesting loops use
// equality icmps, thanks to IndVarSimplify.
- if (ICmpInst *CI = dyn_cast<ICmpInst>(UserInst))
+ if (ICmpInst *CI = dyn_cast<ICmpInst>(UserInst)) {
+ // If CI can be saved in some target, like replaced inside hardware loop
+ // in PowerPC, no need to generate initial formulae for it.
+ if (SaveCmp && CI == dyn_cast<ICmpInst>(ExitBranch->getCondition()))
+ continue;
if (CI->isEquality()) {
- // If CI can be saved in some target, like replaced inside hardware loop
- // in PowerPC, no need to generate initial formulae for it.
- if (SaveCmp && CI == dyn_cast<ICmpInst>(ExitBranch->getCondition()))
- continue;
// Swap the operands if needed to put the OperandValToReplace on the
// left, for consistency.
Value *NV = CI->getOperand(1);
@@ -3298,6 +3298,7 @@ void LSRInstance::CollectFixupsAndInitialFormulae() {
Factors.insert(-(uint64_t)Factors[i]);
Factors.insert(-1);
}
+ }
// Get or create an LSRUse.
std::pair<size_t, int64_t> P = getUse(S, Kind, AccessTy);
OpenPOWER on IntegriCloud