diff options
| author | Joseph Tremoulet <jotrem@microsoft.com> | 2015-09-10 16:51:25 +0000 |
|---|---|---|
| committer | Joseph Tremoulet <jotrem@microsoft.com> | 2015-09-10 16:51:25 +0000 |
| commit | f3aff3140185e9d24acc4cc0672b620c02c70a58 (patch) | |
| tree | cbb6827ec78b0a5109a4d11cdfcd483ca8383de5 /llvm/lib/CodeGen/WinEHPrepare.cpp | |
| parent | aa15bffa1f716525ccedfb89c9cf1a51d0acad14 (diff) | |
| download | bcm5719-llvm-f3aff3140185e9d24acc4cc0672b620c02c70a58.tar.gz bcm5719-llvm-f3aff3140185e9d24acc4cc0672b620c02c70a58.zip | |
[WinEH] Fix single-block cleanup coloring
Summary:
The coloring code in WinEHPrepare queues cleanuprets' successors with the
correct color (the parent one) when it sees their cleanuppad, and so later
when iterating successors knows to skip processing cleanuprets since
they've already been queued. This latter check was incorrectly under an
'else' condition and so inadvertently was not kicking in for single-block
cleanups. This change sinks the check out of the 'else' to fix the bug.
Reviewers: majnemer, andrew.w.kaylor, rnk
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D12751
llvm-svn: 247299
Diffstat (limited to 'llvm/lib/CodeGen/WinEHPrepare.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/WinEHPrepare.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index ea43cb2ffeb..3f666c944e2 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -3245,14 +3245,15 @@ void WinEHPrepare::colorFunclets(Function &F, } else { // Note that this is a member of the given color. FuncletBlocks[Color].insert(Visiting); - TerminatorInst *Terminator = Visiting->getTerminator(); - if (isa<CleanupReturnInst>(Terminator) || - isa<CatchReturnInst>(Terminator) || - isa<CleanupEndPadInst>(Terminator)) { - // These block's successors have already been queued with the parent - // color. - continue; - } + } + + TerminatorInst *Terminator = Visiting->getTerminator(); + if (isa<CleanupReturnInst>(Terminator) || + isa<CatchReturnInst>(Terminator) || + isa<CleanupEndPadInst>(Terminator)) { + // These blocks' successors have already been queued with the parent + // color. + continue; } for (BasicBlock *Succ : successors(Visiting)) { if (isa<CatchEndPadInst>(Succ->getFirstNonPHI())) { |

