[llvm] [AMDGPU][True16][CodeGen] fix v_mov_b16_t16 index in folding pass (PR #161764)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 2 19:30:18 PDT 2025


================
@@ -931,7 +931,9 @@ static MachineOperand *lookUpCopyChain(const SIInstrInfo &TII,
   for (MachineInstr *SubDef = MRI.getVRegDef(SrcReg);
        SubDef && TII.isFoldableCopy(*SubDef);
        SubDef = MRI.getVRegDef(Sub->getReg())) {
-    MachineOperand &SrcOp = SubDef->getOperand(1);
+    unsigned SrcIdx = TII.getFoldableCopySrcIdx(*SubDef);
+    MachineOperand &SrcOp = SubDef->getOperand(SrcIdx);
----------------
arsenm wrote:

use getNetNamedOperandIdx? Also probably should just fix the instruction to keep this in index 1 

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


More information about the llvm-commits mailing list