[clang] [llvm] [X86] Add Support for X86 TLSDESC Relocations (PR #83136)
Phoebe Wang via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 6 19:30:53 PST 2024
phoebewang wrote:
> I assume that's what you're doing in the place I asked for a comment is trying to avoid redundantly generating TLSDESC accesses for _TLS_MODULE_BASE_. I see that we don't generate multiple accesses for _TLS_MODULE_BASE_ in the test cases, but I thought that was only safe to do when an earlier access dominates a later access.
>
> Is my understanding here correct, or is there an interaction with
>
> https://github.com/llvm/llvm-project/blob/04bbbba271ebe4c2421f34a4fbf34c328df9f111/llvm/lib/Target/X86/X86InstrInfo.cpp#L10245
>
> ?
Yes, you are correct.
I think SelectionDAG takes care of it. I checked it locally, it will generate two pairs of `_TLS_MODULE_BASE_` in `if ... else ...` branches respectively and one `_TLS_MODULE_BASE_` otherwise.
I admit I didn't know the code here when adding it to GetTLSADDR. But I think not to create the nodes at the beginning is slightly better than to remove it later if they have the same output. Not to mention dominator iteration is expensive.
https://github.com/llvm/llvm-project/pull/83136
More information about the cfe-commits
mailing list