Fixes: SWDEV-326366
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | ||
---|---|---|
4748 | This reservedRegsFrozen check is probably obsolete |
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | ||
---|---|---|
4774 | Why can't you just select the aligned class above to begin with? |
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | ||
---|---|---|
4774 | This is only VGPRs, and not all VGPRs. Then it will use a condition at every case, while the code below is still needed. |
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | ||
---|---|---|
4774 | RC can be null here and it does for many tests. The switch above only covers AV and only certain sizes. It does not cover neither vgprs nor agprs. The very first test I have added would not pass because it uses VReg_64. |
There seems to be some confusion here, it is not because AV classes has become allocatable. It is an issue from day 1 aligned classes were introduced.
In general, invoking adjustAllocatableRegClass post-regalloc doesn't sound good to me.
I'm in favor of the code that you added to get the aligned regclasses.
But what's the need to adjust the AV operands beforehand? They'll meet the condition as we have the _align2 versions for the superclasses available now.
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | ||
---|---|---|
4777 | Factor this out into a separate function? | |
llvm/test/CodeGen/AMDGPU/mcp-aligned-vgprs.mir | ||
13 | Why does such a copy exist in the first place? |
llvm/test/CodeGen/AMDGPU/mcp-aligned-vgprs.mir | ||
---|---|---|
13 | This is RA created copy of vreg_96:sub1_sub2. A perfectly valid and aligned case. |
MCP sees a physreg which can be propagated, like in the test: aligned physreg copied into an unaligned physreg. It queries TII of get instruction's operand regclass and then checks if copy destination fits that regclass. If it does MCP performs propagation. Therefore, to prevent it we shall adjust the regclass extracted from the operand desc.
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | ||
---|---|---|
4777 | Extracted, although I do not see other places where we need exactly the same interface. |
LGTM except for the typo.
llvm/lib/Target/AMDGPU/SIRegisterInfo.h | ||
---|---|---|
382 | s/correcsponding/corresponding |
This reservedRegsFrozen check is probably obsolete