File tree Expand file tree Collapse file tree 2 files changed +373
-0
lines changed
Expand file tree Collapse file tree 2 files changed +373
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ bool AMDGPUPrepareAGPRAllocImpl::run(MachineFunction &MF) {
9797
9898 const MCInstrDesc &AVImmPseudo32 = TII.get (AMDGPU::AV_MOV_B32_IMM_PSEUDO);
9999 const MCInstrDesc &AVImmPseudo64 = TII.get (AMDGPU::AV_MOV_B64_IMM_PSEUDO);
100+ const SIRegisterInfo *TRI =
101+ static_cast <const SIRegisterInfo *>(MRI.getTargetRegisterInfo ());
100102
101103 bool Changed = false ;
102104 for (MachineBasicBlock &MBB : MF) {
@@ -119,6 +121,20 @@ bool AMDGPUPrepareAGPRAllocImpl::run(MachineFunction &MF) {
119121 Changed = true ;
120122 continue ;
121123 }
124+
125+ for (MachineOperand &Op : MI.operands ()) {
126+ if (!Op.isReg () || !Op.isDef ())
127+ continue ;
128+
129+ Register DefReg = Op.getReg ();
130+ if (DefReg.isPhysical ())
131+ continue ;
132+
133+ const TargetRegisterClass *RC = MRI.getRegClass (DefReg);
134+
135+ if (TRI->isAGPRClass (RC) || TRI->isVGPRClass (RC))
136+ Changed |= MRI.recomputeRegClass (DefReg);
137+ }
122138 }
123139 }
124140
You can’t perform that action at this time.
0 commit comments