/// 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
// 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),
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;
std::unique_ptr<MemoryDepChecker> DepChecker;
Loop *TheLoop;
- const DataLayout *DL;
const TargetLibraryInfo *TLI;
DominatorTree *DT;
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);
}
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);
}
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();
}
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,