1 ; RUN: opt < %s -passes=inline -enable-noalias-to-md-conversion -S | FileCheck %s --match-full-lines
3 define i32 @caller(ptr %p) {
4 ; CHECK-LABEL: define i32 @caller(ptr %p) {
5 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META0:![0-9]+]])
6 ; CHECK-NEXT: [[P_8_I:%.*]] = getelementptr i8, ptr [[P:%.*]], i64 8
7 ; CHECK-NEXT: [[V_I:%.*]] = load i32, ptr [[P_8_I]], align 4, !alias.scope !0
8 ; CHECK-NEXT: [[P_1_I:%.*]] = getelementptr i8, ptr [[P]], i64 1
9 ; CHECK-NEXT: [[P_2_I:%.*]] = getelementptr i8, ptr [[P_1_I]], i64 1
10 ; CHECK-NEXT: [[P_3_I:%.*]] = getelementptr i8, ptr [[P_2_I]], i64 1
11 ; CHECK-NEXT: [[P_4_I:%.*]] = getelementptr i8, ptr [[P_3_I]], i64 1
12 ; CHECK-NEXT: [[P_5_I:%.*]] = getelementptr i8, ptr [[P_4_I]], i64 1
13 ; CHECK-NEXT: [[P_6_I:%.*]] = getelementptr i8, ptr [[P_5_I]], i64 1
14 ; CHECK-NEXT: [[P_7_I:%.*]] = getelementptr i8, ptr [[P_6_I]], i64 1
15 ; CHECK-NEXT: [[P_8_ALIAS_I:%.*]] = getelementptr i8, ptr [[P_7_I]], i64 1
16 ; CHECK-NEXT: store i32 42, ptr [[P_8_ALIAS_I]], align 4
17 ; CHECK-NEXT: ret i32 [[V_I]]
19 %v = call i32 @callee(ptr %p)
23 define internal i32 @callee(ptr noalias %p) {
24 %p.8 = getelementptr i8, ptr %p, i64 8
25 %v = load i32, ptr %p.8
26 %p.1 = getelementptr i8, ptr %p, i64 1
27 %p.2 = getelementptr i8, ptr %p.1, i64 1
28 %p.3 = getelementptr i8, ptr %p.2, i64 1
29 %p.4 = getelementptr i8, ptr %p.3, i64 1
30 %p.5 = getelementptr i8, ptr %p.4, i64 1
31 %p.6 = getelementptr i8, ptr %p.5, i64 1
32 %p.7 = getelementptr i8, ptr %p.6, i64 1
33 %p.8.alias = getelementptr i8, ptr %p.7, i64 1
34 store i32 42, ptr %p.8.alias