[all-commits] [llvm/llvm-project] fbfe1d: [clang] Explicitly set the EmulatedTLS codegen opt...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Tue Sep 13 00:56:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fbfe1db4a95a73ed6a0767db0ab7d449fc03405e
      https://github.com/llvm/llvm-project/commit/fbfe1db4a95a73ed6a0767db0ab7d449fc03405e
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-09-13 (Tue, 13 Sep 2022)

  Changed paths:
    M clang/include/clang/Basic/CodeGenOptions.def
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp

  Log Message:
  -----------
  [clang] Explicitly set the EmulatedTLS codegen option. NFC.

Set the EmulatedTLS option based on `Triple::hasDefaultEmulatedTLS()`
if the user didn't specify it; set `ExplicitEmulatedTLS` to true
in `llvm::TargetOptions` and set `EmulatedTLS` to Clang's
opinion of what the default or preference is.

This avoids any risk of deviance between the two.

This affects one check of `getCodeGenOpts().EmulatedTLS` in
`shouldAssumeDSOLocal` in CodeGenModule, but as that check only
is done for `TT.isWindowsGNUEnvironment()`, and
`hasDefaultEmulatedTLS()` returns false for such environments
it doesn't make any current testable difference - thus NFC.

Some mingw distributions carry a downstream patch, that enables
emulated TLS by default for mingw targets in `hasDefaultEmulatedTLS()`
- and for such cases, this patch does make a difference and fixes the
detection of emulated TLS, if it is implicitly enabled.

Differential Revision: https://reviews.llvm.org/D132916




More information about the All-commits mailing list