Not only is this a lot smaller, it actually works if there is already a
authorChris Lattner <sabre@nondot.org>
Mon, 1 Sep 2003 16:53:46 +0000 (16:53 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 1 Sep 2003 16:53:46 +0000 (16:53 +0000)
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
lib/Transforms/IPO/Parallelize.cpp

index 562a263e29aee3ad254df9987c978aaf5594a102..e78386740290ca97e5e9e025f0fc20609be9b071 100644 (file)
@@ -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<const Type*>(),
-                                                 /*isVararg*/ false),
-                               GlobalValue::ExternalLinkage, DummySyncFuncName,
-                               &M);
+  DummySyncFunc = M.getOrInsertFunction(DummySyncFuncName, Type::VoidTy, 0);
 }
 
 void Cilkifier::TransformFunc(Function* F,
index 562a263e29aee3ad254df9987c978aaf5594a102..e78386740290ca97e5e9e025f0fc20609be9b071 100644 (file)
@@ -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<const Type*>(),
-                                                 /*isVararg*/ false),
-                               GlobalValue::ExternalLinkage, DummySyncFuncName,
-                               &M);
+  DummySyncFunc = M.getOrInsertFunction(DummySyncFuncName, Type::VoidTy, 0);
 }
 
 void Cilkifier::TransformFunc(Function* F,