xref: /llvm-project/llvm/test/Analysis/BasicAA/returned.ll (revision 303c308e452c703c3d47940383ded3b2d3eefd56)
1; RUN: opt < %s -aa-pipeline=basic-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
2
3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4
5%struct = type { i32, i32, i32 }
6
7; CHECK-LABEL: test_simple
8
9; CHECK-DAG: MustAlias: %struct* %st, %struct* %sta
10
11; CHECK-DAG: MayAlias: %struct* %st, i32* %x
12; CHECK-DAG: MayAlias: %struct* %st, i32* %y
13; CHECK-DAG: MayAlias: %struct* %st, i32* %z
14
15; CHECK-DAG: NoAlias: i32* %x, i32* %y
16; CHECK-DAG: NoAlias: i32* %x, i32* %z
17; CHECK-DAG: NoAlias: i32* %y, i32* %z
18
19; CHECK-DAG: MayAlias: %struct* %st, %struct* %y
20; CHECK-DAG: MayAlias: i32* %x, %struct* %y
21; CHECK-DAG: MayAlias: i32* %x, i80* %y
22
23; CHECK-DAG: MayAlias: %struct* %st, i64* %ya
24; CHECK-DAG: MayAlias: i64* %ya, i32* %z
25; CHECK-DAG: NoAlias: i32* %x, i64* %ya
26
27; CHECK-DAG: MustAlias: %struct* %y, i32* %y
28; CHECK-DAG: MustAlias: i32* %y, i64* %ya
29; CHECK-DAG: MustAlias: i80* %y, i32* %y
30
31define void @test_simple(ptr %st, i64 %i, i64 %j, i64 %k) {
32  %x = getelementptr inbounds %struct, ptr %st, i64 %i, i32 0
33  %y = getelementptr inbounds %struct, ptr %st, i64 %j, i32 1
34  %sta = call ptr @func2(ptr %st)
35  %z = getelementptr inbounds %struct, ptr %sta, i64 %k, i32 2
36  %ya = call ptr @func1(ptr %y)
37  load %struct, ptr %st
38  load %struct, ptr %sta
39  load i32, ptr %x
40  load i32, ptr %y
41  load i32, ptr %z
42  load %struct, ptr %y
43  load i80, ptr %y
44  load i64, ptr %ya
45  ret void
46}
47
48declare ptr @func1(ptr returned) nounwind
49declare ptr @func2(ptr returned) nounwind
50
51