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