[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:
Sean Silva 2016-07-07 01:01:53 +00:00
parent ade4eed8a7
commit 284b0324e2
22 changed files with 36 additions and 28 deletions

View File

@ -2027,15 +2027,23 @@ INITIALIZE_PASS_END(LoopAccessAnalysis, LAA_NAME, laa_name, false, true)
char LoopAccessInfoAnalysis::PassID; char LoopAccessInfoAnalysis::PassID;
LoopAccessInfo LoopAccessInfoAnalysis::run(Loop &L, AnalysisManager<Loop> &AM) { LoopAccessInfo LoopAccessInfoAnalysis::run(Loop &L, AnalysisManager<Loop> &AM) {
// FIXME: ugly const cast const AnalysisManager<Function> &FAM =
AnalysisManager<Function> &FAM = const_cast<FunctionAnalysisManager &>( AM.getResult<FunctionAnalysisManagerLoopProxy>(L).getManager();
AM.getResult<FunctionAnalysisManagerLoopProxy>(L).getManager());
Function &F = *L.getHeader()->getParent(); Function &F = *L.getHeader()->getParent();
auto *SE = &FAM.getResult<ScalarEvolutionAnalysis>(F); auto *SE = FAM.getCachedResult<ScalarEvolutionAnalysis>(F);
auto *TLI = FAM.getCachedResult<TargetLibraryAnalysis>(F); auto *TLI = FAM.getCachedResult<TargetLibraryAnalysis>(F);
auto *AA = &FAM.getResult<AAManager>(F); auto *AA = FAM.getCachedResult<AAManager>(F);
auto *DT = &FAM.getResult<DominatorTreeAnalysis>(F); auto *DT = FAM.getCachedResult<DominatorTreeAnalysis>(F);
auto *LI = &FAM.getResult<LoopAnalysis>(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(); const DataLayout &DL = F.getParent()->getDataLayout();
return LoopAccessInfo(&L, SE, DL, TLI, AA, DT, LI); return LoopAccessInfo(&L, SE, DL, TLI, AA, DT, LI);
} }

View File

@ -1,5 +1,5 @@
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s ; 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) ; In this loop just because we access A through different types (int, float)
; we still have a dependence cycle: ; we still have a dependence cycle:

View File

@ -1,5 +1,5 @@
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s ; 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++) { ; for (unsigned i = 0; i < 100; i++) {
; A[i+8] = B[i] + 2; ; A[i+8] = B[i] + 2;

View File

@ -1,5 +1,5 @@
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s ; 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. ; Check that loop-indepedent forward dependences are discovered properly.
; ;

View File

@ -1,5 +1,5 @@
; RUN: opt < %s -store-to-load-forwarding-conflict-detection=false -loop-accesses -analyze | FileCheck %s ; 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 ; This test checks that we prove the strided accesses to be independent before
; concluding that there is a forward dependence. ; concluding that there is a forward dependence.

View File

@ -1,5 +1,5 @@
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s ; 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: ; Handle memchecks involving loop-invariant addresses:
; ;

View File

@ -1,5 +1,5 @@
; RUN: opt -loop-accesses -analyze -S < %s | FileCheck %s ; 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. ; This is the test case from PR26314.
; When we were retrying dependence checking with memchecks only, ; When we were retrying dependence checking with memchecks only,

View File

@ -1,5 +1,5 @@
; RUN: opt -basicaa -loop-accesses -analyze < %s | FileCheck %s ; 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 this loop:
; for (int i = 0; i < n; i++) ; for (int i = 0; i < n; i++)

View File

@ -1,5 +1,5 @@
; RUN: opt -loop-accesses -analyze %s | FileCheck %s ; 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. ; Test that the loop accesses are proven safe in this case.
; The analyzer uses to be confused by the "diamond" because GetUnderlyingObjects ; The analyzer uses to be confused by the "diamond" because GetUnderlyingObjects

View File

@ -1,5 +1,5 @@
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s ; 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 datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--linux-gnueabi" target triple = "aarch64--linux-gnueabi"

View File

@ -1,5 +1,5 @@
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s ; 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" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

View File

@ -1,5 +1,5 @@
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s ; 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 ; 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 ; distance between A[i+offset] and A[i] and add memchecks to prove

View File

@ -1,5 +1,5 @@
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s ; 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 ; The runtime memory check code and the access grouping
; algorithm both assume that the start and end values ; algorithm both assume that the start and end values

View File

@ -1,5 +1,5 @@
; RUN: opt -basicaa -loop-accesses -analyze < %s | FileCheck %s ; 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: ; If the arrays don't alias this loop is safe with no memchecks:
; for (i = 0; i < n; i++) ; for (i = 0; i < n; i++)

View File

@ -1,5 +1,5 @@
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s ; 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: ; Analyze this loop:
; for (i = 0; i < n; i++) ; for (i = 0; i < n; i++)

View File

@ -1,5 +1,5 @@
; RUN: opt < %s -loop-accesses -analyze | FileCheck %s ; 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. ; Test to confirm LAA will not find store to invariant address.
; Inner loop has no store to invariant address. ; Inner loop has no store to invariant address.

View File

@ -1,5 +1,5 @@
; RUN: opt < %s -loop-accesses -analyze | FileCheck %s ; 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. ; Test to confirm LAA will find store to invariant address.
; Inner loop has a store to invariant address. ; Inner loop has a store to invariant address.

View File

@ -1,5 +1,5 @@
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s ; 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 datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"

View File

@ -1,5 +1,5 @@
; RUN: opt -basicaa -loop-accesses -analyze < %s | FileCheck %s ; 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: ; In:
; ;

View File

@ -1,5 +1,5 @@
; RUN: opt -basicaa -loop-accesses -analyze < %s | FileCheck %s ; 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: ; This loop:
; ;

View File

@ -1,5 +1,5 @@
; RUN: opt -loop-accesses -analyze < %s | FileCheck %s ; 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: ; Analyze this loop:
; for (i = 0; i < n; i++) ; for (i = 0; i < n; i++)

View File

@ -1,5 +1,5 @@
; RUN: opt -basicaa -loop-accesses -analyze < %s | FileCheck %s -check-prefix=LAA ; 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 ; 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" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"