1 ; RUN: opt -disable-output -passes=print-mustexecute < %s 2>&1 | FileCheck %s
3 @c = global i16 0, align 2
5 ; CHECK-LABEL: define void @latch_cycle_irreducible
6 ; CHECK: store i16 5, ptr @c, align 2{{$}}
7 define void @latch_cycle_irreducible() {
11 loop: ; preds = %loop.latch, %entry
12 %v = phi i32 [ 10, %entry ], [ 0, %loop.latch ]
13 %c = icmp eq i32 %v, 0
14 br i1 %c, label %loop.exit, label %loop.cont
16 loop.cont: ; preds = %loop
17 br i1 false, label %loop.irreducible, label %loop.latch
19 loop.irreducible: ; preds = %loop.latch, %loop.cont
20 store i16 5, ptr @c, align 2
23 loop.latch: ; preds = %loop.irreducible, %loop.cont
24 br i1 false, label %loop.irreducible, label %loop
26 loop.exit: ; preds = %loop
30 ; CHECK-LABEL: define void @latch_cycle_reducible
31 ; CHECK: store i16 5, ptr @c, align 2{{$}}
32 define void @latch_cycle_reducible() {
36 loop: ; preds = %loop.latch, %entry
37 %v = phi i32 [ 10, %entry ], [ 0, %loop.latch ]
38 %c = icmp eq i32 %v, 0
39 br i1 %c, label %loop.exit, label %loop2
41 loop2: ; preds = %loop.latch, %loop
42 br i1 false, label %loop2.cont, label %loop.latch
44 loop2.cont: ; preds = %loop2
45 store i16 5, ptr @c, align 2
48 loop.latch: ; preds = %loop2.cont, %loop2
49 br i1 false, label %loop2, label %loop
51 loop.exit: ; preds = %loop