1 ; This testcase ensures that CFL AA answers queries soundly when callee tries
2 ; to return the reference of one of its parameters
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
7 declare noalias i8* @malloc(i64)
9 define i32** @return_ref_arg_callee(i32* %arg1) {
10 %ptr = call noalias i8* @malloc(i64 8)
11 %ptr_cast = bitcast i8* %ptr to i32**
12 store i32* %arg1, i32** %ptr_cast
15 ; CHECK-LABEL: Function: test_return_ref_arg
16 ; CHECK: NoAlias: i32** %b, i32** %p
17 ; CHECK: MayAlias: i32* %a, i32* %lb
18 ; CHECK: NoAlias: i32* %lb, i32** %p
19 ; CHECK: NoAlias: i32* %lb, i32** %b
20 ; CHECK: NoAlias: i32* %lp, i32** %p
21 ; CHECK: NoAlias: i32* %lp, i32** %b
22 ; CHECK: MayAlias: i32* %lb, i32* %lp
24 ; Temporarily disable modref checks
25 ; Just Mod: Ptr: i32** %b <-> %b = call i32** @return_ref_arg_callee(i32* %a)
26 define void @test_return_ref_arg() {
27 %a = alloca i32, align 4
28 %p = alloca i32*, align 8
30 store i32* %a, i32** %p
31 %b = call i32** @return_ref_arg_callee(i32* %a)
33 %lb = load i32*, i32** %b
34 %lp = load i32*, i32** %p