aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/LoopExtractor.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-03-18 03:48:06 +0000
committerChris Lattner <sabre@nondot.org>2004-03-18 03:48:06 +0000
commit369287bab599c2c515eab4ffd8a7f3bab227d346 (patch)
tree38fea3a6e11e39fac5e8d09920d735c67f731f05 /lib/Transforms/IPO/LoopExtractor.cpp
parent268316ee1439a6a531f666944705b8cc3d1e761b (diff)
The code extractor needs dominator info. Provide it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12483 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/LoopExtractor.cpp')
-rw-r--r--lib/Transforms/IPO/LoopExtractor.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/LoopExtractor.cpp b/lib/Transforms/IPO/LoopExtractor.cpp
index 4161e41930..5b6aaa9005 100644
--- a/lib/Transforms/IPO/LoopExtractor.cpp
+++ b/lib/Transforms/IPO/LoopExtractor.cpp
@@ -18,6 +18,7 @@
#include "llvm/iTerminators.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
+#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/FunctionUtils.h"
@@ -35,6 +36,7 @@ namespace {
virtual bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.addRequired<DominatorSet>();
AU.addRequired<LoopInfo>();
AU.addRequiredID(LoopSimplifyID);
}
@@ -59,6 +61,8 @@ bool LoopExtractor::runOnFunction(Function &F) {
if (LI.begin() == LI.end())
return false;
+ DominatorSet &DS = getAnalysis<DominatorSet>();
+
// If there is more than one top-level loop in this function, extract all of
// the loops.
bool Changed = false;
@@ -66,7 +70,7 @@ bool LoopExtractor::runOnFunction(Function &F) {
for (LoopInfo::iterator i = LI.begin(), e = LI.end(); i != e; ++i) {
if (NumLoops == 0) return Changed;
--NumLoops;
- Changed |= (ExtractLoop(*i) != 0);
+ Changed |= ExtractLoop(DS, *i) != 0;
}
} else {
// Otherwise there is exactly one top-level loop. If this function is more
@@ -93,7 +97,7 @@ bool LoopExtractor::runOnFunction(Function &F) {
if (ShouldExtractLoop) {
if (NumLoops == 0) return Changed;
--NumLoops;
- Changed |= (ExtractLoop(TLL) != 0);
+ Changed |= ExtractLoop(DS, TLL) != 0;
} else {
// Okay, this function is a minimal container around the specified loop.
// If we extract the loop, we will continue to just keep extracting it
@@ -102,7 +106,7 @@ bool LoopExtractor::runOnFunction(Function &F) {
for (Loop::iterator i = TLL->begin(), e = TLL->end(); i != e; ++i) {
if (NumLoops == 0) return Changed;
--NumLoops;
- Changed |= (ExtractLoop(*i) != 0);
+ Changed |= ExtractLoop(DS, *i) != 0;
}
}
}