@@ -134,3 +134,24 @@ define i32 addrspace(3)* @inbounds_bitcast_vec_to_array_addrspace_matching_alloc
134
134
%gep = getelementptr inbounds [4 x i32 ], [4 x i32 ] addrspace (3 )* %asc , i64 %y , i64 %z
135
135
ret i32 addrspace (3 )* %gep
136
136
}
137
+
138
+ ; Negative test - avoid doing bitcast on i8*, because '16' should be scaled by 'vscale'.
139
+
140
+ define i8* @test_accumulate_constant_offset_vscale_nonzero (<vscale x 16 x i1 > %pg , i8* %base ) {
141
+ ; CHECK-LABEL: @test_accumulate_constant_offset_vscale_nonzero
142
+ ; CHECK-NEXT: %bc = bitcast i8* %base to <vscale x 16 x i8>*
143
+ ; CHECK-NEXT: %gep = getelementptr <vscale x 16 x i8>, <vscale x 16 x i8>* %bc, i64 1, i64 4
144
+ ; CHECK-NEXT: ret i8* %gep
145
+ %bc = bitcast i8* %base to <vscale x 16 x i8 >*
146
+ %gep = getelementptr <vscale x 16 x i8 >, <vscale x 16 x i8 >* %bc , i64 1 , i64 4
147
+ ret i8* %gep
148
+ }
149
+
150
+ define i8* @test_accumulate_constant_offset_vscale_zero (<vscale x 16 x i1 > %pg , i8* %base ) {
151
+ ; CHECK-LABEL: @test_accumulate_constant_offset_vscale_zero
152
+ ; CHECK-NEXT: %[[RES:.*]] = getelementptr i8, i8* %base, i64 4
153
+ ; CHECK-NEXT: ret i8* %[[RES]]
154
+ %bc = bitcast i8* %base to <vscale x 16 x i8 >*
155
+ %gep = getelementptr <vscale x 16 x i8 >, <vscale x 16 x i8 >* %bc , i64 0 , i64 4
156
+ ret i8* %gep
157
+ }
0 commit comments