Skip to content

Commit ae4f037

Browse files
committed
[NFC] Add assertions for Src and Dst vec types in VecCombine folding
SrcVecTy and DstVecTy are used without a null check, and originate from a dyn_cast. This patch adds an assertion that these values are non-null before they are used/dereferenced.
1 parent 8f65519 commit ae4f037

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,6 +2052,9 @@ bool VectorCombine::foldShuffleOfSelects(Instruction &I) {
20522052

20532053
auto *SrcVecTy = dyn_cast<FixedVectorType>(T1->getType());
20542054
auto *DstVecTy = dyn_cast<FixedVectorType>(I.getType());
2055+
assert(SrcVecTy && DstVecTy &&
2056+
"Expected shuffle/select vector types to be defined");
2057+
20552058
auto SK = TargetTransformInfo::SK_PermuteTwoSrc;
20562059
auto SelOp = Instruction::Select;
20572060
InstructionCost OldCost = TTI.getCmpSelInstrCost(

0 commit comments

Comments
 (0)