1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt -passes='print<scalar-evolution>' -disable-output %s 2>&1 | FileCheck %s
4 @glob.i32.align2 = global i32 zeroinitializer, align 2
5 @glob.i32.align8 = global i32 zeroinitializer, align 8
6 @glob.i32.align16 = global i32 zeroinitializer, align 16
7 @array4xi32 = global [4 x i32] zeroinitializer, align 16
9 define i64 @ptrtoint_align_2_size_4_add_5() {
10 ; CHECK-LABEL: 'ptrtoint_align_2_size_4_add_5'
11 ; CHECK-NEXT: Classifying expressions for: @ptrtoint_align_2_size_4_add_5
12 ; CHECK-NEXT: %add = add i64 ptrtoint (ptr @glob.i32.align2 to i64), 5
13 ; CHECK-NEXT: --> (5 + (ptrtoint ptr @glob.i32.align2 to i64))<nuw> U: [7,0) S: [5,0)
14 ; CHECK-NEXT: Determining loop execution counts for: @ptrtoint_align_2_size_4_add_5
17 %add = add i64 ptrtoint (ptr @glob.i32.align2 to i64), 5
21 define i64 @ptrtoint_align_2_size_4_add_6() {
22 ; CHECK-LABEL: 'ptrtoint_align_2_size_4_add_6'
23 ; CHECK-NEXT: Classifying expressions for: @ptrtoint_align_2_size_4_add_6
24 ; CHECK-NEXT: %add = add i64 ptrtoint (ptr @glob.i32.align2 to i64), 6
25 ; CHECK-NEXT: --> (6 + (ptrtoint ptr @glob.i32.align2 to i64)) U: [0,-1) S: [-9223372036854775808,9223372036854775807)
26 ; CHECK-NEXT: Determining loop execution counts for: @ptrtoint_align_2_size_4_add_6
29 %add = add i64 ptrtoint (ptr @glob.i32.align2 to i64), 6
33 define i64 @ptrtoint_align_8_size_4_add_7() {
34 ; CHECK-LABEL: 'ptrtoint_align_8_size_4_add_7'
35 ; CHECK-NEXT: Classifying expressions for: @ptrtoint_align_8_size_4_add_7
36 ; CHECK-NEXT: %add = add i64 ptrtoint (ptr @glob.i32.align8 to i64), 7
37 ; CHECK-NEXT: --> (7 + (ptrtoint ptr @glob.i32.align8 to i64))<nuw><nsw> U: [15,0) S: [-9223372036854775801,-9223372036854775808)
38 ; CHECK-NEXT: Determining loop execution counts for: @ptrtoint_align_8_size_4_add_7
41 %add = add i64 ptrtoint (ptr @glob.i32.align8 to i64), 7
45 define i64 @ptrtoint_align_8_size_4_add_8() {
46 ; CHECK-LABEL: 'ptrtoint_align_8_size_4_add_8'
47 ; CHECK-NEXT: Classifying expressions for: @ptrtoint_align_8_size_4_add_8
48 ; CHECK-NEXT: %add = add i64 ptrtoint (ptr @glob.i32.align8 to i64), 8
49 ; CHECK-NEXT: --> (8 + (ptrtoint ptr @glob.i32.align8 to i64)) U: [0,-7) S: [-9223372036854775808,9223372036854775801)
50 ; CHECK-NEXT: Determining loop execution counts for: @ptrtoint_align_8_size_4_add_8
53 %add = add i64 ptrtoint (ptr @glob.i32.align8 to i64), 8
57 define i64 @ptrtoint_align_16_size_4_add_15() {
58 ; CHECK-LABEL: 'ptrtoint_align_16_size_4_add_15'
59 ; CHECK-NEXT: Classifying expressions for: @ptrtoint_align_16_size_4_add_15
60 ; CHECK-NEXT: %add = add i64 ptrtoint (ptr @glob.i32.align16 to i64), 15
61 ; CHECK-NEXT: --> (15 + (ptrtoint ptr @glob.i32.align16 to i64))<nuw><nsw> U: [31,0) S: [-9223372036854775793,-9223372036854775808)
62 ; CHECK-NEXT: Determining loop execution counts for: @ptrtoint_align_16_size_4_add_15
65 %add = add i64 ptrtoint (ptr @glob.i32.align16 to i64), 15
69 define i64 @ptrtoint_align_16_size_4_add_16() {
70 ; CHECK-LABEL: 'ptrtoint_align_16_size_4_add_16'
71 ; CHECK-NEXT: Classifying expressions for: @ptrtoint_align_16_size_4_add_16
72 ; CHECK-NEXT: %add = add i64 ptrtoint (ptr @glob.i32.align16 to i64), 16
73 ; CHECK-NEXT: --> (16 + (ptrtoint ptr @glob.i32.align16 to i64)) U: [0,-15) S: [-9223372036854775808,9223372036854775793)
74 ; CHECK-NEXT: Determining loop execution counts for: @ptrtoint_align_16_size_4_add_16
77 %add = add i64 ptrtoint (ptr @glob.i32.align16 to i64), 16
81 define i64 @ptrtoint_align_16_size_16_add_16() {
82 ; CHECK-LABEL: 'ptrtoint_align_16_size_16_add_16'
83 ; CHECK-NEXT: Classifying expressions for: @ptrtoint_align_16_size_16_add_16
84 ; CHECK-NEXT: %add = add i64 ptrtoint (ptr @array4xi32 to i64), 16
85 ; CHECK-NEXT: --> (16 + (ptrtoint ptr @array4xi32 to i64))<nuw> U: [32,-15) S: [-9223372036854775808,9223372036854775793)
86 ; CHECK-NEXT: Determining loop execution counts for: @ptrtoint_align_16_size_16_add_16
89 %add = add i64 ptrtoint (ptr @array4xi32 to i64), 16
93 define i64 @ptrtoint_align_16_size_16_add_31() {
94 ; CHECK-LABEL: 'ptrtoint_align_16_size_16_add_31'
95 ; CHECK-NEXT: Classifying expressions for: @ptrtoint_align_16_size_16_add_31
96 ; CHECK-NEXT: %add = add i64 ptrtoint (ptr @array4xi32 to i64), 31
97 ; CHECK-NEXT: --> (31 + (ptrtoint ptr @array4xi32 to i64))<nuw> U: [47,0) S: [31,0)
98 ; CHECK-NEXT: Determining loop execution counts for: @ptrtoint_align_16_size_16_add_31
101 %add = add i64 ptrtoint (ptr @array4xi32 to i64), 31
105 define i64 @ptrtoint_align_16_size_16_add_32() {
106 ; CHECK-LABEL: 'ptrtoint_align_16_size_16_add_32'
107 ; CHECK-NEXT: Classifying expressions for: @ptrtoint_align_16_size_16_add_32
108 ; CHECK-NEXT: %add = add i64 ptrtoint (ptr @array4xi32 to i64), 32
109 ; CHECK-NEXT: --> (32 + (ptrtoint ptr @array4xi32 to i64)) U: [0,-15) S: [-9223372036854775808,9223372036854775793)
110 ; CHECK-NEXT: Determining loop execution counts for: @ptrtoint_align_16_size_16_add_32
113 %add = add i64 ptrtoint (ptr @array4xi32 to i64), 32
117 define i64 @ptrtoint_align_16_size_16_add_33() {
118 ; CHECK-LABEL: 'ptrtoint_align_16_size_16_add_33'
119 ; CHECK-NEXT: Classifying expressions for: @ptrtoint_align_16_size_16_add_33
120 ; CHECK-NEXT: %add = add i64 ptrtoint (ptr @array4xi32 to i64), 33
121 ; CHECK-NEXT: --> (33 + (ptrtoint ptr @array4xi32 to i64)) U: [49,2) S: [-9223372036854775775,-9223372036854775790)
122 ; CHECK-NEXT: Determining loop execution counts for: @ptrtoint_align_16_size_16_add_33
125 %add = add i64 ptrtoint (ptr @array4xi32 to i64), 33
129 define i64 @ptrtoint_align_16_size_16_add_16_umax_sub() {
130 ; CHECK-LABEL: 'ptrtoint_align_16_size_16_add_16_umax_sub'
131 ; CHECK-NEXT: Classifying expressions for: @ptrtoint_align_16_size_16_add_16_umax_sub
132 ; CHECK-NEXT: %add.16 = add i64 ptrtoint (ptr @array4xi32 to i64), 16
133 ; CHECK-NEXT: --> (16 + (ptrtoint ptr @array4xi32 to i64))<nuw> U: [32,-15) S: [-9223372036854775808,9223372036854775793)
134 ; CHECK-NEXT: %umax = call i64 @llvm.umax.i64(i64 ptrtoint (ptr @array4xi32 to i64), i64 %add.16)
135 ; CHECK-NEXT: --> (16 + (ptrtoint ptr @array4xi32 to i64))<nuw> U: [32,-15) S: [-9223372036854775808,9223372036854775793)
136 ; CHECK-NEXT: %add = add i64 %umax, 16
137 ; CHECK-NEXT: --> (32 + (ptrtoint ptr @array4xi32 to i64)) U: [0,-15) S: [-9223372036854775808,9223372036854775793)
138 ; CHECK-NEXT: %sub = sub i64 %add, ptrtoint (ptr @array4xi32 to i64)
139 ; CHECK-NEXT: --> 32 U: [32,33) S: [32,33)
140 ; CHECK-NEXT: Determining loop execution counts for: @ptrtoint_align_16_size_16_add_16_umax_sub
143 %add.16 = add i64 ptrtoint (ptr @array4xi32 to i64), 16
144 %umax = call i64 @llvm.umax.i64(i64 ptrtoint (ptr @array4xi32 to i64), i64 %add.16)
145 %add = add i64 %umax, 16
146 %sub = sub i64 %add, ptrtoint (ptr @array4xi32 to i64)
150 define i64 @ptrtoint_align_16_size_16_add_31_umax_sub() {
151 ; CHECK-LABEL: 'ptrtoint_align_16_size_16_add_31_umax_sub'
152 ; CHECK-NEXT: Classifying expressions for: @ptrtoint_align_16_size_16_add_31_umax_sub
153 ; CHECK-NEXT: %add.31 = add i64 ptrtoint (ptr @array4xi32 to i64), 31
154 ; CHECK-NEXT: --> (31 + (ptrtoint ptr @array4xi32 to i64))<nuw> U: [47,0) S: [31,0)
155 ; CHECK-NEXT: %umax = call i64 @llvm.umax.i64(i64 ptrtoint (ptr @array4xi32 to i64), i64 %add.31)
156 ; CHECK-NEXT: --> (31 + (ptrtoint ptr @array4xi32 to i64))<nuw> U: [47,0) S: [31,0)
157 ; CHECK-NEXT: %add = add i64 %umax, 16
158 ; CHECK-NEXT: --> (47 + (ptrtoint ptr @array4xi32 to i64)) U: [63,16) S: [-9223372036854775761,-9223372036854775776)
159 ; CHECK-NEXT: %sub = sub i64 %add, ptrtoint (ptr @array4xi32 to i64)
160 ; CHECK-NEXT: --> 47 U: [47,48) S: [47,48)
161 ; CHECK-NEXT: Determining loop execution counts for: @ptrtoint_align_16_size_16_add_31_umax_sub
164 %add.31 = add i64 ptrtoint (ptr @array4xi32 to i64), 31
165 %umax = call i64 @llvm.umax.i64(i64 ptrtoint (ptr @array4xi32 to i64), i64 %add.31)
166 %add = add i64 %umax, 16
167 %sub = sub i64 %add, ptrtoint (ptr @array4xi32 to i64)
171 define i64 @ptrtoint_align_16_size_16_add_32_umax_sub() {
172 ; CHECK-LABEL: 'ptrtoint_align_16_size_16_add_32_umax_sub'
173 ; CHECK-NEXT: Classifying expressions for: @ptrtoint_align_16_size_16_add_32_umax_sub
174 ; CHECK-NEXT: %add.32 = add i64 ptrtoint (ptr @array4xi32 to i64), 32
175 ; CHECK-NEXT: --> (32 + (ptrtoint ptr @array4xi32 to i64)) U: [0,-15) S: [-9223372036854775808,9223372036854775793)
176 ; CHECK-NEXT: %umax = call i64 @llvm.umax.i64(i64 ptrtoint (ptr @array4xi32 to i64), i64 %add.32)
177 ; CHECK-NEXT: --> ((32 + (ptrtoint ptr @array4xi32 to i64)) umax (ptrtoint ptr @array4xi32 to i64)) U: [16,-15) S: [-9223372036854775808,9223372036854775793)
178 ; CHECK-NEXT: %add = add i64 %umax, 16
179 ; CHECK-NEXT: --> (16 + ((32 + (ptrtoint ptr @array4xi32 to i64)) umax (ptrtoint ptr @array4xi32 to i64))) U: [0,-15) S: [-9223372036854775808,9223372036854775793)
180 ; CHECK-NEXT: %sub = sub i64 %add, ptrtoint (ptr @array4xi32 to i64)
181 ; CHECK-NEXT: --> (16 + (-1 * (ptrtoint ptr @array4xi32 to i64)) + ((32 + (ptrtoint ptr @array4xi32 to i64)) umax (ptrtoint ptr @array4xi32 to i64))) U: [0,-15) S: [-9223372036854775808,9223372036854775793)
182 ; CHECK-NEXT: Determining loop execution counts for: @ptrtoint_align_16_size_16_add_32_umax_sub
185 %add.32 = add i64 ptrtoint (ptr @array4xi32 to i64), 32
186 %umax = call i64 @llvm.umax.i64(i64 ptrtoint (ptr @array4xi32 to i64), i64 %add.32)
187 %add = add i64 %umax, 16
188 %sub = sub i64 %add, ptrtoint (ptr @array4xi32 to i64)
192 declare i64 @llvm.umax.i64(i64, i64)