1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals --version 2
2 ; RUN: opt -passes=newgvn -S < %s | FileCheck %s
4 define i32 @test1(ptr %p) {
5 ; CHECK-LABEL: define i32 @test1
6 ; CHECK-SAME: (ptr [[P:%.*]]) {
7 ; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4, !range [[RNG0:![0-9]+]]
8 ; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
9 ; CHECK-NEXT: ret i32 [[C]]
11 %a = load i32, ptr %p, !range !0
12 %b = load i32, ptr %p, !range !0
17 define i32 @test2(ptr %p) {
18 ; CHECK-LABEL: define i32 @test2
19 ; CHECK-SAME: (ptr [[P:%.*]]) {
20 ; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4
21 ; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
22 ; CHECK-NEXT: ret i32 [[C]]
24 %a = load i32, ptr %p, !range !0
30 define i32 @test3(ptr %p) {
31 ; CHECK-LABEL: define i32 @test3
32 ; CHECK-SAME: (ptr [[P:%.*]]) {
33 ; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4, !range [[RNG1:![0-9]+]]
34 ; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
35 ; CHECK-NEXT: ret i32 [[C]]
37 %a = load i32, ptr %p, !range !0
38 %b = load i32, ptr %p, !range !1
43 define i32 @test4(ptr %p) {
44 ; CHECK-LABEL: define i32 @test4
45 ; CHECK-SAME: (ptr [[P:%.*]]) {
46 ; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4, !range [[RNG2:![0-9]+]]
47 ; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
48 ; CHECK-NEXT: ret i32 [[C]]
50 %a = load i32, ptr %p, !range !0
51 %b = load i32, ptr %p, !range !2
56 define i32 @test5(ptr %p) {
57 ; CHECK-LABEL: define i32 @test5
58 ; CHECK-SAME: (ptr [[P:%.*]]) {
59 ; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4, !range [[RNG3:![0-9]+]]
60 ; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
61 ; CHECK-NEXT: ret i32 [[C]]
63 %a = load i32, ptr %p, !range !3
64 %b = load i32, ptr %p, !range !4
69 define i32 @test6(ptr %p) {
70 ; CHECK-LABEL: define i32 @test6
71 ; CHECK-SAME: (ptr [[P:%.*]]) {
72 ; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4, !range [[RNG4:![0-9]+]]
73 ; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
74 ; CHECK-NEXT: ret i32 [[C]]
76 %a = load i32, ptr %p, !range !5
77 %b = load i32, ptr %p, !range !6
82 define i32 @test7(ptr %p) {
83 ; CHECK-LABEL: define i32 @test7
84 ; CHECK-SAME: (ptr [[P:%.*]]) {
85 ; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4, !range [[RNG5:![0-9]+]]
86 ; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
87 ; CHECK-NEXT: ret i32 [[C]]
89 %a = load i32, ptr %p, !range !7
90 %b = load i32, ptr %p, !range !8
95 define i32 @test8(ptr %p) {
96 ; CHECK-LABEL: define i32 @test8
97 ; CHECK-SAME: (ptr [[P:%.*]]) {
98 ; CHECK-NEXT: [[A:%.*]] = load i32, ptr [[P]], align 4
99 ; CHECK-NEXT: [[C:%.*]] = add i32 [[A]], [[A]]
100 ; CHECK-NEXT: ret i32 [[C]]
102 %a = load i32, ptr %p, !range !9
103 %b = load i32, ptr %p, !range !10
112 !3 = !{i32 -5, i32 -2}
114 !5 = !{i32 10, i32 1}
115 !6 = !{i32 12, i32 16}
116 !7 = !{i32 1, i32 2, i32 3, i32 4}
119 !10 = !{i32 5, i32 1}
121 ; CHECK: [[RNG0]] = !{i32 0, i32 2}
122 ; CHECK: [[RNG1]] = !{i32 0, i32 2, i32 3, i32 5}
123 ; CHECK: [[RNG2]] = !{i32 0, i32 5}
124 ; CHECK: [[RNG3]] = !{i32 -5, i32 -2, i32 1, i32 5}
125 ; CHECK: [[RNG4]] = !{i32 10, i32 1}
126 ; CHECK: [[RNG5]] = !{i32 3, i32 4, i32 5, i32 2}