1; This testcase ensures that CFL AA answers queries soundly when callee tries
2; to return one of its parameters
3
4; RUN: opt < %s -disable-basic-aa -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
7define i32* @return_arg_callee(i32* %arg1, i32* %arg2) {
8  ret i32* %arg1
9}
10; CHECK-LABEL: Function: test_return_arg
11; CHECK: NoAlias: i32* %a, i32* %b
12; CHECK: MayAlias: i32* %a, i32* %c
13; CHECK: NoAlias: i32* %b, i32* %c
14
15; Temporarily disable modref checks
16; NoModRef: Ptr: i32* %a <-> %c = call i32* @return_arg_callee(i32* %a, i32* %b)
17; NoModRef: Ptr: i32* %b <-> %c = call i32* @return_arg_callee(i32* %a, i32* %b)
18; NoModRef: Ptr: i32* %c <-> %c = call i32* @return_arg_callee(i32* %a, i32* %b)
19define void @test_return_arg() {
20  %a = alloca i32, align 4
21  %b = alloca i32, align 4
22
23  %c = call i32* @return_arg_callee(i32* %a, i32* %b)
24
25  ret void
26}