summaryrefslogtreecommitdiff
path: root/include/llvm/Transforms/Utils/BasicBlockUtils.h
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2011-01-29 04:46:23 +0000
committerEvan Cheng <evan.cheng@apple.com>2011-01-29 04:46:23 +0000
commitc3f507f98a0747bd256e1c13536060b6fc5c4b62 (patch)
tree21d6d7ccd66a19999f470068386986b338c7cbef /include/llvm/Transforms/Utils/BasicBlockUtils.h
parentb0a42fdb36b575a8ad939ca9624105908aeedf51 (diff)
downloadllvm-c3f507f98a0747bd256e1c13536060b6fc5c4b62.tar.gz
llvm-c3f507f98a0747bd256e1c13536060b6fc5c4b62.tar.bz2
llvm-c3f507f98a0747bd256e1c13536060b6fc5c4b62.tar.xz
Re-apply r124518 with fix. Watch out for invalidated iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124526 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Transforms/Utils/BasicBlockUtils.h')
-rw-r--r--include/llvm/Transforms/Utils/BasicBlockUtils.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/include/llvm/Transforms/Utils/BasicBlockUtils.h b/include/llvm/Transforms/Utils/BasicBlockUtils.h
index 6de8b85070..5335860287 100644
--- a/include/llvm/Transforms/Utils/BasicBlockUtils.h
+++ b/include/llvm/Transforms/Utils/BasicBlockUtils.h
@@ -22,9 +22,10 @@
namespace llvm {
+class AliasAnalysis;
class Instruction;
class Pass;
-class AliasAnalysis;
+class ReturnInst;
/// DeleteDeadBlock - Delete the specified block, which must have no
/// predecessors.
@@ -171,7 +172,15 @@ BasicBlock *SplitBlock(BasicBlock *Old, Instruction *SplitPt, Pass *P);
BasicBlock *SplitBlockPredecessors(BasicBlock *BB, BasicBlock *const *Preds,
unsigned NumPreds, const char *Suffix,
Pass *P = 0);
-
+
+/// FoldReturnIntoUncondBranch - This method duplicates the specified return
+/// instruction into a predecessor which ends in an unconditional branch. If
+/// the return instruction returns a value defined by a PHI, propagate the
+/// right value into the return. It returns the new return instruction in the
+/// predecessor.
+ReturnInst *FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
+ BasicBlock *Pred);
+
} // End llvm namespace
#endif