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

Chris Lattner lattner at cs.uiuc.edu
Wed May 12 11:08:24 PDT 2004


Changes in directory llvm/tools/bugpoint:

Miscompilation.cpp updated: 1.46 -> 1.47

---
Log message:

Check to see if all blocks are extractible first.


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

Index: llvm/tools/bugpoint/Miscompilation.cpp
diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.46 llvm/tools/bugpoint/Miscompilation.cpp:1.47
--- llvm/tools/bugpoint/Miscompilation.cpp:1.46	Tue May 11 21:43:24 2004
+++ llvm/tools/bugpoint/Miscompilation.cpp	Wed May 12 11:08:01 2004
@@ -354,11 +354,15 @@
 bool ReduceMiscompiledBlocks::TestFuncs(const std::vector<BasicBlock*> &BBs) {
   // Test to see if the function is misoptimized if we ONLY run it on the
   // functions listed in Funcs.
-  std::cout << "Checking to see if the program is misoptimized when all but "
-            << "these " << BBs.size() << " blocks are extracted: ";
-  for (unsigned i = 0, e = BBs.size() < 10 ? BBs.size() : 10; i != e; ++i)
-    std::cout << BBs[i]->getName() << " ";
-  if (BBs.size() > 10) std::cout << "...";
+  std::cout << "Checking to see if the program is misoptimized when all ";
+  if (!BBs.empty()) {
+    std::cout << "but these " << BBs.size() << " blocks are extracted: ";
+    for (unsigned i = 0, e = BBs.size() < 10 ? BBs.size() : 10; i != e; ++i)
+      std::cout << BBs[i]->getName() << " ";
+    if (BBs.size() > 10) std::cout << "...";
+  } else {
+    std::cout << "blocks are extracted.";
+  }
   std::cout << "\n";
 
   // Split the module into the two halves of the program we want.
@@ -399,9 +403,16 @@
   // obscuring the bug.  The Blocks list will end up containing blocks that must
   // be retained from the original program.
   unsigned OldSize = Blocks.size();
-  ReduceMiscompiledBlocks(BD, TestFn, MiscompiledFunctions).reduceList(Blocks);
-  if (Blocks.size() == OldSize)
-    return false;
+
+  // Check to see if all blocks are extractible first.
+  if (ReduceMiscompiledBlocks(BD, TestFn,
+                  MiscompiledFunctions).TestFuncs(std::vector<BasicBlock*>())) {
+    Blocks.clear();
+  } else {
+    ReduceMiscompiledBlocks(BD, TestFn,MiscompiledFunctions).reduceList(Blocks);
+    if (Blocks.size() == OldSize)
+      return false;
+  }
 
   Module *ProgClone = CloneModule(BD.getProgram());
   Module *ToExtract = SplitFunctionsOutOfModule(ProgClone,





More information about the llvm-commits mailing list