diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2016-02-23 07:18:15 +0000 | 
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2016-02-23 07:18:15 +0000 | 
| commit | 17525aba8af3b218f52ccda0f01e066853d4a1e9 (patch) | |
| tree | 8a1d78d30e3881647130430fe91964a1b8e0644f /llvm/lib/CodeGen/WinEHPrepare.cpp | |
| parent | 7cf7f80c377f30ce0c9692c429964f92f6b99f0c (diff) | |
| download | bcm5719-llvm-17525aba8af3b218f52ccda0f01e066853d4a1e9.tar.gz bcm5719-llvm-17525aba8af3b218f52ccda0f01e066853d4a1e9.zip  | |
[WinEH] Visit 'unwind to caller' catchswitches nested in catchswitches
We had the right logic for the nested cleanuppad case but omitted it for
catchswitches.
llvm-svn: 261615
Diffstat (limited to 'llvm/lib/CodeGen/WinEHPrepare.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/WinEHPrepare.cpp | 12 | 
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index 3e16a25f79e..8157857bc25 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -254,9 +254,11 @@ static void calculateCXXStateNumbers(WinEHFuncInfo &FuncInfo,        FuncInfo.FuncletBaseStateMap[CatchPad] = CatchLow;        for (const User *U : CatchPad->users()) {          const auto *UserI = cast<Instruction>(U); -        if (auto *InnerCatchSwitch = dyn_cast<CatchSwitchInst>(UserI)) -          if (InnerCatchSwitch->getUnwindDest() == CatchSwitch->getUnwindDest()) +        if (auto *InnerCatchSwitch = dyn_cast<CatchSwitchInst>(UserI)) { +          BasicBlock *UnwindDest = InnerCatchSwitch->getUnwindDest(); +          if (!UnwindDest || UnwindDest == CatchSwitch->getUnwindDest())              calculateCXXStateNumbers(FuncInfo, UserI, CatchLow); +        }          if (auto *InnerCleanupPad = dyn_cast<CleanupPadInst>(UserI)) {            BasicBlock *UnwindDest = getCleanupRetUnwindDest(InnerCleanupPad);            // If a nested cleanup pad reports a null unwind destination and the @@ -361,9 +363,11 @@ static void calculateSEHStateNumbers(WinEHFuncInfo &FuncInfo,      // outside the __try.      for (const User *U : CatchPad->users()) {        const auto *UserI = cast<Instruction>(U); -      if (auto *InnerCatchSwitch = dyn_cast<CatchSwitchInst>(UserI)) -        if (InnerCatchSwitch->getUnwindDest() == CatchSwitch->getUnwindDest()) +      if (auto *InnerCatchSwitch = dyn_cast<CatchSwitchInst>(UserI)) { +        BasicBlock *UnwindDest = InnerCatchSwitch->getUnwindDest(); +        if (!UnwindDest || UnwindDest == CatchSwitch->getUnwindDest())            calculateSEHStateNumbers(FuncInfo, UserI, ParentState); +      }        if (auto *InnerCleanupPad = dyn_cast<CleanupPadInst>(UserI)) {          BasicBlock *UnwindDest = getCleanupRetUnwindDest(InnerCleanupPad);          // If a nested cleanup pad reports a null unwind destination and the  | 

