[llvm] [AMDGPU] Accept extractelement of a widening cast when folding image ops to a16 (PR #208207)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 9 09:12:21 PDT 2026
================
@@ -115,6 +125,14 @@ static Value *convertTo16Bit(Value &V, InstCombiner::BuilderTy &Builder) {
Type *VTy = V.getType();
if (isa<FPExtInst, SExtInst, ZExtInst>(&V))
return cast<Instruction>(&V)->getOperand(0);
+ // Vector form: extractelement((s|z|fp)ext Vec), Idx -> extractelement(Vec,
+ // Idx), taking the narrow lane directly so the widening cast can be removed.
+ Value *VecCast, *Idx;
+ if (match(&V, m_ExtractElt(PatternMatch::m_Value(VecCast),
----------------
arsenm wrote:
Shouldn't need all the PatternMatch::, there's usually a using for these (which should already exist in this file)
https://github.com/llvm/llvm-project/pull/208207
More information about the llvm-commits
mailing list