llvm.org GIT mirror llvm / 7f62a83
Simplify irreducible loop metadata test code. Summary: Shorten the irreducible loop metadata test code by removing insignificant instructions. Reviewers: davidxl Reviewed By: davidxl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40043 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318182 91177308-0d34-0410-b5e6-96231b3b80d8 Hiroshi Yamauchi 1 year, 10 months ago
2 changed file(s) with 17 addition(s) and 111 deletion(s). Raw diff Collapse all Expand all
7878 ; Function Attrs: noinline norecurse nounwind uwtable
7979 define i32 @_Z11irreduciblePh(i8* nocapture readonly %p) !prof !27 {
8080 entry:
81 store <2 x i8*> , <2 x i8*>* bitcast ([256 x i8*]* @targets to <2 x i8*>*), align 16
82 store i8* blockaddress(@_Z11irreduciblePh, %TARGET_2), i8** getelementptr inbounds ([256 x i8*], [256 x i8*]* @targets, i64 0, i64 2), align 16
8381 %0 = load i32, i32* @tracing, align 4
82 %1 = trunc i32 %0 to i8
8483 %tobool = icmp eq i32 %0, 0
8584 br label %for.cond1
8685
8786 for.cond1: ; preds = %sw.default, %entry
88 %p.addr.0 = phi i8* [ %p, %entry ], [ %p.addr.4, %sw.default ]
89 %sum.0 = phi i32 [ 0, %entry ], [ %add25, %sw.default ]
90 %incdec.ptr = getelementptr inbounds i8, i8* %p.addr.0, i64 1
91 %1 = load i8, i8* %p.addr.0, align 1
92 %incdec.ptr2 = getelementptr inbounds i8, i8* %p.addr.0, i64 2
93 %2 = load i8, i8* %incdec.ptr, align 1
94 %conv3 = zext i8 %2 to i32
9587 br label %dispatch_op
9688
9789 dispatch_op: ; preds = %sw.bb6, %for.cond1
98 %p.addr.1 = phi i8* [ %incdec.ptr2, %for.cond1 ], [ %p.addr.2, %sw.bb6 ]
99 %op.0 = phi i8 [ %1, %for.cond1 ], [ 1, %sw.bb6 ]
100 %oparg.0 = phi i32 [ %conv3, %for.cond1 ], [ %oparg.2, %sw.bb6 ]
101 %sum.1 = phi i32 [ %sum.0, %for.cond1 ], [ %add7, %sw.bb6 ]
102 switch i8 %op.0, label %sw.default [
90 switch i8 %1, label %sw.default [
10391 i8 0, label %sw.bb
10492 i8 1, label %dispatch_op.sw.bb6_crit_edge
10593 i8 2, label %sw.bb15
10997 br label %sw.bb6
11098
11199 sw.bb: ; preds = %indirectgoto, %dispatch_op
112 %oparg.1 = phi i32 [ %oparg.0, %dispatch_op ], [ 0, %indirectgoto ]
113 %sum.2 = phi i32 [ %sum.1, %dispatch_op ], [ %sum.7, %indirectgoto ]
114 %add.neg = sub i32 -5, %oparg.1
115 %sub = add i32 %add.neg, %sum.2
116100 br label %exit
117101
118102 TARGET_1: ; preds = %indirectgoto
119 %incdec.ptr4 = getelementptr inbounds i8, i8* %add.ptr.pn, i64 2
120 %3 = load i8, i8* %p.addr.5, align 1
121 %conv5 = zext i8 %3 to i32
122103 br label %sw.bb6
123104
124105 sw.bb6: ; preds = %TARGET_1, %dispatch_op.sw.bb6_crit_edge
125 %p.addr.2 = phi i8* [ %incdec.ptr4, %TARGET_1 ], [ %p.addr.1, %dispatch_op.sw.bb6_crit_edge ]
126 %oparg.2 = phi i32 [ %conv5, %TARGET_1 ], [ %oparg.0, %dispatch_op.sw.bb6_crit_edge ]
127 %sum.3 = phi i32 [ %sum.7, %TARGET_1 ], [ %sum.1, %dispatch_op.sw.bb6_crit_edge ]
128 %mul = mul nsw i32 %oparg.2, 7
129 %add7 = add nsw i32 %sum.3, %mul
130 %rem46 = and i32 %add7, 1
131 %cmp8 = icmp eq i32 %rem46, 0
132 br i1 %cmp8, label %dispatch_op, label %if.then, !prof !37, !irr_loop !38
106 br i1 %tobool, label %dispatch_op, label %if.then, !prof !37, !irr_loop !38
133107
134108 if.then: ; preds = %sw.bb6
135 %mul9 = mul nsw i32 %add7, 9
136109 br label %indirectgoto
137110
138111 TARGET_2: ; preds = %indirectgoto
139 %incdec.ptr13 = getelementptr inbounds i8, i8* %add.ptr.pn, i64 2
140 %4 = load i8, i8* %p.addr.5, align 1
141 %conv14 = zext i8 %4 to i32
142112 br label %sw.bb15
143113
144114 sw.bb15: ; preds = %TARGET_2, %dispatch_op
145 %p.addr.3 = phi i8* [ %p.addr.1, %dispatch_op ], [ %incdec.ptr13, %TARGET_2 ]
146 %oparg.3 = phi i32 [ %oparg.0, %dispatch_op ], [ %conv14, %TARGET_2 ]
147 %sum.4 = phi i32 [ %sum.1, %dispatch_op ], [ %sum.7, %TARGET_2 ]
148 %add16 = add nsw i32 %oparg.3, 3
149 %add17 = add nsw i32 %add16, %sum.4
150115 br i1 %tobool, label %if.then18, label %exit, !prof !39, !irr_loop !40
151116
152117 if.then18: ; preds = %sw.bb15
153 %idx.ext = sext i32 %oparg.3 to i64
154 %add.ptr = getelementptr inbounds i8, i8* %p.addr.3, i64 %idx.ext
155 %mul19 = mul nsw i32 %add17, 17
156118 br label %indirectgoto
157119
158120 unknown_op: ; preds = %indirectgoto
159 %sub24 = add nsw i32 %sum.7, -4
160121 br label %sw.default
161122
162123 sw.default: ; preds = %unknown_op, %dispatch_op
163 %p.addr.4 = phi i8* [ %p.addr.5, %unknown_op ], [ %p.addr.1, %dispatch_op ]
164 %sum.5 = phi i32 [ %sub24, %unknown_op ], [ %sum.1, %dispatch_op ]
165 %add25 = add nsw i32 %sum.5, 11
166124 br label %for.cond1
167125
168126 exit: ; preds = %sw.bb15, %sw.bb
169 %sum.6 = phi i32 [ %sub, %sw.bb ], [ %add17, %sw.bb15 ]
170 ret i32 %sum.6
127 ret i32 0
171128
172129 indirectgoto: ; preds = %if.then18, %if.then
173 %add.ptr.pn = phi i8* [ %add.ptr, %if.then18 ], [ %p.addr.2, %if.then ]
174 %sum.7 = phi i32 [ %mul19, %if.then18 ], [ %mul9, %if.then ]
175 %p.addr.5 = getelementptr inbounds i8, i8* %add.ptr.pn, i64 1
176 %5 = load i8, i8* %add.ptr.pn, align 1
177 %idxprom21 = zext i8 %5 to i64
130 %idxprom21 = zext i32 %0 to i64
178131 %arrayidx22 = getelementptr inbounds [256 x i8*], [256 x i8*]* @targets, i64 0, i64 %idxprom21
179 %6 = load i8*, i8** %arrayidx22, align 8
180 indirectbr i8* %6, [label %unknown_op, label %sw.bb, label %TARGET_1, label %TARGET_2], !prof !41, !irr_loop !42
132 %target = load i8*, i8** %arrayidx22, align 8
133 indirectbr i8* %target, [label %unknown_op, label %sw.bb, label %TARGET_1, label %TARGET_2], !prof !41, !irr_loop !42
181134 }
182135
183136 !36 = !{!"branch_weights", i32 0, i32 0, i32 201, i32 1}
6767 ; Function Attrs: noinline norecurse nounwind uwtable
6868 define i32 @_Z11irreduciblePh(i8* nocapture readonly %p) {
6969 entry:
70 store <2 x i8*> , <2 x i8*>* bitcast ([256 x i8*]* @targets to <2 x i8*>*), align 16
71 store i8* blockaddress(@_Z11irreduciblePh, %TARGET_2), i8** getelementptr inbounds ([256 x i8*], [256 x i8*]* @targets, i64 0, i64 2), align 16
7270 %0 = load i32, i32* @tracing, align 4
71 %1 = trunc i32 %0 to i8
7372 %tobool = icmp eq i32 %0, 0
7473 br label %for.cond1
7574
7675 for.cond1: ; preds = %sw.default, %entry
77 %p.addr.0 = phi i8* [ %p, %entry ], [ %p.addr.4, %sw.default ]
78 %sum.0 = phi i32 [ 0, %entry ], [ %add25, %sw.default ]
79 %incdec.ptr = getelementptr inbounds i8, i8* %p.addr.0, i64 1
80 %1 = load i8, i8* %p.addr.0, align 1
81 %incdec.ptr2 = getelementptr inbounds i8, i8* %p.addr.0, i64 2
82 %2 = load i8, i8* %incdec.ptr, align 1
83 %conv3 = zext i8 %2 to i32
8476 br label %dispatch_op
8577
8678 dispatch_op: ; preds = %sw.bb6, %for.cond1
87 %p.addr.1 = phi i8* [ %incdec.ptr2, %for.cond1 ], [ %p.addr.2, %sw.bb6 ]
88 %op.0 = phi i8 [ %1, %for.cond1 ], [ 1, %sw.bb6 ]
89 %oparg.0 = phi i32 [ %conv3, %for.cond1 ], [ %oparg.2, %sw.bb6 ]
90 %sum.1 = phi i32 [ %sum.0, %for.cond1 ], [ %add7, %sw.bb6 ]
91 switch i8 %op.0, label %sw.default [
79 switch i8 %1, label %sw.default [
9280 i8 0, label %sw.bb
9381 i8 1, label %dispatch_op.sw.bb6_crit_edge
9482 i8 2, label %sw.bb15
9886 br label %sw.bb6
9987
10088 sw.bb: ; preds = %indirectgoto, %dispatch_op
101 %oparg.1 = phi i32 [ %oparg.0, %dispatch_op ], [ 0, %indirectgoto ]
102 %sum.2 = phi i32 [ %sum.1, %dispatch_op ], [ %sum.7, %indirectgoto ]
103 %add.neg = sub i32 -5, %oparg.1
104 %sub = add i32 %add.neg, %sum.2
10589 br label %exit
10690
10791 TARGET_1: ; preds = %indirectgoto
108 %incdec.ptr4 = getelementptr inbounds i8, i8* %add.ptr.pn, i64 2
109 %3 = load i8, i8* %p.addr.5, align 1
110 %conv5 = zext i8 %3 to i32
11192 br label %sw.bb6
11293
113 sw.bb6: ; preds = %dispatch_op.sw.bb6_crit_edge, %TARGET_1
114 %p.addr.2 = phi i8* [ %incdec.ptr4, %TARGET_1 ], [ %p.addr.1, %dispatch_op.sw.bb6_crit_edge ]
115 %oparg.2 = phi i32 [ %conv5, %TARGET_1 ], [ %oparg.0, %dispatch_op.sw.bb6_crit_edge ]
116 %sum.3 = phi i32 [ %sum.7, %TARGET_1 ], [ %sum.1, %dispatch_op.sw.bb6_crit_edge ]
117 %mul = mul nsw i32 %oparg.2, 7
118 %add7 = add nsw i32 %sum.3, %mul
119 %rem46 = and i32 %add7, 1
120 %cmp8 = icmp eq i32 %rem46, 0
121 br i1 %cmp8, label %dispatch_op, label %if.then
122 ; USE: br i1 %cmp8, label %dispatch_op, label %if.then, !prof !{{[0-9]+}},
94 sw.bb6: ; preds = %TARGET_1, %dispatch_op.sw.bb6_crit_edge
95 br i1 %tobool, label %dispatch_op, label %if.then
96 ; USE: br i1 %tobool, label %dispatch_op, label %if.then, !prof !{{[0-9]+}},
12397 ; USE-SAME: !irr_loop ![[SW_BB6_IRR_LOOP:[0-9]+]]
12498
12599 if.then: ; preds = %sw.bb6
126 %mul9 = mul nsw i32 %add7, 9
127100 br label %indirectgoto
128101
129102 TARGET_2: ; preds = %indirectgoto
130 %incdec.ptr13 = getelementptr inbounds i8, i8* %add.ptr.pn, i64 2
131 %4 = load i8, i8* %p.addr.5, align 1
132 %conv14 = zext i8 %4 to i32
133103 br label %sw.bb15
134104
135105 sw.bb15: ; preds = %TARGET_2, %dispatch_op
136 %p.addr.3 = phi i8* [ %p.addr.1, %dispatch_op ], [ %incdec.ptr13, %TARGET_2 ]
137 %oparg.3 = phi i32 [ %oparg.0, %dispatch_op ], [ %conv14, %TARGET_2 ]
138 %sum.4 = phi i32 [ %sum.1, %dispatch_op ], [ %sum.7, %TARGET_2 ]
139 %add16 = add nsw i32 %oparg.3, 3
140 %add17 = add nsw i32 %add16, %sum.4
141106 br i1 %tobool, label %if.then18, label %exit
142107 ; USE: br i1 %tobool, label %if.then18, label %exit, !prof !{{[0-9]+}},
143108 ; USE-SAME: !irr_loop ![[SW_BB15_IRR_LOOP:[0-9]+]]
144109
145110 if.then18: ; preds = %sw.bb15
146 %idx.ext = sext i32 %oparg.3 to i64
147 %add.ptr = getelementptr inbounds i8, i8* %p.addr.3, i64 %idx.ext
148 %mul19 = mul nsw i32 %add17, 17
149111 br label %indirectgoto
150112
151113 unknown_op: ; preds = %indirectgoto
152 %sub24 = add nsw i32 %sum.7, -4
153114 br label %sw.default
154115
155116 sw.default: ; preds = %unknown_op, %dispatch_op
156 %p.addr.4 = phi i8* [ %p.addr.5, %unknown_op ], [ %p.addr.1, %dispatch_op ]
157 %sum.5 = phi i32 [ %sub24, %unknown_op ], [ %sum.1, %dispatch_op ]
158 %add25 = add nsw i32 %sum.5, 11
159117 br label %for.cond1
160118
161119 exit: ; preds = %sw.bb15, %sw.bb
162 %sum.6 = phi i32 [ %sub, %sw.bb ], [ %add17, %sw.bb15 ]
163 ret i32 %sum.6
120 ret i32 0
164121
165122 indirectgoto: ; preds = %if.then18, %if.then
166 %add.ptr.pn = phi i8* [ %add.ptr, %if.then18 ], [ %p.addr.2, %if.then ]
167 %sum.7 = phi i32 [ %mul19, %if.then18 ], [ %mul9, %if.then ]
168 %p.addr.5 = getelementptr inbounds i8, i8* %add.ptr.pn, i64 1
169 %5 = load i8, i8* %add.ptr.pn, align 1
170 %idxprom21 = zext i8 %5 to i64
123 %idxprom21 = zext i32 %0 to i64
171124 %arrayidx22 = getelementptr inbounds [256 x i8*], [256 x i8*]* @targets, i64 0, i64 %idxprom21
172 %6 = load i8*, i8** %arrayidx22, align 8
173 indirectbr i8* %6, [label %unknown_op, label %sw.bb, label %TARGET_1, label %TARGET_2]
174 ; USE: indirectbr i8* %6, [label %unknown_op, label %sw.bb, label %TARGET_1, label %TARGET_2], !prof !{{[0-9]+}},
125 %target = load i8*, i8** %arrayidx22, align 8
126 indirectbr i8* %target, [label %unknown_op, label %sw.bb, label %TARGET_1, label %TARGET_2]
127 ; USE: indirectbr i8* %target, [label %unknown_op, label %sw.bb, label %TARGET_1, label %TARGET_2], !prof !{{[0-9]+}},
175128 ; USE-SAME: !irr_loop ![[INDIRECTGOTO_IRR_LOOP:[0-9]+]]
176129 }
177130