From f143b79b78d1d244809fa59320f2af2edf4e1a86 Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Tue, 4 Oct 2011 03:50:44 +0000 Subject: 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 LSR is not splitting edges "nicely" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141059 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/Transforms/Scalar') diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 7b1a340156..4b6c55e162 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -3677,7 +3677,9 @@ void LSRInstance::RewriteForPHI(PHINode *PN, // Split the critical edge. BasicBlock *NewBB = 0; if (!Parent->isLandingPad()) { - NewBB = SplitCriticalEdge(BB, Parent, P); + NewBB = SplitCriticalEdge(BB, Parent, P, + /*MergeIdenticalEdges=*/true, + /*DontDeleteUselessPhis=*/true); } else { SmallVector NewBBs; SplitLandingPadPredecessors(Parent, BB, "", "", P, NewBBs); -- cgit v1.2.3