1; This testcase ensures that AliasAttrs are propagated not only on the same
2; level but also downward.
3
4; RUN: opt < %s -disable-basicaa -cfl-anders-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
5; RUN: opt < %s -aa-pipeline=cfl-anders-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
6
7; CHECK-LABEL: Function: test_attr_below
8; CHECK: MayAlias: i64* %q, i64*** %p
9; CHECK: NoAlias: i64* %esc, i64*** %p
10; CHECK: NoAlias: i64* %esc, i64* %q
11
12; CHECK: MayAlias: i64* %unknown, i64*** %p
13; CHECK: MayAlias: i64* %q, i64* %unknown
14; CHECK: MayAlias: i64* %esc, i64* %unknown
15; CHECK: MayAlias: i64* %q, i64** %pdrf
16; CHECK: MayAlias: i64* %esc, i64** %pdrf
17; CHECK: MayAlias: i64* %unknown, i64** %pdrf
18; CHECK: MayAlias: i64* %pdrf2, i64* %q
19; CHECK: MayAlias: i64* %esc, i64* %pdrf2
20; CHECK: MayAlias: i64* %pdrf2, i64* %unknown
21define void @test_attr_below(i64*** %p, i64* %q) {
22  %esc = alloca i64, align 8
23  %escint = ptrtoint i64* %esc to i64
24  %unknown = inttoptr i64 %escint to i64*
25
26  %pdrf = load i64**, i64*** %p
27  %pdrf2 = load i64*, i64** %pdrf
28
29  ret void
30}
31
32; CHECK-LABEL: Function: test_attr_assign_below
33; CHECK: MayAlias: i64** %sel, i64*** %p
34; CHECK: MayAlias: i64* %q, i64** %sel
35; CHECK: MayAlias: i64** %a, i64** %sel
36; CHECK: MayAlias: i64** %pdrf, i64** %sel
37
38; CHECK: MayAlias: i64** %c, i64*** %p
39; CHECK: MayAlias: i64* %q, i64** %c
40; CHECK: MayAlias: i64** %a, i64** %c
41; CHECK: MayAlias: i64** %c, i64** %pdrf
42; CHECK: MayAlias: i64** %c, i64** %sel
43
44; CHECK: MayAlias: i64* %d, i64*** %p
45; CHECK: MayAlias: i64* %d, i64* %q
46; CHECK: MayAlias: i64* %d, i64** %pdrf
47; CHECK: MayAlias: i64* %d, i64** %sel
48define void @test_attr_assign_below(i64*** %p, i64* %q, i1 %cond) {
49  %a = alloca i64*, align 8
50  %pdrf = load i64**, i64*** %p
51  %sel = select i1 %cond, i64** %a, i64** %pdrf
52
53  %b = alloca i64**, align 8
54  store i64** %sel, i64*** %b
55
56  %c = load i64**, i64*** %b
57  %d = load i64*, i64** %c
58
59  ret void
60}
61
62