File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
llvm/lib/Transforms/Scalar Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -647,17 +647,13 @@ Optional<Value *> LoopPredication::widenICmpRangeCheckDecrementingLoop(
647
647
648
648
static void normalizePredicate (ScalarEvolution *SE, Loop *L,
649
649
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 ) &&
653
653
RC.IV ->getStepRecurrence (*SE)->isOne () &&
654
654
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;
661
657
}
662
658
663
659
You can’t perform that action at this time.
0 commit comments