This change returns empty PSet list for M0 register. Otherwise its
PSet as defined by tablegen is SReg_32. This results in incorrect
register pressure calculation every time an instruction uses M0.
Such uses count as SReg_32 PSet and inadequately increase pressure
on SGPRs.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
| lib/Target/AMDGPU/SIRegisterInfo.cpp | ||
|---|---|---|
| 1336–1337 | Is == M0 sufficient? m0 should be its own regunit since it can't be a subregister | |
| test/CodeGen/AMDGPU/schedule-regpressure.mir | ||
| 1 | This is going to break in a release build | |
| 1 | Better would be a test that doesn't rely on debug output, but if that's not possible you need REQUIRES: asserts or something like that | |
| lib/Target/AMDGPU/SIRegisterInfo.cpp | ||
|---|---|---|
| 1336–1337 | Yes, it is in its own RegUnit, and RegUnit is what we get here. This test yields true for M0 and only for M0 because it does not share a RegUnit with any other register. | |
| lib/Target/AMDGPU/SIRegisterInfo.cpp | ||
|---|---|---|
| 1336–1337 | I mean it's simpler to do just return RegUnit == AMDGPU::M0 instead of doing the whole regunit iterator test | |
| lib/Target/AMDGPU/SIRegisterInfo.cpp | ||
|---|---|---|
| 1336–1337 | AMDGPU::M0 == 89, its RegUnit == 81. | |
| lib/Target/AMDGPU/SIRegisterInfo.cpp | ||
|---|---|---|
| 1336–1337 | Here, gdb log: (gdb) p (int)AMDGPU::M0 $9 = 89 (gdb) call TRI->hasRegUnit(AMDGPU::M0, 81) $12 = true (gdb) call TRI->hasRegUnit(AMDGPU::M0, 89) $13 = false (gdb) call TRI->hasRegUnit(AMDGPU::M0, AMDGPU::M0) $14 = false | |
| lib/Target/AMDGPU/SIRegisterInfo.h | ||
|---|---|---|
| 214 | Matt, this is RegUnit. If that would be reg I would not need to call hasRegUnit and just compared register directly. The function is called getRegUnit... and its parent definition has RegUnit argument name. It is a RegUnit, really ;) | |
| lib/Target/AMDGPU/SIRegisterInfo.h | ||
|---|---|---|
| 214 | OK, I really hate the RegUnit distinctions. This confusion happens everywhere | |
Param name is misleading, it should be Reg not RegUnit