• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; This testcase ensures that CFL AA answers queries soundly when callee tries
2; to escape the memory pointed to by its parameters
3
4; RUN: opt < %s -disable-basic-aa -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
7declare void @opaque(i32*)
8define void @escape_arg_deref(i32** %arg) {
9	%arg_deref = load i32*, i32** %arg
10	call void @opaque(i32* %arg_deref)
11	ret void
12}
13; CHECK-LABEL: Function: test_arg_deref_escape
14; CHECK: NoAlias: i32* %a, i32** %x
15; CHECK: NoAlias: i32* %b, i32** %x
16; CHECK: NoAlias: i32* %a, i32* %b
17; CHECK: NoAlias: i32** %p, i32** %x
18; CHECK: NoAlias: i32* %a, i32** %p
19; CHECK: NoAlias: i32* %b, i32** %p
20; CHECK: MayAlias: i32* %a, i32* %c
21; CHECK: NoAlias: i32* %b, i32* %c
22; CHECK: NoAlias: i32* %c, i32** %p
23define void @test_arg_deref_escape(i32** %x) {
24  %a = alloca i32, align 4
25  %b = alloca i32, align 4
26  %p = alloca i32*, align 4
27
28  store i32* %a, i32** %p
29  call void @escape_arg_deref(i32** %p)
30  %c = load i32*, i32** %x
31
32  ret void
33}