Skip to content

Commit b7099df

Browse files
committed
Fail with cannot select in case rsrc is neither v8i32 nor v4i32
1 parent 222c0a1 commit b7099df

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8209,9 +8209,17 @@ SDValue SITargetLowering::lowerImage(SDValue Op,
82098209
append_range(Ops, VAddrs);
82108210
else
82118211
Ops.push_back(VAddr);
8212-
Ops.push_back(Op.getOperand(ArgOffset + Intr->RsrcIndex));
8213-
if (BaseOpcode->Sampler)
8214-
Ops.push_back(Op.getOperand(ArgOffset + Intr->SampIndex));
8212+
SDValue Rsrc = Op.getOperand(ArgOffset + Intr->RsrcIndex);
8213+
EVT VT = Rsrc.getValueType();
8214+
if (VT != MVT::v4i32 && VT != MVT::v8i32)
8215+
return Op;
8216+
Ops.push_back(Rsrc);
8217+
if (BaseOpcode->Sampler) {
8218+
SDValue Samp = Op.getOperand(ArgOffset + Intr->SampIndex);
8219+
if (Samp.getValueType() != MVT::v4i32)
8220+
return Op;
8221+
Ops.push_back(Samp);
8222+
}
82158223
Ops.push_back(DAG.getTargetConstant(DMask, DL, MVT::i32));
82168224
if (IsGFX10Plus)
82178225
Ops.push_back(DAG.getTargetConstant(DimInfo->Encoding, DL, MVT::i32));

0 commit comments

Comments
 (0)