[PATCH] D120000: [1/2] TLS loads opimization (hoist)

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 2 02:16:28 PST 2022


xiangzhangllvm added a comment.

In D120000#3353738 <https://reviews.llvm.org/D120000#3353738>, @nlopes wrote:

> I have some concerns with this patch:
>
> - Why is it adding a new function attribute (tls-load-hoist) that is not documented in LangRef?

This is only [1/2] patch, the 2nd will add clang option for it, it will enable this optimization by generating function attribute (tls-load-hoist)

> - Why can't this transformation be handled with existing optimizations? Adding e.g. the readonly & speculatable attributes should allow GVN & friends to remove duplicates and hoist these out of loops. If not, then maybe existing optimizations should be improved so others benefit as well.
>
> In summary, do we really need this new pass or is this just a hack?

I don't know which existing optimizations can do this job for the TLS Value (A readable/writable Global Value). Force add readonly attribute to a writable GV is OK/Safe ? Is GVN really suitable to directly handle it ? In fact I am not an mid-end expert, If it can, Please let me know, I'll go to take a look.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120000



More information about the llvm-commits mailing list