Skip to content

Commit 7659cd4

Browse files
authored
[VectorUtils] Use PatternMatch in findScalarElement (NFC) (#168389)
1 parent a9633aa commit 7659cd4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Analysis/VectorUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ Value *llvm::findScalarElement(Value *V, unsigned EltNo) {
317317

318318
if (InsertElementInst *III = dyn_cast<InsertElementInst>(V)) {
319319
// If this is an insert to a variable element, we don't know what it is.
320-
if (!isa<ConstantInt>(III->getOperand(2)))
320+
uint64_t IIElt;
321+
if (!match(III->getOperand(2), m_ConstantInt(IIElt)))
321322
return nullptr;
322-
unsigned IIElt = cast<ConstantInt>(III->getOperand(2))->getZExtValue();
323323

324324
// If this is an insert to the element we are looking for, return the
325325
// inserted value.

0 commit comments

Comments
 (0)