diff options
| author | Reid Kleckner <rnk@google.com> | 2015-09-10 21:46:36 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2015-09-10 21:46:36 +0000 |
| commit | 7bb20bd69ed28cad9cff666c977c7c589419bf32 (patch) | |
| tree | 12f579b9f160544986652c834a012567297a9dd3 /llvm/lib/CodeGen | |
| parent | 6d247f71c30acc8e9e856227507684d19f7ea058 (diff) | |
| download | bcm5719-llvm-7bb20bd69ed28cad9cff666c977c7c589419bf32.tar.gz bcm5719-llvm-7bb20bd69ed28cad9cff666c977c7c589419bf32.zip | |
Fix SEH state numbering algorithm to handle cleanupendpads
WinEHPrepare's new coloring algorithm really expects to see
cleanupendpads now, so Clang will start emitting them soon.
llvm-svn: 247341
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/WinEHPrepare.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index 3f666c944e2..bbf61a14bf1 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -2993,11 +2993,8 @@ static const BasicBlock *getEHPadFromPredecessor(const BasicBlock *BB) { const TerminatorInst *TI = BB->getTerminator(); if (isa<InvokeInst>(TI)) return nullptr; - if (isa<CatchPadInst>(TI) || isa<CatchEndPadInst>(TI) || - isa<TerminatePadInst>(TI)) + if (TI->isEHPad()) return BB; - if (auto *CEPI = dyn_cast<CleanupEndPadInst>(TI)) - return CEPI->getCleanupPad()->getParent(); return cast<CleanupReturnInst>(TI)->getCleanupPad()->getParent(); } @@ -3111,6 +3108,14 @@ static void calculateExplicitSEHStateNumbers(WinEHFuncInfo &FuncInfo, for (const BasicBlock *PredBlock : predecessors(&BB)) if ((PredBlock = getEHPadFromPredecessor(PredBlock))) calculateExplicitSEHStateNumbers(FuncInfo, *PredBlock, CleanupState); + } else if (isa<CleanupEndPadInst>(FirstNonPHI)) { + // Anything unwinding through CleanupEndPadInst is in ParentState. + FuncInfo.EHPadStateMap[FirstNonPHI] = ParentState; + DEBUG(dbgs() << "Assigning state #" << ParentState << " to BB " + << BB.getName() << '\n'); + for (const BasicBlock *PredBlock : predecessors(&BB)) + if ((PredBlock = getEHPadFromPredecessor(PredBlock))) + calculateExplicitSEHStateNumbers(FuncInfo, *PredBlock, ParentState); } else if (isa<TerminatePadInst>(FirstNonPHI)) { report_fatal_error("Not yet implemented!"); } else { |

