; PR10383
-; This used to crash.
+; These next two used to crash.
define void @test2(i1 %cmp, i64 %n) {
entry:
ret void
}
; CHECK: Determining loop execution counts for: @test2
+
+define i32 @test3() {
+if.then466:
+ br i1 undef, label %for.cond539.preheader, label %for.inc479
+
+for.inc479:
+ %a2.07 = phi i32 [ %add495, %for.inc479 ], [ 0, %if.then466 ]
+ %j.36 = phi i32 [ %inc497, %for.inc479 ], [ undef, %if.then466 ]
+ %mul484 = mul nsw i32 %j.36, %j.36
+ %mul491 = mul i32 %j.36, %j.36
+ %mul493 = mul i32 %mul491, %mul484
+ %add495 = add nsw i32 %mul493, %a2.07
+ %inc497 = add nsw i32 %j.36, 1
+ br i1 undef, label %for.cond539.preheader, label %for.inc479
+
+for.cond539.preheader:
+ unreachable
+}
+; CHECK: Determining loop execution counts for: @test3
+
+; PR13489
+; We used to crash on this too.
+
+define void @test4() {
+entry:
+ br label %for.body
+
+for.body: ; preds = %for.body, %entry
+ %v2.02 = phi i64 [ 2, %entry ], [ %phitmp, %for.body ]
+ %v1.01 = phi i64 [ -2, %entry ], [ %sub1, %for.body ]
+ %sub1 = sub i64 %v1.01, %v2.02
+ %phitmp = add i64 %v2.02, 2
+ %tobool = icmp eq i64 %sub1, %phitmp
+ br i1 %tobool, label %for.end, label %for.body
+
+for.end: ; preds = %for.body
+ ret void
+}
+
+; CHECK: Determining loop execution counts for: @test4