forked from OSchip/llvm-project
[PM] Avoid getResult on a higher level in LoopAccessAnalysis
Note that require<domtree> and require<loops> aren't needed because they come in implicitly via the loop pass manager. llvm-svn: 274712
This commit is contained in:
parent
ade4eed8a7
commit
284b0324e2
|
@ -2027,15 +2027,23 @@ INITIALIZE_PASS_END(LoopAccessAnalysis, LAA_NAME, laa_name, false, true)
|
|||
char LoopAccessInfoAnalysis::PassID;
|
||||
|
||||
LoopAccessInfo LoopAccessInfoAnalysis::run(Loop &L, AnalysisManager<Loop> &AM) {
|
||||
// FIXME: ugly const cast
|
||||
AnalysisManager<Function> &FAM = const_cast<FunctionAnalysisManager &>(
|
||||
AM.getResult<FunctionAnalysisManagerLoopProxy>(L).getManager());
|
||||
const AnalysisManager<Function> &FAM =
|
||||
AM.getResult<FunctionAnalysisManagerLoopProxy>(L).getManager();
|
||||
Function &F = *L.getHeader()->getParent();
|
||||
auto *SE = &FAM.getResult<ScalarEvolutionAnalysis>(F);
|
||||
auto *SE = FAM.getCachedResult<ScalarEvolutionAnalysis>(F);
|
||||
auto *TLI = FAM.getCachedResult<TargetLibraryAnalysis>(F);
|
||||
auto *AA = &FAM.getResult<AAManager>(F);
|
||||
auto *DT = &FAM.getResult<DominatorTreeAnalysis>(F);
|
||||
auto *LI = &FAM.getResult<LoopAnalysis>(F);
|
||||
auto *AA = FAM.getCachedResult<AAManager>(F);
|
||||
auto *DT = FAM.getCachedResult<DominatorTreeAnalysis>(F);
|
||||
auto *LI = FAM.getCachedResult<LoopAnalysis>(F);
|
||||
if (!SE)
|
||||
report_fatal_error(
|
||||
"ScalarEvolution must have been cached at a higher level");
|
||||
if (!AA)
|
||||
report_fatal_error("AliasAnalysis must have been cached at a higher level");
|
||||
if (!DT)
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; In this loop just because we access A through different types (int, float)
|
||||
; we still have a dependence cycle:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; for (unsigned i = 0; i < 100; i++) {
|
||||
; A[i+8] = B[i] + 2;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; Check that loop-indepedent forward dependences are discovered properly.
|
||||
;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt < %s -store-to-load-forwarding-conflict-detection=false -loop-accesses -analyze | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -store-to-load-forwarding-conflict-detection=false -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -store-to-load-forwarding-conflict-detection=false -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; This test checks that we prove the strided accesses to be independent before
|
||||
; concluding that there is a forward dependence.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; Handle memchecks involving loop-invariant addresses:
|
||||
;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -loop-accesses -analyze -S < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; This is the test case from PR26314.
|
||||
; When we were retrying dependence checking with memchecks only,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -basicaa -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<aa>,loop(print-access-info)' -aa-pipeline='basic-aa' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<aa>,require<scalar-evolution>,require<aa>,loop(print-access-info)' -aa-pipeline='basic-aa' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; For this loop:
|
||||
; for (int i = 0; i < n; i++)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -loop-accesses -analyze %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; Test that the loop accesses are proven safe in this case.
|
||||
; The analyzer uses to be confused by the "diamond" because GetUnderlyingObjects
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
|
||||
target triple = "aarch64--linux-gnueabi"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; We give up analyzing the dependences in this loop due to non-constant
|
||||
; distance between A[i+offset] and A[i] and add memchecks to prove
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; The runtime memory check code and the access grouping
|
||||
; algorithm both assume that the start and end values
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -basicaa -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='require<aa>,loop(print-access-info)' -aa-pipeline='basic-aa' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<aa>,require<scalar-evolution>,require<aa>,loop(print-access-info)' -aa-pipeline='basic-aa' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; If the arrays don't alias this loop is safe with no memchecks:
|
||||
; for (i = 0; i < n; i++)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; Analyze this loop:
|
||||
; for (i = 0; i < n; i++)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt < %s -loop-accesses -analyze | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; Test to confirm LAA will not find store to invariant address.
|
||||
; Inner loop has no store to invariant address.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt < %s -loop-accesses -analyze | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; Test to confirm LAA will find store to invariant address.
|
||||
; Inner loop has a store to invariant address.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -basicaa -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; In:
|
||||
;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -basicaa -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; This loop:
|
||||
;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s
|
||||
; RUN: opt -passes='loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -passes='require<scalar-evolution>,require<aa>,loop(print-access-info)' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; Analyze this loop:
|
||||
; for (i = 0; i < n; i++)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: opt -basicaa -loop-accesses -analyze < %s | FileCheck %s -check-prefix=LAA
|
||||
; RUN: opt -passes='require<aa>,loop(print-access-info)' -aa-pipeline='basic-aa' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=LAA
|
||||
; RUN: opt -passes='require<aa>,require<scalar-evolution>,require<aa>,loop(print-access-info)' -aa-pipeline='basic-aa' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=LAA
|
||||
; RUN: opt -loop-versioning -S < %s | FileCheck %s -check-prefix=LV
|
||||
|
||||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
||||
|
|
Loading…
Reference in New Issue