<p dir="ltr">Hey nice! Couple of trivial things I noticed while reading through. <br></p>
<p dir="ltr">> +; Here we have a must-exit loop latch that is not computabe and a</p>
<p dir="ltr">"Computable"</p>
<p dir="ltr">> +; may-exit early exit that can only have one non-exiting iteration<br>
> +; before the check is forever skipped.<br>
> +;<br>
> +; CHECK-LABEL: @cannot_compute_mustexit<br>
> +; CHECK: Loop %for.body.i: <multiple exits> Unpredictable backedge-taken count.<br>
> +; CHECK: Loop %for.body.i: Unpredictable max backedge-taken count.<br>
> +@b = common global i32 0, align 4<br>
> +<br>
> +define i32 @cannot_compute_mustexit() {<br>
> +entry:<br>
> +  store i32 -1, i32* @a, align 4<br>
> +  br label %for.body.i<br>
> +<br>
> +for.body.i:                                       ; preds = %for.cond.i, %entry<br>
> +  %storemerge1.i = phi i32 [ -1, %entry ], [ %add.i.i, %for.cond.i ]<br>
> +  %tobool.i = icmp eq i32 %storemerge1.i, 0<br>
> +  %add.i.i = add nsw i32 %storemerge1.i, 2<br>
> +  br i1 %tobool.i, label %bar.exit, label %for.cond.i<br>
> +<br>
> +for.cond.i:                                       ; preds = %for.body.i<br>
> +  store i32 %add.i.i, i32* @a, align 4<br>
> +  %ld = load volatile i32* @b<br>
> +  %cmp.i = icmp ne i32 %ld, 0<br>
> +  br i1 %cmp.i, label %for.body.i, label %bar.exit<br>
> +<br>
> +bar.exit:                                         ; preds = %for.cond.i, %for.body.i<br>
> +  ret i32 0<br>
> +}<br>
> +<br>
> +; This loop has two must-exits, both of with dominate the latch. The</p>
<p dir="ltr">"Both of which"</p>
<p dir="ltr">:)</p>
<p dir="ltr">-eric</p>
<p dir="ltr">> +; MaxBECount should be the minimum of them.<br>
> +;<br>
> +; CHECK-LABEL: @two_mustexit<br>
> +; CHECK: Loop %for.body.i: <multiple exits> Unpredictable backedge-taken count.<br>
> +; CHECK: Loop %for.body.i: max backedge-taken count is 1<br>
> +define i32 @two_mustexit() {<br>
> +entry:<br>
> +  store i32 -1, i32* @a, align 4<br>
> +  br label %for.body.i<br>
> +<br>
> +for.body.i:                                       ; preds = %for.cond.i, %entry<br>
> +  %storemerge1.i = phi i32 [ -1, %entry ], [ %add.i.i, %for.cond.i ]<br>
> +  %tobool.i = icmp sgt i32 %storemerge1.i, 0<br>
> +  %add.i.i = add nsw i32 %storemerge1.i, 2<br>
> +  br i1 %tobool.i, label %bar.exit, label %for.cond.i<br>
> +<br>
> +for.cond.i:                                       ; preds = %for.body.i<br>
> +  store i32 %add.i.i, i32* @a, align 4<br>
> +  %cmp.i = icmp slt i32 %storemerge1.i, 3<br>
> +  br i1 %cmp.i, label %for.body.i, label %bar.exit<br>
> +<br>
> +bar.exit:                                         ; preds = %for.cond.i, %for.body.i<br>
> +  ret i32 0<br>
> +}<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</p>