aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-27 21:30:38 +0000
committerDan Gohman <gohman@apple.com>2009-06-27 21:30:38 +0000
commit7ba0640b33b6beb617078845c8b4ead4e51772c5 (patch)
tree50006e0a70949304f64ee1395d602224e8338078 /lib/Transforms/Utils/SimplifyCFG.cpp
parenta70d7578c1d0f304d8d0c651f0183e1c89883ae3 (diff)
downloadexternal_llvm-7ba0640b33b6beb617078845c8b4ead4e51772c5.zip
external_llvm-7ba0640b33b6beb617078845c8b4ead4e51772c5.tar.gz
external_llvm-7ba0640b33b6beb617078845c8b4ead4e51772c5.tar.bz2
Teach LoopSimplify how to merge multiple loop exits into a single exit,
when one of them can be converted to a trivial icmp and conditional branch. This addresses what is essentially a phase ordering problem. SimplifyCFG knows how to do this transformation, but it doesn't do so if the primary block has any instructions in it other than an icmp and a branch. In the given testcase, the block contains other instructions, however they are loop-invariant and can be hoisted. SimplifyCFG doesn't have LoopInfo though, so it can't hoist them. And, it's important that the blocks be merged before LoopRotation, as it doesn't support multiple-exit loops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74396 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index ee0f6a6..58d4d5a 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1492,7 +1492,7 @@ static bool SimplifyCondBranchToTwoReturns(BranchInst *BI) {
/// and if a predecessor branches to us and one of our successors, fold the
/// setcc into the predecessor and use logical operations to pick the right
/// destination.
-static bool FoldBranchToCommonDest(BranchInst *BI) {
+bool llvm::FoldBranchToCommonDest(BranchInst *BI) {
BasicBlock *BB = BI->getParent();
Instruction *Cond = dyn_cast<Instruction>(BI->getCondition());
if (Cond == 0) return false;