diff options
author | Serguei Katkov <serguei.katkov@azul.com> | 2017-06-26 06:51:45 +0000 |
---|---|---|
committer | Serguei Katkov <serguei.katkov@azul.com> | 2017-06-26 06:51:45 +0000 |
commit | 0e70206c8fc6a17a2b9b9c55aa2a7ddf982037a6 (patch) | |
tree | df7f6ad4aca13de9f65a0552836a107966b3a1b3 /llvm/lib/CodeGen/MachineBlockPlacement.cpp | |
parent | 258245a6effafc7cb73aa0e7713fb25cc894c126 (diff) | |
download | bcm5719-llvm-0e70206c8fc6a17a2b9b9c55aa2a7ddf982037a6.tar.gz bcm5719-llvm-0e70206c8fc6a17a2b9b9c55aa2a7ddf982037a6.zip |
This reverts commit r306272.
Revert "[MBP] do not rotate loop if it creates extra branch"
It breaks the sanitizer build bots. Need to fix this.
llvm-svn: 306276
Diffstat (limited to 'llvm/lib/CodeGen/MachineBlockPlacement.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBlockPlacement.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp index c8f8dda0c2d..2d4b95974cc 100644 --- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp +++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp @@ -1944,35 +1944,6 @@ void MachineBlockPlacement::rotateLoop(BlockChain &LoopChain, if (ExitIt == LoopChain.end()) return; - // Rotating a loop exit to the bottom when there is a fallthrough to top - // trades the entry fallthrough for an exit fallthrough. - // If there is no bottom->top edge, but the chosen exit block does have - // a fallthrough, we break that fallthrough for nothing in return. - - // Let's consider an example. We have a built chain of basic blocks - // B1, B2, ..., Bn, where Bk is a ExitingBB - chosen exit block. - // By doing a rotation we get - // Bk+1, ..., Bn, B1, ..., Bk - // Break of fallthrough to B1 is compensated by a fallthrough from Bk. - // If we had a fallthrough Bk -> Bk+1 it is broken now. - // It might be compensated by fallthrough Bn -> B1. - // So we have a condition to avoid creation of extra branch by loop rotation. - // All below must be true to avoid loop rotation: - // If there is a fallthrough to top (B1) - // There was fallthrough from chosen exit block (Bk) to next one (Bk+1) - // There is no fallthrough from bottom (Bn) to top (B1). - // Please note that there is no exit fallthrough from Bn because we checked it - // above. - if (ViableTopFallthrough) { - MachineBasicBlock *NextBlockInChain = *std::next(ExitIt); - MachineBasicBlock *Bottom = *std::prev(LoopChain.end()); - if (NextBlockInChain->isPredecessor(ExitingBB)) - if (!Top->isPredecessor(Bottom)) - return; - } - - DEBUG(dbgs() << "Rotating loop to put exit " << getBlockName(ExitingBB) - << " at bottom\n"); std::rotate(LoopChain.begin(), std::next(ExitIt), LoopChain.end()); } |