[PATCH] D154507: [NVPTX] Apply global var demotion to private symbols

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 20:57:16 PDT 2023


jdoerfert added a comment.

In D154507#4487519 <https://reviews.llvm.org/D154507#4487519>, @mehdi_amini wrote:

> I'm a bit confused @jdoerfert : are there two different uses of the word "demoted" here? Seems like you're referring to a transformation that turns a global into an alloca, whereas here is it just about "demoting" the linkage type of the global?

I do not see the linkage being changed, if so, to what? Local (=private or internal) is already as "good" as it gets.

Given the test result, and the comment ("Find out if a global variable can be demoted to local scope."), it looks to me as if the scope is changed, thus where the variable is "declared/visible".
That said, I was expecting (w/o knowing for sure), that a variable scoped in a function cannot be accessed by other functions. If that is wrong, the first part of my comment is mood.
I still believe we don't want these special casings in our backends, but that is for later. If the scope doesn't preclude access, this is fine.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154507/new/

https://reviews.llvm.org/D154507



More information about the llvm-commits mailing list