[llvm] 882ee7f - Fix buildbot regression from 9c4baf5.

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 9 17:54:23 PDT 2021


Author: Eli Friedman
Date: 2021-07-09T17:54:09-07:00
New Revision: 882ee7fbd6fc989fba53f3d9672440771feb80f5

URL: https://github.com/llvm/llvm-project/commit/882ee7fbd6fc989fba53f3d9672440771feb80f5
DIFF: https://github.com/llvm/llvm-project/commit/882ee7fbd6fc989fba53f3d9672440771feb80f5.diff

LOG: Fix buildbot regression from 9c4baf5.

Apparently ScalarEvolution::isImpliedCond tries to truncate a pointer in
some obscure cases. Guard the code with a check for pointers.

Added: 
    

Modified: 
    llvm/lib/Analysis/ScalarEvolution.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index c0ce5de7c60c..c9612ec54e0a 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -10581,7 +10581,7 @@ bool ScalarEvolution::isImpliedCond(ICmpInst::Predicate Pred, const SCEV *LHS,
     // For unsigned and equality predicates, try to prove that both found
     // operands fit into narrow unsigned range. If so, try to prove facts in
     // narrow types.
-    if (!CmpInst::isSigned(FoundPred)) {
+    if (!CmpInst::isSigned(FoundPred) && !FoundLHS->getType()->isPointerTy()) {
       auto *NarrowType = LHS->getType();
       auto *WideType = FoundLHS->getType();
       auto BitWidth = getTypeSizeInBits(NarrowType);


        


More information about the llvm-commits mailing list