Skip to content

Commit 3f6ecaf

Browse files
committed
[AMDGPU] Inflate to %av regclass
Change-Id: Ied8fe81cf2c8271ca22eedbade4eb312f3fbea39
1 parent 3e7e60a commit 3f6ecaf

File tree

2 files changed

+373
-0
lines changed

2 files changed

+373
-0
lines changed

llvm/lib/Target/AMDGPU/AMDGPUPrepareAGPRAlloc.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)