[PATCH] D29214: [AMDGPU] Internalize non-kernel symbols

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 28 02:37:18 PST 2017


rampitec added a comment.

BTW, in most cases global variables will not be even dropped. Unlike functions which are internalized based on the calling convention variables are only internalized if totally unused. I.e., in this situation global will not be dropped, because it is used by an unused function:

  global T var;
  void unused_foo() { use(var); }
  kernel void bar() { }

To drop var in this situation we would need to run internalize + global dce twice, so the first pass will remove functions and second will remove remaining variables.

I.e. if a variable is declared in a library module and the same module has a function using this variable (majority of cases), then variable will remain as long as the module is linked in (e.g. when using function is linked as well, even if unused). One pass of internalizer and dce will only remove completely unused and unreferenced global variables.


Repository:
  rL LLVM

https://reviews.llvm.org/D29214





More information about the llvm-commits mailing list