forked from OSchip/llvm-project
[LAA] Don't hold on to DataLayout in the analysis result
In fact, don't even pass this to the ctor since we can get it from the module. llvm-svn: 275326
This commit is contained in:
parent
6616ad08f6
commit
1824e411c6
|
@ -511,9 +511,8 @@ private:
|
|||
/// PSE must be emitted in order for the results of this analysis to be valid.
|
||||
class LoopAccessInfo {
|
||||
public:
|
||||
LoopAccessInfo(Loop *L, ScalarEvolution *SE, const DataLayout &DL,
|
||||
const TargetLibraryInfo *TLI, AliasAnalysis *AA,
|
||||
DominatorTree *DT, LoopInfo *LI);
|
||||
LoopAccessInfo(Loop *L, ScalarEvolution *SE, const TargetLibraryInfo *TLI,
|
||||
AliasAnalysis *AA, DominatorTree *DT, LoopInfo *LI);
|
||||
|
||||
// FIXME:
|
||||
// Hack for MSVC 2013 which sems like it can't synthesize this even
|
||||
|
@ -521,7 +520,7 @@ public:
|
|||
// LoopAccessInfo(LoopAccessInfo &&LAI) = default;
|
||||
LoopAccessInfo(LoopAccessInfo &&LAI)
|
||||
: PSE(std::move(LAI.PSE)), PtrRtChecking(std::move(LAI.PtrRtChecking)),
|
||||
DepChecker(std::move(LAI.DepChecker)), TheLoop(LAI.TheLoop), DL(LAI.DL),
|
||||
DepChecker(std::move(LAI.DepChecker)), TheLoop(LAI.TheLoop),
|
||||
TLI(LAI.TLI), DT(LAI.DT), NumLoads(LAI.NumLoads),
|
||||
NumStores(LAI.NumStores), MaxSafeDepDistBytes(LAI.MaxSafeDepDistBytes),
|
||||
CanVecMem(LAI.CanVecMem),
|
||||
|
@ -537,7 +536,6 @@ public:
|
|||
PtrRtChecking = std::move(LAI.PtrRtChecking);
|
||||
DepChecker = std::move(LAI.DepChecker);
|
||||
TheLoop = LAI.TheLoop;
|
||||
DL = LAI.DL;
|
||||
TLI = LAI.TLI;
|
||||
DT = LAI.DT;
|
||||
NumLoads = LAI.NumLoads;
|
||||
|
@ -661,7 +659,6 @@ private:
|
|||
std::unique_ptr<MemoryDepChecker> DepChecker;
|
||||
|
||||
Loop *TheLoop;
|
||||
const DataLayout *DL;
|
||||
const TargetLibraryInfo *TLI;
|
||||
DominatorTree *DT;
|
||||
|
||||
|
|
|
@ -1830,8 +1830,9 @@ std::pair<Instruction *, Instruction *> LoopAccessInfo::addRuntimeChecks(
|
|||
Instruction *Loc,
|
||||
const SmallVectorImpl<RuntimePointerChecking::PointerCheck> &PointerChecks)
|
||||
const {
|
||||
const DataLayout &DL = TheLoop->getHeader()->getModule()->getDataLayout();
|
||||
auto *SE = PSE->getSE();
|
||||
SCEVExpander Exp(*SE, *DL, "induction");
|
||||
SCEVExpander Exp(*SE, DL, "induction");
|
||||
auto ExpandedChecks =
|
||||
expandBounds(PointerChecks, TheLoop, Loc, SE, Exp, *PtrRtChecking);
|
||||
|
||||
|
@ -1915,15 +1916,13 @@ void LoopAccessInfo::collectStridedAccess(Value *MemAccess) {
|
|||
}
|
||||
|
||||
LoopAccessInfo::LoopAccessInfo(Loop *L, ScalarEvolution *SE,
|
||||
const DataLayout &DL,
|
||||
const TargetLibraryInfo *TLI, AliasAnalysis *AA,
|
||||
DominatorTree *DT, LoopInfo *LI)
|
||||
: PSE(llvm::make_unique<PredicatedScalarEvolution>(*SE, *L)),
|
||||
PtrRtChecking(llvm::make_unique<RuntimePointerChecking>(SE)),
|
||||
DepChecker(llvm::make_unique<MemoryDepChecker>(*PSE, L)), TheLoop(L),
|
||||
DL(&DL), TLI(TLI), DT(DT), NumLoads(0), NumStores(0),
|
||||
MaxSafeDepDistBytes(-1), CanVecMem(false),
|
||||
StoreToLoopInvariantAddress(false) {
|
||||
TLI(TLI), DT(DT), NumLoads(0), NumStores(0), MaxSafeDepDistBytes(-1),
|
||||
CanVecMem(false), StoreToLoopInvariantAddress(false) {
|
||||
if (canAnalyzeLoop())
|
||||
analyzeLoop(AA, LI);
|
||||
}
|
||||
|
@ -1971,10 +1970,9 @@ void LoopAccessInfo::print(raw_ostream &OS, unsigned Depth) const {
|
|||
const LoopAccessInfo &LoopAccessLegacyAnalysis::getInfo(Loop *L) {
|
||||
auto &LAI = LoopAccessInfoMap[L];
|
||||
|
||||
if (!LAI) {
|
||||
const DataLayout &DL = L->getHeader()->getModule()->getDataLayout();
|
||||
LAI = llvm::make_unique<LoopAccessInfo>(L, SE, DL, TLI, AA, DT, LI);
|
||||
}
|
||||
if (!LAI)
|
||||
LAI = llvm::make_unique<LoopAccessInfo>(L, SE, TLI, AA, DT, LI);
|
||||
|
||||
return *LAI.get();
|
||||
}
|
||||
|
||||
|
@ -2040,8 +2038,7 @@ LoopAccessInfo LoopAccessAnalysis::run(Loop &L, AnalysisManager<Loop> &AM) {
|
|||
report_fatal_error("DominatorTree must have been cached at a higher level");
|
||||
if (!LI)
|
||||
report_fatal_error("LoopInfo must have been cached at a higher level");
|
||||
const DataLayout &DL = F.getParent()->getDataLayout();
|
||||
return LoopAccessInfo(&L, SE, DL, TLI, AA, DT, LI);
|
||||
return LoopAccessInfo(&L, SE, TLI, AA, DT, LI);
|
||||
}
|
||||
|
||||
PreservedAnalyses LoopAccessInfoPrinterPass::run(Loop &L,
|
||||
|
|
Loading…
Reference in New Issue