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

Brox Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 3 07:00:52 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);
----------------
broxigarchen wrote:

Seems not all foldable copy has named operand src.

the v_mov_b16_t16 has opsel as modifer thus the operand 1 is src0_mod



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


More information about the llvm-commits mailing list