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
This commit is contained in:
Bill Wendling 2012-06-30 20:21:19 +00:00
parent cf23bd3d8f
commit c1b6ea7b6c

View File

@ -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();