[PATCH] D100322: [ConstantMerge] Don't merge thread_local constants with non-thread_local constants

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 28 13:19:13 PDT 2021


rjmccall added a comment.

In D100322#2723566 <https://reviews.llvm.org/D100322#2723566>, @Amanieu wrote:

> I'm not even sure what it would *mean* to have an unnamed TLS constant: I would expect an earlier pass to convert it to a normal constant rather than having to it in ConstantMerge.
>
> Also, AFAIK neither clang nor rustc will ever generate unnamed TLS constants.

No declared objects in C are ever `unnamed_addr`, but it's completely reasonable to infer it from use patterns, so it's not like this is an invalid combination.  But I agree that it's pointless to merge thread-local constants in constant-merging, because yeah, in any situation where it's permitted we should always be promoting the variable to a global instead (and then maybe that enables constant merging on the promoted TLS).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100322



More information about the llvm-commits mailing list