blob: 0eaf7752f89b826ce25b32c90ef2b997fd94d2a2 [file] [log] [blame]
Chandler Carruth7a73eab2016-12-27 17:59:22 +00001; Test that the BasicAA analysis gets invalidated when its dependencies go
2; away.
3;
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
15;
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
27
28; Some code that will result in actual AA queries, including inside of a loop.
29; FIXME: Sadly, none of these queries managed to use either the domtree or
30; loopinfo that basic-aa cache. But nor does any other test in LLVM. It would
31; be good to enhance this to actually use these other analyses to make this
32; a more thorough test.
33define void @foo(i1 %x, i8* %p1, i8* %p2) {
34entry:
35 %p3 = alloca i8
36 store i8 42, i8* %p1
37 %gep2 = getelementptr i8, i8* %p2, i32 0
38 br i1 %x, label %loop, label %exit
39
40loop:
41 store i8 13, i8* %p3
42 %tmp1 = load i8, i8* %gep2
43 br label %loop
44
45exit:
46 ret void
47}