1 ; Test that memdep gets invalidated when the analyses it depends on are
4 ; Check AA. AA is stateless, but given an explicit invalidate (abandon) the
5 ; AAManager is invalidated and we must invalidate memdep as well given
6 ; the transitive dependency.
7 ; RUN: opt -disable-output -debug-pass-manager -aa-pipeline='basic-aa' %s 2>&1 \
8 ; RUN: -passes='require<memdep>,invalidate<aa>,gvn' \
9 ; RUN: | FileCheck %s --check-prefix=CHECK-AA-INVALIDATE
10 ; CHECK-AA-INVALIDATE: Running pass: RequireAnalysisPass
11 ; CHECK-AA-INVALIDATE: Running analysis: MemoryDependenceAnalysis
12 ; CHECK-AA-INVALIDATE: Running pass: InvalidateAnalysisPass
13 ; CHECK-AA-INVALIDATE: Invalidating analysis: AAManager
14 ; CHECK-AA-INVALIDATE: Invalidating analysis: MemoryDependenceAnalysis
15 ; CHECK-AA-INVALIDATE: Running pass: GVNPass
16 ; CHECK-AA-INVALIDATE: Running analysis: MemoryDependenceAnalysis
18 ; Check domtree specifically.
19 ; RUN: opt -disable-output -debug-pass-manager %s 2>&1 \
20 ; RUN: -passes='require<memdep>,invalidate<domtree>,gvn' \
21 ; RUN: | FileCheck %s --check-prefix=CHECK-DT-INVALIDATE
22 ; CHECK-DT-INVALIDATE: Running pass: RequireAnalysisPass
23 ; CHECK-DT-INVALIDATE: Running analysis: MemoryDependenceAnalysis
24 ; CHECK-DT-INVALIDATE: Running pass: InvalidateAnalysisPass
25 ; CHECK-DT-INVALIDATE: Invalidating analysis: DominatorTreeAnalysis
26 ; CHECK-DT-INVALIDATE: Invalidating analysis: MemoryDependenceAnalysis
27 ; CHECK-DT-INVALIDATE: Running pass: GVNPass
28 ; CHECK-DT-INVALIDATE: Running analysis: MemoryDependenceAnalysis
31 define void @test_use_domtree(ptr nocapture %bufUInt, ptr nocapture %pattern) nounwind {
35 for.exit: ; preds = %for.body
38 for.body: ; preds = %for.body, %entry
39 %i.01 = phi i32 [ 0, %entry ], [ %tmp8.7, %for.body ]
40 %arrayidx = getelementptr i32, ptr %bufUInt, i32 %i.01
41 %arrayidx5 = getelementptr i32, ptr %pattern, i32 %i.01
42 %tmp6 = load i32, ptr %arrayidx5, align 4
43 store i32 %tmp6, ptr %arrayidx, align 4
44 %tmp8.7 = add i32 %i.01, 8
45 %cmp.7 = icmp ult i32 %tmp8.7, 1024
46 br i1 %cmp.7, label %for.body, label %for.exit
50 declare void @foo(ptr)
52 define void @test_use_aa(ptr noalias %stuff ) {
54 %before = load i32, ptr %stuff
56 call void @foo(ptr null)
58 %after = load i32, ptr %stuff
59 %sum = add i32 %before, %after
61 store i32 %sum, ptr %stuff