[PATCH] D154970: [NFC][AMDGPULowerModuleLDSPass] Factorize repetead sort code
Jon Chesterfield via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 12 02:47:01 PDT 2023
JonChesterfield added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp:249
+template <typename T> std::vector<T> sortByName(std::vector<T> &&V) {
+ llvm::sort(V.begin(), V.end(), [](const auto *L, const auto *R) {
+ return L->getName() < R->getName();
----------------
JonChesterfield wrote:
> arsenm wrote:
> > The danger of anonymous values may require a stable_sort (or do we error on those here, I forget)
> 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
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.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154970/new/
https://reviews.llvm.org/D154970
More information about the llvm-commits
mailing list