1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=licm < %s | FileCheck %s
4 @c = global i16 0, align 2
6 ; FIXME: The store should not be hoisted.
10 ; CHECK-NEXT: br label [[LOOP:%.*]]
12 ; CHECK-NEXT: [[V:%.*]] = phi i32 [ 10, [[ENTRY:%.*]] ], [ 0, [[LOOP_LATCH:%.*]] ]
13 ; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[V]], 0
14 ; CHECK-NEXT: br i1 [[C]], label [[LOOP_EXIT:%.*]], label [[LOOP_CONT:%.*]]
16 ; CHECK-NEXT: br i1 false, label [[LOOP_IRREDUCIBLE:%.*]], label [[LOOP_LATCH]]
17 ; CHECK: loop.irreducible:
18 ; CHECK-NEXT: store i16 5, ptr @c, align 2
19 ; CHECK-NEXT: br label [[LOOP_LATCH]]
21 ; CHECK-NEXT: br i1 false, label [[LOOP_IRREDUCIBLE]], label [[LOOP]]
23 ; CHECK-NEXT: ret void
28 loop: ; preds = %loop.latch, %entry
29 %v = phi i32 [ 10, %entry ], [ 0, %loop.latch ]
30 %c = icmp eq i32 %v, 0
31 br i1 %c, label %loop.exit, label %loop.cont
33 loop.cont: ; preds = %loop
34 br i1 false, label %loop.irreducible, label %loop.latch
36 loop.irreducible: ; preds = %loop.latch, %loop.cont
37 store i16 5, ptr @c, align 2
40 loop.latch: ; preds = %loop.irreducible, %loop.cont
41 br i1 false, label %loop.irreducible, label %loop
43 loop.exit: ; preds = %loop