; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=newgvn -S %s | FileCheck %s
define void @crash1_pr35074(i32 %this, i1 %c) {
; CHECK-LABEL: @crash1_pr35074(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[FOR_COND:%.*]]
; CHECK: for.cond:
; CHECK-NEXT: [[PHIOFOPS:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[Y_0:%.*]], [[FOR_INC6:%.*]] ]
; CHECK-NEXT: [[Y_0]] = phi i32 [ 1, [[ENTRY]] ], [ [[INC7:%.*]], [[FOR_INC6]] ]
; CHECK-NEXT: br i1 [[C:%.*]], label [[FOR_INC6]], label [[FOR_BODY_LR_PH:%.*]]
; CHECK: for.body.lr.ph:
; CHECK-NEXT: br label [[FOR_BODY4:%.*]]
; CHECK: for.body4:
; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i32 [[PHIOFOPS]], [[Y_0]]
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_END:%.*]], label [[FOR_BODY4_1:%.*]]
; CHECK: for.end:
; CHECK-NEXT: ret void
; CHECK: for.inc6:
; CHECK-NEXT: [[INC7]] = add nuw nsw i32 [[Y_0]], 1
; CHECK-NEXT: br label [[FOR_COND]]
; CHECK: for.body4.1:
; CHECK-NEXT: [[INC_1:%.*]] = add nuw nsw i32 [[Y_0]], 1
; CHECK-NEXT: tail call void @_blah(i32 [[INC_1]])
; CHECK-NEXT: br label [[FOR_END]]
;
entry:
br label %for.cond
for.cond: ; preds = %for.inc6, %entry
%y.0 = phi i32 [ 1, %entry ], [ %inc7, %for.inc6 ]
br i1 %c, label %for.inc6, label %for.body.lr.ph
for.body.lr.ph: ; preds = %for.cond
%sub = add nsw i32 %y.0, -1
br label %for.body4
for.body4: ; preds = %for.body.lr.ph
%cmp = icmp ugt i32 %sub, %y.0
br i1 %cmp, label %for.end, label %for.body4.1
for.end: ; preds = %for.body4.1, %for.body4
ret void
for.inc6: ; preds = %for.cond
%inc7 = add nuw nsw i32 %y.0, 1
br label %for.cond
for.body4.1: ; preds = %for.body4
%inc.1 = add nuw nsw i32 %y.0, 1
tail call void @_blah(i32 %inc.1)
br label %for.end
}
declare void @_blah(i32)