[llvm-commits] CVS: llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
Chris Lattner
sabre at nondot.org
Fri Oct 27 23:45:11 PDT 2006
Changes in directory llvm/include/llvm/Transforms/Utils:
BasicBlockUtils.h updated: 1.13 -> 1.14
---
Log message:
Expose a smarter way to break critical edges.
---
Diffs of the changes: (+11 -4)
BasicBlockUtils.h | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
Index: llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
diff -u llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.13 llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.14
--- llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.13 Sat May 13 21:01:22 2006
+++ llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h Sat Oct 28 01:44:56 2006
@@ -63,9 +63,15 @@
/// split the critical edge. This will update DominatorSet, ImmediateDominator,
/// DominatorTree, and DominatorFrontier information if it is available, thus
/// calling this pass will not invalidate either of them. This returns true if
-/// the edge was split, false otherwise.
+/// the edge was split, false otherwise. If MergeIdenticalEdges is true (the
+/// default), *all* edges from TI to the specified successor will be merged into
+/// the same critical edge block. This is most commonly interesting with switch
+/// instructions, which may have many edges to any one destination. This
+/// ensures that all edges to that dest go to one block instead of each going to
+/// a different block, but isn't the standard definition of a "critical edge".
///
-bool SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P = 0);
+bool SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P = 0,
+ bool MergeIdenticalEdges = false);
inline bool SplitCriticalEdge(BasicBlock *BB, succ_iterator SI, Pass *P = 0) {
return SplitCriticalEdge(BB->getTerminator(), SI.getSuccessorIndex(), P);
@@ -89,13 +95,14 @@
/// and return true, otherwise return false. This method requires that there be
/// an edge between the two blocks. If P is specified, it updates the analyses
/// described above.
-inline bool SplitCriticalEdge(BasicBlock *Src, BasicBlock *Dst, Pass *P = 0) {
+inline bool SplitCriticalEdge(BasicBlock *Src, BasicBlock *Dst, Pass *P = 0,
+ bool MergeIdenticalEdges = false) {
TerminatorInst *TI = Src->getTerminator();
unsigned i = 0;
while (1) {
assert(i != TI->getNumSuccessors() && "Edge doesn't exist!");
if (TI->getSuccessor(i) == Dst)
- return SplitCriticalEdge(TI, i, P);
+ return SplitCriticalEdge(TI, i, P, MergeIdenticalEdges);
++i;
}
}
More information about the llvm-commits
mailing list