[llvm] 7ff943a - [indvars] Move a check slightlly earlier [NFC]

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 3 12:24:37 PDT 2021


Author: Philip Reames
Date: 2021-11-03T12:24:10-07:00
New Revision: 7ff943a9ed878e3b8ffe162b2af41a81da1a11a2

URL: https://github.com/llvm/llvm-project/commit/7ff943a9ed878e3b8ffe162b2af41a81da1a11a2
DIFF: https://github.com/llvm/llvm-project/commit/7ff943a9ed878e3b8ffe162b2af41a81da1a11a2.diff

LOG: [indvars] Move a check slightlly earlier [NFC]

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index fd8b08bed147..c57acea0ca40 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -1431,7 +1431,7 @@ bool IndVarSimplify::canonicalizeExitCondition(Loop *L) {
     assert(BI->isConditional() && "exit branch must be conditional");
 
     auto *ICmp = dyn_cast<ICmpInst>(BI->getCondition());
-    if (!ICmp || !ICmp->hasOneUse())
+    if (!ICmp || !ICmp->hasOneUse() || ICmp->isUnsigned())
       continue;
 
     auto *LHS = ICmp->getOperand(0);
@@ -1444,7 +1444,7 @@ bool IndVarSimplify::canonicalizeExitCondition(Loop *L) {
 
     // Match (icmp signed-cond zext, RHS)
     Value *LHSOp = nullptr;
-    if (!match(LHS, m_ZExt(m_Value(LHSOp))) || !ICmp->isSigned())
+    if (!match(LHS, m_ZExt(m_Value(LHSOp))))
       continue;
 
     const DataLayout &DL = ExitingBB->getModule()->getDataLayout();


        


More information about the llvm-commits mailing list