xref: /llvm-project/llvm/test/Analysis/BasicAA/call-escape-source.ll (revision d3d84654467e03640a26fcae651a5d2d0e98541a)
1; RUN: opt -aa-pipeline=basic-aa -passes=aa-eval -print-all-alias-modref-info -disable-output < %s 2>&1 | FileCheck %s
2
3; A call return value is not always an escape source, because
4; CaptureTracking can look through some calls. The test is constructed to
5; hit the getUnderlyingObject() recursion limit.
6define i32 @test() {
7; CHECK-LABEL: Function: test
8; CHECK-NEXT: MustAlias: i32* %a, i32* %p7
9  %a = alloca i32
10  %p1 = call ptr @llvm.strip.invariant.group.p0(ptr %a)
11  %p2 = getelementptr i8, ptr %p1, i64 1
12  %p3 = getelementptr i8, ptr %p2, i64 -1
13  %p4 = getelementptr i8, ptr %p3, i64 1
14  %p5 = getelementptr i8, ptr %p4, i64 -1
15  %p6 = getelementptr i8, ptr %p5, i64 1
16  %p7 = getelementptr i8, ptr %p6, i64 -1
17  %v = load i32, ptr %a
18  store i32 -1, ptr %p7
19  ret i32 %v
20}
21
22declare ptr @llvm.strip.invariant.group.p0(ptr)
23