From 273328e8e0e7b037bebfa8418400a247fba82496 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 1 Sep 2003 16:53:46 +0000 Subject: [PATCH] Not only is this a lot smaller, it actually works if there is already a function with the right name in the module. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8290 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/DataStructure/Parallelize.cpp | 6 +----- lib/Transforms/IPO/Parallelize.cpp | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/Analysis/DataStructure/Parallelize.cpp b/lib/Analysis/DataStructure/Parallelize.cpp index 562a263e29a..e7838674029 100644 --- a/lib/Analysis/DataStructure/Parallelize.cpp +++ b/lib/Analysis/DataStructure/Parallelize.cpp @@ -158,11 +158,7 @@ public: Cilkifier::Cilkifier(Module& M) { // create the dummy Sync function and add it to the Module - DummySyncFunc = new Function(FunctionType::get( Type::VoidTy, - std::vector(), - /*isVararg*/ false), - GlobalValue::ExternalLinkage, DummySyncFuncName, - &M); + DummySyncFunc = M.getOrInsertFunction(DummySyncFuncName, Type::VoidTy, 0); } void Cilkifier::TransformFunc(Function* F, diff --git a/lib/Transforms/IPO/Parallelize.cpp b/lib/Transforms/IPO/Parallelize.cpp index 562a263e29a..e7838674029 100644 --- a/lib/Transforms/IPO/Parallelize.cpp +++ b/lib/Transforms/IPO/Parallelize.cpp @@ -158,11 +158,7 @@ public: Cilkifier::Cilkifier(Module& M) { // create the dummy Sync function and add it to the Module - DummySyncFunc = new Function(FunctionType::get( Type::VoidTy, - std::vector(), - /*isVararg*/ false), - GlobalValue::ExternalLinkage, DummySyncFuncName, - &M); + DummySyncFunc = M.getOrInsertFunction(DummySyncFuncName, Type::VoidTy, 0); } void Cilkifier::TransformFunc(Function* F,