annotate gcc/ipa-predicate.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* IPA predicates.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2003-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3 Contributed by Jan Hubicka
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 This file is part of GCC.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
8 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
9 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
10 version.
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
15 for more details.
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
18 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 #include "config.h"
kono
parents:
diff changeset
22 #include "system.h"
kono
parents:
diff changeset
23 #include "coretypes.h"
kono
parents:
diff changeset
24 #include "backend.h"
kono
parents:
diff changeset
25 #include "tree.h"
kono
parents:
diff changeset
26 #include "cgraph.h"
kono
parents:
diff changeset
27 #include "tree-vrp.h"
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
28 #include "alloc-pool.h"
111
kono
parents:
diff changeset
29 #include "symbol-summary.h"
kono
parents:
diff changeset
30 #include "ipa-prop.h"
kono
parents:
diff changeset
31 #include "ipa-fnsummary.h"
kono
parents:
diff changeset
32 #include "real.h"
kono
parents:
diff changeset
33 #include "fold-const.h"
kono
parents:
diff changeset
34 #include "tree-pretty-print.h"
kono
parents:
diff changeset
35 #include "gimple.h"
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
36 #include "gimplify.h"
111
kono
parents:
diff changeset
37 #include "data-streamer.h"
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
40 /* Check whether two set of operations have same effects. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
41 static bool
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
42 expr_eval_ops_equal_p (expr_eval_ops ops1, expr_eval_ops ops2)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
43 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
44 if (ops1)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
45 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
46 if (!ops2 || ops1->length () != ops2->length ())
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
47 return false;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
48
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
49 for (unsigned i = 0; i < ops1->length (); i++)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
50 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
51 expr_eval_op &op1 = (*ops1)[i];
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
52 expr_eval_op &op2 = (*ops2)[i];
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
53
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
54 if (op1.code != op2.code
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
55 || op1.index != op2.index
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
56 || !vrp_operand_equal_p (op1.val[0], op2.val[0])
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
57 || !vrp_operand_equal_p (op1.val[1], op2.val[1])
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
58 || !types_compatible_p (op1.type, op2.type))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
59 return false;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
60 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
61 return true;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
62 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
63 return !ops2;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
64 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
65
111
kono
parents:
diff changeset
66 /* Add clause CLAUSE into the predicate P.
kono
parents:
diff changeset
67 When CONDITIONS is NULL do not perform checking whether NEW_CLAUSE
kono
parents:
diff changeset
68 is obviously true. This is useful only when NEW_CLAUSE is known to be
kono
parents:
diff changeset
69 sane. */
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 void
kono
parents:
diff changeset
72 predicate::add_clause (conditions conditions, clause_t new_clause)
kono
parents:
diff changeset
73 {
kono
parents:
diff changeset
74 int i;
kono
parents:
diff changeset
75 int i2;
kono
parents:
diff changeset
76 int insert_here = -1;
kono
parents:
diff changeset
77 int c1, c2;
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 /* True clause. */
kono
parents:
diff changeset
80 if (!new_clause)
kono
parents:
diff changeset
81 return;
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 /* False clause makes the whole predicate false. Kill the other variants. */
kono
parents:
diff changeset
84 if (new_clause == (1 << predicate::false_condition))
kono
parents:
diff changeset
85 {
kono
parents:
diff changeset
86 *this = false;
kono
parents:
diff changeset
87 return;
kono
parents:
diff changeset
88 }
kono
parents:
diff changeset
89 if (*this == false)
kono
parents:
diff changeset
90 return;
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 /* No one should be silly enough to add false into nontrivial clauses. */
kono
parents:
diff changeset
93 gcc_checking_assert (!(new_clause & (1 << predicate::false_condition)));
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 /* Look where to insert the new_clause. At the same time prune out
kono
parents:
diff changeset
96 new_clauses of P that are implied by the new new_clause and thus
kono
parents:
diff changeset
97 redundant. */
kono
parents:
diff changeset
98 for (i = 0, i2 = 0; i <= max_clauses; i++)
kono
parents:
diff changeset
99 {
kono
parents:
diff changeset
100 m_clause[i2] = m_clause[i];
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 if (!m_clause[i])
kono
parents:
diff changeset
103 break;
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 /* If m_clause[i] implies new_clause, there is nothing to add. */
kono
parents:
diff changeset
106 if ((m_clause[i] & new_clause) == m_clause[i])
kono
parents:
diff changeset
107 {
kono
parents:
diff changeset
108 /* We had nothing to add, none of clauses should've become
kono
parents:
diff changeset
109 redundant. */
kono
parents:
diff changeset
110 gcc_checking_assert (i == i2);
kono
parents:
diff changeset
111 return;
kono
parents:
diff changeset
112 }
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 if (m_clause[i] < new_clause && insert_here < 0)
kono
parents:
diff changeset
115 insert_here = i2;
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 /* If new_clause implies clause[i], then clause[i] becomes redundant.
kono
parents:
diff changeset
118 Otherwise the clause[i] has to stay. */
kono
parents:
diff changeset
119 if ((m_clause[i] & new_clause) != new_clause)
kono
parents:
diff changeset
120 i2++;
kono
parents:
diff changeset
121 }
kono
parents:
diff changeset
122
kono
parents:
diff changeset
123 /* Look for clauses that are obviously true. I.e.
kono
parents:
diff changeset
124 op0 == 5 || op0 != 5. */
kono
parents:
diff changeset
125 if (conditions)
kono
parents:
diff changeset
126 for (c1 = predicate::first_dynamic_condition;
kono
parents:
diff changeset
127 c1 < num_conditions; c1++)
kono
parents:
diff changeset
128 {
kono
parents:
diff changeset
129 condition *cc1;
kono
parents:
diff changeset
130 if (!(new_clause & (1 << c1)))
kono
parents:
diff changeset
131 continue;
kono
parents:
diff changeset
132 cc1 = &(*conditions)[c1 - predicate::first_dynamic_condition];
kono
parents:
diff changeset
133 /* We have no way to represent !changed and !is_not_constant
kono
parents:
diff changeset
134 and thus there is no point for looking for them. */
kono
parents:
diff changeset
135 if (cc1->code == changed || cc1->code == is_not_constant)
kono
parents:
diff changeset
136 continue;
kono
parents:
diff changeset
137 for (c2 = c1 + 1; c2 < num_conditions; c2++)
kono
parents:
diff changeset
138 if (new_clause & (1 << c2))
kono
parents:
diff changeset
139 {
kono
parents:
diff changeset
140 condition *cc2 =
kono
parents:
diff changeset
141 &(*conditions)[c2 - predicate::first_dynamic_condition];
kono
parents:
diff changeset
142 if (cc1->operand_num == cc2->operand_num
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
143 && vrp_operand_equal_p (cc1->val, cc2->val)
111
kono
parents:
diff changeset
144 && cc2->code != is_not_constant
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
145 && cc2->code != changed
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
146 && expr_eval_ops_equal_p (cc1->param_ops, cc2->param_ops)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
147 && cc2->agg_contents == cc1->agg_contents
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
148 && cc2->by_ref == cc1->by_ref
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
149 && types_compatible_p (cc2->type, cc1->type)
111
kono
parents:
diff changeset
150 && cc1->code == invert_tree_comparison (cc2->code,
kono
parents:
diff changeset
151 HONOR_NANS (cc1->val)))
kono
parents:
diff changeset
152 return;
kono
parents:
diff changeset
153 }
kono
parents:
diff changeset
154 }
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156
kono
parents:
diff changeset
157 /* We run out of variants. Be conservative in positive direction. */
kono
parents:
diff changeset
158 if (i2 == max_clauses)
kono
parents:
diff changeset
159 return;
kono
parents:
diff changeset
160 /* Keep clauses in decreasing order. This makes equivalence testing easy. */
kono
parents:
diff changeset
161 m_clause[i2 + 1] = 0;
kono
parents:
diff changeset
162 if (insert_here >= 0)
kono
parents:
diff changeset
163 for (; i2 > insert_here; i2--)
kono
parents:
diff changeset
164 m_clause[i2] = m_clause[i2 - 1];
kono
parents:
diff changeset
165 else
kono
parents:
diff changeset
166 insert_here = i2;
kono
parents:
diff changeset
167 m_clause[insert_here] = new_clause;
kono
parents:
diff changeset
168 }
kono
parents:
diff changeset
169
kono
parents:
diff changeset
170
kono
parents:
diff changeset
171 /* Do THIS &= P. */
kono
parents:
diff changeset
172
kono
parents:
diff changeset
173 predicate &
kono
parents:
diff changeset
174 predicate::operator &= (const predicate &p)
kono
parents:
diff changeset
175 {
kono
parents:
diff changeset
176 /* Avoid busy work. */
kono
parents:
diff changeset
177 if (p == false || *this == true)
kono
parents:
diff changeset
178 {
kono
parents:
diff changeset
179 *this = p;
kono
parents:
diff changeset
180 return *this;
kono
parents:
diff changeset
181 }
kono
parents:
diff changeset
182 if (*this == false || p == true || this == &p)
kono
parents:
diff changeset
183 return *this;
kono
parents:
diff changeset
184
kono
parents:
diff changeset
185 int i;
kono
parents:
diff changeset
186
kono
parents:
diff changeset
187 /* See how far predicates match. */
kono
parents:
diff changeset
188 for (i = 0; m_clause[i] && m_clause[i] == p.m_clause[i]; i++)
kono
parents:
diff changeset
189 {
kono
parents:
diff changeset
190 gcc_checking_assert (i < max_clauses);
kono
parents:
diff changeset
191 }
kono
parents:
diff changeset
192
kono
parents:
diff changeset
193 /* Combine the predicates rest. */
kono
parents:
diff changeset
194 for (; p.m_clause[i]; i++)
kono
parents:
diff changeset
195 {
kono
parents:
diff changeset
196 gcc_checking_assert (i < max_clauses);
kono
parents:
diff changeset
197 add_clause (NULL, p.m_clause[i]);
kono
parents:
diff changeset
198 }
kono
parents:
diff changeset
199 return *this;
kono
parents:
diff changeset
200 }
kono
parents:
diff changeset
201
kono
parents:
diff changeset
202
kono
parents:
diff changeset
203
kono
parents:
diff changeset
204 /* Return THIS | P2. */
kono
parents:
diff changeset
205
kono
parents:
diff changeset
206 predicate
kono
parents:
diff changeset
207 predicate::or_with (conditions conditions,
kono
parents:
diff changeset
208 const predicate &p) const
kono
parents:
diff changeset
209 {
kono
parents:
diff changeset
210 /* Avoid busy work. */
kono
parents:
diff changeset
211 if (p == false || *this == true || *this == p)
kono
parents:
diff changeset
212 return *this;
kono
parents:
diff changeset
213 if (*this == false || p == true)
kono
parents:
diff changeset
214 return p;
kono
parents:
diff changeset
215
kono
parents:
diff changeset
216 /* OK, combine the predicates. */
kono
parents:
diff changeset
217 predicate out = true;
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 for (int i = 0; m_clause[i]; i++)
kono
parents:
diff changeset
220 for (int j = 0; p.m_clause[j]; j++)
kono
parents:
diff changeset
221 {
kono
parents:
diff changeset
222 gcc_checking_assert (i < max_clauses && j < max_clauses);
kono
parents:
diff changeset
223 out.add_clause (conditions, m_clause[i] | p.m_clause[j]);
kono
parents:
diff changeset
224 }
kono
parents:
diff changeset
225 return out;
kono
parents:
diff changeset
226 }
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228
kono
parents:
diff changeset
229 /* Having partial truth assignment in POSSIBLE_TRUTHS, return false
kono
parents:
diff changeset
230 if predicate P is known to be false. */
kono
parents:
diff changeset
231
kono
parents:
diff changeset
232 bool
kono
parents:
diff changeset
233 predicate::evaluate (clause_t possible_truths) const
kono
parents:
diff changeset
234 {
kono
parents:
diff changeset
235 int i;
kono
parents:
diff changeset
236
kono
parents:
diff changeset
237 /* True remains true. */
kono
parents:
diff changeset
238 if (*this == true)
kono
parents:
diff changeset
239 return true;
kono
parents:
diff changeset
240
kono
parents:
diff changeset
241 gcc_assert (!(possible_truths & (1 << predicate::false_condition)));
kono
parents:
diff changeset
242
kono
parents:
diff changeset
243 /* See if we can find clause we can disprove. */
kono
parents:
diff changeset
244 for (i = 0; m_clause[i]; i++)
kono
parents:
diff changeset
245 {
kono
parents:
diff changeset
246 gcc_checking_assert (i < max_clauses);
kono
parents:
diff changeset
247 if (!(m_clause[i] & possible_truths))
kono
parents:
diff changeset
248 return false;
kono
parents:
diff changeset
249 }
kono
parents:
diff changeset
250 return true;
kono
parents:
diff changeset
251 }
kono
parents:
diff changeset
252
kono
parents:
diff changeset
253 /* Return the probability in range 0...REG_BR_PROB_BASE that the predicated
kono
parents:
diff changeset
254 instruction will be recomputed per invocation of the inlined call. */
kono
parents:
diff changeset
255
kono
parents:
diff changeset
256 int
kono
parents:
diff changeset
257 predicate::probability (conditions conds,
kono
parents:
diff changeset
258 clause_t possible_truths,
kono
parents:
diff changeset
259 vec<inline_param_summary> inline_param_summary) const
kono
parents:
diff changeset
260 {
kono
parents:
diff changeset
261 int i;
kono
parents:
diff changeset
262 int combined_prob = REG_BR_PROB_BASE;
kono
parents:
diff changeset
263
kono
parents:
diff changeset
264 /* True remains true. */
kono
parents:
diff changeset
265 if (*this == true)
kono
parents:
diff changeset
266 return REG_BR_PROB_BASE;
kono
parents:
diff changeset
267
kono
parents:
diff changeset
268 if (*this == false)
kono
parents:
diff changeset
269 return 0;
kono
parents:
diff changeset
270
kono
parents:
diff changeset
271 gcc_assert (!(possible_truths & (1 << predicate::false_condition)));
kono
parents:
diff changeset
272
kono
parents:
diff changeset
273 /* See if we can find clause we can disprove. */
kono
parents:
diff changeset
274 for (i = 0; m_clause[i]; i++)
kono
parents:
diff changeset
275 {
kono
parents:
diff changeset
276 gcc_checking_assert (i < max_clauses);
kono
parents:
diff changeset
277 if (!(m_clause[i] & possible_truths))
kono
parents:
diff changeset
278 return 0;
kono
parents:
diff changeset
279 else
kono
parents:
diff changeset
280 {
kono
parents:
diff changeset
281 int this_prob = 0;
kono
parents:
diff changeset
282 int i2;
kono
parents:
diff changeset
283 if (!inline_param_summary.exists ())
kono
parents:
diff changeset
284 return REG_BR_PROB_BASE;
kono
parents:
diff changeset
285 for (i2 = 0; i2 < num_conditions; i2++)
kono
parents:
diff changeset
286 if ((m_clause[i] & possible_truths) & (1 << i2))
kono
parents:
diff changeset
287 {
kono
parents:
diff changeset
288 if (i2 >= predicate::first_dynamic_condition)
kono
parents:
diff changeset
289 {
kono
parents:
diff changeset
290 condition *c =
kono
parents:
diff changeset
291 &(*conds)[i2 - predicate::first_dynamic_condition];
kono
parents:
diff changeset
292 if (c->code == predicate::changed
kono
parents:
diff changeset
293 && (c->operand_num <
kono
parents:
diff changeset
294 (int) inline_param_summary.length ()))
kono
parents:
diff changeset
295 {
kono
parents:
diff changeset
296 int iprob =
kono
parents:
diff changeset
297 inline_param_summary[c->operand_num].change_prob;
kono
parents:
diff changeset
298 this_prob = MAX (this_prob, iprob);
kono
parents:
diff changeset
299 }
kono
parents:
diff changeset
300 else
kono
parents:
diff changeset
301 this_prob = REG_BR_PROB_BASE;
kono
parents:
diff changeset
302 }
kono
parents:
diff changeset
303 else
kono
parents:
diff changeset
304 this_prob = REG_BR_PROB_BASE;
kono
parents:
diff changeset
305 }
kono
parents:
diff changeset
306 combined_prob = MIN (this_prob, combined_prob);
kono
parents:
diff changeset
307 if (!combined_prob)
kono
parents:
diff changeset
308 return 0;
kono
parents:
diff changeset
309 }
kono
parents:
diff changeset
310 }
kono
parents:
diff changeset
311 return combined_prob;
kono
parents:
diff changeset
312 }
kono
parents:
diff changeset
313
kono
parents:
diff changeset
314
kono
parents:
diff changeset
315 /* Dump conditional COND. */
kono
parents:
diff changeset
316
kono
parents:
diff changeset
317 void
kono
parents:
diff changeset
318 dump_condition (FILE *f, conditions conditions, int cond)
kono
parents:
diff changeset
319 {
kono
parents:
diff changeset
320 condition *c;
kono
parents:
diff changeset
321 if (cond == predicate::false_condition)
kono
parents:
diff changeset
322 fprintf (f, "false");
kono
parents:
diff changeset
323 else if (cond == predicate::not_inlined_condition)
kono
parents:
diff changeset
324 fprintf (f, "not inlined");
kono
parents:
diff changeset
325 else
kono
parents:
diff changeset
326 {
kono
parents:
diff changeset
327 c = &(*conditions)[cond - predicate::first_dynamic_condition];
kono
parents:
diff changeset
328 fprintf (f, "op%i", c->operand_num);
kono
parents:
diff changeset
329 if (c->agg_contents)
kono
parents:
diff changeset
330 fprintf (f, "[%soffset: " HOST_WIDE_INT_PRINT_DEC "]",
kono
parents:
diff changeset
331 c->by_ref ? "ref " : "", c->offset);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
332
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
333 for (unsigned i = 0; i < vec_safe_length (c->param_ops); i++)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
334 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
335 expr_eval_op &op = (*(c->param_ops))[i];
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
336 const char *op_name = op_symbol_code (op.code);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
337
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
338 if (op_name == op_symbol_code (ERROR_MARK))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
339 op_name = get_tree_code_name (op.code);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
340
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
341 fprintf (f, ",(");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
342
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
343 if (!op.val[0])
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
344 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
345 switch (op.code)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
346 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
347 case FLOAT_EXPR:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
348 case FIX_TRUNC_EXPR:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
349 case FIXED_CONVERT_EXPR:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
350 case VIEW_CONVERT_EXPR:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
351 CASE_CONVERT:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
352 if (op.code == VIEW_CONVERT_EXPR)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
353 fprintf (f, "VCE");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
354 fprintf (f, "(");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
355 print_generic_expr (f, op.type);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
356 fprintf (f, ")" );
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
357 break;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
358
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
359 default:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
360 fprintf (f, "%s", op_name);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
361 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
362 fprintf (f, " #");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
363 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
364 else if (!op.val[1])
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
365 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
366 if (op.index)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
367 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
368 print_generic_expr (f, op.val[0]);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
369 fprintf (f, " %s #", op_name);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
370 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
371 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
372 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
373 fprintf (f, "# %s ", op_name);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
374 print_generic_expr (f, op.val[0]);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
375 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
376 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
377 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
378 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
379 fprintf (f, "%s ", op_name);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
380 switch (op.index)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
381 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
382 case 0:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
383 fprintf (f, "#, ");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
384 print_generic_expr (f, op.val[0]);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
385 fprintf (f, ", ");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
386 print_generic_expr (f, op.val[1]);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
387 break;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
388
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
389 case 1:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
390 print_generic_expr (f, op.val[0]);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
391 fprintf (f, ", #, ");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
392 print_generic_expr (f, op.val[1]);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
393 break;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
394
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
395 case 2:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
396 print_generic_expr (f, op.val[0]);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
397 fprintf (f, ", ");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
398 print_generic_expr (f, op.val[1]);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
399 fprintf (f, ", #");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
400 break;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
401
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
402 default:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
403 fprintf (f, "*, *, *");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
404 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
405 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
406 fprintf (f, ")");
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
407 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
408
111
kono
parents:
diff changeset
409 if (c->code == predicate::is_not_constant)
kono
parents:
diff changeset
410 {
kono
parents:
diff changeset
411 fprintf (f, " not constant");
kono
parents:
diff changeset
412 return;
kono
parents:
diff changeset
413 }
kono
parents:
diff changeset
414 if (c->code == predicate::changed)
kono
parents:
diff changeset
415 {
kono
parents:
diff changeset
416 fprintf (f, " changed");
kono
parents:
diff changeset
417 return;
kono
parents:
diff changeset
418 }
kono
parents:
diff changeset
419 fprintf (f, " %s ", op_symbol_code (c->code));
kono
parents:
diff changeset
420 print_generic_expr (f, c->val);
kono
parents:
diff changeset
421 }
kono
parents:
diff changeset
422 }
kono
parents:
diff changeset
423
kono
parents:
diff changeset
424
kono
parents:
diff changeset
425 /* Dump clause CLAUSE. */
kono
parents:
diff changeset
426
kono
parents:
diff changeset
427 static void
kono
parents:
diff changeset
428 dump_clause (FILE *f, conditions conds, clause_t clause)
kono
parents:
diff changeset
429 {
kono
parents:
diff changeset
430 int i;
kono
parents:
diff changeset
431 bool found = false;
kono
parents:
diff changeset
432 fprintf (f, "(");
kono
parents:
diff changeset
433 if (!clause)
kono
parents:
diff changeset
434 fprintf (f, "true");
kono
parents:
diff changeset
435 for (i = 0; i < predicate::num_conditions; i++)
kono
parents:
diff changeset
436 if (clause & (1 << i))
kono
parents:
diff changeset
437 {
kono
parents:
diff changeset
438 if (found)
kono
parents:
diff changeset
439 fprintf (f, " || ");
kono
parents:
diff changeset
440 found = true;
kono
parents:
diff changeset
441 dump_condition (f, conds, i);
kono
parents:
diff changeset
442 }
kono
parents:
diff changeset
443 fprintf (f, ")");
kono
parents:
diff changeset
444 }
kono
parents:
diff changeset
445
kono
parents:
diff changeset
446
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
447 /* Dump THIS to F. CONDS a vector of conditions used when evaluating
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
448 predicates. When NL is true new line is output at the end of dump. */
111
kono
parents:
diff changeset
449
kono
parents:
diff changeset
450 void
kono
parents:
diff changeset
451 predicate::dump (FILE *f, conditions conds, bool nl) const
kono
parents:
diff changeset
452 {
kono
parents:
diff changeset
453 int i;
kono
parents:
diff changeset
454 if (*this == true)
kono
parents:
diff changeset
455 dump_clause (f, conds, 0);
kono
parents:
diff changeset
456 else
kono
parents:
diff changeset
457 for (i = 0; m_clause[i]; i++)
kono
parents:
diff changeset
458 {
kono
parents:
diff changeset
459 if (i)
kono
parents:
diff changeset
460 fprintf (f, " && ");
kono
parents:
diff changeset
461 dump_clause (f, conds, m_clause[i]);
kono
parents:
diff changeset
462 }
kono
parents:
diff changeset
463 if (nl)
kono
parents:
diff changeset
464 fprintf (f, "\n");
kono
parents:
diff changeset
465 }
kono
parents:
diff changeset
466
kono
parents:
diff changeset
467
kono
parents:
diff changeset
468 void
kono
parents:
diff changeset
469 predicate::debug (conditions conds) const
kono
parents:
diff changeset
470 {
kono
parents:
diff changeset
471 dump (stderr, conds);
kono
parents:
diff changeset
472 }
kono
parents:
diff changeset
473
kono
parents:
diff changeset
474
kono
parents:
diff changeset
475 /* Remap predicate THIS of former function to be predicate of duplicated function.
kono
parents:
diff changeset
476 POSSIBLE_TRUTHS is clause of possible truths in the duplicated node,
kono
parents:
diff changeset
477 INFO is inline summary of the duplicated node. */
kono
parents:
diff changeset
478
kono
parents:
diff changeset
479 predicate
kono
parents:
diff changeset
480 predicate::remap_after_duplication (clause_t possible_truths)
kono
parents:
diff changeset
481 {
kono
parents:
diff changeset
482 int j;
kono
parents:
diff changeset
483 predicate out = true;
kono
parents:
diff changeset
484 for (j = 0; m_clause[j]; j++)
kono
parents:
diff changeset
485 if (!(possible_truths & m_clause[j]))
kono
parents:
diff changeset
486 return false;
kono
parents:
diff changeset
487 else
kono
parents:
diff changeset
488 out.add_clause (NULL, possible_truths & m_clause[j]);
kono
parents:
diff changeset
489 return out;
kono
parents:
diff changeset
490 }
kono
parents:
diff changeset
491
kono
parents:
diff changeset
492
kono
parents:
diff changeset
493 /* Translate all conditions from callee representation into caller
kono
parents:
diff changeset
494 representation and symbolically evaluate predicate THIS into new predicate.
kono
parents:
diff changeset
495
kono
parents:
diff changeset
496 INFO is ipa_fn_summary of function we are adding predicate into, CALLEE_INFO
kono
parents:
diff changeset
497 is summary of function predicate P is from. OPERAND_MAP is array giving
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
498 callee formal IDs the caller formal IDs. POSSSIBLE_TRUTHS is clause of all
111
kono
parents:
diff changeset
499 callee conditions that may be true in caller context. TOPLEV_PREDICATE is
kono
parents:
diff changeset
500 predicate under which callee is executed. OFFSET_MAP is an array of of
kono
parents:
diff changeset
501 offsets that need to be added to conditions, negative offset means that
kono
parents:
diff changeset
502 conditions relying on values passed by reference have to be discarded
kono
parents:
diff changeset
503 because they might not be preserved (and should be considered offset zero
kono
parents:
diff changeset
504 for other purposes). */
kono
parents:
diff changeset
505
kono
parents:
diff changeset
506 predicate
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
507 predicate::remap_after_inlining (class ipa_fn_summary *info,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
508 class ipa_node_params *params_summary,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
509 class ipa_fn_summary *callee_info,
111
kono
parents:
diff changeset
510 vec<int> operand_map,
kono
parents:
diff changeset
511 vec<int> offset_map,
kono
parents:
diff changeset
512 clause_t possible_truths,
kono
parents:
diff changeset
513 const predicate &toplev_predicate)
kono
parents:
diff changeset
514 {
kono
parents:
diff changeset
515 int i;
kono
parents:
diff changeset
516 predicate out = true;
kono
parents:
diff changeset
517
kono
parents:
diff changeset
518 /* True predicate is easy. */
kono
parents:
diff changeset
519 if (*this == true)
kono
parents:
diff changeset
520 return toplev_predicate;
kono
parents:
diff changeset
521 for (i = 0; m_clause[i]; i++)
kono
parents:
diff changeset
522 {
kono
parents:
diff changeset
523 clause_t clause = m_clause[i];
kono
parents:
diff changeset
524 int cond;
kono
parents:
diff changeset
525 predicate clause_predicate = false;
kono
parents:
diff changeset
526
kono
parents:
diff changeset
527 gcc_assert (i < max_clauses);
kono
parents:
diff changeset
528
kono
parents:
diff changeset
529 for (cond = 0; cond < num_conditions; cond++)
kono
parents:
diff changeset
530 /* Do we have condition we can't disprove? */
kono
parents:
diff changeset
531 if (clause & possible_truths & (1 << cond))
kono
parents:
diff changeset
532 {
kono
parents:
diff changeset
533 predicate cond_predicate;
kono
parents:
diff changeset
534 /* Work out if the condition can translate to predicate in the
kono
parents:
diff changeset
535 inlined function. */
kono
parents:
diff changeset
536 if (cond >= predicate::first_dynamic_condition)
kono
parents:
diff changeset
537 {
kono
parents:
diff changeset
538 struct condition *c;
kono
parents:
diff changeset
539
kono
parents:
diff changeset
540 c = &(*callee_info->conds)[cond
kono
parents:
diff changeset
541 -
kono
parents:
diff changeset
542 predicate::first_dynamic_condition];
kono
parents:
diff changeset
543 /* See if we can remap condition operand to caller's operand.
kono
parents:
diff changeset
544 Otherwise give up. */
kono
parents:
diff changeset
545 if (!operand_map.exists ()
kono
parents:
diff changeset
546 || (int) operand_map.length () <= c->operand_num
kono
parents:
diff changeset
547 || operand_map[c->operand_num] == -1
kono
parents:
diff changeset
548 /* TODO: For non-aggregate conditions, adding an offset is
kono
parents:
diff changeset
549 basically an arithmetic jump function processing which
kono
parents:
diff changeset
550 we should support in future. */
kono
parents:
diff changeset
551 || ((!c->agg_contents || !c->by_ref)
kono
parents:
diff changeset
552 && offset_map[c->operand_num] > 0)
kono
parents:
diff changeset
553 || (c->agg_contents && c->by_ref
kono
parents:
diff changeset
554 && offset_map[c->operand_num] < 0))
kono
parents:
diff changeset
555 cond_predicate = true;
kono
parents:
diff changeset
556 else
kono
parents:
diff changeset
557 {
kono
parents:
diff changeset
558 struct agg_position_info ap;
kono
parents:
diff changeset
559 HOST_WIDE_INT offset_delta = offset_map[c->operand_num];
kono
parents:
diff changeset
560 if (offset_delta < 0)
kono
parents:
diff changeset
561 {
kono
parents:
diff changeset
562 gcc_checking_assert (!c->agg_contents || !c->by_ref);
kono
parents:
diff changeset
563 offset_delta = 0;
kono
parents:
diff changeset
564 }
kono
parents:
diff changeset
565 gcc_assert (!c->agg_contents
kono
parents:
diff changeset
566 || c->by_ref || offset_delta == 0);
kono
parents:
diff changeset
567 ap.offset = c->offset + offset_delta;
kono
parents:
diff changeset
568 ap.agg_contents = c->agg_contents;
kono
parents:
diff changeset
569 ap.by_ref = c->by_ref;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
570 cond_predicate = add_condition (info, params_summary,
111
kono
parents:
diff changeset
571 operand_map[c->operand_num],
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
572 c->type, &ap, c->code,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
573 c->val, c->param_ops);
111
kono
parents:
diff changeset
574 }
kono
parents:
diff changeset
575 }
kono
parents:
diff changeset
576 /* Fixed conditions remains same, construct single
kono
parents:
diff changeset
577 condition predicate. */
kono
parents:
diff changeset
578 else
kono
parents:
diff changeset
579 cond_predicate = predicate::predicate_testing_cond (cond);
kono
parents:
diff changeset
580 clause_predicate = clause_predicate.or_with (info->conds,
kono
parents:
diff changeset
581 cond_predicate);
kono
parents:
diff changeset
582 }
kono
parents:
diff changeset
583 out &= clause_predicate;
kono
parents:
diff changeset
584 }
kono
parents:
diff changeset
585 out &= toplev_predicate;
kono
parents:
diff changeset
586 return out;
kono
parents:
diff changeset
587 }
kono
parents:
diff changeset
588
kono
parents:
diff changeset
589
kono
parents:
diff changeset
590 /* Read predicate from IB. */
kono
parents:
diff changeset
591
kono
parents:
diff changeset
592 void
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
593 predicate::stream_in (class lto_input_block *ib)
111
kono
parents:
diff changeset
594 {
kono
parents:
diff changeset
595 clause_t clause;
kono
parents:
diff changeset
596 int k = 0;
kono
parents:
diff changeset
597
kono
parents:
diff changeset
598 do
kono
parents:
diff changeset
599 {
kono
parents:
diff changeset
600 gcc_assert (k <= max_clauses);
kono
parents:
diff changeset
601 clause = m_clause[k++] = streamer_read_uhwi (ib);
kono
parents:
diff changeset
602 }
kono
parents:
diff changeset
603 while (clause);
kono
parents:
diff changeset
604
kono
parents:
diff changeset
605 /* Zero-initialize the remaining clauses in OUT. */
kono
parents:
diff changeset
606 while (k <= max_clauses)
kono
parents:
diff changeset
607 m_clause[k++] = 0;
kono
parents:
diff changeset
608 }
kono
parents:
diff changeset
609
kono
parents:
diff changeset
610
kono
parents:
diff changeset
611 /* Write predicate P to OB. */
kono
parents:
diff changeset
612
kono
parents:
diff changeset
613 void
kono
parents:
diff changeset
614 predicate::stream_out (struct output_block *ob)
kono
parents:
diff changeset
615 {
kono
parents:
diff changeset
616 int j;
kono
parents:
diff changeset
617 for (j = 0; m_clause[j]; j++)
kono
parents:
diff changeset
618 {
kono
parents:
diff changeset
619 gcc_assert (j < max_clauses);
kono
parents:
diff changeset
620 streamer_write_uhwi (ob, m_clause[j]);
kono
parents:
diff changeset
621 }
kono
parents:
diff changeset
622 streamer_write_uhwi (ob, 0);
kono
parents:
diff changeset
623 }
kono
parents:
diff changeset
624
kono
parents:
diff changeset
625
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
626 /* Add condition to condition list SUMMARY. OPERAND_NUM, TYPE, CODE, VAL and
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
627 PARAM_OPS correspond to fields of condition structure. AGGPOS describes
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
628 whether the used operand is loaded from an aggregate and where in the
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
629 aggregate it is. It can be NULL, which means this not a load from an
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
630 aggregate. */
111
kono
parents:
diff changeset
631
kono
parents:
diff changeset
632 predicate
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
633 add_condition (class ipa_fn_summary *summary,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
634 class ipa_node_params *params_summary,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
635 int operand_num,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
636 tree type, struct agg_position_info *aggpos,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
637 enum tree_code code, tree val, expr_eval_ops param_ops)
111
kono
parents:
diff changeset
638 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
639 int i, j;
111
kono
parents:
diff changeset
640 struct condition *c;
kono
parents:
diff changeset
641 struct condition new_cond;
kono
parents:
diff changeset
642 HOST_WIDE_INT offset;
kono
parents:
diff changeset
643 bool agg_contents, by_ref;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
644 expr_eval_op *op;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
645
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
646 if (params_summary)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
647 ipa_set_param_used_by_ipa_predicates (params_summary, operand_num, true);
111
kono
parents:
diff changeset
648
kono
parents:
diff changeset
649 if (aggpos)
kono
parents:
diff changeset
650 {
kono
parents:
diff changeset
651 offset = aggpos->offset;
kono
parents:
diff changeset
652 agg_contents = aggpos->agg_contents;
kono
parents:
diff changeset
653 by_ref = aggpos->by_ref;
kono
parents:
diff changeset
654 }
kono
parents:
diff changeset
655 else
kono
parents:
diff changeset
656 {
kono
parents:
diff changeset
657 offset = 0;
kono
parents:
diff changeset
658 agg_contents = false;
kono
parents:
diff changeset
659 by_ref = false;
kono
parents:
diff changeset
660 }
kono
parents:
diff changeset
661
kono
parents:
diff changeset
662 gcc_checking_assert (operand_num >= 0);
kono
parents:
diff changeset
663 for (i = 0; vec_safe_iterate (summary->conds, i, &c); i++)
kono
parents:
diff changeset
664 {
kono
parents:
diff changeset
665 if (c->operand_num == operand_num
kono
parents:
diff changeset
666 && c->code == code
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
667 && types_compatible_p (c->type, type)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
668 && vrp_operand_equal_p (c->val, val)
111
kono
parents:
diff changeset
669 && c->agg_contents == agg_contents
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
670 && expr_eval_ops_equal_p (c->param_ops, param_ops)
111
kono
parents:
diff changeset
671 && (!agg_contents || (c->offset == offset && c->by_ref == by_ref)))
kono
parents:
diff changeset
672 return predicate::predicate_testing_cond (i);
kono
parents:
diff changeset
673 }
kono
parents:
diff changeset
674 /* Too many conditions. Give up and return constant true. */
kono
parents:
diff changeset
675 if (i == predicate::num_conditions - predicate::first_dynamic_condition)
kono
parents:
diff changeset
676 return true;
kono
parents:
diff changeset
677
kono
parents:
diff changeset
678 new_cond.operand_num = operand_num;
kono
parents:
diff changeset
679 new_cond.code = code;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
680 new_cond.type = unshare_expr_without_location (type);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
681 new_cond.val = val ? unshare_expr_without_location (val) : val;
111
kono
parents:
diff changeset
682 new_cond.agg_contents = agg_contents;
kono
parents:
diff changeset
683 new_cond.by_ref = by_ref;
kono
parents:
diff changeset
684 new_cond.offset = offset;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
685 new_cond.param_ops = vec_safe_copy (param_ops);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
686
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
687 for (j = 0; vec_safe_iterate (new_cond.param_ops, j, &op); j++)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
688 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
689 if (op->val[0])
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
690 op->val[0] = unshare_expr_without_location (op->val[0]);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
691 if (op->val[1])
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
692 op->val[1] = unshare_expr_without_location (op->val[1]);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
693 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
694
111
kono
parents:
diff changeset
695 vec_safe_push (summary->conds, new_cond);
kono
parents:
diff changeset
696
kono
parents:
diff changeset
697 return predicate::predicate_testing_cond (i);
kono
parents:
diff changeset
698 }