This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][CodeGen] Support (base | offset) SMEM loads.
ClosedPublic

Authored by kosarev on Aug 24 2022, 5:42 AM.

Details

Summary

Prevents generation of unnecessary s_or_b32 instructions.

Diff Detail

Event Timeline

kosarev created this revision.Aug 24 2022, 5:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2022, 5:42 AM
kosarev requested review of this revision.Aug 24 2022, 5:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2022, 5:42 AM

Reduces code size for ~770 corpus shaders by ~36 bytes in average.

foad added a comment.Aug 24 2022, 6:56 AM

As a follow up could we update all calls to getBaseWithConstantOffset to pass in a non-null KnownBits?

llvm/lib/Target/AMDGPU/AMDGPUGlobalISelUtils.cpp
48

Test KnownBits first because it's cheapest.

llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
1990–1991

Nice catch!

llvm/test/CodeGen/AMDGPU/amdgcn-load-offset-from-reg.ll
138

Please precommit this new test.

kosarev updated this revision to Diff 456957.Aug 31 2022, 7:38 AM

Rebase on top of D133021 and change the if() as suggested.

kosarev marked 2 inline comments as done.Aug 31 2022, 7:39 AM
foad accepted this revision.Sep 1 2022, 2:22 AM
This revision is now accepted and ready to land.Sep 1 2022, 2:22 AM
kosarev updated this revision to Diff 457961.Sep 5 2022, 6:06 AM

Rebased.

This revision was landed with ongoing or failed builds.Sep 5 2022, 6:22 AM
This revision was automatically updated to reflect the committed changes.