aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-08-08 21:39:47 +0000
committerDevang Patel <dpatel@apple.com>2007-08-08 21:39:47 +0000
commit787a713bb2121c141c560a643d88ecfa2060e612 (patch)
tree6958479f33dc3fc8458478677238e52ed807d4ec /lib
parent8cad423d94fd7e30d84742311c454016f36e3ee3 (diff)
downloadexternal_llvm-787a713bb2121c141c560a643d88ecfa2060e612.zip
external_llvm-787a713bb2121c141c560a643d88ecfa2060e612.tar.gz
external_llvm-787a713bb2121c141c560a643d88ecfa2060e612.tar.bz2
Preserve dom info while processing one iteration loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40947 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/LoopIndexSplit.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp
index 1d110e1..7687827 100644
--- a/lib/Transforms/Scalar/LoopIndexSplit.cpp
+++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp
@@ -17,6 +17,7 @@
#include "llvm/Function.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h"
+#include "llvm/Analysis/Dominators.h"
#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Statistic.h"
@@ -43,6 +44,8 @@ namespace {
AU.addPreserved<LoopInfo>();
AU.addRequiredID(LoopSimplifyID);
AU.addPreservedID(LoopSimplifyID);
+ AU.addPreserved<DominatorTree>();
+ AU.addPreserved<DominanceFrontier>();
}
private:
@@ -314,6 +317,20 @@ bool LoopIndexSplit::processOneIterationLoop(SplitInfo &SD, LPPassManager &LPM)
}
LPM.deleteLoopFromQueue(L);
+
+ // Update Dominator Info.
+ // Only CFG change done is to remove Latch to Header edge. This
+ // does not change dominator tree because Latch did not dominate
+ // Header.
+ if (DominanceFrontier *DF = getAnalysisToUpdate<DominanceFrontier>()) {
+ DominanceFrontier::iterator HeaderDF = DF->find(Header);
+ if (HeaderDF != DF->end())
+ DF->removeFromFrontier(HeaderDF, Header);
+
+ DominanceFrontier::iterator LatchDF = DF->find(Latch);
+ if (LatchDF != DF->end())
+ DF->removeFromFrontier(LatchDF, Header);
+ }
return true;
}