LoopRotate: Fix use after scope bug

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301702 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Berlin 2017-04-28 22:05:55 +00:00
parent 737d3b6aab
commit 3df4f544fe

View File

@ -670,8 +670,9 @@ PreservedAnalyses LoopRotatePass::run(Loop &L, LoopAnalysisManager &AM,
LPMUpdater &) {
int Threshold = EnableHeaderDuplication ? DefaultRotationThreshold : 0;
const DataLayout &DL = L.getHeader()->getModule()->getDataLayout();
const SimplifyQuery SQ = getBestSimplifyQuery(AR, DL);
LoopRotate LR(Threshold, &AR.LI, &AR.TTI, &AR.AC, &AR.DT, &AR.SE,
getBestSimplifyQuery(AR, DL));
SQ);
bool Changed = LR.processLoop(&L);
if (!Changed)
@ -714,8 +715,8 @@ public:
auto *DT = DTWP ? &DTWP->getDomTree() : nullptr;
auto *SEWP = getAnalysisIfAvailable<ScalarEvolutionWrapperPass>();
auto *SE = SEWP ? &SEWP->getSE() : nullptr;
LoopRotate LR(MaxHeaderSize, LI, TTI, AC, DT, SE,
getBestSimplifyQuery(*this, F));
const SimplifyQuery SQ = getBestSimplifyQuery(*this, F);
LoopRotate LR(MaxHeaderSize, LI, TTI, AC, DT, SE, SQ);
return LR.processLoop(L);
}
};