1 ; This testcase ensures that CFL AA answers queries soundly when callee tries
2 ; to mutate the memory pointed to by its parameters
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
7 declare noalias i8* @malloc(i64)
9 define void @store_arg_multilevel_callee(i32*** %arg1, i32* %arg2) {
10 %ptr = call noalias i8* @malloc(i64 8)
11 %ptr_cast = bitcast i8* %ptr to i32**
12 store i32* %arg2, i32** %ptr_cast
13 store i32** %ptr_cast, i32*** %arg1
16 ; CHECK-LABEL: Function: test_store_arg_multilevel
17 ; CHECK: NoAlias: i32* %a, i32** %lpp
18 ; CHECK: NoAlias: i32* %b, i32** %lpp
19 ; CHECK: MayAlias: i32** %lpp, i32** %p
20 ; CHECK: MayAlias: i32* %a, i32* %lpp_deref
21 ; CHECK: MayAlias: i32* %b, i32* %lpp_deref
22 ; CHECK: NoAlias: i32* %lpp_deref, i32** %p
23 ; CHECK: NoAlias: i32* %lpp_deref, i32*** %pp
24 ; CHECK: NoAlias: i32* %lpp_deref, i32** %lpp
25 ; CHECK: MayAlias: i32* %a, i32* %lp
26 ; CHECK: NoAlias: i32* %lp, i32*** %pp
27 ; CHECK: NoAlias: i32* %lp, i32** %lpp
28 ; CHECK: MayAlias: i32* %lp, i32* %lpp_deref
30 ; We could've proven the following facts if the analysis were inclusion-based:
31 ; NoAlias: i32* %a, i32* %b
32 define void @test_store_arg_multilevel() {
33 %a = alloca i32, align 4
34 %b = alloca i32, align 4
35 %p = alloca i32*, align 8
36 %pp = alloca i32**, align 8
38 store i32* %a, i32** %p
39 store i32** %p, i32*** %pp
40 call void @store_arg_multilevel_callee(i32*** %pp, i32* %b)
42 %lpp = load i32**, i32*** %pp
43 %lpp_deref = load i32*, i32** %lpp
44 %lp = load i32*, i32** %p