[llvm-commits] CVS: llvm/tools/bugpoint/Miscompilation.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Nov 18 23:09:56 PST 2004



Changes in directory llvm/tools/bugpoint:

Miscompilation.cpp updated: 1.54 -> 1.55
---
Log message:

Fix a bug in the checkin where I adjusted this code to work when 
LinkModules nukes the second module argument.


---
Diffs of the changes:  (+8 -7)

Index: llvm/tools/bugpoint/Miscompilation.cpp
diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.54 llvm/tools/bugpoint/Miscompilation.cpp:1.55
--- llvm/tools/bugpoint/Miscompilation.cpp:1.54	Tue Nov 16 00:31:38 2004
+++ llvm/tools/bugpoint/Miscompilation.cpp	Fri Nov 19 01:09:40 2004
@@ -295,8 +295,9 @@
     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 @@
   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 @@
 
       // 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






More information about the llvm-commits mailing list