This is an archive of the discontinued LLVM Phabricator instance.

[NFC][AMDGPULowerModuleLDSPass] Factorize repetead sort code
ClosedPublic

Authored by jmmartinez on Jul 11 2023, 7:25 AM.

Diff Detail

Event Timeline

jmmartinez created this revision.Jul 11 2023, 7:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2023, 7:25 AM
jmmartinez requested review of this revision.Jul 11 2023, 7:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2023, 7:25 AM
arsenm added inline comments.Jul 11 2023, 7:38 AM
llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
249

The danger of anonymous values may require a stable_sort (or do we error on those here, I forget)

JonChesterfield accepted this revision.Jul 11 2023, 7:59 AM

The move -> return approach seems reasonable. Could we go with GlobalVariable* instead of T before landing?

llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
249

No anonymous variables here - these globals are all created by this pass, and all given non-empty names.

There's a hard error on anonymous functions at present, can drop that if we find a better way to bind structs to functions

1318

This is a bit dubious in general, should probably be establishing the sorted invariant before calling into this. For another patch.

This revision is now accepted and ready to land.Jul 11 2023, 7:59 AM
This revision was landed with ongoing or failed builds.Jul 11 2023, 8:04 AM
This revision was automatically updated to reflect the committed changes.
llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
249

Re anonymous vars - we should test that. This may be reachable from the call that chooses an order for the array<i32> subtable with the original variable names.

The variables in question are deleted by this pass so could be assigned arbitrary unique names as a fix if necessary.