[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
Sat Oct 4 13:34:21 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:
I thought a helper is better since people might forget about this special case when they are adding new code. But if you think maintaining the switch is more costly, I'll create follow up patch to remove it.
https://github.com/llvm/llvm-project/pull/161764
More information about the llvm-commits
mailing list