Instructions in SOPK format may not have 32-bit
literal constants following the instruction.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I believe you are correct about SOPK being fixed size. This looks like it could be an NFC change, because the code below would detect if there was a literal used. If you have any reason to think its not NFC, please add a test. That said, I think a better way to do the change is set FixedSize = 1 on SOPP_Pseudo.
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | ||
---|---|---|
7486 ↗ | (On Diff #460498) | Shouldn't special case this here, FixedSize should be set. |
@Joe_Nash This patch fixes a bug where a literal is appended to the instruction. It has hardly been observed, however a test will be helpful. I will write one up,
Right, FixedSize was originally introduced (D25500) as a special case for instructions that are known not to have a literal operand even though the InOperandList contains something unusual that might look like a literal. It should not be needed in general for all instructions that happen to have a fixed size. So it would be nice to know what unusual case prompted this patch.
- added a test to check for block sizes through offsets printed during branch relaxation
llvm/test/CodeGen/AMDGPU/sopk-no-literal.ll | ||
---|---|---|
6–10 | For a function that does not require relaxation, how did it introduce a block with size 0? |
llvm/test/CodeGen/AMDGPU/sopk-no-literal.ll | ||
---|---|---|
6–10 | It was first introduced due to the structurize CFG pass. I think it combines a sequence of instructions into a phi instruction. |
llvm/test/CodeGen/AMDGPU/sopk-no-literal.ll | ||
---|---|---|
6–10 | I'd somewhat prefer if the IR was a more direct match to what comes out here, so pre-structurize. You could also try using s.setreg intrinsics for direct emission of a sopk |
- Simplified sopk-no-literal.ll test. This test checks for the size of the kernel which should be 28 bytes as each instruction is 4 bytes long, except for s_load_b32 which is 8 bytes in size.
If you're going to rely on -debug-only, this needs REQUIRES: asserts