diff options
author | Justin Bogner <mail@justinbogner.com> | 2014-04-10 18:13:13 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2014-04-10 18:13:13 +0000 |
commit | f2ea775ed9ec93ac5402d226d1841443555e5421 (patch) | |
tree | 6f325b2c0f7b110f7571a4fd723a19cd422a9996 /clang/lib/CodeGen/CodeGenPGO.cpp | |
parent | 582e4f74da8be623d3ca93a9cbb386184105b987 (diff) | |
download | bcm5719-llvm-f2ea775ed9ec93ac5402d226d1841443555e5421.tar.gz bcm5719-llvm-f2ea775ed9ec93ac5402d226d1841443555e5421.zip |
CodeGen: Move PGO initialization into Release()
Emitting the PGO initialization in EmitGlobalFunctionDefinition is
inefficient, since this only has an effect once per module. We move
this to Release() with the rest of the once-per-module logic.
llvm-svn: 205977
Diffstat (limited to 'clang/lib/CodeGen/CodeGenPGO.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenPGO.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp index 935724f59f5..2e562ca826f 100644 --- a/clang/lib/CodeGen/CodeGenPGO.cpp +++ b/clang/lib/CodeGen/CodeGenPGO.cpp @@ -294,9 +294,8 @@ llvm::Function *CodeGenPGO::emitInitialization(CodeGenModule &CGM) { if (!CGM.getCodeGenOpts().ProfileInstrGenerate) return nullptr; - // Only need to create this once per module. - if (CGM.getModule().getFunction("__llvm_profile_init")) - return nullptr; + assert(CGM.getModule().getFunction("__llvm_profile_init") == nullptr && + "profile initialization already emitted"); // Get the function to call at initialization. llvm::Constant *RegisterF = getRegisterFunc(CGM); |