[PATCH] D13036: [LoopUnswitch] Require DominatorTree info.
Michael Zolotukhin via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 17:01:22 PDT 2015
mzolotukhin created this revision.
mzolotukhin added reviewers: chandlerc, hfinkel.
mzolotukhin added a subscriber: llvm-commits.
We should either require the DT info to be available, or check if it's
available in every place we use DT (and we already miss such check in
one place, which causes failures in some cases). As other loop passes
preserve DT and it's usually available, it makes sense to just require
it here.
http://reviews.llvm.org/D13036
Files:
lib/Transforms/Scalar/LoopUnswitch.cpp
Index: lib/Transforms/Scalar/LoopUnswitch.cpp
===================================================================
--- lib/Transforms/Scalar/LoopUnswitch.cpp
+++ lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -193,6 +193,7 @@
AU.addPreserved<LoopInfoWrapperPass>();
AU.addRequiredID(LCSSAID);
AU.addPreservedID(LCSSAID);
+ AU.addRequired<DominatorTreeWrapperPass>();
AU.addPreserved<DominatorTreeWrapperPass>();
AU.addPreserved<ScalarEvolutionWrapperPass>();
AU.addRequired<TargetTransformInfoWrapperPass>();
@@ -412,23 +413,19 @@
*L->getHeader()->getParent());
LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
LPM = &LPM_Ref;
- DominatorTreeWrapperPass *DTWP =
- getAnalysisIfAvailable<DominatorTreeWrapperPass>();
- DT = DTWP ? &DTWP->getDomTree() : nullptr;
+ DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
currentLoop = L;
Function *F = currentLoop->getHeader()->getParent();
bool Changed = false;
do {
- assert(!DT || currentLoop->isLCSSAForm(*DT));
+ assert(currentLoop->isLCSSAForm(*DT));
redoLoop = false;
Changed |= processCurrentLoop();
} while(redoLoop);
- if (Changed) {
- // FIXME: Reconstruct dom info, because it is not preserved properly.
- if (DT)
- DT->recalculate(*F);
- }
+ // FIXME: Reconstruct dom info, because it is not preserved properly.
+ if (Changed)
+ DT->recalculate(*F);
return Changed;
}
@@ -1196,8 +1193,7 @@
// domtree here -- instead we force it to do a full recomputation
// after the pass is complete -- but we do need to inform it of
// new blocks.
- if (DT)
- DT->addNewBlock(Abort, NewSISucc);
+ DT->addNewBlock(Abort, NewSISucc);
}
SimplifyCode(Worklist, L);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13036.35322.patch
Type: text/x-patch
Size: 1773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150922/75447900/attachment.bin>
More information about the llvm-commits
mailing list