[llvm] [AMDGPU] SIFixSgprCopies should not process twice VGPR to SGPR copies inserted by PHI preprocessing. (PR #134153)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 9 09:30:12 PDT 2025
================
@@ -971,16 +971,29 @@ void SIFixSGPRCopies::analyzeVGPRToSGPRCopy(MachineInstr* MI) {
}
} else if (Inst->getNumExplicitDefs() != 0) {
Register Reg = Inst->getOperand(0).getReg();
- if (TRI->isSGPRReg(*MRI, Reg) && !TII->isVALU(*Inst))
- for (auto &U : MRI->use_instructions(Reg))
- Users.push_back(&U);
+ if (TRI->isSGPRReg(*MRI, Reg) && !TII->isVALU(*Inst)) {
+ if (Reg.isVirtual()) {
+ for (auto &U : MRI->use_instructions(Reg))
+ Users.push_back(&U);
+ } else {
+ auto I = Inst->getIterator();
+ auto E = Inst->getParent()->end();
+ while (++I != E) {
+ if (I->readsRegister(Reg, TRI))
+ Users.push_back(&*I);
+ if (I->modifiesRegister(Reg, TRI))
+ break;
+ }
----------------
alex-t wrote:
Done
https://github.com/llvm/llvm-project/pull/134153
More information about the llvm-commits
mailing list