1; This testcase ensures that CFL AA answers queries soundly when callee tries
2; to return an unknown pointer
3
4; RUN: opt < %s -aa-pipeline=cfl-anders-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
5
6@g = external global i32
7define i32* @return_unknown_callee(i32* %arg1, i32* %arg2) {
8	ret i32* @g
9}
10; CHECK-LABEL: Function: test_return_unknown
11; CHECK-DAG: NoAlias: i32* %a, i32* %b
12; CHECK-DAG: MayAlias: i32* %c, i32* %x
13; CHECK-DAG: NoAlias: i32* %a, i32* %c
14; CHECK-DAG: NoAlias: i32* %b, i32* %c
15define void @test_return_unknown(i32* %x) {
16  %a = alloca i32, align 4
17  %b = alloca i32, align 4
18
19  %c = call i32* @return_unknown_callee(i32* %a, i32* %b)
20  load i32, i32* %a
21  load i32, i32* %b
22  load i32, i32* %c
23  load i32, i32* %x
24
25  ret void
26}
27
28@g2 = external global i32*
29define i32** @return_unknown_callee2() {
30	ret i32** @g2
31}
32; CHECK-LABEL: Function: test_return_unknown2
33; CHECK-DAG: MayAlias: i32** %a, i32* %x
34; CHECK-DAG: MayAlias: i32* %b, i32* %x
35; CHECK-DAG: MayAlias: i32** %a, i32* %b
36define void @test_return_unknown2(i32* %x) {
37  %a = call i32** @return_unknown_callee2()
38  %b = load i32*, i32** %a
39  load i32, i32* %b
40  load i32, i32* %x
41
42  ret void
43}
44