Home | History | Annotate | Download | only in Steensgaard
      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 -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 define void @store_arg_callee(i32** %arg1, i32* %arg2) {
      8 	store i32* %arg2, i32** %arg1
      9 	ret void
     10 }
     11 ; CHECK-LABEL: Function: test_store_arg
     12 ; CHECK: NoAlias: i32* %a, i32** %p
     13 ; CHECK: NoAlias: i32* %b, i32** %p
     14 ; CHECK: MayAlias: i32* %a, i32* %lp
     15 ; CHECK: MayAlias: i32* %b, i32* %lp
     16 ; CHECK: MayAlias: i32* %b, i32* %lq
     17 ; CHECK: MayAlias: i32* %lp, i32* %lq
     18 
     19 ; We could've proven the following facts if the analysis were inclusion-based:
     20 ; NoAlias: i32* %a, i32* %b
     21 ; NoAlias: i32* %a, i32* %lq
     22 define void @test_store_arg() {
     23   %a = alloca i32, align 4
     24   %b = alloca i32, align 4
     25   %p = alloca i32*, align 8
     26   %q = alloca i32*, align 8
     27 
     28   store i32* %a, i32** %p
     29   store i32* %b, i32** %q
     30   call void @store_arg_callee(i32** %p, i32* %b)
     31 
     32   %lp = load i32*, i32** %p
     33   %lq = load i32*, i32** %q
     34 
     35   ret void
     36 }