1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=irce -irce-print-changed-loops=true < %s | FileCheck %s
4 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
5 target triple = "x86_64-unknown-linux-gnu"
12 ; CHECK-NEXT: br label [[OUTER_HEADER:%.*]]
14 ; CHECK-NEXT: [[TMP:%.*]] = or i32 [[TMP5:%.*]], 1
15 ; CHECK-NEXT: [[TMP2:%.*]] = add nuw nsw i32 [[TMP5]], 1
16 ; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP8:%.*]], 0
17 ; CHECK-NEXT: br i1 [[TMP3]], label [[RET2:%.*]], label [[OUTER_HEADER]]
18 ; CHECK: outer_header:
19 ; CHECK-NEXT: [[TMP5]] = phi i32 [ 0, [[BB:%.*]] ], [ [[TMP2]], [[OUTER_LATCH:%.*]] ]
20 ; CHECK-NEXT: br label [[INNER_HEADER:%.*]]
22 ; CHECK-NEXT: [[TMP12_LCSSA:%.*]] = phi i32 [ [[TMP12:%.*]], [[INNER_HEADER]] ]
23 ; CHECK-NEXT: [[TMP7:%.*]] = or i32 [[TMP12_LCSSA]], [[TMP5]]
24 ; CHECK-NEXT: [[TMP8]] = add nuw i32 [[TMP12_LCSSA]], [[TMP5]]
25 ; CHECK-NEXT: [[TMP9:%.*]] = icmp ult i32 [[TMP5]], 0
26 ; CHECK-NEXT: br i1 [[TMP9]], label [[OUTER_LATCH]], label [[RET1:%.*]]
28 ; CHECK-NEXT: ret void
29 ; CHECK: inner_header:
30 ; CHECK-NEXT: [[TMP12]] = phi i32 [ [[TMP14:%.*]], [[INNER_HEADER]] ], [ 0, [[OUTER_HEADER]] ]
31 ; CHECK-NEXT: [[TMP13:%.*]] = or i32 [[TMP12]], 1
32 ; CHECK-NEXT: [[TMP14]] = add nuw nsw i32 [[TMP12]], 1
33 ; CHECK-NEXT: br i1 true, label [[INNER_EXIT:%.*]], label [[INNER_HEADER]]
35 ; CHECK-NEXT: ret void
38 br label %outer_header
40 outer_latch: ; preds = %inner_exit
41 %tmp = or i32 %tmp5, 1
42 %tmp2 = add nuw nsw i32 %tmp5, 1
43 %tmp3 = icmp eq i32 %tmp8, 0
44 br i1 %tmp3, label %ret2, label %outer_header
46 outer_header: ; preds = %outer_latch, %bb
47 %tmp5 = phi i32 [ 0, %bb ], [ %tmp2, %outer_latch ]
48 br label %inner_header
50 inner_exit: ; preds = %inner_header
51 %tmp12.lcssa = phi i32 [ %tmp12, %inner_header ]
52 %tmp7 = or i32 %tmp12.lcssa, %tmp5
53 %tmp8 = add nuw i32 %tmp12.lcssa, %tmp5
54 %tmp9 = icmp ult i32 %tmp5, 0
55 br i1 %tmp9, label %outer_latch, label %ret1
57 ret1: ; preds = %inner_exit
60 inner_header: ; preds = %inner_header, %outer_header
61 %tmp12 = phi i32 [ %tmp14, %inner_header ], [ 0, %outer_header ]
62 %tmp13 = or i32 %tmp12, 1
63 %tmp14 = add nuw nsw i32 %tmp12, 1
64 br i1 true, label %inner_exit, label %inner_header
66 ret2: ; preds = %outer_latch