aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/UnrollLoop.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-03 19:44:02 +0000
committerChris Lattner <sabre@nondot.org>2008-12-03 19:44:02 +0000
commit29874e0dc6c4e55bc384611273343bb358982cc3 (patch)
treeff01073ac8df137035c562888c7cd0f61b60d29f /lib/Transforms/Utils/UnrollLoop.cpp
parente96cc775e496260b7a42dbd6148dffb0575d1304 (diff)
Factor some code into a new FoldSingleEntryPHINodes method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60501 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/UnrollLoop.cpp')
-rw-r--r--lib/Transforms/Utils/UnrollLoop.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/Transforms/Utils/UnrollLoop.cpp b/lib/Transforms/Utils/UnrollLoop.cpp
index 63493dc66a..caef7ec5c4 100644
--- a/lib/Transforms/Utils/UnrollLoop.cpp
+++ b/lib/Transforms/Utils/UnrollLoop.cpp
@@ -25,13 +25,14 @@
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/Local.h"
#include <cstdio>
using namespace llvm;
-/* TODO: Should these be here or in LoopUnroll? */
+// TODO: Should these be here or in LoopUnroll?
STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled");
STATISTIC(NumUnrolled, "Number of loops unrolled (completely or otherwise)");
@@ -68,11 +69,7 @@ static BasicBlock *FoldBlockIntoPredecessor(BasicBlock *BB, LoopInfo* LI) {
// multiple duplicate (but guaranteed to be equal) entries for the
// incoming edges. This occurs when there are multiple edges from
// OnlyPred to OnlySucc.
- //
- while (PHINode *PN = dyn_cast<PHINode>(&BB->front())) {
- PN->replaceAllUsesWith(PN->getIncomingValue(0));
- BB->getInstList().pop_front(); // Delete the phi node...
- }
+ FoldSingleEntryPHINodes(BB);
// Delete the unconditional branch from the predecessor...
OnlyPred->getInstList().pop_back();