[llvm] r365425 - [LoopPred] Stylistic improvement to recently added NE/EQ normalization [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 8 19:03:31 PDT 2019
Author: reames
Date: Mon Jul 8 19:03:31 2019
New Revision: 365425
URL: http://llvm.org/viewvc/llvm-project?rev=365425&view=rev
Log:
[LoopPred] Stylistic improvement to recently added NE/EQ normalization [NFC]
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopPredication.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopPredication.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopPredication.cpp?rev=365425&r1=365424&r2=365425&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopPredication.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopPredication.cpp Mon Jul 8 19:03:31 2019
@@ -647,17 +647,13 @@ Optional<Value *> LoopPredication::widen
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;
}
More information about the llvm-commits
mailing list