diff options
author | Dan Gohman <gohman@apple.com> | 2009-06-27 21:30:38 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-06-27 21:30:38 +0000 |
commit | 4b35f83b91a1a313f0730c600e5178aaf7df98d6 (patch) | |
tree | 50006e0a70949304f64ee1395d602224e8338078 /include | |
parent | cfb32203bceb0638db976fea5ce906b2a1010bac (diff) | |
download | external_llvm-4b35f83b91a1a313f0730c600e5178aaf7df98d6.zip external_llvm-4b35f83b91a1a313f0730c600e5178aaf7df98d6.tar.gz external_llvm-4b35f83b91a1a313f0730c600e5178aaf7df98d6.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 'include')
-rw-r--r-- | include/llvm/Transforms/Utils/Local.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/Transforms/Utils/Local.h b/include/llvm/Transforms/Utils/Local.h index 98a68f6..dd423fa 100644 --- a/include/llvm/Transforms/Utils/Local.h +++ b/include/llvm/Transforms/Utils/Local.h @@ -19,6 +19,7 @@ namespace llvm { class User; class BasicBlock; +class BranchInst; class Instruction; class Value; class Pass; @@ -94,6 +95,12 @@ void MergeBasicBlockIntoOnlyPred(BasicBlock *BB); /// bool SimplifyCFG(BasicBlock *BB); +/// FoldBranchToCommonDest - If this basic block is ONLY a setcc and a branch, +/// 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. +bool FoldBranchToCommonDest(BranchInst *BI); + /// DemoteRegToStack - This function takes a virtual register computed by an /// Instruction and replaces it with a slot in the stack frame, allocated via /// alloca. This allows the CFG to be changed around without fear of |