summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2015-05-12 20:56:33 +0000
committerPhilip Reames <listmail@philipreames.com>2015-05-12 20:56:33 +0000
commit57bdac96d9abbf08e8a7d181070daf9350fad077 (patch)
tree7180642cf9156f39771ac4dbed3b6eb337c85da2 /llvm/lib
parentb465563b46ac9ebbbe3c6993a010a17b79d460be (diff)
downloadbcm5719-llvm-57bdac96d9abbf08e8a7d181070daf9350fad077.tar.gz
bcm5719-llvm-57bdac96d9abbf08e8a7d181070daf9350fad077.zip
[PlaceSafepoints] Use analysis infrastructure to get dominator tree
The old code computed dominators for every loop. This was terribly slow with no good reason. Just use the standard infrastructure for analysis passes. Differential Revision: http://reviews.llvm.org/D9586 llvm-svn: 237176
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp b/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp
index 9822a3ef82b..4cb3bed49c5 100644
--- a/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp
+++ b/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp
@@ -130,6 +130,7 @@ struct PlaceBackedgeSafepointsImpl : public LoopPass {
bool runOnLoop(Loop *, LPPassManager &LPM) override;
void getAnalysisUsage(AnalysisUsage &AU) const override {
+ AU.addRequired<DominatorTreeWrapperPass>();
AU.addRequired<ScalarEvolution>();
// We no longer modify the IR at all in this pass. Thus all
// analysis are preserved.
@@ -312,6 +313,7 @@ static void scanInlinedCode(Instruction *start, Instruction *end,
bool PlaceBackedgeSafepointsImpl::runOnLoop(Loop *L, LPPassManager &LPM) {
ScalarEvolution *SE = &getAnalysis<ScalarEvolution>();
+ DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
// Loop through all loop latches (branches controlling backedges). We need
// to place a safepoint on every backedge (potentially).
@@ -320,11 +322,6 @@ bool PlaceBackedgeSafepointsImpl::runOnLoop(Loop *L, LPPassManager &LPM) {
// w.r.t. loops with multiple backedges.
BasicBlock *header = L->getHeader();
- // TODO: Use the analysis pass infrastructure for this. There is no reason
- // to recalculate this here.
- DominatorTree DT;
- DT.recalculate(*header->getParent());
-
SmallVector<BasicBlock*, 16> LoopLatches;
L->getLoopLatches(LoopLatches);
for (BasicBlock *pred : LoopLatches) {
@@ -341,7 +338,7 @@ bool PlaceBackedgeSafepointsImpl::runOnLoop(Loop *L, LPPassManager &LPM) {
continue;
}
if (CallSafepointsEnabled &&
- containsUnconditionalCallSafepoint(L, header, pred, DT)) {
+ containsUnconditionalCallSafepoint(L, header, pred, *DT)) {
// Note: This is only semantically legal since we won't do any further
// IPO or inlining before the actual call insertion.. If we hadn't, we
// might latter loose this call safepoint.
@@ -746,6 +743,7 @@ INITIALIZE_PASS_BEGIN(PlaceBackedgeSafepointsImpl,
"place-backedge-safepoints-impl",
"Place Backedge Safepoints", false, false)
INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
+INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_END(PlaceBackedgeSafepointsImpl,
"place-backedge-safepoints-impl",
"Place Backedge Safepoints", false, false)
OpenPOWER on IntegriCloud