[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp

Chris Lattner lattner at apoc.cs.uiuc.edu
Thu Sep 19 11:13:01 PDT 2002


Changes in directory llvm/lib/VMCore:

Verifier.cpp updated: 1.37 -> 1.38

---
Log message:

Make sure that we abort if an error happens as early as neccesary.  Before 
it was possible for the passmanager to continue running passes after the 
verifier even if the module was not well formed.



---
Diffs of the changes:

Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.37 llvm/lib/VMCore/Verifier.cpp:1.38
--- llvm/lib/VMCore/Verifier.cpp:1.37	Mon Sep  9 23:52:59 2002
+++ llvm/lib/VMCore/Verifier.cpp	Thu Sep 19 11:12:19 2002
@@ -48,7 +48,6 @@
 #include "llvm/Support/InstVisitor.h"
 #include "Support/STLExtras.h"
 #include <algorithm>
-#include <iostream>
 
 namespace {  // Anonymous namespace for class
 
@@ -67,6 +66,13 @@
 
     bool doInitialization(Module &M) {
       verifySymbolTable(M.getSymbolTable());
+
+      // If this is a real pass, in a pass manager, we must abort before
+      // returning back to the pass manager, or else the pass manager may try to
+      // run other passes on the broken module.
+      //
+      if (RealPass)
+        abortIfBroken();
       return false;
     }
 
@@ -74,6 +80,14 @@
       // Get dominator information if we are being run by PassManager
       if (RealPass) DS = &getAnalysis<DominatorSet>();
       visit(F);
+
+      // If this is a real pass, in a pass manager, we must abort before
+      // returning back to the pass manager, or else the pass manager may try to
+      // run other passes on the broken module.
+      //
+      if (RealPass)
+        abortIfBroken();
+
       return false;
     }
 
@@ -83,10 +97,8 @@
         if (I->isExternal() && I->hasInternalLinkage())
           CheckFailed("Function Declaration has Internal Linkage!", I);
 
-      if (Broken && AbortBroken) {
-        std::cerr << "Broken module found, compilation aborted!\n";
-        abort();
-      }
+      // If the module is broken, abort at this time.
+      abortIfBroken();
       return false;
     }
 
@@ -94,6 +106,16 @@
       AU.setPreservesAll();
       if (RealPass)
         AU.addRequired<DominatorSet>();
+    }
+
+    // abortIfBroken - If the module is broken and we are supposed to abort on
+    // this condition, do so.
+    //
+    void abortIfBroken() const {
+      if (Broken && AbortBroken) {
+        std::cerr << "Broken module found, compilation aborted!\n";
+        abort();
+      }
     }
 
     // Verification methods...





More information about the llvm-commits mailing list