Skip to content

Commit b8529e5

Browse files
committed
Use dyn_cast
1 parent 8e12a1f commit b8529e5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,10 +1122,11 @@ bool VectorCombine::scalarizeOpOrCmp(Instruction &I) {
11221122
else if (isa<BinaryOperator>(I))
11231123
NewVecC = ConstantFoldBinaryOpOperands((Instruction::BinaryOps)Opcode,
11241124
VecCs[0], VecCs[1], *DL);
1125-
else if (isa<IntrinsicInst>(I) && cast<IntrinsicInst>(I).arg_size() == 2)
1126-
NewVecC =
1127-
ConstantFoldBinaryIntrinsic(cast<IntrinsicInst>(I).getIntrinsicID(),
1128-
VecCs[0], VecCs[1], I.getType(), &I);
1125+
else if (auto *II = dyn_cast<IntrinsicInst>(&I)) {
1126+
if (II->arg_size() == 2)
1127+
NewVecC = ConstantFoldBinaryIntrinsic(II->getIntrinsicID(), VecCs[0],
1128+
VecCs[1], II->getType(), II);
1129+
}
11291130

11301131
// Get cost estimate for the insert element. This cost will factor into
11311132
// both sequences.

0 commit comments

Comments
 (0)