[llvm-branch-commits] [llvm] [AMDGPU][SIInstrInfo] Materialise t16 PHI subreg operands (PR #222155)

Yaxun Liu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Sep 9 07:53:46 PDT 2026


================
@@ -8097,8 +8095,16 @@ void SIInstrInfo::legalizeOperandsVALUt16(MachineInstr &MI, unsigned OpIdx,
   if (!RI.isVGPRClass(CurrRC))
     return;
 
-  int16_t RCID = getOpRegClassID(get(Opcode).operands()[OpIdx]);
-  const TargetRegisterClass *ExpectedRC = RI.getRegClass(RCID);
+  const TargetRegisterClass *ExpectedRC;
+  if (MI.isPHI()) {
+    // A PHI is generic, so it carries no operand register classes.
+    ExpectedRC = MRI.getRegClass(MI.getOperand(0).getReg());
----------------
yxsamliu wrote:

Could this use `getOpRegClass(MI, 0)`? It already handles generic instructions and is also used by the PHI legalization below. This would keep the register-class lookup in one place.

https://github.com/llvm/llvm-project/pull/222155


More information about the llvm-branch-commits mailing list