SGPRs are generally cheaper, so try to use them over VGPRs.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Typo in test file name
lib/Target/AMDGPU/SIFixSGPRCopies.cpp | ||
---|---|---|
182–187 | This probably breaks if you have a copy that looks like a sub register extract | |
192 | Why do you check the parent? | |
193 | Why do you need to check this? Isn't this filtering the global isel pseudos which should never exist here? | |
194 | Avoid doing the weird pointer arithmetic? | |
198 | I forsee this breaking cases with multiple uses | |
test/CodeGen/AMDGPU/opt-sgpr-to-vgrp-copy.ll | ||
25 ↗ | (On Diff #102279) | Probably need a MIR test to stress multiple uses |
lib/Target/AMDGPU/SIFixSGPRCopies.cpp | ||
---|---|---|
182–187 | The should not be a problem. I'm changing VGPR class to equivalent SGPR class, they support the same set of subregs. | |
192 | A copy can be in a divergent control flow. If it is the same block we can be sure that is actually the value we are going to use. | |
193 | isOperandLegal does not work with generic opcodes because they have no RC classes assigned to operands. | |
194 | How do I get operand number otherwise? | |
198 | Why? I'm checking all uses for operand legality. It also does not happen if there is a second def of the same register. |
test/CodeGen/AMDGPU/opt-sgpr-to-vgrp-copy.ll | ||
---|---|---|
25 ↗ | (On Diff #102279) | Can you be more specific, multiple uses of what? Do you mean multiple uses of the same COPY? |
Added subreg-extract like copy test.
Cleaned mir test.
lib/Target/AMDGPU/SIFixSGPRCopies.cpp | ||
---|---|---|
182–187 | I have added test for that. |
lib/Target/AMDGPU/SIFixSGPRCopies.cpp | ||
---|---|---|
198 | I have added test for multiple uses. |
LGTM. It's possible to reduce the mir testcase further though
test/CodeGen/AMDGPU/opt-sgpr-to-vgpr-copy.mir | ||
---|---|---|
102–117 | You can strip out most of this stuff |
This probably breaks if you have a copy that looks like a sub register extract