@@ -755,14 +755,16 @@ for.exit:
755755
756756; The histogram operation generates vectors. This example used to crash
757757; due to a missing entry in a switch statement.
758- define void @histogram_generates_vectors_crash (ptr %data_array ) {
758+ define void @histogram_generates_vectors_crash (ptr %data_array , ptr noalias %indices ) {
759759; CHECK-LABEL: define void @histogram_generates_vectors_crash(
760- ; CHECK-SAME: ptr [[DATA_ARRAY:%.*]]) {
760+ ; CHECK-SAME: ptr [[DATA_ARRAY:%.*]], ptr noalias [[INDICES:%.*]] ) {
761761; CHECK-NEXT: entry:
762762; CHECK-NEXT: br label [[FOR_BODY:%.*]]
763763; CHECK: for.body:
764- ; CHECK-NEXT: store i1 true, ptr poison, align 1
765- ; CHECK-NEXT: br i1 poison, label [[FOR_EXIT:%.*]], label [[FOR_BODY]]
764+ ; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[FOR_BODY]] ]
765+ ; CHECK-NEXT: [[IV_NEXT]] = add i64 [[IV]], 1
766+ ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV]], 1
767+ ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_EXIT:%.*]], label [[FOR_BODY]]
766768; CHECK: for.exit:
767769; CHECK-NEXT: ret void
768770;
@@ -771,7 +773,7 @@ entry:
771773
772774for.body:
773775 %iv = phi i64 [ 0 , %entry ], [ %iv.next , %for.body ]
774- %gep.indices = getelementptr [1048576 x i32 ], ptr null , i64 %iv
776+ %gep.indices = getelementptr [1048576 x i32 ], ptr %indices , i64 %iv
775777 %l.idx = load i32 , ptr %gep.indices , align 4
776778 %idxprom5 = sext i32 %l.idx to i64
777779 %gep.bucket = getelementptr [1048576 x i32 ], ptr %data_array , i64 %idxprom5
0 commit comments