Skip to content

Commit b3c55e2

Browse files
committed
Use Builder.createScalarZExtOrTrunc
1 parent 45a6d99 commit b3c55e2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2603,11 +2603,8 @@ expandVPWidenIntOrFpInduction(VPWidenIntOrFpInductionRecipe *WidenIVR,
26032603
if (StepTy->isFloatingPointTy())
26042604
VF = Builder.createScalarCast(Instruction::CastOps::UIToFP, VF, StepTy,
26052605
DL);
2606-
else if (VFTy->getScalarSizeInBits() > StepTy->getScalarSizeInBits())
2607-
VF =
2608-
Builder.createScalarCast(Instruction::CastOps::Trunc, VF, StepTy, DL);
2609-
else if (VFTy->getScalarSizeInBits() < StepTy->getScalarSizeInBits())
2610-
VF = Builder.createScalarCast(Instruction::CastOps::ZExt, VF, StepTy, DL);
2606+
else
2607+
VF = Builder.createScalarZExtOrTrunc(VF, StepTy, VFTy, DL);
26112608

26122609
Inc = Builder.createNaryOp(MulOp, {Step, VF}, Flags);
26132610
Inc = Builder.createNaryOp(VPInstruction::Broadcast, Inc);

0 commit comments

Comments
 (0)