1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 13:11:39 +01:00

[LoopPred] Stylistic improvement to recently added NE/EQ normalization [NFC]

llvm-svn: 365425
This commit is contained in:
Philip Reames 2019-07-09 02:03:31 +00:00
parent 61809186ed
commit 38489eb344

View 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;
}