[llvm-branch-commits] [llvm-branch] r136171 - /llvm/branches/exception-handling-rewrite/lib/VMCore/Verifier.cpp

Bill Wendling isanbard at gmail.com
Tue Jul 26 15:47:58 PDT 2011


Author: void
Date: Tue Jul 26 17:47:58 2011
New Revision: 136171

URL: http://llvm.org/viewvc/llvm-project?rev=136171&view=rev
Log:
Add to the verifier that the personality functions of all landingpad
instructions within the same function must match.

Modified:
    llvm/branches/exception-handling-rewrite/lib/VMCore/Verifier.cpp

Modified: llvm/branches/exception-handling-rewrite/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/exception-handling-rewrite/lib/VMCore/Verifier.cpp?rev=136171&r1=136170&r2=136171&view=diff
==============================================================================
--- llvm/branches/exception-handling-rewrite/lib/VMCore/Verifier.cpp (original)
+++ llvm/branches/exception-handling-rewrite/lib/VMCore/Verifier.cpp Tue Jul 26 17:47:58 2011
@@ -39,6 +39,8 @@
 //    only by the unwind edge of an invoke instruction.
 //  * A landingpad instruction must be the first non-PHI instruction in the
 //    block.
+//  * All landingpad instructions must use the same personality function with
+//    the same function.
 //  * All other things that are tested by asserts spread about the code...
 //
 //===----------------------------------------------------------------------===//
@@ -135,18 +137,22 @@
     /// already.
     SmallPtrSet<MDNode *, 32> MDNodes;
 
+    /// PersonalityFn - The personality function referenced by the
+    /// LandingPadInsts. All LandingPadInsts within the same function must use
+    /// the same personality function.
+    const Value *PersonalityFn;
+
     Verifier()
-      : FunctionPass(ID), 
-      Broken(false), RealPass(true), action(AbortProcessAction),
-      Mod(0), Context(0), DT(0), MessagesStr(Messages) {
-        initializeVerifierPass(*PassRegistry::getPassRegistry());
-      }
+      : FunctionPass(ID), Broken(false), RealPass(true),
+        action(AbortProcessAction), Mod(0), Context(0), DT(0),
+        MessagesStr(Messages), PersonalityFn(0) {
+      initializeVerifierPass(*PassRegistry::getPassRegistry());
+    }
     explicit Verifier(VerifierFailureAction ctn)
-      : FunctionPass(ID), 
-      Broken(false), RealPass(true), action(ctn), Mod(0), Context(0), DT(0),
-      MessagesStr(Messages) {
-        initializeVerifierPass(*PassRegistry::getPassRegistry());
-      }
+      : FunctionPass(ID), Broken(false), RealPass(true), action(ctn), Mod(0),
+        Context(0), DT(0), MessagesStr(Messages), PersonalityFn(0) {
+      initializeVerifierPass(*PassRegistry::getPassRegistry());
+    }
 
     bool doInitialization(Module &M) {
       Mod = &M;
@@ -1374,6 +1380,13 @@
           "LandingPadInst not the first non-PHI instruction in the block.",
           &LPI);
 
+  // The personality functions for all landingpad instructions within the same
+  // function should match.
+  if (PersonalityFn)
+    Assert1(LPI.getPersonalityFn() == PersonalityFn,
+            "Personality function doesn't match others in function", &LPI);
+  PersonalityFn = LPI.getPersonalityFn();
+
   visitInstruction(LPI);
 }
 





More information about the llvm-branch-commits mailing list