[WinEH] Fix catchpad pred verification
[oota-llvm.git] / lib / IR / Verifier.cpp
index a99927065d0e7ee7e00365a995a86ad81ba008a1..9198b0e1fb587f4df09dd5c64ace9e647757e0c5 100644 (file)
@@ -2996,6 +2996,9 @@ void Verifier::visitEHPadPredecessors(Instruction &I) {
              "Block containg CatchPadInst must be jumped to "
              "only by its catchswitch.",
              CPI);
+    Assert(BB != CPI->getCatchSwitch()->getUnwindDest(),
+           "Catchswitch cannot unwind to one of its catchpads",
+           CPI->getCatchSwitch(), CPI);
     return;
   }