150
|
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
2 ; PR28705
|
236
|
3 ; RUN: opt < %s -passes=indvars -S | FileCheck %s
|
150
|
4
|
|
5 ; Check IndVarSimplify doesn't replace external use of the induction var
|
|
6 ; "%inc.i.i" with "%.sroa.speculated + 1" because it is not profitable.
|
|
7 ;
|
|
8 ;
|
252
|
9 define void @foo(i32 %sub.ptr.div.i, ptr %ref.i1174) local_unnamed_addr {
|
150
|
10 ; CHECK-LABEL: @foo(
|
|
11 ; CHECK-NEXT: entry:
|
|
12 ; CHECK-NEXT: [[CMP_I1137:%.*]] = icmp ugt i32 [[SUB_PTR_DIV_I:%.*]], 3
|
|
13 ; CHECK-NEXT: [[DOTSROA_SPECULATED:%.*]] = select i1 [[CMP_I1137]], i32 3, i32 [[SUB_PTR_DIV_I]]
|
|
14 ; CHECK-NEXT: [[CMP6483126:%.*]] = icmp eq i32 [[DOTSROA_SPECULATED]], 0
|
|
15 ; CHECK-NEXT: br i1 [[CMP6483126]], label [[XZ_EXIT:%.*]], label [[FOR_BODY650_LR_PH:%.*]]
|
|
16 ; CHECK: for.body650.lr.ph:
|
|
17 ; CHECK-NEXT: br label [[FOR_BODY650:%.*]]
|
|
18 ; CHECK: loopexit:
|
|
19 ; CHECK-NEXT: [[INC_I_I_LCSSA:%.*]] = phi i32 [ [[INC_I_I:%.*]], [[FOR_BODY650]] ]
|
|
20 ; CHECK-NEXT: br label [[XZ_EXIT]]
|
|
21 ; CHECK: XZ.exit:
|
|
22 ; CHECK-NEXT: [[DB_SROA_9_0_LCSSA:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ], [ [[INC_I_I_LCSSA]], [[LOOPEXIT:%.*]] ]
|
|
23 ; CHECK-NEXT: br label [[END:%.*]]
|
|
24 ; CHECK: for.body650:
|
|
25 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[FOR_BODY650_LR_PH]] ], [ [[INC655:%.*]], [[FOR_BODY650]] ]
|
|
26 ; CHECK-NEXT: [[IV2:%.*]] = phi i32 [ 1, [[FOR_BODY650_LR_PH]] ], [ [[INC_I_I]], [[FOR_BODY650]] ]
|
252
|
27 ; CHECK-NEXT: [[ARRAYIDX_I_I1105:%.*]] = getelementptr inbounds i8, ptr [[REF_I1174:%.*]], i32 [[IV2]]
|
|
28 ; CHECK-NEXT: store i8 7, ptr [[ARRAYIDX_I_I1105]], align 1
|
150
|
29 ; CHECK-NEXT: [[INC_I_I]] = add nuw nsw i32 [[IV2]], 1
|
|
30 ; CHECK-NEXT: [[INC655]] = add nuw nsw i32 [[IV]], 1
|
|
31 ; CHECK-NEXT: [[CMP648:%.*]] = icmp eq i32 [[INC655]], [[DOTSROA_SPECULATED]]
|
|
32 ; CHECK-NEXT: br i1 [[CMP648]], label [[LOOPEXIT]], label [[FOR_BODY650]]
|
|
33 ; CHECK: end:
|
|
34 ; CHECK-NEXT: ret void
|
|
35 ;
|
|
36 entry:
|
|
37 %cmp.i1137 = icmp ugt i32 %sub.ptr.div.i, 3
|
|
38 %.sroa.speculated = select i1 %cmp.i1137, i32 3, i32 %sub.ptr.div.i
|
|
39 %cmp6483126 = icmp eq i32 %.sroa.speculated, 0
|
|
40 br i1 %cmp6483126, label %XZ.exit, label %for.body650.lr.ph
|
|
41
|
|
42 for.body650.lr.ph:
|
|
43 br label %for.body650
|
|
44
|
|
45 loopexit:
|
|
46 %inc.i.i.lcssa = phi i32 [ %inc.i.i, %for.body650 ]
|
|
47 br label %XZ.exit
|
|
48
|
|
49 XZ.exit:
|
|
50 %DB.sroa.9.0.lcssa = phi i32 [ 1, %entry ], [ %inc.i.i.lcssa, %loopexit ]
|
|
51 br label %end
|
|
52
|
|
53 for.body650:
|
|
54 %iv = phi i32 [ 0, %for.body650.lr.ph ], [ %inc655, %for.body650 ]
|
|
55 %iv2 = phi i32 [ 1, %for.body650.lr.ph ], [ %inc.i.i, %for.body650 ]
|
252
|
56 %arrayidx.i.i1105 = getelementptr inbounds i8, ptr %ref.i1174, i32 %iv2
|
|
57 store i8 7, ptr %arrayidx.i.i1105, align 1
|
150
|
58 %inc.i.i = add i32 %iv2, 1
|
|
59 %inc655 = add i32 %iv, 1
|
|
60 %cmp648 = icmp eq i32 %inc655, %.sroa.speculated
|
|
61 br i1 %cmp648, label %loopexit, label %for.body650
|
|
62
|
|
63 end:
|
|
64 ret void
|
|
65 }
|