Skip to content

Commit f989db5

Browse files
authored
[NFC] Use cast instead of dyn_cast for Src and Dst vec types in VecCombine folding (#134432)
SrcVecTy and DstVecTy are used without a null check, and originate from a dyn_cast. This patch adjusts this to use a fixed cast, since it is not checked for null before use otherwise, but is semantically guaranteed from previous checks.
1 parent 5978bb2 commit f989db5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,8 +2051,8 @@ bool VectorCombine::foldShuffleOfSelects(Instruction &I) {
20512051
(SI0FOp->getFastMathFlags() != SI1FOp->getFastMathFlags())))
20522052
return false;
20532053

2054-
auto *SrcVecTy = dyn_cast<FixedVectorType>(T1->getType());
2055-
auto *DstVecTy = dyn_cast<FixedVectorType>(I.getType());
2054+
auto *SrcVecTy = cast<FixedVectorType>(T1->getType());
2055+
auto *DstVecTy = cast<FixedVectorType>(I.getType());
20562056
auto SK = TargetTransformInfo::SK_PermuteTwoSrc;
20572057
auto SelOp = Instruction::Select;
20582058
InstructionCost OldCost = TTI.getCmpSelInstrCost(

0 commit comments

Comments
 (0)