aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-10-31 20:39:26 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-10-31 20:39:26 +0000
commit3ad0636e0a0c39dfa08b67f1a568ee08ebbd1fdc (patch)
treea5846567d8079018a821eacfb5ec564778b85e13 /clang/lib/CodeGen/CodeGenFunction.h
parentf7e3d8915e54b44c6ce5a00a2fc666051f2e800e (diff)
downloadllvm-3ad0636e0a0c39dfa08b67f1a568ee08ebbd1fdc.zip
llvm-3ad0636e0a0c39dfa08b67f1a568ee08ebbd1fdc.tar.gz
llvm-3ad0636e0a0c39dfa08b67f1a568ee08ebbd1fdc.tar.bz2
Part of PR39508: Emit an @llvm.invariant.start after storing to
__tls_guard. __tls_guard can only ever transition from 0 to 1, and only once. This permits LLVM to remove repeated checks for TLS initialization and repeated initialization code in cases like: int g(); thread_local int n = g(); int a = n + n; where we could not prove that __tls_guard was still 'true' when checking it for the second reference to 'n' in the initializer of 'a'. llvm-svn: 345774
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index c73cef5..d5de0a0 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -3892,6 +3892,8 @@ public:
AddInitializerToStaticVarDecl(const VarDecl &D,
llvm::GlobalVariable *GV);
+ // Emit an @llvm.invariant.start call for the given memory region.
+ void EmitInvariantStart(llvm::Constant *Addr, CharUnits Size);
/// EmitCXXGlobalVarDeclInit - Create the initializer for a C++
/// variable with global storage.
@@ -3927,9 +3929,10 @@ public:
/// GenerateCXXGlobalInitFunc - Generates code for initializing global
/// variables.
- void GenerateCXXGlobalInitFunc(llvm::Function *Fn,
- ArrayRef<llvm::Function *> CXXThreadLocals,
- Address Guard = Address::invalid());
+ void
+ GenerateCXXGlobalInitFunc(llvm::Function *Fn,
+ ArrayRef<llvm::Function *> CXXThreadLocals,
+ ConstantAddress Guard = ConstantAddress::invalid());
/// GenerateCXXGlobalDtorsFunc - Generates code for destroying global
/// variables.