1 ; RUN: opt -S -irce -irce-print-changed-loops=true < %s | FileCheck %s
2 ; RUN: opt -S -passes='require<branch-prob>,loop(irce)' -irce-print-changed-loops=true < %s | FileCheck %s
6 define void @bad_loop_structure_increasing(i64 %iv.start) {
11 %indvars.iv = phi i64 [ %iv.start, %entry ], [ %indvars.iv.next, %for.inc ]
12 %cmp = icmp ult i64 %indvars.iv, 100
13 br i1 %cmp, label %switch.lookup, label %for.inc
19 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
20 %cmp55 = icmp slt i64 %indvars.iv.next, 11
21 br i1 %cmp55, label %for.body, label %for.end
27 define void @bad_loop_structure_decreasing(i64 %iv.start) {
32 %indvars.iv = phi i64 [ %iv.start, %entry ], [ %indvars.iv.next, %for.inc ]
33 %cmp = icmp ult i64 %indvars.iv, 100
34 br i1 %cmp, label %switch.lookup, label %for.inc
40 %indvars.iv.next = add nuw nsw i64 %indvars.iv, -1
41 %cmp55 = icmp sgt i64 %indvars.iv.next, 11
42 br i1 %cmp55, label %for.body, label %for.end