gn build: Merge r374476
[llvm-complete.git] / test / Analysis / BasicAA / invalidation.ll
blob27e94cb6a2e2c8e2e883f97fbed19fc87f5f09a5
1 ; Test that the BasicAA analysis gets invalidated when its dependencies go
2 ; away.
4 ; Check DomTree specifically.
5 ; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
6 ; RUN:     -passes='require<aa>,invalidate<domtree>,aa-eval' -aa-pipeline='basic-aa' \
7 ; RUN:     | FileCheck %s --check-prefix=CHECK-DT-INVALIDATE
8 ; CHECK-DT-INVALIDATE: Running pass: RequireAnalysisPass
9 ; CHECK-DT-INVALIDATE: Running analysis: BasicAA
10 ; CHECK-DT-INVALIDATE: Running pass: InvalidateAnalysisPass
11 ; CHECK-DT-INVALIDATE: Invalidating analysis: DominatorTreeAnalysis
12 ; CHECK-DT-INVALIDATE: Invalidating analysis: BasicAA
13 ; CHECK-DT-INVALIDATE: Running pass: AAEvaluator
14 ; CHECK-DT-INVALIDATE: Running analysis: BasicAA
16 ; Check LoopInfo specifically.
17 ; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
18 ; RUN:     -passes='require<loops>,require<aa>,invalidate<loops>,aa-eval' -aa-pipeline='basic-aa' \
19 ; RUN:     | FileCheck %s --check-prefix=CHECK-LI-INVALIDATE
20 ; CHECK-LI-INVALIDATE: Running pass: RequireAnalysisPass
21 ; CHECK-LI-INVALIDATE: Running analysis: BasicAA
22 ; CHECK-LI-INVALIDATE: Running pass: InvalidateAnalysisPass
23 ; CHECK-LI-INVALIDATE: Invalidating analysis: LoopAnalysis
24 ; CHECK-LI-INVALIDATE: Invalidating analysis: BasicAA
25 ; CHECK-LI-INVALIDATE: Running pass: AAEvaluator
26 ; CHECK-LI-INVALIDATE: Running analysis: BasicAA
28 ; Check PhiValues specifically.
29 ; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
30 ; RUN:     -passes='require<phi-values>,require<aa>,invalidate<phi-values>,aa-eval' -aa-pipeline='basic-aa' \
31 ; RUN:     | FileCheck %s --check-prefix=CHECK-PV-INVALIDATE
32 ; CHECK-PV-INVALIDATE: Running pass: RequireAnalysisPass
33 ; CHECK-PV-INVALIDATE: Running analysis: BasicAA
34 ; CHECK-PV-INVALIDATE: Running pass: InvalidateAnalysisPass
35 ; CHECK-PV-INVALIDATE: Invalidating analysis: PhiValuesAnalysis
36 ; CHECK-PV-INVALIDATE: Invalidating analysis: BasicAA
37 ; CHECK-PV-INVALIDATE: Running pass: AAEvaluator
38 ; CHECK-PV-INVALIDATE: Running analysis: BasicAA
40 ; Some code that will result in actual AA queries, including inside of a loop.
41 ; FIXME: Sadly, none of these queries managed to use either the domtree or
42 ; loopinfo that basic-aa cache. But nor does any other test in LLVM. It would
43 ; be good to enhance this to actually use these other analyses to make this
44 ; a more thorough test.
45 define void @foo(i1 %x, i8* %p1, i8* %p2) {
46 entry:
47   %p3 = alloca i8
48   store i8 42, i8* %p1
49   %gep2 = getelementptr i8, i8* %p2, i32 0
50   br i1 %x, label %loop, label %exit
52 loop:
53   store i8 13, i8* %p3
54   %tmp1 = load i8, i8* %gep2
55   br label %loop
57 exit:
58   ret void