[llvm] r368502 - [MemDep] allow to select block-scan-limit when constructing MemoryDependenceAnalysis
Fedor Sergeev via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 9 18:23:38 PDT 2019
Author: fedor.sergeev
Date: Fri Aug 9 18:23:38 2019
New Revision: 368502
URL: http://llvm.org/viewvc/llvm-project?rev=368502&view=rev
Log:
[MemDep] allow to select block-scan-limit when constructing MemoryDependenceAnalysis
Introducing non-global control for default block-scan-limit in MemDep analysis.
Useful when there are many compilations per initialized LLVM instance (e.g. JIT).
Reviewed By: asbirlea
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65806
Modified:
llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h
llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
Modified: llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h?rev=368502&r1=368501&r2=368502&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h Fri Aug 9 18:23:38 2019
@@ -362,11 +362,14 @@ private:
PhiValues &PV;
PredIteratorCache PredCache;
+ unsigned DefaultBlockScanLimit;
+
public:
MemoryDependenceResults(AliasAnalysis &AA, AssumptionCache &AC,
- const TargetLibraryInfo &TLI,
- DominatorTree &DT, PhiValues &PV)
- : AA(AA), AC(AC), TLI(TLI), DT(DT), PV(PV) {}
+ const TargetLibraryInfo &TLI, DominatorTree &DT,
+ PhiValues &PV, unsigned DefaultBlockScanLimit)
+ : AA(AA), AC(AC), TLI(TLI), DT(DT), PV(PV),
+ DefaultBlockScanLimit(DefaultBlockScanLimit) {}
/// Handle invalidation in the new PM.
bool invalidate(Function &F, const PreservedAnalyses &PA,
@@ -511,9 +514,14 @@ class MemoryDependenceAnalysis
static AnalysisKey Key;
+ unsigned DefaultBlockScanLimit;
+
public:
using Result = MemoryDependenceResults;
+ MemoryDependenceAnalysis();
+ MemoryDependenceAnalysis(unsigned DefaultBlockScanLimit) : DefaultBlockScanLimit(DefaultBlockScanLimit) { }
+
MemoryDependenceResults run(Function &F, FunctionAnalysisManager &AM);
};
Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=368502&r1=368501&r2=368502&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Fri Aug 9 18:23:38 2019
@@ -183,7 +183,7 @@ static ModRefInfo GetLocation(const Inst
MemDepResult MemoryDependenceResults::getCallDependencyFrom(
CallBase *Call, bool isReadOnlyCall, BasicBlock::iterator ScanIt,
BasicBlock *BB) {
- unsigned Limit = BlockScanLimit;
+ unsigned Limit = getDefaultBlockScanLimit();
// Walk backwards through the block, looking for dependencies.
while (ScanIt != BB->begin()) {
@@ -443,7 +443,7 @@ MemDepResult MemoryDependenceResults::ge
OrderedBasicBlock *OBB) {
bool isInvariantLoad = false;
- unsigned DefaultLimit = BlockScanLimit;
+ unsigned DefaultLimit = getDefaultBlockScanLimit();
if (!Limit)
Limit = &DefaultLimit;
@@ -1746,6 +1746,9 @@ void MemoryDependenceResults::verifyRemo
AnalysisKey MemoryDependenceAnalysis::Key;
+MemoryDependenceAnalysis::MemoryDependenceAnalysis()
+ : DefaultBlockScanLimit(BlockScanLimit) {}
+
MemoryDependenceResults
MemoryDependenceAnalysis::run(Function &F, FunctionAnalysisManager &AM) {
auto &AA = AM.getResult<AAManager>(F);
@@ -1753,7 +1756,7 @@ MemoryDependenceAnalysis::run(Function &
auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
auto &PV = AM.getResult<PhiValuesAnalysis>(F);
- return MemoryDependenceResults(AA, AC, TLI, DT, PV);
+ return MemoryDependenceResults(AA, AC, TLI, DT, PV, DefaultBlockScanLimit);
}
char MemoryDependenceWrapperPass::ID = 0;
@@ -1807,7 +1810,7 @@ bool MemoryDependenceResults::invalidate
}
unsigned MemoryDependenceResults::getDefaultBlockScanLimit() const {
- return BlockScanLimit;
+ return DefaultBlockScanLimit;
}
bool MemoryDependenceWrapperPass::runOnFunction(Function &F) {
@@ -1816,6 +1819,6 @@ bool MemoryDependenceWrapperPass::runOnF
auto &TLI = getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
auto &PV = getAnalysis<PhiValuesWrapperPass>().getResult();
- MemDep.emplace(AA, AC, TLI, DT, PV);
+ MemDep.emplace(AA, AC, TLI, DT, PV, BlockScanLimit);
return false;
}
More information about the llvm-commits
mailing list