aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/LoopPredication.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2019-07-09 02:03:31 +0000
committerPhilip Reames <listmail@philipreames.com>2019-07-09 02:03:31 +0000
commit0e344e9dc5f640cb0a2e72538962c1499ceb9663 (patch)
treeacc097ff81ac13b011f53e5442c89eca3541094d /llvm/lib/Transforms/Scalar/LoopPredication.cpp
parent4e636156ef2eb1c1d4caf64d5c7fa31ef9fb3985 (diff)
downloadllvm-0e344e9dc5f640cb0a2e72538962c1499ceb9663.zip
llvm-0e344e9dc5f640cb0a2e72538962c1499ceb9663.tar.gz
llvm-0e344e9dc5f640cb0a2e72538962c1499ceb9663.tar.bz2
[LoopPred] Stylistic improvement to recently added NE/EQ normalization [NFC]
llvm-svn: 365425
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopPredication.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopPredication.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopPredication.cpp b/llvm/lib/Transforms/Scalar/LoopPredication.cpp
index 4ee3d00..a14c690 100644
--- a/llvm/lib/Transforms/Scalar/LoopPredication.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopPredication.cpp
@@ -647,17 +647,13 @@ Optional<Value *> LoopPredication::widenICmpRangeCheckDecrementingLoop(
static void normalizePredicate(ScalarEvolution *SE, Loop *L,
LoopICmp& RC) {
- // LFTR canonicalizes checks to the ICMP_NE form instead of an ULT/SLT form.
- // Normalize back to the ULT/SLT form for ease of handling.
- if (RC.Pred == ICmpInst::ICMP_NE &&
+ // LFTR canonicalizes checks to the ICMP_NE/EQ form; normalize back to the
+ // ULT/UGE form for ease of handling by our caller.
+ if (ICmpInst::isEquality(RC.Pred) &&
RC.IV->getStepRecurrence(*SE)->isOne() &&
SE->isKnownPredicate(ICmpInst::ICMP_ULE, RC.IV->getStart(), RC.Limit))
- RC.Pred = ICmpInst::ICMP_ULT;
- if (RC.Pred == ICmpInst::ICMP_EQ &&
- RC.IV->getStepRecurrence(*SE)->isOne() &&
- SE->isKnownPredicate(ICmpInst::ICMP_ULE, RC.IV->getStart(), RC.Limit))
- RC.Pred = ICmpInst::ICMP_UGE;
-
+ RC.Pred = RC.Pred == ICmpInst::ICMP_NE ?
+ ICmpInst::ICMP_ULT : ICmpInst::ICMP_UGE;
}