diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopPredication.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopPredication.cpp b/llvm/lib/Transforms/Scalar/LoopPredication.cpp index 4ee3d0079c7..a14c690d5c4 100644 --- a/llvm/lib/Transforms/Scalar/LoopPredication.cpp +++ b/llvm/lib/Transforms/Scalar/LoopPredication.cpp @@ -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; } |

