diff options
author | lattner <lattner@91177308-0d34-0410-b5e6-96231b3b80d8> | 2009-01-26 02:11:30 +0000 |
---|---|---|
committer | lattner <lattner@91177308-0d34-0410-b5e6-96231b3b80d8> | 2009-01-26 02:11:30 +0000 |
commit | cb011ab0c97c7a9da8ceda38b6caea5003d427b8 (patch) | |
tree | eeee4a2c7c842f6aef7e40bf58c3a016d5819240 /lib/Transforms/Scalar/LoopRotation.cpp | |
parent | 8a9258420c714f52f5a48d4e87a42bb04ee453ff (diff) | |
download | external_llvm-cb011ab0c97c7a9da8ceda38b6caea5003d427b8.tar.gz external_llvm-cb011ab0c97c7a9da8ceda38b6caea5003d427b8.tar.bz2 external_llvm-cb011ab0c97c7a9da8ceda38b6caea5003d427b8.zip |
Fix PR3408 by making a non-obvious assumption very obvious, and
handling the flaw inherent in that assumption. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62984 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopRotation.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopRotation.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp index 1118ed5591..aed84e2df8 100644 --- a/lib/Transforms/Scalar/LoopRotation.cpp +++ b/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 |