1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -canon-freeze -S | FileCheck %s
3 declare void @call(i32)
5 define void @add(i32 %init, i32 %n) {
8 ; CHECK-NEXT: [[INIT_FROZEN:%.*]] = freeze i32 [[INIT:%.*]]
9 ; CHECK-NEXT: br label [[LOOP:%.*]]
11 ; CHECK-NEXT: [[I:%.*]] = phi i32 [ [[INIT_FROZEN]], [[ENTRY:%.*]] ], [ [[I_NEXT:%.*]], [[LOOP]] ]
12 ; CHECK-NEXT: [[I_NEXT]] = add i32 [[I]], 1
13 ; CHECK-NEXT: [[NONSTEP:%.*]] = mul nsw i32 [[I]], 2
14 ; CHECK-NEXT: call void @call(i32 [[NONSTEP]])
15 ; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[I_NEXT]], [[N:%.*]]
16 ; CHECK-NEXT: br i1 [[COND]], label [[LOOP]], label [[EXIT:%.*]]
18 ; CHECK-NEXT: ret void
24 %i = phi i32 [ %init, %entry], [%i.next, %loop ]
25 %i.next = add nsw i32 %i, 1
26 %i.next.fr = freeze i32 %i.next
27 %nonstep = mul nsw i32 %i, 2
28 call void @call(i32 %nonstep)
29 %cond = icmp eq i32 %i.next.fr, %n
30 br i1 %cond, label %loop, label %exit