Skip to content

Commit 01eb571

Browse files
committed
Use ConstantInt::get instead of Constant::getIntegerValue
1 parent d11a108 commit 01eb571

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3768,7 +3768,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
37683768
// %0, i64 0 %3 = shufflevector <4 x i32> %2, poison, <4 x i32>
37693769
// zeroinitializer %4 = tail call i32 @llvm.vector.reduce.add.v4i32(%3)
37703770
// =>
3771-
// %2 = shl i32 %0, 2
3771+
// %2 = mul i32 %0, 4
37723772
if (Value *Splat = getSplatValue(Arg)) {
37733773
// It is only a multiplication if we add the same element over and over.
37743774
assert(Arg->getType()->isVectorTy() &&
@@ -3778,10 +3778,8 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
37783778
if (ReducedVectorElementCount.isFixed()) {
37793779
unsigned VectorSize = ReducedVectorElementCount.getFixedValue();
37803780
Type *SplatType = Splat->getType();
3781-
unsigned SplatTypeWidth = SplatType->getIntegerBitWidth();
3782-
Value *Res = Builder.CreateMul(
3783-
Splat, Constant::getIntegerValue(
3784-
SplatType, APInt(SplatTypeWidth, VectorSize)));
3781+
Value *Res =
3782+
Builder.CreateMul(Splat, ConstantInt::get(SplatType, VectorSize));
37853783
return replaceInstUsesWith(CI, Res);
37863784
}
37873785
}

0 commit comments

Comments
 (0)