diff options
author | Andrew Trick <atrick@apple.com> | 2011-10-04 03:50:44 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2011-10-04 03:50:44 +0000 |
commit | f143b79b78d1d244809fa59320f2af2edf4e1a86 (patch) | |
tree | d98851fb9036648d18eeb33137346849071a4847 /include/llvm/Transforms/Utils/BasicBlockUtils.h | |
parent | 2aeb8027d649320d5ad3a30d9bbeb71c783b50d4 (diff) | |
download | external_llvm-f143b79b78d1d244809fa59320f2af2edf4e1a86.zip external_llvm-f143b79b78d1d244809fa59320f2af2edf4e1a86.tar.gz external_llvm-f143b79b78d1d244809fa59320f2af2edf4e1a86.tar.bz2 |
LSR should avoid redundant edge splitting.
This handles the case in which LSR rewrites an IV user that is a phi and
splits critical edges originating from a switch.
Fixes <rdar://problem/6453893> LSR is not splitting edges "nicely"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141059 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Transforms/Utils/BasicBlockUtils.h')
-rw-r--r-- | include/llvm/Transforms/Utils/BasicBlockUtils.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/llvm/Transforms/Utils/BasicBlockUtils.h b/include/llvm/Transforms/Utils/BasicBlockUtils.h index 9736451..6fcd160 100644 --- a/include/llvm/Transforms/Utils/BasicBlockUtils.h +++ b/include/llvm/Transforms/Utils/BasicBlockUtils.h @@ -109,7 +109,8 @@ bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum, /// to. /// BasicBlock *SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, - Pass *P = 0, bool MergeIdenticalEdges = false); + Pass *P = 0, bool MergeIdenticalEdges = false, + bool DontDeleteUselessPHIs = false); inline BasicBlock *SplitCriticalEdge(BasicBlock *BB, succ_iterator SI, Pass *P = 0) { @@ -136,13 +137,15 @@ inline bool SplitCriticalEdge(BasicBlock *Succ, pred_iterator PI, Pass *P = 0) { /// described above. inline BasicBlock *SplitCriticalEdge(BasicBlock *Src, BasicBlock *Dst, Pass *P = 0, - bool MergeIdenticalEdges = false) { + bool MergeIdenticalEdges = false, + bool DontDeleteUselessPHIs = 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, MergeIdenticalEdges); + return SplitCriticalEdge(TI, i, P, MergeIdenticalEdges, + DontDeleteUselessPHIs); ++i; } } |