1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt < %s --passes=canon-freeze -S | FileCheck %s
4 define void @check_duplicate_removal(i32 %n) {
5 ; CHECK-LABEL: define void @check_duplicate_removal(
6 ; CHECK-SAME: i32 [[N:%.*]]) {
8 ; CHECK-NEXT: [[N_FROZEN:%.*]] = freeze i32 [[N]]
9 ; CHECK-NEXT: br label [[LOOP:%.*]]
11 ; CHECK-NEXT: [[T1:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[T3:%.*]], [[LOOP]] ]
12 ; CHECK-NEXT: [[T2:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[T3]], [[LOOP]] ]
13 ; CHECK-NEXT: [[T3]] = add i32 [[N_FROZEN]], [[T2]]
14 ; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[T2]], 0
15 ; CHECK-NEXT: br i1 [[COND]], label [[LOOP]], label [[EXIT:%.*]]
17 ; CHECK-NEXT: ret void
23 %t1 = phi i32 [ 0, %entry], [%t3, %loop ]
24 %t2 = phi i32 [ 0, %entry], [%t3, %loop ]
27 %cond = icmp eq i32 %t2, 0
28 br i1 %cond, label %loop, label %exit