; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -S -passes=indvars < %s | FileCheck %s
target datalayout = "n8:16:32:64"
; Make sure it does not crash.
define i32 @m() {
; CHECK-LABEL: define i32 @m() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: br label %[[FOR_BODY_I6:.*]]
; CHECK: [[FOR_BODY_I6]]:
; CHECK-NEXT: br i1 true, label %[[I_EXIT:.*]], label %[[IF_END_I:.*]]
; CHECK: [[IF_END_I]]:
; CHECK-NEXT: store i64 0, ptr null, align 8
; CHECK-NEXT: br label %[[FOR_BODY_I6]]
; CHECK: [[I_EXIT]]:
; CHECK-NEXT: ret i32 0
;
entry:
%div.i4 = sdiv i32 1, 0
br label %for.body.i6
for.body.i6: ; preds = %if.end.i, %entry
%add57.i = phi i32 [ %add.i7, %if.end.i ], [ 0, %entry ]
br i1 true, label %i.exit, label %if.end.i
if.end.i: ; preds = %for.body.i6
%add.i7 = add i32 %add57.i, %div.i4
%conv.i = zext i32 %add57.i to i64
store i64 %conv.i, ptr null, align 8
br label %for.body.i6
i.exit: ; preds = %for.body.i6
ret i32 0
}