aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2024-04-17 12:48:02 -0700
committerGitHub <noreply@github.com>2024-04-17 12:48:02 -0700
commit652bcf685c72447f3cc46d93d6c9c1948e8499f3 (patch)
treebcada6c64aee0c2ce4c93da6bf044857125df281 /llvm/lib/CodeGen/MachineBasicBlock.cpp
parentdb2f64ee1f743153f242ca92bf627458ba7f8000 (diff)
downloadllvm-652bcf685c72447f3cc46d93d6c9c1948e8499f3.zip
llvm-652bcf685c72447f3cc46d93d6c9c1948e8499f3.tar.gz
llvm-652bcf685c72447f3cc46d93d6c9c1948e8499f3.tar.bz2
CodeGenPrepare: Add support for llvm.threadlocal.address address-mode sinking (#87844)
Depending on the TLSMode many thread-local accesses on x86 can be expressed by adding a %fs: segment register to an addressing mode. Even if there are mutliple users of a `llvm.threadlocal.address` intrinsic it is generally not worth sharing the value in a register but instead fold the %fs access into multiple addressing modes. Hence this changes CodeGenPrepare to duplicate the `llvm.threadlocal.address` intrinsic as necessary. Introduces a new `TargetLowering::addressingModeSupportsTLS` callback that allows targets to indicate whether TLS accesses can be part of an addressing mode. This is fixing a performance problem, as this folding of TLS-accesses into multiple addressing modes happened naturally before the introduction of the `llvm.threadlocal.address` intrinsic, but regressed due to `SelectionDAG` keeping things in registers when accessed across basic blocks, so CodeGenPrepare needs to duplicate to mitigate this. We see a ~0.5% recovery in a codebase with heavy TLS usage (HHVM). This fixes most of #87437
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
0 files changed, 0 insertions, 0 deletions