aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-06-30 20:21:19 +0000
committerBill Wendling <isanbard@gmail.com>2012-06-30 20:21:19 +0000
commitc1b6ea7b6ce3a738accbacddf52480bf94354d2f (patch)
treef29a4f909cf5b0a2c1ef02025b21fd4fdd5a240d /lib
parentcf23bd3d8f7e7dec6331043295dbf1ec92fedb4f (diff)
Don't reinsert the 'atexit' function if it already exists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159491 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Instrumentation/GCOVProfiling.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index dda92b1882..264a6a6153 100644
--- a/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -687,8 +687,7 @@ void GCOVProfiler::insertCounterWriteout(
FTy = FunctionType::get(Type::getInt32Ty(*Ctx),
PointerType::get(FTy, 0), false);
- Function *AtExitFn =
- Function::Create(FTy, GlobalValue::ExternalLinkage, "atexit", M);
+ Constant *AtExitFn = M->getOrInsertFunction("atexit", FTy);
Builder.CreateCall(AtExitFn, WriteoutF);
Builder.CreateRetVoid();