[clang] [Clang][Driver] Enable internalization by default for AMDGPU (PR #138365)
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Fri May 2 23:20:20 PDT 2025
================
@@ -9284,6 +9284,12 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(Args.MakeArgString(
"--device-linker=" + TC->getTripleString() + "=" + Arg));
+ // Enable internalization for AMDGPU.
+ if (TC->getTriple().isAMDGPU())
+ CmdArgs.push_back(
+ Args.MakeArgString("--device-linker=" + TC->getTripleString() +
+ "=-plugin-opt=-amdgpu-internalize-symbols"));
----------------
arsenm wrote:
This looks more like "always" than "by default".
The implementation details are kind of a hack. We should be able to just run the ordinary internalize pass without the special AMDGPU filter. https://github.com/llvm/llvm-project/blob/c63687c04f96e3b1db9ce0f70e5f331fce69959b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp#L761
The most legitimate part of this is the isEntryFunctionCC, which we could just make the internalize pass directly do. The sanitizer name hacks are also obviously hacks.
The attempt to drop constant users looks like a bad side effect a predicate should not have, I don't know what that's doing there
https://github.com/llvm/llvm-project/pull/138365
More information about the cfe-commits
mailing list