forked from OSchip/llvm-project
[InstCombine] Refactor foldICmpMulConstant
This is a follow-up to 2ebfda2417
(replace "if" with "else if" since the cases nuw/nsw
were meant to be handled separately).
Test plan:
1/ ninja check-llvm check-clang check-lld
2/ Bootstrapped LLVM/Clang pass tests
This commit is contained in:
parent
a0d6105162
commit
d982f1e0c6
|
@ -2053,9 +2053,7 @@ Instruction *InstCombinerImpl::foldICmpMulConstant(ICmpInst &Cmp,
|
|||
NewC = ConstantInt::get(
|
||||
Mul->getType(),
|
||||
APIntOps::RoundingSDiv(C, *MulC, APInt::Rounding::DOWN));
|
||||
}
|
||||
|
||||
if (Mul->hasNoUnsignedWrap()) {
|
||||
} else if (Mul->hasNoUnsignedWrap()) {
|
||||
if (Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_UGE)
|
||||
NewC = ConstantInt::get(
|
||||
Mul->getType(),
|
||||
|
|
|
@ -860,7 +860,9 @@ define i1 @splat_mul_known_lz(i32 %x) {
|
|||
|
||||
define i1 @splat_mul_unknown_lz(i32 %x) {
|
||||
; CHECK-LABEL: @splat_mul_unknown_lz(
|
||||
; CHECK-NEXT: [[R:%.*]] = icmp sgt i32 [[X:%.*]], -1
|
||||
; CHECK-NEXT: [[Z:%.*]] = zext i32 [[X:%.*]] to i128
|
||||
; CHECK-NEXT: [[M:%.*]] = mul nuw nsw i128 [[Z]], 18446744078004518913
|
||||
; CHECK-NEXT: [[R:%.*]] = icmp ult i128 [[M]], 39614081257132168796771975168
|
||||
; CHECK-NEXT: ret i1 [[R]]
|
||||
;
|
||||
%z = zext i32 %x to i128
|
||||
|
|
Loading…
Reference in New Issue