]> granicus.if.org Git - llvm/commitdiff
[LoopPred] Stylistic improvement to recently added NE/EQ normalization [NFC]
authorPhilip Reames <listmail@philipreames.com>
Tue, 9 Jul 2019 02:03:31 +0000 (02:03 +0000)
committerPhilip Reames <listmail@philipreames.com>
Tue, 9 Jul 2019 02:03:31 +0000 (02:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365425 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopPredication.cpp

index 4ee3d0079c782d6ce462df2693c262b6cda755ca..a14c690d5c47e5309571c364dd9cde350d0befa3 100644 (file)
@@ -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;
 }