diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-10-01 21:04:13 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-10-01 21:04:13 +0000 |
commit | 4600c0643466114c20a557b74b233665105cf9bb (patch) | |
tree | 37cec5454d127aa3f382fbd9dd1e6e3e07b7fb0f /llvm/lib/CodeGen | |
parent | d943670a82206b2701555b348bbd8995d838abc4 (diff) | |
download | bcm5719-llvm-4600c0643466114c20a557b74b233665105cf9bb.tar.gz bcm5719-llvm-4600c0643466114c20a557b74b233665105cf9bb.zip |
[WinEH] Stop BranchFolding from merging across funclets
BranchFolding would merge two funclets together, this is not OK.
Disable this and strengthen the assertion in FuncletLayout.
llvm-svn: 249069
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/BranchFolding.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/CodeGen/FuncletLayout.cpp | 14 |
2 files changed, 7 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index 2ef8889091f..2cc851f3973 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -94,9 +94,11 @@ bool BranchFolderPass::runOnMachineFunction(MachineFunction &MF) { TargetPassConfig *PassConfig = &getAnalysis<TargetPassConfig>(); // TailMerge can create jump into if branches that make CFG irreducible for - // HW that requires structurized CFG. + // HW that requires structurized CFG. It can also cause BBs to get shared + // between funclets. bool EnableTailMerge = !MF.getTarget().requiresStructuredCFG() && - PassConfig->getEnableTailMerge(); + !MF.getMMI().hasEHFunclets() && + PassConfig->getEnableTailMerge(); BranchFolder Folder(EnableTailMerge, /*CommonHoist=*/true, getAnalysis<MachineBlockFrequencyInfo>(), getAnalysis<MachineBranchProbabilityInfo>()); diff --git a/llvm/lib/CodeGen/FuncletLayout.cpp b/llvm/lib/CodeGen/FuncletLayout.cpp index e1e185b4752..4fdb66700b2 100644 --- a/llvm/lib/CodeGen/FuncletLayout.cpp +++ b/llvm/lib/CodeGen/FuncletLayout.cpp @@ -39,17 +39,9 @@ collectFuncletMembers(DenseMap<MachineBasicBlock *, int> &FuncletMembership, int Funclet, MachineBasicBlock *MBB) { // Don't revisit blocks. if (FuncletMembership.count(MBB) > 0) { - // FIXME: This is a hack, we need to assert this unconditionally. - bool IsProbablyUnreachableBlock = - MBB->empty() || - (MBB->succ_empty() && !MBB->getFirstTerminator()->isReturn() && - MBB->size() == 1); - - if (!IsProbablyUnreachableBlock) { - if (FuncletMembership[MBB] != Funclet) { - assert(false && "MBB is part of two funclets!"); - report_fatal_error("MBB is part of two funclets!"); - } + if (FuncletMembership[MBB] != Funclet) { + assert(false && "MBB is part of two funclets!"); + report_fatal_error("MBB is part of two funclets!"); } return; } |