[llvm] [AMDGPU][LowerModuleLDS] Refactor partially lowered module detection (PR #85793)

Jon Chesterfield via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 21 03:22:26 PDT 2024


JonChesterfield wrote:

I think the control flow around deleting dead variables is a little off. For example, the openmp cause here is a variable in llvm.compiler.used and otherwise dead - removing that despite being in compiler.user seems legitimate as the compiler does nothing with dead lds variables.

An argument could be made for deleting all unused lds variables, ignoring llvm.used as well, since they're module-local and otherwise inaccessible, and I think that is partially reified in the pass. However in the new might-run-multiple-times world, it's not totally clear to me whether an unused variable with an absolute address assigned is dead or not.

We're on slightly thin ice here. The pass was written assuming it was run once on the whole code object. We'd like it to run incrementally and/or somehow support separate linking. That's quite complicated and not an immediate req so we're trying to perturb it to work in the thinlto style case. I can see bugs coming in.

@arsenm did we ever get a reasonable place in tree for runtime tests? As in a bunch of programs written in C++ (ideally) or HIP/opencl (if one must) for things like this? There's some tests in libc which do the right sort of thing but I'm not totally sure I can pitch backend specific execution tests as being a part of libc



https://github.com/llvm/llvm-project/pull/85793


More information about the llvm-commits mailing list