[PATCH] D122091: [amdgpu] Elide module lds allocation in kernels with no callees
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 21 06:01:08 PDT 2022
arsenm added a comment.
I don't like using an attribute for this (especially one set to a negative value). Ultimately the passes need to understand how much will be allocated.
Plus, it turns out you can't rely so heavily on the call graph analysis for correctness since it doesn't see calls through aliases.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp:380
+ const CallGraphNode *N = CG[&Func];
+ const bool CalleesRequireModuleLDS = N->size() > 0;
+
----------------
I don't think this actually works for indirect calls (or even calls through aliases)
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp:36
+ const char *Attr = "amdgpu-requires-module-lds";
+ if (F.hasFnAttribute(Attr))
+ CalleeRequiresModuleLDS = F.getFnAttribute(Attr).getValueAsBool();
----------------
You can just do getFnAttribute, you don't need a second query
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122091/new/
https://reviews.llvm.org/D122091
More information about the llvm-commits
mailing list