summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineBlockPlacement.cpp
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2017-03-23 23:28:09 +0000
committerDehao Chen <dehao@google.com>2017-03-23 23:28:09 +0000
commitb197d5b0a00747c0b6d8f82a275f871f3c9240c2 (patch)
treede0bf01aebebd0b7cb5ec907728eb6cb2bd8077d /llvm/lib/CodeGen/MachineBlockPlacement.cpp
parent722e94061baa662a0f41ede6fd0cf6d0dcf5932a (diff)
downloadbcm5719-llvm-b197d5b0a00747c0b6d8f82a275f871f3c9240c2.tar.gz
bcm5719-llvm-b197d5b0a00747c0b6d8f82a275f871f3c9240c2.zip
Fix trellis layout to avoid mis-identify triangle.
Summary: For the following CFG: A->B B->C A->C If there is another edge B->D, then ABC should not be considered as triangle. Reviewers: davidxl, iteratee Reviewed By: iteratee Subscribers: nemanjai, llvm-commits Differential Revision: https://reviews.llvm.org/D31310 llvm-svn: 298661
Diffstat (limited to 'llvm/lib/CodeGen/MachineBlockPlacement.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBlockPlacement.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
index d3bf95b9a95..de0b572f2fe 100644
--- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -839,8 +839,13 @@ bool MachineBlockPlacement::isTrellis(
int PredCount = 0;
for (auto SuccPred : Succ->predecessors()) {
// Allow triangle successors, but don't count them.
- if (Successors.count(SuccPred))
+ if (Successors.count(SuccPred)) {
+ // Make sure that it is actually a triangle.
+ for (MachineBasicBlock *CheckSucc : SuccPred->successors())
+ if (!Successors.count(CheckSucc))
+ return false;
continue;
+ }
const BlockChain *PredChain = BlockToChain[SuccPred];
if (SuccPred == BB || (BlockFilter && !BlockFilter->count(SuccPred)) ||
PredChain == &Chain || PredChain == BlockToChain[Succ])
OpenPOWER on IntegriCloud