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);
}
; 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:
; 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;
; 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.
;
; 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.
; 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:
;
; 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,
; 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++)
; 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
; 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"
; 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"
; 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
; 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
; 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++)
; 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++)
; 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.
; 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.
; 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"
; 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:
;
; 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:
;
; 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++)
; 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"