1; This testcase ensures that CFL AA answers queries soundly when callee tries
2; to mutate the memory pointed to by its parameters
3
4; RUN: opt < %s -aa-pipeline=cfl-steens-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
5
6define void @store_arg_callee(i32** %arg1, i32* %arg2) {
7	store i32* %arg2, i32** %arg1
8	ret void
9}
10; CHECK-LABEL: Function: test_store_arg
11; CHECK: NoAlias: i32* %a, i32** %p
12; CHECK: NoAlias: i32* %b, i32** %p
13; CHECK: MayAlias: i32* %a, i32* %lp
14; CHECK: MayAlias: i32* %b, i32* %lp
15; CHECK: MayAlias: i32* %b, i32* %lq
16; CHECK: MayAlias: i32* %lp, i32* %lq
17
18; We could've proven the following facts if the analysis were inclusion-based:
19; NoAlias: i32* %a, i32* %b
20; NoAlias: i32* %a, i32* %lq
21define void @test_store_arg() {
22  %a = alloca i32, align 4
23  %b = alloca i32, align 4
24  %p = alloca i32*, align 8
25  %q = alloca i32*, align 8
26
27  load i32, i32* %a
28  load i32, i32* %b
29  store i32* %a, i32** %p
30  store i32* %b, i32** %q
31  call void @store_arg_callee(i32** %p, i32* %b)
32
33  %lp = load i32*, i32** %p
34  %lq = load i32*, i32** %q
35  load i32, i32* %lp
36  load i32, i32* %lq
37
38  ret void
39}
40