From e4f9b09b5156b5bdd479a98ce28042d2a7623a9b Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Mon, 5 Oct 2015 20:09:16 +0000 Subject: [WinEH] Update CATCHRET's operand to match its successor The CATCHRET operand did not match the MachineFunction's CFG. This mismatch happened because FrameLowering created a new MachineBasicBlock and updated the CFG but forgot to update the CATCHRET operand. Let's make sure this doesn't happen again by strengthing the funclet membership analysis: it can now reason about the membership of all basic blocks, not just those inside of funclets. llvm-svn: 249344 --- llvm/lib/CodeGen/FuncletLayout.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/FuncletLayout.cpp') diff --git a/llvm/lib/CodeGen/FuncletLayout.cpp b/llvm/lib/CodeGen/FuncletLayout.cpp index 4307c1524ad..8b2f505ff02 100644 --- a/llvm/lib/CodeGen/FuncletLayout.cpp +++ b/llvm/lib/CodeGen/FuncletLayout.cpp @@ -42,8 +42,12 @@ bool FuncletLayout::runOnMachineFunction(MachineFunction &F) { if (FuncletMembership.empty()) return false; - F.sort([&](MachineBasicBlock &x, MachineBasicBlock &y) { - return FuncletMembership[&x] < FuncletMembership[&y]; + F.sort([&](MachineBasicBlock &X, MachineBasicBlock &Y) { + auto FuncletX = FuncletMembership.find(&X); + auto FuncletY = FuncletMembership.find(&Y); + assert(FuncletX != FuncletMembership.end()); + assert(FuncletY != FuncletMembership.end()); + return FuncletX->second < FuncletY->second; }); // Conservatively assume we changed something. -- cgit v1.2.3