diff options
author | Chris Lattner <sabre@nondot.org> | 2004-11-19 07:09:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-11-19 07:09:40 +0000 |
commit | dad1823703731e2ffc8274170e80716fc400a0a4 (patch) | |
tree | 88bf4485d59e04277e5a7d6239ee5c9b57d68756 /llvm/tools/bugpoint/Miscompilation.cpp | |
parent | 0bcf9e4da6064f09632a71cdf7ada9e859af45fa (diff) | |
download | bcm5719-llvm-dad1823703731e2ffc8274170e80716fc400a0a4.tar.gz bcm5719-llvm-dad1823703731e2ffc8274170e80716fc400a0a4.zip |
Fix a bug in the checkin where I adjusted this code to work when
LinkModules nukes the second module argument.
llvm-svn: 17986
Diffstat (limited to 'llvm/tools/bugpoint/Miscompilation.cpp')
-rw-r--r-- | llvm/tools/bugpoint/Miscompilation.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/tools/bugpoint/Miscompilation.cpp b/llvm/tools/bugpoint/Miscompilation.cpp index b578202402a..6800c8e0ade 100644 --- a/llvm/tools/bugpoint/Miscompilation.cpp +++ b/llvm/tools/bugpoint/Miscompilation.cpp @@ -295,8 +295,9 @@ static bool ExtractLoops(BugDriver &BD, std::vector<std::pair<std::string, const FunctionType*> > MisCompFunctions; for (Module::iterator I = ToOptimizeLoopExtracted->begin(), E = ToOptimizeLoopExtracted->end(); I != E; ++I) - MisCompFunctions.push_back(std::make_pair(I->getName(), - I->getFunctionType())); + if (!I->isExternal()) + MisCompFunctions.push_back(std::make_pair(I->getName(), + I->getFunctionType())); // Okay, great! Now we know that we extracted a loop and that loop // extraction both didn't break the program, and didn't mask the problem. @@ -432,8 +433,9 @@ static bool ExtractBlocks(BugDriver &BD, std::vector<std::pair<std::string, const FunctionType*> > MisCompFunctions; for (Module::iterator I = Extracted->begin(), E = Extracted->end(); I != E; ++I) - MisCompFunctions.push_back(std::make_pair(I->getName(), - I->getFunctionType())); + if (!I->isExternal()) + MisCompFunctions.push_back(std::make_pair(I->getName(), + I->getFunctionType())); std::string ErrorMsg; if (LinkModules(ProgClone, Extracted, &ErrorMsg)) { @@ -624,11 +626,10 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, // Call the old main function and return its result BasicBlock *BB = new BasicBlock("entry", newMain); - CallInst *call = new CallInst(oldMainProto, args); - BB->getInstList().push_back(call); + CallInst *call = new CallInst(oldMainProto, args, "", BB); // If the type of old function wasn't void, return value of call - new ReturnInst(oldMain->getReturnType() != Type::VoidTy ? call : 0, BB); + new ReturnInst(call, BB); } // The second nasty issue we must deal with in the JIT is that the Safe |