@@ -753,6 +753,48 @@ for.exit:
753
753
ret void
754
754
}
755
755
756
+ ; The histogram operation generates vectors. This example used to crash
757
+ ; due to a missing entry in a switch statement.
758
+ define void @histogram_generates_vectors_crash (ptr %data_array , ptr noalias %indices ) {
759
+ ; CHECK-LABEL: define void @histogram_generates_vectors_crash(
760
+ ; CHECK-SAME: ptr [[DATA_ARRAY:%.*]], ptr noalias [[INDICES:%.*]]) {
761
+ ; CHECK-NEXT: entry:
762
+ ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
763
+ ; CHECK: for.body:
764
+ ; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[FOR_BODY]] ]
765
+ ; CHECK-NEXT: [[GEP_INDICES:%.*]] = getelementptr [1048576 x i32], ptr [[INDICES]], i64 [[IV]]
766
+ ; CHECK-NEXT: [[L_IDX:%.*]] = load i32, ptr [[GEP_INDICES]], align 4
767
+ ; CHECK-NEXT: [[IDXPROM5:%.*]] = sext i32 [[L_IDX]] to i64
768
+ ; CHECK-NEXT: [[GEP_BUCKET:%.*]] = getelementptr [1048576 x i32], ptr [[DATA_ARRAY]], i64 [[IDXPROM5]]
769
+ ; CHECK-NEXT: [[L_BUCKET:%.*]] = load i32, ptr [[GEP_BUCKET]], align 4
770
+ ; CHECK-NEXT: [[INC:%.*]] = add i32 [[L_BUCKET]], 1
771
+ ; CHECK-NEXT: store i32 [[INC]], ptr [[GEP_BUCKET]], align 4
772
+ ; CHECK-NEXT: [[IV_NEXT]] = add i64 [[IV]], 1
773
+ ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV]], 1
774
+ ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_EXIT:%.*]], label [[FOR_BODY]]
775
+ ; CHECK: for.exit:
776
+ ; CHECK-NEXT: ret void
777
+ ;
778
+ entry:
779
+ br label %for.body
780
+
781
+ for.body:
782
+ %iv = phi i64 [ 0 , %entry ], [ %iv.next , %for.body ]
783
+ %gep.indices = getelementptr [1048576 x i32 ], ptr %indices , i64 %iv
784
+ %l.idx = load i32 , ptr %gep.indices , align 4
785
+ %idxprom5 = sext i32 %l.idx to i64
786
+ %gep.bucket = getelementptr [1048576 x i32 ], ptr %data_array , i64 %idxprom5
787
+ %l.bucket = load i32 , ptr %gep.bucket , align 4
788
+ %inc = add i32 %l.bucket , 1
789
+ store i32 %inc , ptr %gep.bucket , align 4
790
+ %iv.next = add i64 %iv , 1
791
+ %exitcond = icmp eq i64 %iv , 1
792
+ br i1 %exitcond , label %for.exit , label %for.body
793
+
794
+ for.exit:
795
+ ret void
796
+ }
797
+
756
798
attributes #0 = { "target-features" ="+sve2" vscale_range(1 ,16 ) }
757
799
758
800
!0 = distinct !{!0 , !1 }
0 commit comments