1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -loop-unroll -unroll-count=4 < %s | FileCheck %s
4 define void @test_inside(i32* %addr1, i32* %addr2) {
5 ; CHECK-LABEL: @test_inside(
7 ; CHECK-NEXT: br label [[BODY:%.*]]
9 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata !0)
10 ; CHECK-NEXT: [[X:%.*]] = load i32, i32* [[ADDR1:%.*]], align 4, !alias.scope !0
11 ; CHECK-NEXT: store i32 [[X]], i32* [[ADDR2:%.*]], align 4, !noalias !0
12 ; CHECK-NEXT: [[ADDR1I_1:%.*]] = getelementptr inbounds i32, i32* [[ADDR1]], i32 1
13 ; CHECK-NEXT: [[ADDR2I_1:%.*]] = getelementptr inbounds i32, i32* [[ADDR2]], i32 1
14 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata !3)
15 ; CHECK-NEXT: [[X_1:%.*]] = load i32, i32* [[ADDR1I_1]], align 4, !alias.scope !3
16 ; CHECK-NEXT: store i32 [[X_1]], i32* [[ADDR2I_1]], align 4, !noalias !3
17 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata !5)
18 ; CHECK-NEXT: [[X_2:%.*]] = load i32, i32* [[ADDR1]], align 4, !alias.scope !5
19 ; CHECK-NEXT: store i32 [[X_2]], i32* [[ADDR2]], align 4, !noalias !5
20 ; CHECK-NEXT: [[ADDR1I_3:%.*]] = getelementptr inbounds i32, i32* [[ADDR1]], i32 1
21 ; CHECK-NEXT: [[ADDR2I_3:%.*]] = getelementptr inbounds i32, i32* [[ADDR2]], i32 1
22 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata !7)
23 ; CHECK-NEXT: [[X_3:%.*]] = load i32, i32* [[ADDR1I_3]], align 4, !alias.scope !7
24 ; CHECK-NEXT: store i32 [[X_3]], i32* [[ADDR2I_3]], align 4, !noalias !7
25 ; CHECK-NEXT: ret void
31 %i = phi i32 [ 0, %start ], [ %i2, %body ]
33 %addr1i = getelementptr inbounds i32, i32* %addr1, i32 %j
34 %addr2i = getelementptr inbounds i32, i32* %addr2, i32 %j
36 call void @llvm.experimental.noalias.scope.decl(metadata !2)
37 %x = load i32, i32* %addr1i, !alias.scope !2
38 store i32 %x, i32* %addr2i, !noalias !2
41 %cmp = icmp slt i32 %i2, 4
42 br i1 %cmp, label %body, label %end
48 define void @test_outside(i32* %addr1, i32* %addr2) {
49 ; CHECK-LABEL: @test_outside(
51 ; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata !0)
52 ; CHECK-NEXT: br label [[BODY:%.*]]
54 ; CHECK-NEXT: [[X:%.*]] = load i32, i32* [[ADDR1:%.*]], align 4, !alias.scope !0
55 ; CHECK-NEXT: store i32 [[X]], i32* [[ADDR2:%.*]], align 4, !noalias !0
56 ; CHECK-NEXT: [[ADDR1I_1:%.*]] = getelementptr inbounds i32, i32* [[ADDR1]], i32 1
57 ; CHECK-NEXT: [[ADDR2I_1:%.*]] = getelementptr inbounds i32, i32* [[ADDR2]], i32 1
58 ; CHECK-NEXT: [[X_1:%.*]] = load i32, i32* [[ADDR1I_1]], align 4, !alias.scope !0
59 ; CHECK-NEXT: store i32 [[X_1]], i32* [[ADDR2I_1]], align 4, !noalias !0
60 ; CHECK-NEXT: [[X_2:%.*]] = load i32, i32* [[ADDR1]], align 4, !alias.scope !0
61 ; CHECK-NEXT: store i32 [[X_2]], i32* [[ADDR2]], align 4, !noalias !0
62 ; CHECK-NEXT: [[ADDR1I_3:%.*]] = getelementptr inbounds i32, i32* [[ADDR1]], i32 1
63 ; CHECK-NEXT: [[ADDR2I_3:%.*]] = getelementptr inbounds i32, i32* [[ADDR2]], i32 1
64 ; CHECK-NEXT: [[X_3:%.*]] = load i32, i32* [[ADDR1I_3]], align 4, !alias.scope !0
65 ; CHECK-NEXT: store i32 [[X_3]], i32* [[ADDR2I_3]], align 4, !noalias !0
66 ; CHECK-NEXT: ret void
69 call void @llvm.experimental.noalias.scope.decl(metadata !2)
73 %i = phi i32 [ 0, %start ], [ %i2, %body ]
75 %addr1i = getelementptr inbounds i32, i32* %addr1, i32 %j
76 %addr2i = getelementptr inbounds i32, i32* %addr2, i32 %j
78 %x = load i32, i32* %addr1i, !alias.scope !2
79 store i32 %x, i32* %addr2i, !noalias !2
82 %cmp = icmp slt i32 %i2, 4
83 br i1 %cmp, label %body, label %end
89 declare void @llvm.experimental.noalias.scope.decl(metadata)
92 !1 = distinct !{!1, !0}
96 ; CHECK: !1 = distinct !{!1, !2}
97 ; CHECK: !2 = distinct !{!2}
99 ; CHECK: !4 = distinct !{!4, !2, !"It1"}
101 ; CHECK: !6 = distinct !{!6, !2, !"It2"}
103 ; CHECK: !8 = distinct !{!8, !2, !"It3"}