[llvm] [AIX][TLS] Produce a faster local-exec access sequence for the "aix-small-tls" global variable attribute (PR #83053)

Felix via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 23 17:36:15 PDT 2024


orcguru wrote:

> > Does it make sense to turn the function level attribute HasAIXSmallLocalExecTLS into variable attributes for example by `addAttribute` inside `LowerGlobalTLSAddressAIX`, and then we only need to check variable attribute for the peepholes?
> > For any TLS LE variable accessed by more than one functions, and if one of them HasAIXSmallLocalExecTLS, then that variable should better have the "aix-small-tls" attribute?
> 
> Thanks for taking a look at the patch, @orcguru! I apologize if I misunderstood your suggestion: are you suggesting that `HasAIXSmallLocalExecTLS` should be a variable attribute, similar to `aix-small-tls`?
> 
> The target/function attribute was implemented to correspond to the front end clang option to turn on this optimized code gen (`-maix-small-local-exec-tls`) for all variables. However, I believe this `aix-small-tls` is more about selectively deciding which TLS LE variables get the optimized code gen. On the other hand, in the presence of `HasAIXSmallLocalExecTLS` (when this is turned on/true), I remember discussing that the optimized code sequence gets generated for all cases, anyway.
> 
> @hubert-reinterpretcast Is my above understanding correct, and do you have any thoughts on this/the suggestion?

Hi Amy, my understanding is that ISEL checks those attributes, and then peephole also checks those. ISEL just executes once, however peephole may get invoked multiple times since some more peephole opportunity may surface after previous peephole did make some change. This makes it more important to simplify peephole's operations from my view.

Now given that both the function level attribute and variable attribute all serve the same purpose, can we simplify that into one kind of flag check in the peephole logic? This is my first question.

Regarding my second question, I think since the function level attribute and variable attribute are not orthogonal (e.g. there are different ways for the two attributes to generate the same effect), I'm a little bit puzzled regarding some corner cases. Please ignore the question if that is not important.

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


More information about the llvm-commits mailing list