diff options
author | Andrew Trick <atrick@apple.com> | 2012-09-18 17:51:33 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2012-09-18 17:51:33 +0000 |
commit | f08c115e6c4b24b975ce376574f7daf6d5a92462 (patch) | |
tree | 731a8d8468d20e089e779f86ff44f0609077275c /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | 7c8df7aa0c02908a29f0b5e6cfccb531dccdb96b (diff) | |
download | external_llvm-f08c115e6c4b24b975ce376574f7daf6d5a92462.zip external_llvm-f08c115e6c4b24b975ce376574f7daf6d5a92462.tar.gz external_llvm-f08c115e6c4b24b975ce376574f7daf6d5a92462.tar.bz2 |
LSR critical edge splitting fix for PR13756.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164147 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index bcd27b1..1d3d156 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -4464,17 +4464,21 @@ void LSRInstance::RewriteForPHI(PHINode *PN, SplitLandingPadPredecessors(Parent, BB, "", "", P, NewBBs); NewBB = NewBBs[0]; } - - // If PN is outside of the loop and BB is in the loop, we want to - // move the block to be immediately before the PHI block, not - // immediately after BB. - if (L->contains(BB) && !L->contains(PN)) - NewBB->moveBefore(PN->getParent()); - - // Splitting the edge can reduce the number of PHI entries we have. - e = PN->getNumIncomingValues(); - BB = NewBB; - i = PN->getBasicBlockIndex(BB); + // If NewBB==NULL, then SplitCriticalEdge refused to split because all + // phi predecessors are identical. The simple thing to do is skip + // splitting in this case rather than complicate the API. + if (NewBB) { + // If PN is outside of the loop and BB is in the loop, we want to + // move the block to be immediately before the PHI block, not + // immediately after BB. + if (L->contains(BB) && !L->contains(PN)) + NewBB->moveBefore(PN->getParent()); + + // Splitting the edge can reduce the number of PHI entries we have. + e = PN->getNumIncomingValues(); + BB = NewBB; + i = PN->getBasicBlockIndex(BB); + } } } |