From 7659cd42578c59d1bef1313053d493171b9146a2 Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Mon, 17 Nov 2025 16:36:42 +0000 Subject: [VectorUtils] Use PatternMatch in findScalarElement (NFC) (#168389) --- llvm/lib/Analysis/VectorUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Analysis/VectorUtils.cpp') diff --git a/llvm/lib/Analysis/VectorUtils.cpp b/llvm/lib/Analysis/VectorUtils.cpp index 530fa9518f40..a3e9b039f922 100644 --- a/llvm/lib/Analysis/VectorUtils.cpp +++ b/llvm/lib/Analysis/VectorUtils.cpp @@ -317,9 +317,9 @@ Value *llvm::findScalarElement(Value *V, unsigned EltNo) { if (InsertElementInst *III = dyn_cast(V)) { // If this is an insert to a variable element, we don't know what it is. - if (!isa(III->getOperand(2))) + uint64_t IIElt; + if (!match(III->getOperand(2), m_ConstantInt(IIElt))) return nullptr; - unsigned IIElt = cast(III->getOperand(2))->getZExtValue(); // If this is an insert to the element we are looking for, return the // inserted value. -- cgit v1.2.3