This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Peephole adjacent equivalent S_SET_GPR_IDX_ON
ClosedPublic

Authored by rampitec on May 13 2020, 2:04 PM.

Diff Detail

Event Timeline

rampitec created this revision.May 13 2020, 2:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 13 2020, 2:04 PM
arsenm added inline comments.May 13 2020, 2:14 PM
llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp
152

Register() instead of NoRegister. When does the NoRegister case happen?

157–159

Should have a search threshold

rampitec marked 2 inline comments as done.May 13 2020, 2:47 PM
rampitec added inline comments.
llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp
152

I do not believe we produce it on practice, but operand is described as SSrc_b32 which may include an immediate. There is test for this in this change.

157–159

Sure. I also think I will invert and speedup scan a little.

rampitec updated this revision to Diff 263871.May 13 2020, 3:28 PM
rampitec marked 2 inline comments as done.

Speedup the scan.

arsenm added inline comments.May 13 2020, 4:02 PM
llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp
225–228

I'm confused by this usage of threshold. You never break from the loop on it and it's not part of the loop condition

rampitec marked an inline comment as done.May 13 2020, 4:25 PM
rampitec added inline comments.
llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp
225–228

Right, the block will be scanned once. However, it will not send two S_SET_GPR_IDX_ON instructions into the optimizeSetGPR() if they are too far apart. That is the loop from the first to next S_SET_GPR_IDX_ON in the optimizeSetGPR() which performs expensive checks.

arsenm accepted this revision.May 14 2020, 3:09 PM
arsenm added inline comments.
llvm/lib/Target/AMDGPU/SIPreEmitPeephole.cpp
225–228

This could uses a comment

This revision is now accepted and ready to land.May 14 2020, 3:09 PM
rampitec updated this revision to Diff 264116.May 14 2020, 3:18 PM
rampitec marked 2 inline comments as done.

Added comment.

This revision was automatically updated to reflect the committed changes.