Skip to content

Commit 0e344e9

Browse files
committed
[LoopPred] Stylistic improvement to recently added NE/EQ normalization [NFC]
llvm-svn: 365425
1 parent 4e63615 commit 0e344e9

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

llvm/lib/Transforms/Scalar/LoopPredication.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -647,17 +647,13 @@ Optional<Value *> LoopPredication::widenICmpRangeCheckDecrementingLoop(
647647

648648
static void normalizePredicate(ScalarEvolution *SE, Loop *L,
649649
LoopICmp& RC) {
650-
// LFTR canonicalizes checks to the ICMP_NE form instead of an ULT/SLT form.
651-
// Normalize back to the ULT/SLT form for ease of handling.
652-
if (RC.Pred == ICmpInst::ICMP_NE &&
650+
// LFTR canonicalizes checks to the ICMP_NE/EQ form; normalize back to the
651+
// ULT/UGE form for ease of handling by our caller.
652+
if (ICmpInst::isEquality(RC.Pred) &&
653653
RC.IV->getStepRecurrence(*SE)->isOne() &&
654654
SE->isKnownPredicate(ICmpInst::ICMP_ULE, RC.IV->getStart(), RC.Limit))
655-
RC.Pred = ICmpInst::ICMP_ULT;
656-
if (RC.Pred == ICmpInst::ICMP_EQ &&
657-
RC.IV->getStepRecurrence(*SE)->isOne() &&
658-
SE->isKnownPredicate(ICmpInst::ICMP_ULE, RC.IV->getStart(), RC.Limit))
659-
RC.Pred = ICmpInst::ICMP_UGE;
660-
655+
RC.Pred = RC.Pred == ICmpInst::ICMP_NE ?
656+
ICmpInst::ICMP_ULT : ICmpInst::ICMP_UGE;
661657
}
662658

663659

0 commit comments

Comments
 (0)