[InstCombine] foldOrOfICmps - only fold (icmp_eq B, 0) | (icmp_ult/gt A, B) for integ...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 19 Oct 2020 16:05:38 +0000 (17:05 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 19 Oct 2020 16:05:38 +0000 (17:05 +0100)
Fixes a number of stage2 buildbots that were failing when I generalized the m_ConstantInt() logic - that didn't match for pointer types but m_Zero() does......

llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

index 7d8291e..b34ba4e 100644 (file)
@@ -2373,10 +2373,10 @@ Value *InstCombinerImpl::foldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS,
       else if (PredL == ICmpInst::ICMP_UGT && RHS0 == LHS0)
         A = LHS1;
     }
-    if (A && B)
+    if (A && B && B->getType()->isIntOrIntVectorTy())
       return Builder.CreateICmp(
           ICmpInst::ICMP_UGE,
-          Builder.CreateAdd(B, ConstantInt::getAllOnesValue(B->getType())), A);
+          Builder.CreateAdd(B, Constant::getAllOnesValue(B->getType())), A);
   }
 
   if (Value *V = foldAndOrOfICmpsWithConstEq(LHS, RHS, Or, Builder, Q))