[llvm] adb52e5 - [InstCombine] foldOrOfICmps - only fold (icmp_eq B, 0) | (icmp_ult/gt A, B) for integer types
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 19 09:06:05 PDT 2020
Author: Simon Pilgrim
Date: 2020-10-19T17:05:38+01:00
New Revision: adb52e5f9e66e726a8175bb0025ed3553cc1534e
URL: https://github.com/llvm/llvm-project/commit/adb52e5f9e66e726a8175bb0025ed3553cc1534e
DIFF: https://github.com/llvm/llvm-project/commit/adb52e5f9e66e726a8175bb0025ed3553cc1534e.diff
LOG: [InstCombine] foldOrOfICmps - only fold (icmp_eq B, 0) | (icmp_ult/gt A, B) for integer types
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......
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index 7d8291eaa56c..b34ba4e7908f 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -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))
More information about the llvm-commits
mailing list