From 46398550bae68dc818e4f6a1c4ca9899362d58a3 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Tue, 9 Jul 2019 02:03:31 +0000 Subject: [PATCH] [LoopPred] Stylistic improvement to recently added NE/EQ normalization [NFC] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365425 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopPredication.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/Transforms/Scalar/LoopPredication.cpp b/lib/Transforms/Scalar/LoopPredication.cpp index 4ee3d0079c7..a14c690d5c4 100644 --- a/lib/Transforms/Scalar/LoopPredication.cpp +++ b/lib/Transforms/Scalar/LoopPredication.cpp @@ -647,17 +647,13 @@ Optional 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; } -- 2.50.1