summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopRotation.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-26 02:11:30 +0000
committerChris Lattner <sabre@nondot.org>2009-01-26 02:11:30 +0000
commit7b6647c17893a74dcc9e54cf28ea764292c751b0 (patch)
tree79a216942a35ee9067cdf92efae5412dbf61f8a6 /llvm/lib/Transforms/Scalar/LoopRotation.cpp
parent57cb472b56d75dce518bf6f1730e0dc855c79d25 (diff)
downloadbcm5719-llvm-7b6647c17893a74dcc9e54cf28ea764292c751b0.tar.gz
bcm5719-llvm-7b6647c17893a74dcc9e54cf28ea764292c751b0.zip
Fix PR3408 by making a non-obvious assumption very obvious, and
handling the flaw inherent in that assumption. :) llvm-svn: 62984
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopRotation.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopRotation.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopRotation.cpp b/llvm/lib/Transforms/Scalar/LoopRotation.cpp
index 1118ed55918..aed84e2df87 100644
--- a/llvm/lib/Transforms/Scalar/LoopRotation.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopRotation.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "loop-rotate"
-
#include "llvm/Transforms/Scalar.h"
#include "llvm/Function.h"
#include "llvm/Instructions.h"
@@ -26,7 +25,6 @@
#include "llvm/Support/Debug.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/SmallVector.h"
-
using namespace llvm;
#define MAX_HEADER_SIZE 16
@@ -178,6 +176,12 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) {
assert(NewHeader && "Unable to determine new loop header");
assert(L->contains(NewHeader) && !L->contains(Exit) &&
"Unable to determine loop header and exit blocks");
+
+ // This code assumes that new header has exactly one predecessor. Remove any
+ // single entry PHI nodes in it.
+ assert(NewHeader->getSinglePredecessor() &&
+ "New header doesn't have one pred!");
+ FoldSingleEntryPHINodes(NewHeader);
// Copy PHI nodes and other instructions from original header
// into original pre-header. Unlike original header, original pre-header is
OpenPOWER on IntegriCloud