Skip to content

Commit 67a9093

Browse files
authored
[instCombine][bugfix] Fix crash caused by using of cast in instCombineSVECmpNE (#102472)
1 parent e3ce979 commit 67a9093

File tree

2 files changed

+413
-1
lines changed

2 files changed

+413
-1
lines changed

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,8 @@ static std::optional<Instruction *> instCombineSVECmpNE(InstCombiner &IC,
11871187
return std::nullopt;
11881188

11891189
// Where the dupq is a lane 0 replicate of a vector insert
1190-
if (!cast<ConstantInt>(DupQLane->getArgOperand(1))->isZero())
1190+
auto *DupQLaneIdx = dyn_cast<ConstantInt>(DupQLane->getArgOperand(1));
1191+
if (!DupQLaneIdx || !DupQLaneIdx->isZero())
11911192
return std::nullopt;
11921193

11931194
auto *VecIns = dyn_cast<IntrinsicInst>(DupQLane->getArgOperand(0));

0 commit comments

Comments
 (0)