[llvm] CodeGenPrepare: Remove threadlocal_address intrinsic when cheap to recompute. (PR #87844)

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 8 11:37:11 PDT 2024


MatzeB wrote:

> Hm. I think this is an unfortunate way to fix the issue. Long-term, I'd like to get to the point where it is no longer valid to reference a TLS value directly in IR as if it was a simple address, but instead, require that accesses MUST always go through a call. We aren't in that ideal state now, but this goes further away from it instead of further towards it.

This isn't really changing how IR behaves, at least it's not changing anything in the actual transform/optimization phases of LLVM...

I was thinking of this as just yet another hack/workaround where massaging the IR in `CodeGenPrepare` is just way easier than  doing things in SelectionDAG because of its "basic block at a time" design. From all I can tell it is somewhat fundamentally baked into SelectionDAG today that instructions read across basic blocks need registers assigned and only `Value`s not tied to instructions can be seen immediately. I initially tried fixing this in SelectionDAG but that would need more fundamental changes there than seemed reasonable for a small improvement like this...

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


More information about the llvm-commits mailing list