1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt -S -loop-reduce %s | FileCheck --check-prefixes=LEGACYPM %s
3 ; RUN: opt -S -passes=loop-reduce %s | FileCheck --check-prefixes=NEWPM %s
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
8 define void @function_0(i32 %val_i32_8, i32 %val_i32_9) {
9 ; LEGACYPM-LABEL: define void @function_0
10 ; LEGACYPM-SAME: (i32 [[VAL_I32_8:%.*]], i32 [[VAL_I32_9:%.*]]) {
11 ; LEGACYPM-NEXT: [[VAL_I1_22:%.*]] = trunc i8 -66 to i1
12 ; LEGACYPM-NEXT: br i1 [[VAL_I1_22]], label [[BB_2_PREHEADER:%.*]], label [[BB_2_PREHEADER]]
13 ; LEGACYPM: bb_2.preheader:
14 ; LEGACYPM-NEXT: br label [[BB_2:%.*]]
16 ; LEGACYPM-NEXT: br label [[PRHDR_LOOP_3:%.*]]
17 ; LEGACYPM: prhdr_loop_3:
18 ; LEGACYPM-NEXT: br label [[LOOP_4:%.*]]
20 ; LEGACYPM-NEXT: [[LSR_IV:%.*]] = phi i32 [ [[LSR_IV_NEXT:%.*]], [[BE_6:%.*]] ], [ 7851, [[PRHDR_LOOP_3]] ]
21 ; LEGACYPM-NEXT: br i1 [[VAL_I1_22]], label [[BE_6]], label [[LOOP_EXIT_7SPLIT:%.*]]
23 ; LEGACYPM-NEXT: [[VAL_I32_40:%.*]] = mul i32 [[VAL_I32_9]], [[VAL_I32_24_LCSSA:%.*]]
24 ; LEGACYPM-NEXT: br label [[BB_2]]
26 ; LEGACYPM-NEXT: [[LSR_IV_NEXT]] = add i32 [[LSR_IV]], 1
27 ; LEGACYPM-NEXT: br i1 [[VAL_I1_22]], label [[LOOP_4]], label [[BE_6_LOOP_EXIT_7_CRIT_EDGE:%.*]]
28 ; LEGACYPM: loop_exit_7split:
29 ; LEGACYPM-NEXT: [[LSR_IV_LCSSA:%.*]] = phi i32 [ [[LSR_IV]], [[LOOP_4]] ]
30 ; LEGACYPM-NEXT: br label [[LOOP_EXIT_7:%.*]]
31 ; LEGACYPM: be_6.loop_exit_7_crit_edge:
32 ; LEGACYPM-NEXT: [[LSR_IV_LCSSA1:%.*]] = phi i32 [ [[LSR_IV]], [[BE_6]] ]
33 ; LEGACYPM-NEXT: br label [[LOOP_EXIT_7]]
34 ; LEGACYPM: loop_exit_7:
35 ; LEGACYPM-NEXT: [[VAL_I32_24_LCSSA]] = phi i32 [ [[LSR_IV_LCSSA1]], [[BE_6_LOOP_EXIT_7_CRIT_EDGE]] ], [ [[LSR_IV_LCSSA]], [[LOOP_EXIT_7SPLIT]] ]
36 ; LEGACYPM-NEXT: br label [[BB_5:%.*]]
38 ; NEWPM-LABEL: define void @function_0
39 ; NEWPM-SAME: (i32 [[VAL_I32_8:%.*]], i32 [[VAL_I32_9:%.*]]) {
40 ; NEWPM-NEXT: [[VAL_I1_22:%.*]] = trunc i8 -66 to i1
41 ; NEWPM-NEXT: br i1 [[VAL_I1_22]], label [[BB_2_PREHEADER:%.*]], label [[BB_2_PREHEADER]]
42 ; NEWPM: bb_2.preheader:
43 ; NEWPM-NEXT: br label [[BB_2:%.*]]
45 ; NEWPM-NEXT: br label [[PRHDR_LOOP_3:%.*]]
46 ; NEWPM: prhdr_loop_3:
47 ; NEWPM-NEXT: br label [[LOOP_4:%.*]]
49 ; NEWPM-NEXT: [[LSR_IV:%.*]] = phi i32 [ [[LSR_IV_NEXT:%.*]], [[BE_6:%.*]] ], [ 7851, [[PRHDR_LOOP_3]] ]
50 ; NEWPM-NEXT: br i1 [[VAL_I1_22]], label [[BE_6]], label [[LOOP_EXIT_7SPLIT:%.*]]
52 ; NEWPM-NEXT: [[VAL_I32_40:%.*]] = mul i32 [[VAL_I32_9]], [[VAL_I32_24_LCSSA:%.*]]
53 ; NEWPM-NEXT: br label [[BB_2]]
55 ; NEWPM-NEXT: [[LSR_IV_NEXT]] = add i32 [[LSR_IV]], 1
56 ; NEWPM-NEXT: br i1 [[VAL_I1_22]], label [[LOOP_4]], label [[BE_6_LOOP_EXIT_7_CRIT_EDGE:%.*]]
57 ; NEWPM: loop_exit_7split:
58 ; NEWPM-NEXT: [[LSR_IV_LCSSA:%.*]] = phi i32 [ [[LSR_IV]], [[LOOP_4]] ]
59 ; NEWPM-NEXT: br label [[LOOP_EXIT_7:%.*]]
60 ; NEWPM: be_6.loop_exit_7_crit_edge:
61 ; NEWPM-NEXT: [[LSR_IV_LCSSA1:%.*]] = phi i32 [ [[LSR_IV]], [[BE_6]] ]
62 ; NEWPM-NEXT: br label [[LOOP_EXIT_7]]
64 ; NEWPM-NEXT: [[VAL_I32_24_LCSSA]] = phi i32 [ [[LSR_IV_LCSSA1]], [[BE_6_LOOP_EXIT_7_CRIT_EDGE]] ], [ [[LSR_IV_LCSSA]], [[LOOP_EXIT_7SPLIT]] ]
65 ; NEWPM-NEXT: br label [[BB_5:%.*]]
67 %val_i1_22 = trunc i8 -66 to i1
68 br i1 %val_i1_22, label %bb_2, label %bb_2
70 bb_2: ; preds = %bb_5, %entry_1, %entry_1
71 br label %prhdr_loop_3
73 prhdr_loop_3: ; preds = %bb_2
76 loop_4: ; preds = %be_6, %prhdr_loop_3
77 %loop_cnt_i32_11 = phi i32 [ 7850, %prhdr_loop_3 ], [ %val_i32_24, %be_6 ]
78 %val_i32_24 = add i32 %loop_cnt_i32_11, 1
79 br i1 %val_i1_22, label %be_6, label %loop_exit_7
81 bb_5: ; preds = %loop_exit_7
82 %val_i32_40 = mul i32 %val_i32_9, %val_i32_24.lcssa
85 be_6: ; preds = %loop_4
86 br i1 %val_i1_22, label %loop_4, label %loop_exit_7
88 loop_exit_7: ; preds = %be_6, %loop_4
89 %val_i32_24.lcssa = phi i32 [ %val_i32_24, %be_6 ], [ %val_i32_24, %loop_4 ]