[WinEH] Don't forward branches across empty EH pad BBs
[oota-llvm.git] / lib / CodeGen / BranchFolding.cpp
index 6ee9a4b16fea84d6817990f121d51d49ffe4b748..0b2495cc996e00b409c8a1be88a8d70b8f6391e2 100644 (file)
@@ -1404,7 +1404,7 @@ ReoptimizeBlock:
     // other blocks across it.
     if (CurTBB && CurCond.empty() && !CurFBB &&
         IsBranchOnlyBlock(MBB) && CurTBB != MBB &&
-        !MBB->hasAddressTaken()) {
+        !MBB->hasAddressTaken() && !MBB->isEHPad()) {
       DebugLoc dl = getBranchDebugLoc(*MBB);
       // This block may contain just an unconditional branch.  Because there can
       // be 'non-branch terminators' in the block, try removing the branch and