File: | build/gcc/omp-expand.c |
Warning: | line 7207, column 5 Value stored to 't' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* Expansion pass for OMP directives. Outlines regions of certain OMP |
2 | directives to separate functions, converts others into explicit calls to the |
3 | runtime library (libgomp) and so forth |
4 | |
5 | Copyright (C) 2005-2021 Free Software Foundation, Inc. |
6 | |
7 | This file is part of GCC. |
8 | |
9 | GCC is free software; you can redistribute it and/or modify it under |
10 | the terms of the GNU General Public License as published by the Free |
11 | Software Foundation; either version 3, or (at your option) any later |
12 | version. |
13 | |
14 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
15 | WARRANTY; without even the implied warranty of MERCHANTABILITY or |
16 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
17 | for more details. |
18 | |
19 | You should have received a copy of the GNU General Public License |
20 | along with GCC; see the file COPYING3. If not see |
21 | <http://www.gnu.org/licenses/>. */ |
22 | |
23 | #include "config.h" |
24 | #include "system.h" |
25 | #include "coretypes.h" |
26 | #include "memmodel.h" |
27 | #include "backend.h" |
28 | #include "target.h" |
29 | #include "rtl.h" |
30 | #include "tree.h" |
31 | #include "gimple.h" |
32 | #include "cfghooks.h" |
33 | #include "tree-pass.h" |
34 | #include "ssa.h" |
35 | #include "optabs.h" |
36 | #include "cgraph.h" |
37 | #include "pretty-print.h" |
38 | #include "diagnostic-core.h" |
39 | #include "fold-const.h" |
40 | #include "stor-layout.h" |
41 | #include "cfganal.h" |
42 | #include "internal-fn.h" |
43 | #include "gimplify.h" |
44 | #include "gimple-iterator.h" |
45 | #include "gimplify-me.h" |
46 | #include "gimple-walk.h" |
47 | #include "tree-cfg.h" |
48 | #include "tree-into-ssa.h" |
49 | #include "tree-ssa.h" |
50 | #include "splay-tree.h" |
51 | #include "cfgloop.h" |
52 | #include "omp-general.h" |
53 | #include "omp-offload.h" |
54 | #include "tree-cfgcleanup.h" |
55 | #include "alloc-pool.h" |
56 | #include "symbol-summary.h" |
57 | #include "gomp-constants.h" |
58 | #include "gimple-pretty-print.h" |
59 | #include "stringpool.h" |
60 | #include "attribs.h" |
61 | #include "tree-eh.h" |
62 | |
63 | /* OMP region information. Every parallel and workshare |
64 | directive is enclosed between two markers, the OMP_* directive |
65 | and a corresponding GIMPLE_OMP_RETURN statement. */ |
66 | |
67 | struct omp_region |
68 | { |
69 | /* The enclosing region. */ |
70 | struct omp_region *outer; |
71 | |
72 | /* First child region. */ |
73 | struct omp_region *inner; |
74 | |
75 | /* Next peer region. */ |
76 | struct omp_region *next; |
77 | |
78 | /* Block containing the omp directive as its last stmt. */ |
79 | basic_block entry; |
80 | |
81 | /* Block containing the GIMPLE_OMP_RETURN as its last stmt. */ |
82 | basic_block exit; |
83 | |
84 | /* Block containing the GIMPLE_OMP_CONTINUE as its last stmt. */ |
85 | basic_block cont; |
86 | |
87 | /* If this is a combined parallel+workshare region, this is a list |
88 | of additional arguments needed by the combined parallel+workshare |
89 | library call. */ |
90 | vec<tree, va_gc> *ws_args; |
91 | |
92 | /* The code for the omp directive of this region. */ |
93 | enum gimple_code type; |
94 | |
95 | /* Schedule kind, only used for GIMPLE_OMP_FOR type regions. */ |
96 | enum omp_clause_schedule_kind sched_kind; |
97 | |
98 | /* Schedule modifiers. */ |
99 | unsigned char sched_modifiers; |
100 | |
101 | /* True if this is a combined parallel+workshare region. */ |
102 | bool is_combined_parallel; |
103 | |
104 | /* Copy of fd.lastprivate_conditional != 0. */ |
105 | bool has_lastprivate_conditional; |
106 | |
107 | /* The ordered stmt if type is GIMPLE_OMP_ORDERED and it has |
108 | a depend clause. */ |
109 | gomp_ordered *ord_stmt; |
110 | }; |
111 | |
112 | static struct omp_region *root_omp_region; |
113 | static bool omp_any_child_fn_dumped; |
114 | |
115 | static void expand_omp_build_assign (gimple_stmt_iterator *, tree, tree, |
116 | bool = false); |
117 | static gphi *find_phi_with_arg_on_edge (tree, edge); |
118 | static void expand_omp (struct omp_region *region); |
119 | |
120 | /* Return true if REGION is a combined parallel+workshare region. */ |
121 | |
122 | static inline bool |
123 | is_combined_parallel (struct omp_region *region) |
124 | { |
125 | return region->is_combined_parallel; |
126 | } |
127 | |
128 | /* Given two blocks PAR_ENTRY_BB and WS_ENTRY_BB such that WS_ENTRY_BB |
129 | is the immediate dominator of PAR_ENTRY_BB, return true if there |
130 | are no data dependencies that would prevent expanding the parallel |
131 | directive at PAR_ENTRY_BB as a combined parallel+workshare region. |
132 | |
133 | When expanding a combined parallel+workshare region, the call to |
134 | the child function may need additional arguments in the case of |
135 | GIMPLE_OMP_FOR regions. In some cases, these arguments are |
136 | computed out of variables passed in from the parent to the child |
137 | via 'struct .omp_data_s'. For instance: |
138 | |
139 | #pragma omp parallel for schedule (guided, i * 4) |
140 | for (j ...) |
141 | |
142 | Is lowered into: |
143 | |
144 | # BLOCK 2 (PAR_ENTRY_BB) |
145 | .omp_data_o.i = i; |
146 | #pragma omp parallel [child fn: bar.omp_fn.0 ( ..., D.1598) |
147 | |
148 | # BLOCK 3 (WS_ENTRY_BB) |
149 | .omp_data_i = &.omp_data_o; |
150 | D.1667 = .omp_data_i->i; |
151 | D.1598 = D.1667 * 4; |
152 | #pragma omp for schedule (guided, D.1598) |
153 | |
154 | When we outline the parallel region, the call to the child function |
155 | 'bar.omp_fn.0' will need the value D.1598 in its argument list, but |
156 | that value is computed *after* the call site. So, in principle we |
157 | cannot do the transformation. |
158 | |
159 | To see whether the code in WS_ENTRY_BB blocks the combined |
160 | parallel+workshare call, we collect all the variables used in the |
161 | GIMPLE_OMP_FOR header check whether they appear on the LHS of any |
162 | statement in WS_ENTRY_BB. If so, then we cannot emit the combined |
163 | call. |
164 | |
165 | FIXME. If we had the SSA form built at this point, we could merely |
166 | hoist the code in block 3 into block 2 and be done with it. But at |
167 | this point we don't have dataflow information and though we could |
168 | hack something up here, it is really not worth the aggravation. */ |
169 | |
170 | static bool |
171 | workshare_safe_to_combine_p (basic_block ws_entry_bb) |
172 | { |
173 | struct omp_for_data fd; |
174 | gimple *ws_stmt = last_stmt (ws_entry_bb); |
175 | |
176 | if (gimple_code (ws_stmt) == GIMPLE_OMP_SECTIONS) |
177 | return true; |
178 | |
179 | gcc_assert (gimple_code (ws_stmt) == GIMPLE_OMP_FOR)((void)(!(gimple_code (ws_stmt) == GIMPLE_OMP_FOR) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 179, __FUNCTION__), 0 : 0)); |
180 | if (gimple_omp_for_kind (ws_stmt) != GF_OMP_FOR_KIND_FOR) |
181 | return false; |
182 | |
183 | omp_extract_for_data (as_a <gomp_for *> (ws_stmt), &fd, NULLnullptr); |
184 | |
185 | if (fd.collapse > 1 && TREE_CODE (fd.loop.n2)((enum tree_code) (fd.loop.n2)->base.code) != INTEGER_CST) |
186 | return false; |
187 | if (fd.iter_type != long_integer_type_nodeinteger_types[itk_long]) |
188 | return false; |
189 | |
190 | /* FIXME. We give up too easily here. If any of these arguments |
191 | are not constants, they will likely involve variables that have |
192 | been mapped into fields of .omp_data_s for sharing with the child |
193 | function. With appropriate data flow, it would be possible to |
194 | see through this. */ |
195 | if (!is_gimple_min_invariant (fd.loop.n1) |
196 | || !is_gimple_min_invariant (fd.loop.n2) |
197 | || !is_gimple_min_invariant (fd.loop.step) |
198 | || (fd.chunk_size && !is_gimple_min_invariant (fd.chunk_size))) |
199 | return false; |
200 | |
201 | return true; |
202 | } |
203 | |
204 | /* Adjust CHUNK_SIZE from SCHEDULE clause, depending on simd modifier |
205 | presence (SIMD_SCHEDULE). */ |
206 | |
207 | static tree |
208 | omp_adjust_chunk_size (tree chunk_size, bool simd_schedule) |
209 | { |
210 | if (!simd_schedule || integer_zerop (chunk_size)) |
211 | return chunk_size; |
212 | |
213 | poly_uint64 vf = omp_max_vf (); |
214 | if (known_eq (vf, 1U)(!maybe_ne (vf, 1U))) |
215 | return chunk_size; |
216 | |
217 | tree type = TREE_TYPE (chunk_size)((contains_struct_check ((chunk_size), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 217, __FUNCTION__))->typed.type); |
218 | chunk_size = fold_build2 (PLUS_EXPR, type, chunk_size,fold_build2_loc (((location_t) 0), PLUS_EXPR, type, chunk_size , build_int_cst (type, vf - 1) ) |
219 | build_int_cst (type, vf - 1))fold_build2_loc (((location_t) 0), PLUS_EXPR, type, chunk_size , build_int_cst (type, vf - 1) ); |
220 | return fold_build2 (BIT_AND_EXPR, type, chunk_size,fold_build2_loc (((location_t) 0), BIT_AND_EXPR, type, chunk_size , build_int_cst (type, -vf) ) |
221 | build_int_cst (type, -vf))fold_build2_loc (((location_t) 0), BIT_AND_EXPR, type, chunk_size , build_int_cst (type, -vf) ); |
222 | } |
223 | |
224 | /* Collect additional arguments needed to emit a combined |
225 | parallel+workshare call. WS_STMT is the workshare directive being |
226 | expanded. */ |
227 | |
228 | static vec<tree, va_gc> * |
229 | get_ws_args_for (gimple *par_stmt, gimple *ws_stmt) |
230 | { |
231 | tree t; |
232 | location_t loc = gimple_location (ws_stmt); |
233 | vec<tree, va_gc> *ws_args; |
234 | |
235 | if (gomp_for *for_stmt = dyn_cast <gomp_for *> (ws_stmt)) |
236 | { |
237 | struct omp_for_data fd; |
238 | tree n1, n2; |
239 | |
240 | omp_extract_for_data (for_stmt, &fd, NULLnullptr); |
241 | n1 = fd.loop.n1; |
242 | n2 = fd.loop.n2; |
243 | |
244 | if (gimple_omp_for_combined_into_p (for_stmt)) |
245 | { |
246 | tree innerc |
247 | = omp_find_clause (gimple_omp_parallel_clauses (par_stmt), |
248 | OMP_CLAUSE__LOOPTEMP_); |
249 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 249, __FUNCTION__), 0 : 0)); |
250 | n1 = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 250, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 250, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 250, __FUNCTION__))); |
251 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 251, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 251, __FUNCTION__))->common.chain), |
252 | OMP_CLAUSE__LOOPTEMP_); |
253 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 253, __FUNCTION__), 0 : 0)); |
254 | n2 = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 254, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 254, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 254, __FUNCTION__))); |
255 | } |
256 | |
257 | vec_alloc (ws_args, 3 + (fd.chunk_size != 0)); |
258 | |
259 | t = fold_convert_loc (loc, long_integer_type_nodeinteger_types[itk_long], n1); |
260 | ws_args->quick_push (t); |
261 | |
262 | t = fold_convert_loc (loc, long_integer_type_nodeinteger_types[itk_long], n2); |
263 | ws_args->quick_push (t); |
264 | |
265 | t = fold_convert_loc (loc, long_integer_type_nodeinteger_types[itk_long], fd.loop.step); |
266 | ws_args->quick_push (t); |
267 | |
268 | if (fd.chunk_size) |
269 | { |
270 | t = fold_convert_loc (loc, long_integer_type_nodeinteger_types[itk_long], fd.chunk_size); |
271 | t = omp_adjust_chunk_size (t, fd.simd_schedule); |
272 | ws_args->quick_push (t); |
273 | } |
274 | |
275 | return ws_args; |
276 | } |
277 | else if (gimple_code (ws_stmt) == GIMPLE_OMP_SECTIONS) |
278 | { |
279 | /* Number of sections is equal to the number of edges from the |
280 | GIMPLE_OMP_SECTIONS_SWITCH statement, except for the one to |
281 | the exit of the sections region. */ |
282 | basic_block bb = single_succ (gimple_bb (ws_stmt)); |
283 | t = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], EDGE_COUNT (bb->succs)vec_safe_length (bb->succs) - 1); |
284 | vec_alloc (ws_args, 1); |
285 | ws_args->quick_push (t); |
286 | return ws_args; |
287 | } |
288 | |
289 | gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 289, __FUNCTION__)); |
290 | } |
291 | |
292 | /* Discover whether REGION is a combined parallel+workshare region. */ |
293 | |
294 | static void |
295 | determine_parallel_type (struct omp_region *region) |
296 | { |
297 | basic_block par_entry_bb, par_exit_bb; |
298 | basic_block ws_entry_bb, ws_exit_bb; |
299 | |
300 | if (region == NULLnullptr || region->inner == NULLnullptr |
301 | || region->exit == NULLnullptr || region->inner->exit == NULLnullptr |
302 | || region->inner->cont == NULLnullptr) |
303 | return; |
304 | |
305 | /* We only support parallel+for and parallel+sections. */ |
306 | if (region->type != GIMPLE_OMP_PARALLEL |
307 | || (region->inner->type != GIMPLE_OMP_FOR |
308 | && region->inner->type != GIMPLE_OMP_SECTIONS)) |
309 | return; |
310 | |
311 | /* Check for perfect nesting PAR_ENTRY_BB -> WS_ENTRY_BB and |
312 | WS_EXIT_BB -> PAR_EXIT_BB. */ |
313 | par_entry_bb = region->entry; |
314 | par_exit_bb = region->exit; |
315 | ws_entry_bb = region->inner->entry; |
316 | ws_exit_bb = region->inner->exit; |
317 | |
318 | /* Give up for task reductions on the parallel, while it is implementable, |
319 | adding another big set of APIs or slowing down the normal paths is |
320 | not acceptable. */ |
321 | tree pclauses = gimple_omp_parallel_clauses (last_stmt (par_entry_bb)); |
322 | if (omp_find_clause (pclauses, OMP_CLAUSE__REDUCTEMP_)) |
323 | return; |
324 | |
325 | if (single_succ (par_entry_bb) == ws_entry_bb |
326 | && single_succ (ws_exit_bb) == par_exit_bb |
327 | && workshare_safe_to_combine_p (ws_entry_bb) |
328 | && (gimple_omp_parallel_combined_p (last_stmt (par_entry_bb)) |
329 | || (last_and_only_stmt (ws_entry_bb) |
330 | && last_and_only_stmt (par_exit_bb)))) |
331 | { |
332 | gimple *par_stmt = last_stmt (par_entry_bb); |
333 | gimple *ws_stmt = last_stmt (ws_entry_bb); |
334 | |
335 | if (region->inner->type == GIMPLE_OMP_FOR) |
336 | { |
337 | /* If this is a combined parallel loop, we need to determine |
338 | whether or not to use the combined library calls. There |
339 | are two cases where we do not apply the transformation: |
340 | static loops and any kind of ordered loop. In the first |
341 | case, we already open code the loop so there is no need |
342 | to do anything else. In the latter case, the combined |
343 | parallel loop call would still need extra synchronization |
344 | to implement ordered semantics, so there would not be any |
345 | gain in using the combined call. */ |
346 | tree clauses = gimple_omp_for_clauses (ws_stmt); |
347 | tree c = omp_find_clause (clauses, OMP_CLAUSE_SCHEDULE); |
348 | if (c == NULLnullptr |
349 | || ((OMP_CLAUSE_SCHEDULE_KIND (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_SCHEDULE), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 349, __FUNCTION__))->omp_clause.subcode.schedule_kind) & OMP_CLAUSE_SCHEDULE_MASK) |
350 | == OMP_CLAUSE_SCHEDULE_STATIC) |
351 | || omp_find_clause (clauses, OMP_CLAUSE_ORDERED) |
352 | || omp_find_clause (clauses, OMP_CLAUSE__REDUCTEMP_) |
353 | || ((c = omp_find_clause (clauses, OMP_CLAUSE__CONDTEMP_)) |
354 | && POINTER_TYPE_P (TREE_TYPE (OMP_CLAUSE_DECL (c)))(((enum tree_code) (((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 354, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 354, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 354, __FUNCTION__)))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 354, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 354, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 354, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 354, __FUNCTION__)))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 354, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ))) |
355 | return; |
356 | } |
357 | else if (region->inner->type == GIMPLE_OMP_SECTIONS |
358 | && (omp_find_clause (gimple_omp_sections_clauses (ws_stmt), |
359 | OMP_CLAUSE__REDUCTEMP_) |
360 | || omp_find_clause (gimple_omp_sections_clauses (ws_stmt), |
361 | OMP_CLAUSE__CONDTEMP_))) |
362 | return; |
363 | |
364 | region->is_combined_parallel = true; |
365 | region->inner->is_combined_parallel = true; |
366 | region->ws_args = get_ws_args_for (par_stmt, ws_stmt); |
367 | } |
368 | } |
369 | |
370 | /* Debugging dumps for parallel regions. */ |
371 | void dump_omp_region (FILE *, struct omp_region *, int); |
372 | void debug_omp_region (struct omp_region *); |
373 | void debug_all_omp_regions (void); |
374 | |
375 | /* Dump the parallel region tree rooted at REGION. */ |
376 | |
377 | void |
378 | dump_omp_region (FILE *file, struct omp_region *region, int indent) |
379 | { |
380 | fprintf (file, "%*sbb %d: %s\n", indent, "", region->entry->index, |
381 | gimple_code_name[region->type]); |
382 | |
383 | if (region->inner) |
384 | dump_omp_region (file, region->inner, indent + 4); |
385 | |
386 | if (region->cont) |
387 | { |
388 | fprintf (file, "%*sbb %d: GIMPLE_OMP_CONTINUE\n", indent, "", |
389 | region->cont->index); |
390 | } |
391 | |
392 | if (region->exit) |
393 | fprintf (file, "%*sbb %d: GIMPLE_OMP_RETURN\n", indent, "", |
394 | region->exit->index); |
395 | else |
396 | fprintf (file, "%*s[no exit marker]\n", indent, ""); |
397 | |
398 | if (region->next) |
399 | dump_omp_region (file, region->next, indent); |
400 | } |
401 | |
402 | DEBUG_FUNCTION__attribute__ ((__used__)) void |
403 | debug_omp_region (struct omp_region *region) |
404 | { |
405 | dump_omp_region (stderrstderr, region, 0); |
406 | } |
407 | |
408 | DEBUG_FUNCTION__attribute__ ((__used__)) void |
409 | debug_all_omp_regions (void) |
410 | { |
411 | dump_omp_region (stderrstderr, root_omp_region, 0); |
412 | } |
413 | |
414 | /* Create a new parallel region starting at STMT inside region PARENT. */ |
415 | |
416 | static struct omp_region * |
417 | new_omp_region (basic_block bb, enum gimple_code type, |
418 | struct omp_region *parent) |
419 | { |
420 | struct omp_region *region = XCNEW (struct omp_region)((struct omp_region *) xcalloc (1, sizeof (struct omp_region) )); |
421 | |
422 | region->outer = parent; |
423 | region->entry = bb; |
424 | region->type = type; |
425 | |
426 | if (parent) |
427 | { |
428 | /* This is a nested region. Add it to the list of inner |
429 | regions in PARENT. */ |
430 | region->next = parent->inner; |
431 | parent->inner = region; |
432 | } |
433 | else |
434 | { |
435 | /* This is a toplevel region. Add it to the list of toplevel |
436 | regions in ROOT_OMP_REGION. */ |
437 | region->next = root_omp_region; |
438 | root_omp_region = region; |
439 | } |
440 | |
441 | return region; |
442 | } |
443 | |
444 | /* Release the memory associated with the region tree rooted at REGION. */ |
445 | |
446 | static void |
447 | free_omp_region_1 (struct omp_region *region) |
448 | { |
449 | struct omp_region *i, *n; |
450 | |
451 | for (i = region->inner; i ; i = n) |
452 | { |
453 | n = i->next; |
454 | free_omp_region_1 (i); |
455 | } |
456 | |
457 | free (region); |
458 | } |
459 | |
460 | /* Release the memory for the entire omp region tree. */ |
461 | |
462 | void |
463 | omp_free_regions (void) |
464 | { |
465 | struct omp_region *r, *n; |
466 | for (r = root_omp_region; r ; r = n) |
467 | { |
468 | n = r->next; |
469 | free_omp_region_1 (r); |
470 | } |
471 | root_omp_region = NULLnullptr; |
472 | } |
473 | |
474 | /* A convenience function to build an empty GIMPLE_COND with just the |
475 | condition. */ |
476 | |
477 | static gcond * |
478 | gimple_build_cond_empty (tree cond) |
479 | { |
480 | enum tree_code pred_code; |
481 | tree lhs, rhs; |
482 | |
483 | gimple_cond_get_ops_from_tree (cond, &pred_code, &lhs, &rhs); |
484 | return gimple_build_cond (pred_code, lhs, rhs, NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
485 | } |
486 | |
487 | /* Change DECL_CONTEXT of CHILD_FNDECL to that of the parent function. |
488 | Add CHILD_FNDECL to decl chain of the supercontext of the block |
489 | ENTRY_BLOCK - this is the block which originally contained the |
490 | code from which CHILD_FNDECL was created. |
491 | |
492 | Together, these actions ensure that the debug info for the outlined |
493 | function will be emitted with the correct lexical scope. */ |
494 | |
495 | static void |
496 | adjust_context_and_scope (struct omp_region *region, tree entry_block, |
497 | tree child_fndecl) |
498 | { |
499 | tree parent_fndecl = NULL_TREE(tree) nullptr; |
500 | gimple *entry_stmt; |
501 | /* OMP expansion expands inner regions before outer ones, so if |
502 | we e.g. have explicit task region nested in parallel region, when |
503 | expanding the task region current_function_decl will be the original |
504 | source function, but we actually want to use as context the child |
505 | function of the parallel. */ |
506 | for (region = region->outer; |
507 | region && parent_fndecl == NULL_TREE(tree) nullptr; region = region->outer) |
508 | switch (region->type) |
509 | { |
510 | case GIMPLE_OMP_PARALLEL: |
511 | case GIMPLE_OMP_TASK: |
512 | case GIMPLE_OMP_TEAMS: |
513 | entry_stmt = last_stmt (region->entry); |
514 | parent_fndecl = gimple_omp_taskreg_child_fn (entry_stmt); |
515 | break; |
516 | case GIMPLE_OMP_TARGET: |
517 | entry_stmt = last_stmt (region->entry); |
518 | parent_fndecl |
519 | = gimple_omp_target_child_fn (as_a <gomp_target *> (entry_stmt)); |
520 | break; |
521 | default: |
522 | break; |
523 | } |
524 | |
525 | if (parent_fndecl == NULL_TREE(tree) nullptr) |
526 | parent_fndecl = current_function_decl; |
527 | DECL_CONTEXT (child_fndecl)((contains_struct_check ((child_fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 527, __FUNCTION__))->decl_minimal.context) = parent_fndecl; |
528 | |
529 | if (entry_block != NULL_TREE(tree) nullptr && TREE_CODE (entry_block)((enum tree_code) (entry_block)->base.code) == BLOCK) |
530 | { |
531 | tree b = BLOCK_SUPERCONTEXT (entry_block)((tree_check ((entry_block), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 531, __FUNCTION__, (BLOCK)))->block.supercontext); |
532 | if (TREE_CODE (b)((enum tree_code) (b)->base.code) == BLOCK) |
533 | { |
534 | DECL_CHAIN (child_fndecl)(((contains_struct_check (((contains_struct_check ((child_fndecl ), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 534, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 534, __FUNCTION__))->common.chain)) = BLOCK_VARS (b)((tree_check ((b), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 534, __FUNCTION__, (BLOCK)))->block.vars); |
535 | BLOCK_VARS (b)((tree_check ((b), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 535, __FUNCTION__, (BLOCK)))->block.vars) = child_fndecl; |
536 | } |
537 | } |
538 | } |
539 | |
540 | /* Build the function calls to GOMP_parallel etc to actually |
541 | generate the parallel operation. REGION is the parallel region |
542 | being expanded. BB is the block where to insert the code. WS_ARGS |
543 | will be set if this is a call to a combined parallel+workshare |
544 | construct, it contains the list of additional arguments needed by |
545 | the workshare construct. */ |
546 | |
547 | static void |
548 | expand_parallel_call (struct omp_region *region, basic_block bb, |
549 | gomp_parallel *entry_stmt, |
550 | vec<tree, va_gc> *ws_args) |
551 | { |
552 | tree t, t1, t2, val, cond, c, clauses, flags; |
553 | gimple_stmt_iterator gsi; |
554 | gimple *stmt; |
555 | enum built_in_function start_ix; |
556 | int start_ix2; |
557 | location_t clause_loc; |
558 | vec<tree, va_gc> *args; |
559 | |
560 | clauses = gimple_omp_parallel_clauses (entry_stmt); |
561 | |
562 | /* Determine what flavor of GOMP_parallel we will be |
563 | emitting. */ |
564 | start_ix = BUILT_IN_GOMP_PARALLEL; |
565 | tree rtmp = omp_find_clause (clauses, OMP_CLAUSE__REDUCTEMP_); |
566 | if (rtmp) |
567 | start_ix = BUILT_IN_GOMP_PARALLEL_REDUCTIONS; |
568 | else if (is_combined_parallel (region)) |
569 | { |
570 | switch (region->inner->type) |
571 | { |
572 | case GIMPLE_OMP_FOR: |
573 | gcc_assert (region->inner->sched_kind != OMP_CLAUSE_SCHEDULE_AUTO)((void)(!(region->inner->sched_kind != OMP_CLAUSE_SCHEDULE_AUTO ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 573, __FUNCTION__), 0 : 0)); |
574 | switch (region->inner->sched_kind) |
575 | { |
576 | case OMP_CLAUSE_SCHEDULE_RUNTIME: |
577 | /* For lastprivate(conditional:), our implementation |
578 | requires monotonic behavior. */ |
579 | if (region->inner->has_lastprivate_conditional != 0) |
580 | start_ix2 = 3; |
581 | else if ((region->inner->sched_modifiers |
582 | & OMP_CLAUSE_SCHEDULE_NONMONOTONIC) != 0) |
583 | start_ix2 = 6; |
584 | else if ((region->inner->sched_modifiers |
585 | & OMP_CLAUSE_SCHEDULE_MONOTONIC) == 0) |
586 | start_ix2 = 7; |
587 | else |
588 | start_ix2 = 3; |
589 | break; |
590 | case OMP_CLAUSE_SCHEDULE_DYNAMIC: |
591 | case OMP_CLAUSE_SCHEDULE_GUIDED: |
592 | if ((region->inner->sched_modifiers |
593 | & OMP_CLAUSE_SCHEDULE_MONOTONIC) == 0 |
594 | && !region->inner->has_lastprivate_conditional) |
595 | { |
596 | start_ix2 = 3 + region->inner->sched_kind; |
597 | break; |
598 | } |
599 | /* FALLTHRU */ |
600 | default: |
601 | start_ix2 = region->inner->sched_kind; |
602 | break; |
603 | } |
604 | start_ix2 += (int) BUILT_IN_GOMP_PARALLEL_LOOP_STATIC; |
605 | start_ix = (enum built_in_function) start_ix2; |
606 | break; |
607 | case GIMPLE_OMP_SECTIONS: |
608 | start_ix = BUILT_IN_GOMP_PARALLEL_SECTIONS; |
609 | break; |
610 | default: |
611 | gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 611, __FUNCTION__)); |
612 | } |
613 | } |
614 | |
615 | /* By default, the value of NUM_THREADS is zero (selected at run time) |
616 | and there is no conditional. */ |
617 | cond = NULL_TREE(tree) nullptr; |
618 | val = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 0); |
619 | flags = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 0); |
620 | |
621 | c = omp_find_clause (clauses, OMP_CLAUSE_IF); |
622 | if (c) |
623 | cond = OMP_CLAUSE_IF_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_IF ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 623, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 623, __FUNCTION__))); |
624 | |
625 | c = omp_find_clause (clauses, OMP_CLAUSE_NUM_THREADS); |
626 | if (c) |
627 | { |
628 | val = OMP_CLAUSE_NUM_THREADS_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_NUM_THREADS ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 628, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 628, __FUNCTION__))); |
629 | clause_loc = OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 629, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus; |
630 | } |
631 | else |
632 | clause_loc = gimple_location (entry_stmt); |
633 | |
634 | c = omp_find_clause (clauses, OMP_CLAUSE_PROC_BIND); |
635 | if (c) |
636 | flags = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], OMP_CLAUSE_PROC_BIND_KIND (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_PROC_BIND), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 636, __FUNCTION__))->omp_clause.subcode.proc_bind_kind)); |
637 | |
638 | /* Ensure 'val' is of the correct type. */ |
639 | val = fold_convert_loc (clause_loc, unsigned_type_nodeinteger_types[itk_unsigned_int], val); |
640 | |
641 | /* If we found the clause 'if (cond)', build either |
642 | (cond != 0) or (cond ? val : 1u). */ |
643 | if (cond) |
644 | { |
645 | cond = gimple_boolify (cond); |
646 | |
647 | if (integer_zerop (val)) |
648 | val = fold_build2_loc (clause_loc, |
649 | EQ_EXPR, unsigned_type_nodeinteger_types[itk_unsigned_int], cond, |
650 | build_int_cst (TREE_TYPE (cond)((contains_struct_check ((cond), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 650, __FUNCTION__))->typed.type), 0)); |
651 | else |
652 | { |
653 | basic_block cond_bb, then_bb, else_bb; |
654 | edge e, e_then, e_else; |
655 | tree tmp_then, tmp_else, tmp_join, tmp_var; |
656 | |
657 | tmp_var = create_tmp_var (TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 657, __FUNCTION__))->typed.type)); |
658 | if (gimple_in_ssa_p (cfun(cfun + 0))) |
659 | { |
660 | tmp_then = make_ssa_name (tmp_var); |
661 | tmp_else = make_ssa_name (tmp_var); |
662 | tmp_join = make_ssa_name (tmp_var); |
663 | } |
664 | else |
665 | { |
666 | tmp_then = tmp_var; |
667 | tmp_else = tmp_var; |
668 | tmp_join = tmp_var; |
669 | } |
670 | |
671 | e = split_block_after_labels (bb); |
672 | cond_bb = e->src; |
673 | bb = e->dest; |
674 | remove_edge (e); |
675 | |
676 | then_bb = create_empty_bb (cond_bb); |
677 | else_bb = create_empty_bb (then_bb); |
678 | set_immediate_dominator (CDI_DOMINATORS, then_bb, cond_bb); |
679 | set_immediate_dominator (CDI_DOMINATORS, else_bb, cond_bb); |
680 | |
681 | stmt = gimple_build_cond_empty (cond); |
682 | gsi = gsi_start_bb (cond_bb); |
683 | gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); |
684 | |
685 | gsi = gsi_start_bb (then_bb); |
686 | expand_omp_build_assign (&gsi, tmp_then, val, true); |
687 | |
688 | gsi = gsi_start_bb (else_bb); |
689 | expand_omp_build_assign (&gsi, tmp_else, |
690 | build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 1), |
691 | true); |
692 | |
693 | make_edge (cond_bb, then_bb, EDGE_TRUE_VALUE); |
694 | make_edge (cond_bb, else_bb, EDGE_FALSE_VALUE); |
695 | add_bb_to_loop (then_bb, cond_bb->loop_father); |
696 | add_bb_to_loop (else_bb, cond_bb->loop_father); |
697 | e_then = make_edge (then_bb, bb, EDGE_FALLTHRU); |
698 | e_else = make_edge (else_bb, bb, EDGE_FALLTHRU); |
699 | |
700 | if (gimple_in_ssa_p (cfun(cfun + 0))) |
701 | { |
702 | gphi *phi = create_phi_node (tmp_join, bb); |
703 | add_phi_arg (phi, tmp_then, e_then, UNKNOWN_LOCATION((location_t) 0)); |
704 | add_phi_arg (phi, tmp_else, e_else, UNKNOWN_LOCATION((location_t) 0)); |
705 | } |
706 | |
707 | val = tmp_join; |
708 | } |
709 | |
710 | gsi = gsi_start_bb (bb); |
711 | val = force_gimple_operand_gsi (&gsi, val, true, NULL_TREE(tree) nullptr, |
712 | false, GSI_CONTINUE_LINKING); |
713 | } |
714 | |
715 | gsi = gsi_last_nondebug_bb (bb); |
716 | t = gimple_omp_parallel_data_arg (entry_stmt); |
717 | if (t == NULLnullptr) |
718 | t1 = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; |
719 | else |
720 | t1 = build_fold_addr_expr (t)build_fold_addr_expr_loc (((location_t) 0), (t)); |
721 | tree child_fndecl = gimple_omp_parallel_child_fn (entry_stmt); |
722 | t2 = build_fold_addr_expr (child_fndecl)build_fold_addr_expr_loc (((location_t) 0), (child_fndecl)); |
723 | |
724 | vec_alloc (args, 4 + vec_safe_length (ws_args)); |
725 | args->quick_push (t2); |
726 | args->quick_push (t1); |
727 | args->quick_push (val); |
728 | if (ws_args) |
729 | args->splice (*ws_args); |
730 | args->quick_push (flags); |
731 | |
732 | t = build_call_expr_loc_vec (UNKNOWN_LOCATION((location_t) 0), |
733 | builtin_decl_explicit (start_ix), args); |
734 | |
735 | if (rtmp) |
736 | { |
737 | tree type = TREE_TYPE (OMP_CLAUSE_DECL (rtmp))((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((rtmp), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 737, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 737, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 737, __FUNCTION__)))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 737, __FUNCTION__))->typed.type); |
738 | t = build2 (MODIFY_EXPR, type, OMP_CLAUSE_DECL (rtmp)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((rtmp), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 738, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 738, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 738, __FUNCTION__))), |
739 | fold_convert (type,fold_convert_loc (((location_t) 0), type, fold_convert_loc (( (location_t) 0), global_trees[TI_POINTER_SIZED_TYPE], t)) |
740 | fold_convert (pointer_sized_int_node, t))fold_convert_loc (((location_t) 0), type, fold_convert_loc (( (location_t) 0), global_trees[TI_POINTER_SIZED_TYPE], t))); |
741 | } |
742 | force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, |
743 | false, GSI_CONTINUE_LINKING); |
744 | } |
745 | |
746 | /* Build the function call to GOMP_task to actually |
747 | generate the task operation. BB is the block where to insert the code. */ |
748 | |
749 | static void |
750 | expand_task_call (struct omp_region *region, basic_block bb, |
751 | gomp_task *entry_stmt) |
752 | { |
753 | tree t1, t2, t3; |
754 | gimple_stmt_iterator gsi; |
755 | location_t loc = gimple_location (entry_stmt); |
756 | |
757 | tree clauses = gimple_omp_task_clauses (entry_stmt); |
758 | |
759 | tree ifc = omp_find_clause (clauses, OMP_CLAUSE_IF); |
760 | tree untied = omp_find_clause (clauses, OMP_CLAUSE_UNTIED); |
761 | tree mergeable = omp_find_clause (clauses, OMP_CLAUSE_MERGEABLE); |
762 | tree depend = omp_find_clause (clauses, OMP_CLAUSE_DEPEND); |
763 | tree finalc = omp_find_clause (clauses, OMP_CLAUSE_FINAL); |
764 | tree priority = omp_find_clause (clauses, OMP_CLAUSE_PRIORITY); |
765 | |
766 | unsigned int iflags |
767 | = (untied ? GOMP_TASK_FLAG_UNTIED(1 << 0) : 0) |
768 | | (mergeable ? GOMP_TASK_FLAG_MERGEABLE(1 << 2) : 0) |
769 | | (depend ? GOMP_TASK_FLAG_DEPEND(1 << 3) : 0); |
770 | |
771 | bool taskloop_p = gimple_omp_task_taskloop_p (entry_stmt); |
772 | tree startvar = NULL_TREE(tree) nullptr, endvar = NULL_TREE(tree) nullptr, step = NULL_TREE(tree) nullptr; |
773 | tree num_tasks = NULL_TREE(tree) nullptr; |
774 | bool ull = false; |
775 | if (taskloop_p) |
776 | { |
777 | gimple *g = last_stmt (region->outer->entry); |
778 | gcc_assert (gimple_code (g) == GIMPLE_OMP_FOR((void)(!(gimple_code (g) == GIMPLE_OMP_FOR && gimple_omp_for_kind (g) == GF_OMP_FOR_KIND_TASKLOOP) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 779, __FUNCTION__), 0 : 0)) |
779 | && gimple_omp_for_kind (g) == GF_OMP_FOR_KIND_TASKLOOP)((void)(!(gimple_code (g) == GIMPLE_OMP_FOR && gimple_omp_for_kind (g) == GF_OMP_FOR_KIND_TASKLOOP) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 779, __FUNCTION__), 0 : 0)); |
780 | struct omp_for_data fd; |
781 | omp_extract_for_data (as_a <gomp_for *> (g), &fd, NULLnullptr); |
782 | startvar = omp_find_clause (clauses, OMP_CLAUSE__LOOPTEMP_); |
783 | endvar = omp_find_clause (OMP_CLAUSE_CHAIN (startvar)((contains_struct_check (((tree_check ((startvar), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 783, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 783, __FUNCTION__))->common.chain), |
784 | OMP_CLAUSE__LOOPTEMP_); |
785 | startvar = OMP_CLAUSE_DECL (startvar)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((startvar), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 785, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 785, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 785, __FUNCTION__))); |
786 | endvar = OMP_CLAUSE_DECL (endvar)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((endvar), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 786, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 786, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 786, __FUNCTION__))); |
787 | step = fold_convert_loc (loc, fd.iter_type, fd.loop.step); |
788 | if (fd.loop.cond_code == LT_EXPR) |
789 | iflags |= GOMP_TASK_FLAG_UP(1 << 8); |
790 | tree tclauses = gimple_omp_for_clauses (g); |
791 | num_tasks = omp_find_clause (tclauses, OMP_CLAUSE_NUM_TASKS); |
792 | if (num_tasks) |
793 | num_tasks = OMP_CLAUSE_NUM_TASKS_EXPR (num_tasks)(*(omp_clause_elt_check (((omp_clause_subcode_check ((num_tasks ), (OMP_CLAUSE_NUM_TASKS), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 793, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 793, __FUNCTION__))); |
794 | else |
795 | { |
796 | num_tasks = omp_find_clause (tclauses, OMP_CLAUSE_GRAINSIZE); |
797 | if (num_tasks) |
798 | { |
799 | iflags |= GOMP_TASK_FLAG_GRAINSIZE(1 << 9); |
800 | num_tasks = OMP_CLAUSE_GRAINSIZE_EXPR (num_tasks)(*(omp_clause_elt_check (((omp_clause_subcode_check ((num_tasks ), (OMP_CLAUSE_GRAINSIZE), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 800, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 800, __FUNCTION__))); |
801 | } |
802 | else |
803 | num_tasks = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; |
804 | } |
805 | num_tasks = fold_convert_loc (loc, long_integer_type_nodeinteger_types[itk_long], num_tasks); |
806 | if (ifc == NULL_TREE(tree) nullptr) |
807 | iflags |= GOMP_TASK_FLAG_IF(1 << 10); |
808 | if (omp_find_clause (tclauses, OMP_CLAUSE_NOGROUP)) |
809 | iflags |= GOMP_TASK_FLAG_NOGROUP(1 << 11); |
810 | ull = fd.iter_type == long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long]; |
811 | if (omp_find_clause (clauses, OMP_CLAUSE_REDUCTION)) |
812 | iflags |= GOMP_TASK_FLAG_REDUCTION(1 << 12); |
813 | } |
814 | else if (priority) |
815 | iflags |= GOMP_TASK_FLAG_PRIORITY(1 << 4); |
816 | |
817 | tree flags = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], iflags); |
818 | |
819 | tree cond = boolean_true_nodeglobal_trees[TI_BOOLEAN_TRUE]; |
820 | if (ifc) |
821 | { |
822 | if (taskloop_p) |
823 | { |
824 | tree t = gimple_boolify (OMP_CLAUSE_IF_EXPR (ifc)(*(omp_clause_elt_check (((omp_clause_subcode_check ((ifc), ( OMP_CLAUSE_IF), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 824, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 824, __FUNCTION__)))); |
825 | t = fold_build3_loc (loc, COND_EXPR, unsigned_type_nodeinteger_types[itk_unsigned_int], t, |
826 | build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], |
827 | GOMP_TASK_FLAG_IF(1 << 10)), |
828 | build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 0)); |
829 | flags = fold_build2_loc (loc, PLUS_EXPR, unsigned_type_nodeinteger_types[itk_unsigned_int], |
830 | flags, t); |
831 | } |
832 | else |
833 | cond = gimple_boolify (OMP_CLAUSE_IF_EXPR (ifc)(*(omp_clause_elt_check (((omp_clause_subcode_check ((ifc), ( OMP_CLAUSE_IF), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 833, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 833, __FUNCTION__)))); |
834 | } |
835 | |
836 | if (finalc) |
837 | { |
838 | tree t = gimple_boolify (OMP_CLAUSE_FINAL_EXPR (finalc)(*(omp_clause_elt_check (((omp_clause_subcode_check ((finalc) , (OMP_CLAUSE_FINAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 838, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 838, __FUNCTION__)))); |
839 | t = fold_build3_loc (loc, COND_EXPR, unsigned_type_nodeinteger_types[itk_unsigned_int], t, |
840 | build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], |
841 | GOMP_TASK_FLAG_FINAL(1 << 1)), |
842 | build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 0)); |
843 | flags = fold_build2_loc (loc, PLUS_EXPR, unsigned_type_nodeinteger_types[itk_unsigned_int], flags, t); |
844 | } |
845 | if (depend) |
846 | depend = OMP_CLAUSE_DECL (depend)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((depend), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 846, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 846, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 846, __FUNCTION__))); |
847 | else |
848 | depend = build_int_cst (ptr_type_nodeglobal_trees[TI_PTR_TYPE], 0); |
849 | if (priority) |
850 | priority = fold_convert (integer_type_node,fold_convert_loc (((location_t) 0), integer_types[itk_int], ( *(omp_clause_elt_check (((omp_clause_subcode_check ((priority ), (OMP_CLAUSE_PRIORITY), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 851, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 851, __FUNCTION__)))) |
851 | OMP_CLAUSE_PRIORITY_EXPR (priority))fold_convert_loc (((location_t) 0), integer_types[itk_int], ( *(omp_clause_elt_check (((omp_clause_subcode_check ((priority ), (OMP_CLAUSE_PRIORITY), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 851, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 851, __FUNCTION__)))); |
852 | else |
853 | priority = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; |
854 | |
855 | gsi = gsi_last_nondebug_bb (bb); |
856 | tree t = gimple_omp_task_data_arg (entry_stmt); |
857 | if (t == NULLnullptr) |
858 | t2 = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; |
859 | else |
860 | t2 = build_fold_addr_expr_loc (loc, t); |
861 | t1 = build_fold_addr_expr_loc (loc, gimple_omp_task_child_fn (entry_stmt)); |
862 | t = gimple_omp_task_copy_fn (entry_stmt); |
863 | if (t == NULLnullptr) |
864 | t3 = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; |
865 | else |
866 | t3 = build_fold_addr_expr_loc (loc, t); |
867 | |
868 | if (taskloop_p) |
869 | t = build_call_expr (ull |
870 | ? builtin_decl_explicit (BUILT_IN_GOMP_TASKLOOP_ULL) |
871 | : builtin_decl_explicit (BUILT_IN_GOMP_TASKLOOP), |
872 | 11, t1, t2, t3, |
873 | gimple_omp_task_arg_size (entry_stmt), |
874 | gimple_omp_task_arg_align (entry_stmt), flags, |
875 | num_tasks, priority, startvar, endvar, step); |
876 | else |
877 | t = build_call_expr (builtin_decl_explicit (BUILT_IN_GOMP_TASK), |
878 | 9, t1, t2, t3, |
879 | gimple_omp_task_arg_size (entry_stmt), |
880 | gimple_omp_task_arg_align (entry_stmt), cond, flags, |
881 | depend, priority); |
882 | |
883 | force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, |
884 | false, GSI_CONTINUE_LINKING); |
885 | } |
886 | |
887 | /* Build the function call to GOMP_taskwait_depend to actually |
888 | generate the taskwait operation. BB is the block where to insert the |
889 | code. */ |
890 | |
891 | static void |
892 | expand_taskwait_call (basic_block bb, gomp_task *entry_stmt) |
893 | { |
894 | tree clauses = gimple_omp_task_clauses (entry_stmt); |
895 | tree depend = omp_find_clause (clauses, OMP_CLAUSE_DEPEND); |
896 | if (depend == NULL_TREE(tree) nullptr) |
897 | return; |
898 | |
899 | depend = OMP_CLAUSE_DECL (depend)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((depend), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 899, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 899, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 899, __FUNCTION__))); |
900 | |
901 | gimple_stmt_iterator gsi = gsi_last_nondebug_bb (bb); |
902 | tree t |
903 | = build_call_expr (builtin_decl_explicit (BUILT_IN_GOMP_TASKWAIT_DEPEND), |
904 | 1, depend); |
905 | |
906 | force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, |
907 | false, GSI_CONTINUE_LINKING); |
908 | } |
909 | |
910 | /* Build the function call to GOMP_teams_reg to actually |
911 | generate the host teams operation. REGION is the teams region |
912 | being expanded. BB is the block where to insert the code. */ |
913 | |
914 | static void |
915 | expand_teams_call (basic_block bb, gomp_teams *entry_stmt) |
916 | { |
917 | tree clauses = gimple_omp_teams_clauses (entry_stmt); |
918 | tree num_teams = omp_find_clause (clauses, OMP_CLAUSE_NUM_TEAMS); |
919 | if (num_teams == NULL_TREE(tree) nullptr) |
920 | num_teams = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 0); |
921 | else |
922 | { |
923 | num_teams = OMP_CLAUSE_NUM_TEAMS_EXPR (num_teams)(*(omp_clause_elt_check (((omp_clause_subcode_check ((num_teams ), (OMP_CLAUSE_NUM_TEAMS), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 923, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 923, __FUNCTION__))); |
924 | num_teams = fold_convert (unsigned_type_node, num_teams)fold_convert_loc (((location_t) 0), integer_types[itk_unsigned_int ], num_teams); |
925 | } |
926 | tree thread_limit = omp_find_clause (clauses, OMP_CLAUSE_THREAD_LIMIT); |
927 | if (thread_limit == NULL_TREE(tree) nullptr) |
928 | thread_limit = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 0); |
929 | else |
930 | { |
931 | thread_limit = OMP_CLAUSE_THREAD_LIMIT_EXPR (thread_limit)(*(omp_clause_elt_check (((omp_clause_subcode_check ((thread_limit ), (OMP_CLAUSE_THREAD_LIMIT), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 931, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 931, __FUNCTION__))); |
932 | thread_limit = fold_convert (unsigned_type_node, thread_limit)fold_convert_loc (((location_t) 0), integer_types[itk_unsigned_int ], thread_limit); |
933 | } |
934 | |
935 | gimple_stmt_iterator gsi = gsi_last_nondebug_bb (bb); |
936 | tree t = gimple_omp_teams_data_arg (entry_stmt), t1; |
937 | if (t == NULLnullptr) |
938 | t1 = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; |
939 | else |
940 | t1 = build_fold_addr_expr (t)build_fold_addr_expr_loc (((location_t) 0), (t)); |
941 | tree child_fndecl = gimple_omp_teams_child_fn (entry_stmt); |
942 | tree t2 = build_fold_addr_expr (child_fndecl)build_fold_addr_expr_loc (((location_t) 0), (child_fndecl)); |
943 | |
944 | vec<tree, va_gc> *args; |
945 | vec_alloc (args, 5); |
946 | args->quick_push (t2); |
947 | args->quick_push (t1); |
948 | args->quick_push (num_teams); |
949 | args->quick_push (thread_limit); |
950 | /* For future extensibility. */ |
951 | args->quick_push (build_zero_cst (unsigned_type_nodeinteger_types[itk_unsigned_int])); |
952 | |
953 | t = build_call_expr_loc_vec (UNKNOWN_LOCATION((location_t) 0), |
954 | builtin_decl_explicit (BUILT_IN_GOMP_TEAMS_REG), |
955 | args); |
956 | |
957 | force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, |
958 | false, GSI_CONTINUE_LINKING); |
959 | } |
960 | |
961 | /* Chain all the DECLs in LIST by their TREE_CHAIN fields. */ |
962 | |
963 | static tree |
964 | vec2chain (vec<tree, va_gc> *v) |
965 | { |
966 | tree chain = NULL_TREE(tree) nullptr, t; |
967 | unsigned ix; |
968 | |
969 | FOR_EACH_VEC_SAFE_ELT_REVERSE (v, ix, t)for (ix = vec_safe_length (v) - 1; vec_safe_iterate ((v), (ix ), &(t)); (ix)--) |
970 | { |
971 | DECL_CHAIN (t)(((contains_struct_check (((contains_struct_check ((t), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 971, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 971, __FUNCTION__))->common.chain)) = chain; |
972 | chain = t; |
973 | } |
974 | |
975 | return chain; |
976 | } |
977 | |
978 | /* Remove barriers in REGION->EXIT's block. Note that this is only |
979 | valid for GIMPLE_OMP_PARALLEL regions. Since the end of a parallel region |
980 | is an implicit barrier, any workshare inside the GIMPLE_OMP_PARALLEL that |
981 | left a barrier at the end of the GIMPLE_OMP_PARALLEL region can now be |
982 | removed. */ |
983 | |
984 | static void |
985 | remove_exit_barrier (struct omp_region *region) |
986 | { |
987 | gimple_stmt_iterator gsi; |
988 | basic_block exit_bb; |
989 | edge_iterator ei; |
990 | edge e; |
991 | gimple *stmt; |
992 | int any_addressable_vars = -1; |
993 | |
994 | exit_bb = region->exit; |
995 | |
996 | /* If the parallel region doesn't return, we don't have REGION->EXIT |
997 | block at all. */ |
998 | if (! exit_bb) |
999 | return; |
1000 | |
1001 | /* The last insn in the block will be the parallel's GIMPLE_OMP_RETURN. The |
1002 | workshare's GIMPLE_OMP_RETURN will be in a preceding block. The kinds of |
1003 | statements that can appear in between are extremely limited -- no |
1004 | memory operations at all. Here, we allow nothing at all, so the |
1005 | only thing we allow to precede this GIMPLE_OMP_RETURN is a label. */ |
1006 | gsi = gsi_last_nondebug_bb (exit_bb); |
1007 | gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN)((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1007, __FUNCTION__), 0 : 0)); |
1008 | gsi_prev_nondebug (&gsi); |
1009 | if (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) != GIMPLE_LABEL) |
1010 | return; |
1011 | |
1012 | FOR_EACH_EDGE (e, ei, exit_bb->preds)for ((ei) = ei_start_1 (&((exit_bb->preds))); ei_cond ( (ei), &(e)); ei_next (&(ei))) |
1013 | { |
1014 | gsi = gsi_last_nondebug_bb (e->src); |
1015 | if (gsi_end_p (gsi)) |
1016 | continue; |
1017 | stmt = gsi_stmt (gsi); |
1018 | if (gimple_code (stmt) == GIMPLE_OMP_RETURN |
1019 | && !gimple_omp_return_nowait_p (stmt)) |
1020 | { |
1021 | /* OpenMP 3.0 tasks unfortunately prevent this optimization |
1022 | in many cases. If there could be tasks queued, the barrier |
1023 | might be needed to let the tasks run before some local |
1024 | variable of the parallel that the task uses as shared |
1025 | runs out of scope. The task can be spawned either |
1026 | from within current function (this would be easy to check) |
1027 | or from some function it calls and gets passed an address |
1028 | of such a variable. */ |
1029 | if (any_addressable_vars < 0) |
1030 | { |
1031 | gomp_parallel *parallel_stmt |
1032 | = as_a <gomp_parallel *> (last_stmt (region->entry)); |
1033 | tree child_fun = gimple_omp_parallel_child_fn (parallel_stmt); |
1034 | tree local_decls, block, decl; |
1035 | unsigned ix; |
1036 | |
1037 | any_addressable_vars = 0; |
1038 | FOR_EACH_LOCAL_DECL (DECL_STRUCT_FUNCTION (child_fun), ix, decl)for (ix = vec_safe_length ((((tree_check ((child_fun), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1038, __FUNCTION__, (FUNCTION_DECL)))->function_decl.f)) ->local_decls) - 1; vec_safe_iterate (((((tree_check ((child_fun ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1038, __FUNCTION__, (FUNCTION_DECL)))->function_decl.f)) ->local_decls), (ix), &(decl)); (ix)--) |
1039 | if (TREE_ADDRESSABLE (decl)((decl)->base.addressable_flag)) |
1040 | { |
1041 | any_addressable_vars = 1; |
1042 | break; |
1043 | } |
1044 | for (block = gimple_block (stmt); |
1045 | !any_addressable_vars |
1046 | && block |
1047 | && TREE_CODE (block)((enum tree_code) (block)->base.code) == BLOCK; |
1048 | block = BLOCK_SUPERCONTEXT (block)((tree_check ((block), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1048, __FUNCTION__, (BLOCK)))->block.supercontext)) |
1049 | { |
1050 | for (local_decls = BLOCK_VARS (block)((tree_check ((block), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1050, __FUNCTION__, (BLOCK)))->block.vars); |
1051 | local_decls; |
1052 | local_decls = DECL_CHAIN (local_decls)(((contains_struct_check (((contains_struct_check ((local_decls ), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1052, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1052, __FUNCTION__))->common.chain))) |
1053 | if (TREE_ADDRESSABLE (local_decls)((local_decls)->base.addressable_flag)) |
1054 | { |
1055 | any_addressable_vars = 1; |
1056 | break; |
1057 | } |
1058 | if (block == gimple_block (parallel_stmt)) |
1059 | break; |
1060 | } |
1061 | } |
1062 | if (!any_addressable_vars) |
1063 | gimple_omp_return_set_nowait (stmt); |
1064 | } |
1065 | } |
1066 | } |
1067 | |
1068 | static void |
1069 | remove_exit_barriers (struct omp_region *region) |
1070 | { |
1071 | if (region->type == GIMPLE_OMP_PARALLEL) |
1072 | remove_exit_barrier (region); |
1073 | |
1074 | if (region->inner) |
1075 | { |
1076 | region = region->inner; |
1077 | remove_exit_barriers (region); |
1078 | while (region->next) |
1079 | { |
1080 | region = region->next; |
1081 | remove_exit_barriers (region); |
1082 | } |
1083 | } |
1084 | } |
1085 | |
1086 | /* Optimize omp_get_thread_num () and omp_get_num_threads () |
1087 | calls. These can't be declared as const functions, but |
1088 | within one parallel body they are constant, so they can be |
1089 | transformed there into __builtin_omp_get_{thread_num,num_threads} () |
1090 | which are declared const. Similarly for task body, except |
1091 | that in untied task omp_get_thread_num () can change at any task |
1092 | scheduling point. */ |
1093 | |
1094 | static void |
1095 | optimize_omp_library_calls (gimple *entry_stmt) |
1096 | { |
1097 | basic_block bb; |
1098 | gimple_stmt_iterator gsi; |
1099 | tree thr_num_tree = builtin_decl_explicit (BUILT_IN_OMP_GET_THREAD_NUM); |
1100 | tree thr_num_id = DECL_ASSEMBLER_NAME (thr_num_tree)decl_assembler_name (thr_num_tree); |
1101 | tree num_thr_tree = builtin_decl_explicit (BUILT_IN_OMP_GET_NUM_THREADS); |
1102 | tree num_thr_id = DECL_ASSEMBLER_NAME (num_thr_tree)decl_assembler_name (num_thr_tree); |
1103 | bool untied_task = (gimple_code (entry_stmt) == GIMPLE_OMP_TASK |
1104 | && omp_find_clause (gimple_omp_task_clauses (entry_stmt), |
1105 | OMP_CLAUSE_UNTIED) != NULLnullptr); |
1106 | |
1107 | FOR_EACH_BB_FN (bb, cfun)for (bb = ((cfun + 0))->cfg->x_entry_block_ptr->next_bb ; bb != ((cfun + 0))->cfg->x_exit_block_ptr; bb = bb-> next_bb) |
1108 | for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) |
1109 | { |
1110 | gimple *call = gsi_stmt (gsi); |
1111 | tree decl; |
1112 | |
1113 | if (is_gimple_call (call) |
1114 | && (decl = gimple_call_fndecl (call)) |
1115 | && DECL_EXTERNAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1115, __FUNCTION__))->decl_common.decl_flag_1) |
1116 | && TREE_PUBLIC (decl)((decl)->base.public_flag) |
1117 | && DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1117, __FUNCTION__))->decl_common.initial) == NULLnullptr) |
1118 | { |
1119 | tree built_in; |
1120 | |
1121 | if (DECL_NAME (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1121, __FUNCTION__))->decl_minimal.name) == thr_num_id) |
1122 | { |
1123 | /* In #pragma omp task untied omp_get_thread_num () can change |
1124 | during the execution of the task region. */ |
1125 | if (untied_task) |
1126 | continue; |
1127 | built_in = builtin_decl_explicit (BUILT_IN_OMP_GET_THREAD_NUM); |
1128 | } |
1129 | else if (DECL_NAME (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1129, __FUNCTION__))->decl_minimal.name) == num_thr_id) |
1130 | built_in = builtin_decl_explicit (BUILT_IN_OMP_GET_NUM_THREADS); |
1131 | else |
1132 | continue; |
1133 | |
1134 | if (DECL_ASSEMBLER_NAME (decl)decl_assembler_name (decl) != DECL_ASSEMBLER_NAME (built_in)decl_assembler_name (built_in) |
1135 | || gimple_call_num_args (call) != 0) |
1136 | continue; |
1137 | |
1138 | if (flag_exceptionsglobal_options.x_flag_exceptions && !TREE_NOTHROW (decl)((decl)->base.nothrow_flag)) |
1139 | continue; |
1140 | |
1141 | if (TREE_CODE (TREE_TYPE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1141, __FUNCTION__))->typed.type))->base.code) != FUNCTION_TYPE |
1142 | || !types_compatible_p (TREE_TYPE (TREE_TYPE (decl))((contains_struct_check ((((contains_struct_check ((decl), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1142, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1142, __FUNCTION__))->typed.type), |
1143 | TREE_TYPE (TREE_TYPE (built_in))((contains_struct_check ((((contains_struct_check ((built_in) , (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1143, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1143, __FUNCTION__))->typed.type))) |
1144 | continue; |
1145 | |
1146 | gimple_call_set_fndecl (call, built_in); |
1147 | } |
1148 | } |
1149 | } |
1150 | |
1151 | /* Callback for expand_omp_build_assign. Return non-NULL if *tp needs to be |
1152 | regimplified. */ |
1153 | |
1154 | static tree |
1155 | expand_omp_regimplify_p (tree *tp, int *walk_subtrees, void *) |
1156 | { |
1157 | tree t = *tp; |
1158 | |
1159 | /* Any variable with DECL_VALUE_EXPR needs to be regimplified. */ |
1160 | if (VAR_P (t)(((enum tree_code) (t)->base.code) == VAR_DECL) && DECL_HAS_VALUE_EXPR_P (t)((tree_check3 ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1160, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL)) ) ->decl_common.decl_flag_2)) |
1161 | return t; |
1162 | |
1163 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == ADDR_EXPR) |
1164 | recompute_tree_invariant_for_addr_expr (t); |
1165 | |
1166 | *walk_subtrees = !TYPE_P (t)(tree_code_type[(int) (((enum tree_code) (t)->base.code))] == tcc_type) && !DECL_P (t)(tree_code_type[(int) (((enum tree_code) (t)->base.code))] == tcc_declaration); |
1167 | return NULL_TREE(tree) nullptr; |
1168 | } |
1169 | |
1170 | /* Prepend or append TO = FROM assignment before or after *GSI_P. */ |
1171 | |
1172 | static void |
1173 | expand_omp_build_assign (gimple_stmt_iterator *gsi_p, tree to, tree from, |
1174 | bool after) |
1175 | { |
1176 | bool simple_p = DECL_P (to)(tree_code_type[(int) (((enum tree_code) (to)->base.code)) ] == tcc_declaration) && TREE_ADDRESSABLE (to)((to)->base.addressable_flag); |
1177 | from = force_gimple_operand_gsi (gsi_p, from, simple_p, NULL_TREE(tree) nullptr, |
1178 | !after, after ? GSI_CONTINUE_LINKING |
1179 | : GSI_SAME_STMT); |
1180 | gimple *stmt = gimple_build_assign (to, from); |
1181 | if (after) |
1182 | gsi_insert_after (gsi_p, stmt, GSI_CONTINUE_LINKING); |
1183 | else |
1184 | gsi_insert_before (gsi_p, stmt, GSI_SAME_STMT); |
1185 | if (walk_tree (&from, expand_omp_regimplify_p, NULL, NULL)walk_tree_1 (&from, expand_omp_regimplify_p, nullptr, nullptr , nullptr) |
1186 | || walk_tree (&to, expand_omp_regimplify_p, NULL, NULL)walk_tree_1 (&to, expand_omp_regimplify_p, nullptr, nullptr , nullptr)) |
1187 | { |
1188 | gimple_stmt_iterator gsi = gsi_for_stmt (stmt); |
1189 | gimple_regimplify_operands (stmt, &gsi); |
1190 | } |
1191 | } |
1192 | |
1193 | /* Expand the OpenMP parallel or task directive starting at REGION. */ |
1194 | |
1195 | static void |
1196 | expand_omp_taskreg (struct omp_region *region) |
1197 | { |
1198 | basic_block entry_bb, exit_bb, new_bb; |
1199 | struct function *child_cfun; |
1200 | tree child_fn, block, t; |
1201 | gimple_stmt_iterator gsi; |
1202 | gimple *entry_stmt, *stmt; |
1203 | edge e; |
1204 | vec<tree, va_gc> *ws_args; |
1205 | |
1206 | entry_stmt = last_stmt (region->entry); |
1207 | if (gimple_code (entry_stmt) == GIMPLE_OMP_TASK |
1208 | && gimple_omp_task_taskwait_p (entry_stmt)) |
1209 | { |
1210 | new_bb = region->entry; |
1211 | gsi = gsi_last_nondebug_bb (region->entry); |
1212 | gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TASK)((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TASK) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1212, __FUNCTION__), 0 : 0)); |
1213 | gsi_remove (&gsi, true); |
1214 | expand_taskwait_call (new_bb, as_a <gomp_task *> (entry_stmt)); |
1215 | return; |
1216 | } |
1217 | |
1218 | child_fn = gimple_omp_taskreg_child_fn (entry_stmt); |
1219 | child_cfun = DECL_STRUCT_FUNCTION (child_fn)((tree_check ((child_fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1219, __FUNCTION__, (FUNCTION_DECL)))->function_decl.f); |
1220 | |
1221 | entry_bb = region->entry; |
1222 | if (gimple_code (entry_stmt) == GIMPLE_OMP_TASK) |
1223 | exit_bb = region->cont; |
1224 | else |
1225 | exit_bb = region->exit; |
1226 | |
1227 | if (is_combined_parallel (region)) |
1228 | ws_args = region->ws_args; |
1229 | else |
1230 | ws_args = NULLnullptr; |
1231 | |
1232 | if (child_cfun->cfg) |
1233 | { |
1234 | /* Due to inlining, it may happen that we have already outlined |
1235 | the region, in which case all we need to do is make the |
1236 | sub-graph unreachable and emit the parallel call. */ |
1237 | edge entry_succ_e, exit_succ_e; |
1238 | |
1239 | entry_succ_e = single_succ_edge (entry_bb); |
1240 | |
1241 | gsi = gsi_last_nondebug_bb (entry_bb); |
1242 | gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_PARALLEL((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_PARALLEL || gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TASK || gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TEAMS) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1244, __FUNCTION__), 0 : 0)) |
1243 | || gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TASK((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_PARALLEL || gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TASK || gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TEAMS) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1244, __FUNCTION__), 0 : 0)) |
1244 | || gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TEAMS)((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_PARALLEL || gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TASK || gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TEAMS) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1244, __FUNCTION__), 0 : 0)); |
1245 | gsi_remove (&gsi, true); |
1246 | |
1247 | new_bb = entry_bb; |
1248 | if (exit_bb) |
1249 | { |
1250 | exit_succ_e = single_succ_edge (exit_bb); |
1251 | make_edge (new_bb, exit_succ_e->dest, EDGE_FALLTHRU); |
1252 | } |
1253 | remove_edge_and_dominated_blocks (entry_succ_e); |
1254 | } |
1255 | else |
1256 | { |
1257 | unsigned srcidx, dstidx, num; |
1258 | |
1259 | /* If the parallel region needs data sent from the parent |
1260 | function, then the very first statement (except possible |
1261 | tree profile counter updates) of the parallel body |
1262 | is a copy assignment .OMP_DATA_I = &.OMP_DATA_O. Since |
1263 | &.OMP_DATA_O is passed as an argument to the child function, |
1264 | we need to replace it with the argument as seen by the child |
1265 | function. |
1266 | |
1267 | In most cases, this will end up being the identity assignment |
1268 | .OMP_DATA_I = .OMP_DATA_I. However, if the parallel body had |
1269 | a function call that has been inlined, the original PARM_DECL |
1270 | .OMP_DATA_I may have been converted into a different local |
1271 | variable. In which case, we need to keep the assignment. */ |
1272 | if (gimple_omp_taskreg_data_arg (entry_stmt)) |
1273 | { |
1274 | basic_block entry_succ_bb |
1275 | = single_succ_p (entry_bb) ? single_succ (entry_bb) |
1276 | : FALLTHRU_EDGE (entry_bb)((*((entry_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(0)] : (*((entry_bb))->succs) [(1)])->dest; |
1277 | tree arg; |
1278 | gimple *parcopy_stmt = NULLnullptr; |
1279 | |
1280 | for (gsi = gsi_start_bb (entry_succ_bb); ; gsi_next (&gsi)) |
1281 | { |
1282 | gimple *stmt; |
1283 | |
1284 | gcc_assert (!gsi_end_p (gsi))((void)(!(!gsi_end_p (gsi)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1284, __FUNCTION__), 0 : 0)); |
1285 | stmt = gsi_stmt (gsi); |
1286 | if (gimple_code (stmt) != GIMPLE_ASSIGN) |
1287 | continue; |
1288 | |
1289 | if (gimple_num_ops (stmt) == 2) |
1290 | { |
1291 | tree arg = gimple_assign_rhs1 (stmt); |
1292 | |
1293 | /* We're ignore the subcode because we're |
1294 | effectively doing a STRIP_NOPS. */ |
1295 | |
1296 | if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == ADDR_EXPR |
1297 | && (TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1297, __FUNCTION__))))) |
1298 | == gimple_omp_taskreg_data_arg (entry_stmt))) |
1299 | { |
1300 | parcopy_stmt = stmt; |
1301 | break; |
1302 | } |
1303 | } |
1304 | } |
1305 | |
1306 | gcc_assert (parcopy_stmt != NULL)((void)(!(parcopy_stmt != nullptr) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1306, __FUNCTION__), 0 : 0)); |
1307 | arg = DECL_ARGUMENTS (child_fn)((tree_check ((child_fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1307, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments ); |
1308 | |
1309 | if (!gimple_in_ssa_p (cfun(cfun + 0))) |
1310 | { |
1311 | if (gimple_assign_lhs (parcopy_stmt) == arg) |
1312 | gsi_remove (&gsi, true); |
1313 | else |
1314 | { |
1315 | /* ?? Is setting the subcode really necessary ?? */ |
1316 | gimple_omp_set_subcode (parcopy_stmt, TREE_CODE (arg)((enum tree_code) (arg)->base.code)); |
1317 | gimple_assign_set_rhs1 (parcopy_stmt, arg); |
1318 | } |
1319 | } |
1320 | else |
1321 | { |
1322 | tree lhs = gimple_assign_lhs (parcopy_stmt); |
1323 | gcc_assert (SSA_NAME_VAR (lhs) == arg)((void)(!(((tree_check ((lhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1323, __FUNCTION__, (SSA_NAME)))->ssa_name.var == (tree) nullptr || ((enum tree_code) ((lhs)->ssa_name.var)->base .code) == IDENTIFIER_NODE ? (tree) nullptr : (lhs)->ssa_name .var) == arg) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1323, __FUNCTION__), 0 : 0)); |
1324 | /* We'd like to set the rhs to the default def in the child_fn, |
1325 | but it's too early to create ssa names in the child_fn. |
1326 | Instead, we set the rhs to the parm. In |
1327 | move_sese_region_to_fn, we introduce a default def for the |
1328 | parm, map the parm to it's default def, and once we encounter |
1329 | this stmt, replace the parm with the default def. */ |
1330 | gimple_assign_set_rhs1 (parcopy_stmt, arg); |
1331 | update_stmt (parcopy_stmt); |
1332 | } |
1333 | } |
1334 | |
1335 | /* Declare local variables needed in CHILD_CFUN. */ |
1336 | block = DECL_INITIAL (child_fn)((contains_struct_check ((child_fn), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1336, __FUNCTION__))->decl_common.initial); |
1337 | BLOCK_VARS (block)((tree_check ((block), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1337, __FUNCTION__, (BLOCK)))->block.vars) = vec2chain (child_cfun->local_decls); |
1338 | /* The gimplifier could record temporaries in parallel/task block |
1339 | rather than in containing function's local_decls chain, |
1340 | which would mean cgraph missed finalizing them. Do it now. */ |
1341 | for (t = BLOCK_VARS (block)((tree_check ((block), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1341, __FUNCTION__, (BLOCK)))->block.vars); t; t = DECL_CHAIN (t)(((contains_struct_check (((contains_struct_check ((t), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1341, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1341, __FUNCTION__))->common.chain))) |
1342 | if (VAR_P (t)(((enum tree_code) (t)->base.code) == VAR_DECL) && TREE_STATIC (t)((t)->base.static_flag) && !DECL_EXTERNAL (t)((contains_struct_check ((t), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1342, __FUNCTION__))->decl_common.decl_flag_1)) |
1343 | varpool_node::finalize_decl (t); |
1344 | DECL_SAVED_TREE (child_fn)((tree_check ((child_fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1344, __FUNCTION__, (FUNCTION_DECL)))->function_decl.saved_tree ) = NULLnullptr; |
1345 | /* We'll create a CFG for child_fn, so no gimple body is needed. */ |
1346 | gimple_set_body (child_fn, NULLnullptr); |
1347 | TREE_USED (block)((block)->base.used_flag) = 1; |
1348 | |
1349 | /* Reset DECL_CONTEXT on function arguments. */ |
1350 | for (t = DECL_ARGUMENTS (child_fn)((tree_check ((child_fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1350, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments ); t; t = DECL_CHAIN (t)(((contains_struct_check (((contains_struct_check ((t), (TS_DECL_MINIMAL ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1350, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1350, __FUNCTION__))->common.chain))) |
1351 | DECL_CONTEXT (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1351, __FUNCTION__))->decl_minimal.context) = child_fn; |
1352 | |
1353 | /* Split ENTRY_BB at GIMPLE_OMP_PARALLEL or GIMPLE_OMP_TASK, |
1354 | so that it can be moved to the child function. */ |
1355 | gsi = gsi_last_nondebug_bb (entry_bb); |
1356 | stmt = gsi_stmt (gsi); |
1357 | gcc_assert (stmt && (gimple_code (stmt) == GIMPLE_OMP_PARALLEL((void)(!(stmt && (gimple_code (stmt) == GIMPLE_OMP_PARALLEL || gimple_code (stmt) == GIMPLE_OMP_TASK || gimple_code (stmt ) == GIMPLE_OMP_TEAMS)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1359, __FUNCTION__), 0 : 0)) |
1358 | || gimple_code (stmt) == GIMPLE_OMP_TASK((void)(!(stmt && (gimple_code (stmt) == GIMPLE_OMP_PARALLEL || gimple_code (stmt) == GIMPLE_OMP_TASK || gimple_code (stmt ) == GIMPLE_OMP_TEAMS)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1359, __FUNCTION__), 0 : 0)) |
1359 | || gimple_code (stmt) == GIMPLE_OMP_TEAMS))((void)(!(stmt && (gimple_code (stmt) == GIMPLE_OMP_PARALLEL || gimple_code (stmt) == GIMPLE_OMP_TASK || gimple_code (stmt ) == GIMPLE_OMP_TEAMS)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1359, __FUNCTION__), 0 : 0)); |
1360 | e = split_block (entry_bb, stmt); |
1361 | gsi_remove (&gsi, true); |
1362 | entry_bb = e->dest; |
1363 | edge e2 = NULLnullptr; |
1364 | if (gimple_code (entry_stmt) != GIMPLE_OMP_TASK) |
1365 | single_succ_edge (entry_bb)->flags = EDGE_FALLTHRU; |
1366 | else |
1367 | { |
1368 | e2 = make_edge (e->src, BRANCH_EDGE (entry_bb)((*((entry_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(1)] : (*((entry_bb))->succs) [(0)])->dest, EDGE_ABNORMAL); |
1369 | gcc_assert (e2->dest == region->exit)((void)(!(e2->dest == region->exit) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1369, __FUNCTION__), 0 : 0)); |
1370 | remove_edge (BRANCH_EDGE (entry_bb)((*((entry_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(1)] : (*((entry_bb))->succs) [(0)])); |
1371 | set_immediate_dominator (CDI_DOMINATORS, e2->dest, e->src); |
1372 | gsi = gsi_last_nondebug_bb (region->exit); |
1373 | gcc_assert (!gsi_end_p (gsi)((void)(!(!gsi_end_p (gsi) && gimple_code (gsi_stmt ( gsi)) == GIMPLE_OMP_RETURN) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1374, __FUNCTION__), 0 : 0)) |
1374 | && gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN)((void)(!(!gsi_end_p (gsi) && gimple_code (gsi_stmt ( gsi)) == GIMPLE_OMP_RETURN) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1374, __FUNCTION__), 0 : 0)); |
1375 | gsi_remove (&gsi, true); |
1376 | } |
1377 | |
1378 | /* Convert GIMPLE_OMP_{RETURN,CONTINUE} into a RETURN_EXPR. */ |
1379 | if (exit_bb) |
1380 | { |
1381 | gsi = gsi_last_nondebug_bb (exit_bb); |
1382 | gcc_assert (!gsi_end_p (gsi)((void)(!(!gsi_end_p (gsi) && (gimple_code (gsi_stmt ( gsi)) == (e2 ? GIMPLE_OMP_CONTINUE : GIMPLE_OMP_RETURN))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1384, __FUNCTION__), 0 : 0)) |
1383 | && (gimple_code (gsi_stmt (gsi))((void)(!(!gsi_end_p (gsi) && (gimple_code (gsi_stmt ( gsi)) == (e2 ? GIMPLE_OMP_CONTINUE : GIMPLE_OMP_RETURN))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1384, __FUNCTION__), 0 : 0)) |
1384 | == (e2 ? GIMPLE_OMP_CONTINUE : GIMPLE_OMP_RETURN)))((void)(!(!gsi_end_p (gsi) && (gimple_code (gsi_stmt ( gsi)) == (e2 ? GIMPLE_OMP_CONTINUE : GIMPLE_OMP_RETURN))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1384, __FUNCTION__), 0 : 0)); |
1385 | stmt = gimple_build_return (NULLnullptr); |
1386 | gsi_insert_after (&gsi, stmt, GSI_SAME_STMT); |
1387 | gsi_remove (&gsi, true); |
1388 | } |
1389 | |
1390 | /* Move the parallel region into CHILD_CFUN. */ |
1391 | |
1392 | if (gimple_in_ssa_p (cfun(cfun + 0))) |
1393 | { |
1394 | init_tree_ssa (child_cfun); |
1395 | init_ssa_operands (child_cfun); |
1396 | child_cfun->gimple_df->in_ssa_p = true; |
1397 | block = NULL_TREE(tree) nullptr; |
1398 | } |
1399 | else |
1400 | block = gimple_block (entry_stmt); |
1401 | |
1402 | new_bb = move_sese_region_to_fn (child_cfun, entry_bb, exit_bb, block); |
1403 | if (exit_bb) |
1404 | single_succ_edge (new_bb)->flags = EDGE_FALLTHRU; |
1405 | if (e2) |
1406 | { |
1407 | basic_block dest_bb = e2->dest; |
1408 | if (!exit_bb) |
1409 | make_edge (new_bb, dest_bb, EDGE_FALLTHRU); |
1410 | remove_edge (e2); |
1411 | set_immediate_dominator (CDI_DOMINATORS, dest_bb, new_bb); |
1412 | } |
1413 | /* When the OMP expansion process cannot guarantee an up-to-date |
1414 | loop tree arrange for the child function to fixup loops. */ |
1415 | if (loops_state_satisfies_p (LOOPS_NEED_FIXUP)) |
1416 | child_cfun->x_current_loops->state |= LOOPS_NEED_FIXUP; |
1417 | |
1418 | /* Remove non-local VAR_DECLs from child_cfun->local_decls list. */ |
1419 | num = vec_safe_length (child_cfun->local_decls); |
1420 | for (srcidx = 0, dstidx = 0; srcidx < num; srcidx++) |
1421 | { |
1422 | t = (*child_cfun->local_decls)[srcidx]; |
1423 | if (DECL_CONTEXT (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1423, __FUNCTION__))->decl_minimal.context) == cfun(cfun + 0)->decl) |
1424 | continue; |
1425 | if (srcidx != dstidx) |
1426 | (*child_cfun->local_decls)[dstidx] = t; |
1427 | dstidx++; |
1428 | } |
1429 | if (dstidx != num) |
1430 | vec_safe_truncate (child_cfun->local_decls, dstidx); |
1431 | |
1432 | /* Inform the callgraph about the new function. */ |
1433 | child_cfun->curr_properties = cfun(cfun + 0)->curr_properties; |
1434 | child_cfun->has_simduid_loops |= cfun(cfun + 0)->has_simduid_loops; |
1435 | child_cfun->has_force_vectorize_loops |= cfun(cfun + 0)->has_force_vectorize_loops; |
1436 | cgraph_node *node = cgraph_node::get_create (child_fn); |
1437 | node->parallelized_function = 1; |
1438 | cgraph_node::add_new_function (child_fn, true); |
1439 | |
1440 | bool need_asm = DECL_ASSEMBLER_NAME_SET_P (current_function_decl)(((contains_struct_check ((current_function_decl), (TS_DECL_WITH_VIS ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1440, __FUNCTION__))->decl_with_vis.assembler_name) != ( tree) nullptr) |
1441 | && !DECL_ASSEMBLER_NAME_SET_P (child_fn)(((contains_struct_check ((child_fn), (TS_DECL_WITH_VIS), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1441, __FUNCTION__))->decl_with_vis.assembler_name) != ( tree) nullptr); |
1442 | |
1443 | /* Fix the callgraph edges for child_cfun. Those for cfun will be |
1444 | fixed in a following pass. */ |
1445 | push_cfun (child_cfun); |
1446 | if (need_asm) |
1447 | assign_assembler_name_if_needed (child_fn); |
1448 | |
1449 | if (optimizeglobal_options.x_optimize) |
1450 | optimize_omp_library_calls (entry_stmt); |
1451 | update_max_bb_count (); |
1452 | cgraph_edge::rebuild_edges (); |
1453 | |
1454 | /* Some EH regions might become dead, see PR34608. If |
1455 | pass_cleanup_cfg isn't the first pass to happen with the |
1456 | new child, these dead EH edges might cause problems. |
1457 | Clean them up now. */ |
1458 | if (flag_exceptionsglobal_options.x_flag_exceptions) |
1459 | { |
1460 | basic_block bb; |
1461 | bool changed = false; |
1462 | |
1463 | FOR_EACH_BB_FN (bb, cfun)for (bb = ((cfun + 0))->cfg->x_entry_block_ptr->next_bb ; bb != ((cfun + 0))->cfg->x_exit_block_ptr; bb = bb-> next_bb) |
1464 | changed |= gimple_purge_dead_eh_edges (bb); |
1465 | if (changed) |
1466 | cleanup_tree_cfg (); |
1467 | } |
1468 | if (gimple_in_ssa_p (cfun(cfun + 0))) |
1469 | update_ssa (TODO_update_ssa(1 << 11)); |
1470 | if (flag_checkingglobal_options.x_flag_checking && !loops_state_satisfies_p (LOOPS_NEED_FIXUP)) |
1471 | verify_loop_structure (); |
1472 | pop_cfun (); |
1473 | |
1474 | if (dump_file && !gimple_in_ssa_p (cfun(cfun + 0))) |
1475 | { |
1476 | omp_any_child_fn_dumped = true; |
1477 | dump_function_header (dump_file, child_fn, dump_flags); |
1478 | dump_function_to_file (child_fn, dump_file, dump_flags); |
1479 | } |
1480 | } |
1481 | |
1482 | adjust_context_and_scope (region, gimple_block (entry_stmt), child_fn); |
1483 | |
1484 | if (gimple_code (entry_stmt) == GIMPLE_OMP_PARALLEL) |
1485 | expand_parallel_call (region, new_bb, |
1486 | as_a <gomp_parallel *> (entry_stmt), ws_args); |
1487 | else if (gimple_code (entry_stmt) == GIMPLE_OMP_TEAMS) |
1488 | expand_teams_call (new_bb, as_a <gomp_teams *> (entry_stmt)); |
1489 | else |
1490 | expand_task_call (region, new_bb, as_a <gomp_task *> (entry_stmt)); |
1491 | if (gimple_in_ssa_p (cfun(cfun + 0))) |
1492 | update_ssa (TODO_update_ssa_only_virtuals(1 << 14)); |
1493 | } |
1494 | |
1495 | /* Information about members of an OpenACC collapsed loop nest. */ |
1496 | |
1497 | struct oacc_collapse |
1498 | { |
1499 | tree base; /* Base value. */ |
1500 | tree iters; /* Number of steps. */ |
1501 | tree step; /* Step size. */ |
1502 | tree tile; /* Tile increment (if tiled). */ |
1503 | tree outer; /* Tile iterator var. */ |
1504 | }; |
1505 | |
1506 | /* Helper for expand_oacc_for. Determine collapsed loop information. |
1507 | Fill in COUNTS array. Emit any initialization code before GSI. |
1508 | Return the calculated outer loop bound of BOUND_TYPE. */ |
1509 | |
1510 | static tree |
1511 | expand_oacc_collapse_init (const struct omp_for_data *fd, |
1512 | gimple_stmt_iterator *gsi, |
1513 | oacc_collapse *counts, tree diff_type, |
1514 | tree bound_type, location_t loc) |
1515 | { |
1516 | tree tiling = fd->tiling; |
1517 | tree total = build_int_cst (bound_type, 1); |
1518 | int ix; |
1519 | |
1520 | gcc_assert (integer_onep (fd->loop.step))((void)(!(integer_onep (fd->loop.step)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1520, __FUNCTION__), 0 : 0)); |
1521 | gcc_assert (integer_zerop (fd->loop.n1))((void)(!(integer_zerop (fd->loop.n1)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1521, __FUNCTION__), 0 : 0)); |
1522 | |
1523 | /* When tiling, the first operand of the tile clause applies to the |
1524 | innermost loop, and we work outwards from there. Seems |
1525 | backwards, but whatever. */ |
1526 | for (ix = fd->collapse; ix--;) |
1527 | { |
1528 | const omp_for_data_loop *loop = &fd->loops[ix]; |
1529 | |
1530 | tree iter_type = TREE_TYPE (loop->v)((contains_struct_check ((loop->v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1530, __FUNCTION__))->typed.type); |
1531 | tree plus_type = iter_type; |
1532 | |
1533 | gcc_assert (loop->cond_code == fd->loop.cond_code)((void)(!(loop->cond_code == fd->loop.cond_code) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1533, __FUNCTION__), 0 : 0)); |
1534 | |
1535 | if (POINTER_TYPE_P (iter_type)(((enum tree_code) (iter_type)->base.code) == POINTER_TYPE || ((enum tree_code) (iter_type)->base.code) == REFERENCE_TYPE )) |
1536 | plus_type = sizetypesizetype_tab[(int) stk_sizetype]; |
1537 | |
1538 | if (tiling) |
1539 | { |
1540 | tree num = build_int_cst (integer_type_nodeinteger_types[itk_int], fd->collapse); |
1541 | tree loop_no = build_int_cst (integer_type_nodeinteger_types[itk_int], ix); |
1542 | tree tile = TREE_VALUE (tiling)((tree_check ((tiling), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1542, __FUNCTION__, (TREE_LIST)))->list.value); |
1543 | gcall *call |
1544 | = gimple_build_call_internal (IFN_GOACC_TILE, 5, num, loop_no, tile, |
1545 | /* gwv-outer=*/integer_zero_nodeglobal_trees[TI_INTEGER_ZERO], |
1546 | /* gwv-inner=*/integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]); |
1547 | |
1548 | counts[ix].outer = create_tmp_var (iter_type, ".outer"); |
1549 | counts[ix].tile = create_tmp_var (diff_type, ".tile"); |
1550 | gimple_call_set_lhs (call, counts[ix].tile); |
1551 | gimple_set_location (call, loc); |
1552 | gsi_insert_before (gsi, call, GSI_SAME_STMT); |
1553 | |
1554 | tiling = TREE_CHAIN (tiling)((contains_struct_check ((tiling), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1554, __FUNCTION__))->common.chain); |
1555 | } |
1556 | else |
1557 | { |
1558 | counts[ix].tile = NULLnullptr; |
1559 | counts[ix].outer = loop->v; |
1560 | } |
1561 | |
1562 | tree b = loop->n1; |
1563 | tree e = loop->n2; |
1564 | tree s = loop->step; |
1565 | bool up = loop->cond_code == LT_EXPR; |
1566 | tree dir = build_int_cst (diff_type, up ? +1 : -1); |
1567 | bool negating; |
1568 | tree expr; |
1569 | |
1570 | b = force_gimple_operand_gsi (gsi, b, true, NULL_TREE(tree) nullptr, |
1571 | true, GSI_SAME_STMT); |
1572 | e = force_gimple_operand_gsi (gsi, e, true, NULL_TREE(tree) nullptr, |
1573 | true, GSI_SAME_STMT); |
1574 | |
1575 | /* Convert the step, avoiding possible unsigned->signed overflow. */ |
1576 | negating = !up && TYPE_UNSIGNED (TREE_TYPE (s))((tree_class_check ((((contains_struct_check ((s), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1576, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1576, __FUNCTION__))->base.u.bits.unsigned_flag); |
1577 | if (negating) |
1578 | s = fold_build1 (NEGATE_EXPR, TREE_TYPE (s), s)fold_build1_loc (((location_t) 0), NEGATE_EXPR, ((contains_struct_check ((s), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1578, __FUNCTION__))->typed.type), s ); |
1579 | s = fold_convert (diff_type, s)fold_convert_loc (((location_t) 0), diff_type, s); |
1580 | if (negating) |
1581 | s = fold_build1 (NEGATE_EXPR, diff_type, s)fold_build1_loc (((location_t) 0), NEGATE_EXPR, diff_type, s ); |
1582 | s = force_gimple_operand_gsi (gsi, s, true, NULL_TREE(tree) nullptr, |
1583 | true, GSI_SAME_STMT); |
1584 | |
1585 | /* Determine the range, avoiding possible unsigned->signed overflow. */ |
1586 | negating = !up && TYPE_UNSIGNED (iter_type)((tree_class_check ((iter_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1586, __FUNCTION__))->base.u.bits.unsigned_flag); |
1587 | expr = fold_build2 (MINUS_EXPR, plus_type,fold_build2_loc (((location_t) 0), MINUS_EXPR, plus_type, fold_convert_loc (((location_t) 0), plus_type, negating ? b : e), fold_convert_loc (((location_t) 0), plus_type, negating ? e : b) ) |
1588 | fold_convert (plus_type, negating ? b : e),fold_build2_loc (((location_t) 0), MINUS_EXPR, plus_type, fold_convert_loc (((location_t) 0), plus_type, negating ? b : e), fold_convert_loc (((location_t) 0), plus_type, negating ? e : b) ) |
1589 | fold_convert (plus_type, negating ? e : b))fold_build2_loc (((location_t) 0), MINUS_EXPR, plus_type, fold_convert_loc (((location_t) 0), plus_type, negating ? b : e), fold_convert_loc (((location_t) 0), plus_type, negating ? e : b) ); |
1590 | expr = fold_convert (diff_type, expr)fold_convert_loc (((location_t) 0), diff_type, expr); |
1591 | if (negating) |
1592 | expr = fold_build1 (NEGATE_EXPR, diff_type, expr)fold_build1_loc (((location_t) 0), NEGATE_EXPR, diff_type, expr ); |
1593 | tree range = force_gimple_operand_gsi |
1594 | (gsi, expr, true, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); |
1595 | |
1596 | /* Determine number of iterations. */ |
1597 | expr = fold_build2 (MINUS_EXPR, diff_type, range, dir)fold_build2_loc (((location_t) 0), MINUS_EXPR, diff_type, range , dir ); |
1598 | expr = fold_build2 (PLUS_EXPR, diff_type, expr, s)fold_build2_loc (((location_t) 0), PLUS_EXPR, diff_type, expr , s ); |
1599 | expr = fold_build2 (TRUNC_DIV_EXPR, diff_type, expr, s)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, diff_type, expr, s ); |
1600 | |
1601 | tree iters = force_gimple_operand_gsi (gsi, expr, true, NULL_TREE(tree) nullptr, |
1602 | true, GSI_SAME_STMT); |
1603 | |
1604 | counts[ix].base = b; |
1605 | counts[ix].iters = iters; |
1606 | counts[ix].step = s; |
1607 | |
1608 | total = fold_build2 (MULT_EXPR, bound_type, total,fold_build2_loc (((location_t) 0), MULT_EXPR, bound_type, total , fold_convert_loc (((location_t) 0), bound_type, iters) ) |
1609 | fold_convert (bound_type, iters))fold_build2_loc (((location_t) 0), MULT_EXPR, bound_type, total , fold_convert_loc (((location_t) 0), bound_type, iters) ); |
1610 | } |
1611 | |
1612 | return total; |
1613 | } |
1614 | |
1615 | /* Emit initializers for collapsed loop members. INNER is true if |
1616 | this is for the element loop of a TILE. IVAR is the outer |
1617 | loop iteration variable, from which collapsed loop iteration values |
1618 | are calculated. COUNTS array has been initialized by |
1619 | expand_oacc_collapse_inits. */ |
1620 | |
1621 | static void |
1622 | expand_oacc_collapse_vars (const struct omp_for_data *fd, bool inner, |
1623 | gimple_stmt_iterator *gsi, |
1624 | const oacc_collapse *counts, tree ivar, |
1625 | tree diff_type) |
1626 | { |
1627 | tree ivar_type = TREE_TYPE (ivar)((contains_struct_check ((ivar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1627, __FUNCTION__))->typed.type); |
1628 | |
1629 | /* The most rapidly changing iteration variable is the innermost |
1630 | one. */ |
1631 | for (int ix = fd->collapse; ix--;) |
1632 | { |
1633 | const omp_for_data_loop *loop = &fd->loops[ix]; |
1634 | const oacc_collapse *collapse = &counts[ix]; |
1635 | tree v = inner ? loop->v : collapse->outer; |
1636 | tree iter_type = TREE_TYPE (v)((contains_struct_check ((v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1636, __FUNCTION__))->typed.type); |
1637 | tree plus_type = iter_type; |
1638 | enum tree_code plus_code = PLUS_EXPR; |
1639 | tree expr; |
1640 | |
1641 | if (POINTER_TYPE_P (iter_type)(((enum tree_code) (iter_type)->base.code) == POINTER_TYPE || ((enum tree_code) (iter_type)->base.code) == REFERENCE_TYPE )) |
1642 | { |
1643 | plus_code = POINTER_PLUS_EXPR; |
1644 | plus_type = sizetypesizetype_tab[(int) stk_sizetype]; |
1645 | } |
1646 | |
1647 | expr = ivar; |
1648 | if (ix) |
1649 | { |
1650 | tree mod = fold_convert (ivar_type, collapse->iters)fold_convert_loc (((location_t) 0), ivar_type, collapse->iters ); |
1651 | ivar = fold_build2 (TRUNC_DIV_EXPR, ivar_type, expr, mod)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, ivar_type, expr, mod ); |
1652 | expr = fold_build2 (TRUNC_MOD_EXPR, ivar_type, expr, mod)fold_build2_loc (((location_t) 0), TRUNC_MOD_EXPR, ivar_type, expr, mod ); |
1653 | ivar = force_gimple_operand_gsi (gsi, ivar, true, NULL_TREE(tree) nullptr, |
1654 | true, GSI_SAME_STMT); |
1655 | } |
1656 | |
1657 | expr = fold_build2 (MULT_EXPR, diff_type, fold_convert (diff_type, expr),fold_build2_loc (((location_t) 0), MULT_EXPR, diff_type, fold_convert_loc (((location_t) 0), diff_type, expr), fold_convert_loc (((location_t ) 0), diff_type, collapse->step) ) |
1658 | fold_convert (diff_type, collapse->step))fold_build2_loc (((location_t) 0), MULT_EXPR, diff_type, fold_convert_loc (((location_t) 0), diff_type, expr), fold_convert_loc (((location_t ) 0), diff_type, collapse->step) ); |
1659 | expr = fold_build2 (plus_code, iter_type,fold_build2_loc (((location_t) 0), plus_code, iter_type, inner ? collapse->outer : collapse->base, fold_convert_loc ( ((location_t) 0), plus_type, expr) ) |
1660 | inner ? collapse->outer : collapse->base,fold_build2_loc (((location_t) 0), plus_code, iter_type, inner ? collapse->outer : collapse->base, fold_convert_loc ( ((location_t) 0), plus_type, expr) ) |
1661 | fold_convert (plus_type, expr))fold_build2_loc (((location_t) 0), plus_code, iter_type, inner ? collapse->outer : collapse->base, fold_convert_loc ( ((location_t) 0), plus_type, expr) ); |
1662 | expr = force_gimple_operand_gsi (gsi, expr, false, NULL_TREE(tree) nullptr, |
1663 | true, GSI_SAME_STMT); |
1664 | gassign *ass = gimple_build_assign (v, expr); |
1665 | gsi_insert_before (gsi, ass, GSI_SAME_STMT); |
1666 | } |
1667 | } |
1668 | |
1669 | /* Helper function for expand_omp_{for_*,simd}. If this is the outermost |
1670 | of the combined collapse > 1 loop constructs, generate code like: |
1671 | if (__builtin_expect (N32 cond3 N31, 0)) goto ZERO_ITER_BB; |
1672 | if (cond3 is <) |
1673 | adj = STEP3 - 1; |
1674 | else |
1675 | adj = STEP3 + 1; |
1676 | count3 = (adj + N32 - N31) / STEP3; |
1677 | if (__builtin_expect (N22 cond2 N21, 0)) goto ZERO_ITER_BB; |
1678 | if (cond2 is <) |
1679 | adj = STEP2 - 1; |
1680 | else |
1681 | adj = STEP2 + 1; |
1682 | count2 = (adj + N22 - N21) / STEP2; |
1683 | if (__builtin_expect (N12 cond1 N11, 0)) goto ZERO_ITER_BB; |
1684 | if (cond1 is <) |
1685 | adj = STEP1 - 1; |
1686 | else |
1687 | adj = STEP1 + 1; |
1688 | count1 = (adj + N12 - N11) / STEP1; |
1689 | count = count1 * count2 * count3; |
1690 | Furthermore, if ZERO_ITER_BB is NULL, create a BB which does: |
1691 | count = 0; |
1692 | and set ZERO_ITER_BB to that bb. If this isn't the outermost |
1693 | of the combined loop constructs, just initialize COUNTS array |
1694 | from the _looptemp_ clauses. For loop nests with non-rectangular |
1695 | loops, do this only for the rectangular loops. Then pick |
1696 | the loops which reference outer vars in their bound expressions |
1697 | and the loops which they refer to and for this sub-nest compute |
1698 | number of iterations. For triangular loops use Faulhaber's formula, |
1699 | otherwise as a fallback, compute by iterating the loops. |
1700 | If e.g. the sub-nest is |
1701 | for (I = N11; I COND1 N12; I += STEP1) |
1702 | for (J = M21 * I + N21; J COND2 M22 * I + N22; J += STEP2) |
1703 | for (K = M31 * J + N31; K COND3 M32 * J + N32; K += STEP3) |
1704 | do: |
1705 | COUNT = 0; |
1706 | for (tmpi = N11; tmpi COND1 N12; tmpi += STEP1) |
1707 | for (tmpj = M21 * tmpi + N21; |
1708 | tmpj COND2 M22 * tmpi + N22; tmpj += STEP2) |
1709 | { |
1710 | int tmpk1 = M31 * tmpj + N31; |
1711 | int tmpk2 = M32 * tmpj + N32; |
1712 | if (tmpk1 COND3 tmpk2) |
1713 | { |
1714 | if (COND3 is <) |
1715 | adj = STEP3 - 1; |
1716 | else |
1717 | adj = STEP3 + 1; |
1718 | COUNT += (adj + tmpk2 - tmpk1) / STEP3; |
1719 | } |
1720 | } |
1721 | and finally multiply the counts of the rectangular loops not |
1722 | in the sub-nest with COUNT. Also, as counts[fd->last_nonrect] |
1723 | store number of iterations of the loops from fd->first_nonrect |
1724 | to fd->last_nonrect inclusive, i.e. the above COUNT multiplied |
1725 | by the counts of rectangular loops not referenced in any non-rectangular |
1726 | loops sandwitched in between those. */ |
1727 | |
1728 | /* NOTE: It *could* be better to moosh all of the BBs together, |
1729 | creating one larger BB with all the computation and the unexpected |
1730 | jump at the end. I.e. |
1731 | |
1732 | bool zero3, zero2, zero1, zero; |
1733 | |
1734 | zero3 = N32 c3 N31; |
1735 | count3 = (N32 - N31) /[cl] STEP3; |
1736 | zero2 = N22 c2 N21; |
1737 | count2 = (N22 - N21) /[cl] STEP2; |
1738 | zero1 = N12 c1 N11; |
1739 | count1 = (N12 - N11) /[cl] STEP1; |
1740 | zero = zero3 || zero2 || zero1; |
1741 | count = count1 * count2 * count3; |
1742 | if (__builtin_expect(zero, false)) goto zero_iter_bb; |
1743 | |
1744 | After all, we expect the zero=false, and thus we expect to have to |
1745 | evaluate all of the comparison expressions, so short-circuiting |
1746 | oughtn't be a win. Since the condition isn't protecting a |
1747 | denominator, we're not concerned about divide-by-zero, so we can |
1748 | fully evaluate count even if a numerator turned out to be wrong. |
1749 | |
1750 | It seems like putting this all together would create much better |
1751 | scheduling opportunities, and less pressure on the chip's branch |
1752 | predictor. */ |
1753 | |
1754 | static void |
1755 | expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi, |
1756 | basic_block &entry_bb, tree *counts, |
1757 | basic_block &zero_iter1_bb, int &first_zero_iter1, |
1758 | basic_block &zero_iter2_bb, int &first_zero_iter2, |
1759 | basic_block &l2_dom_bb) |
1760 | { |
1761 | tree t, type = TREE_TYPE (fd->loop.v)((contains_struct_check ((fd->loop.v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1761, __FUNCTION__))->typed.type); |
1762 | edge e, ne; |
1763 | int i; |
1764 | |
1765 | /* Collapsed loops need work for expansion into SSA form. */ |
1766 | gcc_assert (!gimple_in_ssa_p (cfun))((void)(!(!gimple_in_ssa_p ((cfun + 0))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1766, __FUNCTION__), 0 : 0)); |
1767 | |
1768 | if (gimple_omp_for_combined_into_p (fd->for_stmt) |
1769 | && TREE_CODE (fd->loop.n2)((enum tree_code) (fd->loop.n2)->base.code) != INTEGER_CST) |
1770 | { |
1771 | gcc_assert (fd->ordered == 0)((void)(!(fd->ordered == 0) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1771, __FUNCTION__), 0 : 0)); |
1772 | /* First two _looptemp_ clauses are for istart/iend, counts[0] |
1773 | isn't supposed to be handled, as the inner loop doesn't |
1774 | use it. */ |
1775 | tree innerc = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), |
1776 | OMP_CLAUSE__LOOPTEMP_); |
1777 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1777, __FUNCTION__), 0 : 0)); |
1778 | for (i = 0; i < fd->collapse; i++) |
1779 | { |
1780 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1780, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1780, __FUNCTION__))->common.chain), |
1781 | OMP_CLAUSE__LOOPTEMP_); |
1782 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1782, __FUNCTION__), 0 : 0)); |
1783 | if (i) |
1784 | counts[i] = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1784, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1784, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1784, __FUNCTION__))); |
1785 | else |
1786 | counts[0] = NULL_TREE(tree) nullptr; |
1787 | } |
1788 | if (fd->non_rect |
1789 | && fd->last_nonrect == fd->first_nonrect + 1 |
1790 | && !TYPE_UNSIGNED (TREE_TYPE (fd->loops[fd->last_nonrect].v))((tree_class_check ((((contains_struct_check ((fd->loops[fd ->last_nonrect].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1790, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1790, __FUNCTION__))->base.u.bits.unsigned_flag)) |
1791 | { |
1792 | tree c[4]; |
1793 | for (i = 0; i < 4; i++) |
1794 | { |
1795 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1795, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1795, __FUNCTION__))->common.chain), |
1796 | OMP_CLAUSE__LOOPTEMP_); |
1797 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1797, __FUNCTION__), 0 : 0)); |
1798 | c[i] = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1798, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1798, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1798, __FUNCTION__))); |
1799 | } |
1800 | counts[0] = c[0]; |
1801 | fd->first_inner_iterations = c[1]; |
1802 | fd->factor = c[2]; |
1803 | fd->adjn1 = c[3]; |
1804 | } |
1805 | return; |
1806 | } |
1807 | |
1808 | for (i = fd->collapse; i < fd->ordered; i++) |
1809 | { |
1810 | tree itype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1810, __FUNCTION__))->typed.type); |
1811 | counts[i] = NULL_TREE(tree) nullptr; |
1812 | t = fold_binary (fd->loops[i].cond_code, boolean_type_node,fold_binary_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], fold_convert_loc (((location_t ) 0), itype, fd->loops[i].n1), fold_convert_loc (((location_t ) 0), itype, fd->loops[i].n2)) |
1813 | fold_convert (itype, fd->loops[i].n1),fold_binary_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], fold_convert_loc (((location_t ) 0), itype, fd->loops[i].n1), fold_convert_loc (((location_t ) 0), itype, fd->loops[i].n2)) |
1814 | fold_convert (itype, fd->loops[i].n2))fold_binary_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], fold_convert_loc (((location_t ) 0), itype, fd->loops[i].n1), fold_convert_loc (((location_t ) 0), itype, fd->loops[i].n2)); |
1815 | if (t && integer_zerop (t)) |
1816 | { |
1817 | for (i = fd->collapse; i < fd->ordered; i++) |
1818 | counts[i] = build_int_cst (type, 0); |
1819 | break; |
1820 | } |
1821 | } |
1822 | bool rect_count_seen = false; |
1823 | for (i = 0; i < (fd->ordered ? fd->ordered : fd->collapse); i++) |
1824 | { |
1825 | tree itype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1825, __FUNCTION__))->typed.type); |
1826 | |
1827 | if (i >= fd->collapse && counts[i]) |
1828 | continue; |
1829 | if (fd->non_rect) |
1830 | { |
1831 | /* Skip loops that use outer iterators in their expressions |
1832 | during this phase. */ |
1833 | if (fd->loops[i].m1 || fd->loops[i].m2) |
1834 | { |
1835 | counts[i] = build_zero_cst (type); |
1836 | continue; |
1837 | } |
1838 | } |
1839 | if ((SSA_VAR_P (fd->loop.n2)(((enum tree_code) (fd->loop.n2)->base.code) == VAR_DECL || ((enum tree_code) (fd->loop.n2)->base.code) == PARM_DECL || ((enum tree_code) (fd->loop.n2)->base.code) == RESULT_DECL || ((enum tree_code) (fd->loop.n2)->base.code) == SSA_NAME ) || i >= fd->collapse) |
1840 | && ((t = fold_binary (fd->loops[i].cond_code, boolean_type_node,fold_binary_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], fold_convert_loc (((location_t ) 0), itype, fd->loops[i].n1), fold_convert_loc (((location_t ) 0), itype, fd->loops[i].n2)) |
1841 | fold_convert (itype, fd->loops[i].n1),fold_binary_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], fold_convert_loc (((location_t ) 0), itype, fd->loops[i].n1), fold_convert_loc (((location_t ) 0), itype, fd->loops[i].n2)) |
1842 | fold_convert (itype, fd->loops[i].n2))fold_binary_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], fold_convert_loc (((location_t ) 0), itype, fd->loops[i].n1), fold_convert_loc (((location_t ) 0), itype, fd->loops[i].n2))) |
1843 | == NULL_TREE(tree) nullptr || !integer_onep (t))) |
1844 | { |
1845 | gcond *cond_stmt; |
1846 | tree n1, n2; |
1847 | n1 = fold_convert (itype, unshare_expr (fd->loops[i].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n1)); |
1848 | n1 = force_gimple_operand_gsi (gsi, n1, true, NULL_TREE(tree) nullptr, |
1849 | true, GSI_SAME_STMT); |
1850 | n2 = fold_convert (itype, unshare_expr (fd->loops[i].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n2)); |
1851 | n2 = force_gimple_operand_gsi (gsi, n2, true, NULL_TREE(tree) nullptr, |
1852 | true, GSI_SAME_STMT); |
1853 | cond_stmt = gimple_build_cond (fd->loops[i].cond_code, n1, n2, |
1854 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
1855 | gsi_insert_before (gsi, cond_stmt, GSI_SAME_STMT); |
1856 | if (walk_tree (gimple_cond_lhs_ptr (cond_stmt),walk_tree_1 (gimple_cond_lhs_ptr (cond_stmt), expand_omp_regimplify_p , nullptr, nullptr, nullptr) |
1857 | expand_omp_regimplify_p, NULL, NULL)walk_tree_1 (gimple_cond_lhs_ptr (cond_stmt), expand_omp_regimplify_p , nullptr, nullptr, nullptr) |
1858 | || walk_tree (gimple_cond_rhs_ptr (cond_stmt),walk_tree_1 (gimple_cond_rhs_ptr (cond_stmt), expand_omp_regimplify_p , nullptr, nullptr, nullptr) |
1859 | expand_omp_regimplify_p, NULL, NULL)walk_tree_1 (gimple_cond_rhs_ptr (cond_stmt), expand_omp_regimplify_p , nullptr, nullptr, nullptr)) |
1860 | { |
1861 | *gsi = gsi_for_stmt (cond_stmt); |
1862 | gimple_regimplify_operands (cond_stmt, gsi); |
1863 | } |
1864 | e = split_block (entry_bb, cond_stmt); |
1865 | basic_block &zero_iter_bb |
1866 | = i < fd->collapse ? zero_iter1_bb : zero_iter2_bb; |
1867 | int &first_zero_iter |
1868 | = i < fd->collapse ? first_zero_iter1 : first_zero_iter2; |
1869 | if (zero_iter_bb == NULLnullptr) |
1870 | { |
1871 | gassign *assign_stmt; |
1872 | first_zero_iter = i; |
1873 | zero_iter_bb = create_empty_bb (entry_bb); |
1874 | add_bb_to_loop (zero_iter_bb, entry_bb->loop_father); |
1875 | *gsi = gsi_after_labels (zero_iter_bb); |
1876 | if (i < fd->collapse) |
1877 | assign_stmt = gimple_build_assign (fd->loop.n2, |
1878 | build_zero_cst (type)); |
1879 | else |
1880 | { |
1881 | counts[i] = create_tmp_reg (type, ".count"); |
1882 | assign_stmt |
1883 | = gimple_build_assign (counts[i], build_zero_cst (type)); |
1884 | } |
1885 | gsi_insert_before (gsi, assign_stmt, GSI_SAME_STMT); |
1886 | set_immediate_dominator (CDI_DOMINATORS, zero_iter_bb, |
1887 | entry_bb); |
1888 | } |
1889 | ne = make_edge (entry_bb, zero_iter_bb, EDGE_FALSE_VALUE); |
1890 | ne->probability = profile_probability::very_unlikely (); |
1891 | e->flags = EDGE_TRUE_VALUE; |
1892 | e->probability = ne->probability.invert (); |
1893 | if (l2_dom_bb == NULLnullptr) |
1894 | l2_dom_bb = entry_bb; |
1895 | entry_bb = e->dest; |
1896 | *gsi = gsi_last_nondebug_bb (entry_bb); |
1897 | } |
1898 | |
1899 | if (POINTER_TYPE_P (itype)(((enum tree_code) (itype)->base.code) == POINTER_TYPE || ( (enum tree_code) (itype)->base.code) == REFERENCE_TYPE)) |
1900 | itype = signed_type_for (itype); |
1901 | t = build_int_cst (itype, (fd->loops[i].cond_code == LT_EXPR |
1902 | ? -1 : 1)); |
1903 | t = fold_build2 (PLUS_EXPR, itype,fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fold_convert_loc (((location_t) 0), itype, fd->loops[i].step), t ) |
1904 | fold_convert (itype, fd->loops[i].step), t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fold_convert_loc (((location_t) 0), itype, fd->loops[i].step), t ); |
1905 | t = fold_build2 (PLUS_EXPR, itype, t,fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, fd->loops[i].n2) ) |
1906 | fold_convert (itype, fd->loops[i].n2))fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, fd->loops[i].n2) ); |
1907 | t = fold_build2 (MINUS_EXPR, itype, t,fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, fd->loops[i].n1) ) |
1908 | fold_convert (itype, fd->loops[i].n1))fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, fd->loops[i].n1) ); |
1909 | /* ?? We could probably use CEIL_DIV_EXPR instead of |
1910 | TRUNC_DIV_EXPR and adjusting by hand. Unless we can't |
1911 | generate the same code in the end because generically we |
1912 | don't know that the values involved must be negative for |
1913 | GT?? */ |
1914 | if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1914, __FUNCTION__))->base.u.bits.unsigned_flag) && fd->loops[i].cond_code == GT_EXPR) |
1915 | t = fold_build2 (TRUNC_DIV_EXPR, itype,fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, fold_convert_loc (((location_t ) 0), itype, fd->loops[i].step) ) ) |
1916 | fold_build1 (NEGATE_EXPR, itype, t),fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, fold_convert_loc (((location_t ) 0), itype, fd->loops[i].step) ) ) |
1917 | fold_build1 (NEGATE_EXPR, itype,fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, fold_convert_loc (((location_t ) 0), itype, fd->loops[i].step) ) ) |
1918 | fold_convert (itype,fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, fold_convert_loc (((location_t ) 0), itype, fd->loops[i].step) ) ) |
1919 | fd->loops[i].step)))fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, fold_convert_loc (((location_t ) 0), itype, fd->loops[i].step) ) ); |
1920 | else |
1921 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t,fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, fd->loops[i].step) ) |
1922 | fold_convert (itype, fd->loops[i].step))fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, fd->loops[i].step) ); |
1923 | t = fold_convert (type, t)fold_convert_loc (((location_t) 0), type, t); |
1924 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == INTEGER_CST) |
1925 | counts[i] = t; |
1926 | else |
1927 | { |
1928 | if (i < fd->collapse || i != first_zero_iter2) |
1929 | counts[i] = create_tmp_reg (type, ".count"); |
1930 | expand_omp_build_assign (gsi, counts[i], t); |
1931 | } |
1932 | if (SSA_VAR_P (fd->loop.n2)(((enum tree_code) (fd->loop.n2)->base.code) == VAR_DECL || ((enum tree_code) (fd->loop.n2)->base.code) == PARM_DECL || ((enum tree_code) (fd->loop.n2)->base.code) == RESULT_DECL || ((enum tree_code) (fd->loop.n2)->base.code) == SSA_NAME ) && i < fd->collapse) |
1933 | { |
1934 | if (fd->non_rect && i >= fd->first_nonrect && i <= fd->last_nonrect) |
1935 | continue; |
1936 | if (!rect_count_seen) |
1937 | { |
1938 | t = counts[i]; |
1939 | rect_count_seen = true; |
1940 | } |
1941 | else |
1942 | t = fold_build2 (MULT_EXPR, type, fd->loop.n2, counts[i])fold_build2_loc (((location_t) 0), MULT_EXPR, type, fd->loop .n2, counts[i] ); |
1943 | expand_omp_build_assign (gsi, fd->loop.n2, t); |
1944 | } |
1945 | } |
1946 | if (fd->non_rect && SSA_VAR_P (fd->loop.n2)(((enum tree_code) (fd->loop.n2)->base.code) == VAR_DECL || ((enum tree_code) (fd->loop.n2)->base.code) == PARM_DECL || ((enum tree_code) (fd->loop.n2)->base.code) == RESULT_DECL || ((enum tree_code) (fd->loop.n2)->base.code) == SSA_NAME )) |
1947 | { |
1948 | gcc_assert (fd->last_nonrect != -1)((void)(!(fd->last_nonrect != -1) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1948, __FUNCTION__), 0 : 0)); |
1949 | |
1950 | counts[fd->last_nonrect] = create_tmp_reg (type, ".count"); |
1951 | expand_omp_build_assign (gsi, counts[fd->last_nonrect], |
1952 | build_zero_cst (type)); |
1953 | for (i = fd->first_nonrect + 1; i < fd->last_nonrect; i++) |
1954 | if (fd->loops[i].m1 |
1955 | || fd->loops[i].m2 |
1956 | || fd->loops[i].non_rect_referenced) |
1957 | break; |
1958 | if (i == fd->last_nonrect |
1959 | && fd->loops[i].outer == fd->last_nonrect - fd->first_nonrect |
1960 | && !TYPE_UNSIGNED (TREE_TYPE (fd->loops[i].v))((tree_class_check ((((contains_struct_check ((fd->loops[i ].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1960, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1960, __FUNCTION__))->base.u.bits.unsigned_flag)) |
1961 | { |
1962 | int o = fd->first_nonrect; |
1963 | tree itype = TREE_TYPE (fd->loops[o].v)((contains_struct_check ((fd->loops[o].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1963, __FUNCTION__))->typed.type); |
1964 | tree n1o = create_tmp_reg (itype, ".n1o"); |
1965 | t = fold_convert (itype, unshare_expr (fd->loops[o].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[o].n1)); |
1966 | expand_omp_build_assign (gsi, n1o, t); |
1967 | tree n2o = create_tmp_reg (itype, ".n2o"); |
1968 | t = fold_convert (itype, unshare_expr (fd->loops[o].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[o].n2)); |
1969 | expand_omp_build_assign (gsi, n2o, t); |
1970 | if (fd->loops[i].m1 && fd->loops[i].m2) |
1971 | t = fold_build2 (MINUS_EXPR, itype, unshare_expr (fd->loops[i].m2),fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, unshare_expr (fd->loops[i].m2), unshare_expr (fd->loops[i].m1) ) |
1972 | unshare_expr (fd->loops[i].m1))fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, unshare_expr (fd->loops[i].m2), unshare_expr (fd->loops[i].m1) ); |
1973 | else if (fd->loops[i].m1) |
1974 | t = fold_unary (NEGATE_EXPR, itype,fold_unary_loc (((location_t) 0), NEGATE_EXPR, itype, unshare_expr (fd->loops[i].m1)) |
1975 | unshare_expr (fd->loops[i].m1))fold_unary_loc (((location_t) 0), NEGATE_EXPR, itype, unshare_expr (fd->loops[i].m1)); |
1976 | else |
1977 | t = unshare_expr (fd->loops[i].m2); |
1978 | tree m2minusm1 |
1979 | = force_gimple_operand_gsi (gsi, t, true, NULL_TREE(tree) nullptr, |
1980 | true, GSI_SAME_STMT); |
1981 | |
1982 | gimple_stmt_iterator gsi2 = *gsi; |
1983 | gsi_prev (&gsi2); |
1984 | e = split_block (entry_bb, gsi_stmt (gsi2)); |
1985 | e = split_block (e->dest, (gimple *) NULLnullptr); |
1986 | basic_block bb1 = e->src; |
1987 | entry_bb = e->dest; |
1988 | *gsi = gsi_after_labels (entry_bb); |
1989 | |
1990 | gsi2 = gsi_after_labels (bb1); |
1991 | tree ostep = fold_convert (itype, fd->loops[o].step)fold_convert_loc (((location_t) 0), itype, fd->loops[o].step ); |
1992 | t = build_int_cst (itype, (fd->loops[o].cond_code |
1993 | == LT_EXPR ? -1 : 1)); |
1994 | t = fold_build2 (PLUS_EXPR, itype, ostep, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, ostep, t ); |
1995 | t = fold_build2 (PLUS_EXPR, itype, t, n2o)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, n2o ); |
1996 | t = fold_build2 (MINUS_EXPR, itype, t, n1o)fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, t, n1o ); |
1997 | if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 1997, __FUNCTION__))->base.u.bits.unsigned_flag) |
1998 | && fd->loops[o].cond_code == GT_EXPR) |
1999 | t = fold_build2 (TRUNC_DIV_EXPR, itype,fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, ostep ) ) |
2000 | fold_build1 (NEGATE_EXPR, itype, t),fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, ostep ) ) |
2001 | fold_build1 (NEGATE_EXPR, itype, ostep))fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, ostep ) ); |
2002 | else |
2003 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t, ostep)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, ostep ); |
2004 | tree outer_niters |
2005 | = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
2006 | true, GSI_SAME_STMT); |
2007 | t = fold_build2 (MINUS_EXPR, itype, outer_niters,fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, outer_niters , build_one_cst (itype) ) |
2008 | build_one_cst (itype))fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, outer_niters , build_one_cst (itype) ); |
2009 | t = fold_build2 (MULT_EXPR, itype, t, ostep)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, ostep ); |
2010 | t = fold_build2 (PLUS_EXPR, itype, n1o, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1o, t ); |
2011 | tree last = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
2012 | true, GSI_SAME_STMT); |
2013 | tree n1, n2, n1e, n2e; |
2014 | t = fold_convert (itype, unshare_expr (fd->loops[i].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n1)); |
2015 | if (fd->loops[i].m1) |
2016 | { |
2017 | n1 = fold_convert (itype, unshare_expr (fd->loops[i].m1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m1)); |
2018 | n1 = fold_build2 (MULT_EXPR, itype, n1o, n1)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, n1o, n1 ); |
2019 | n1 = fold_build2 (PLUS_EXPR, itype, n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1, t ); |
2020 | } |
2021 | else |
2022 | n1 = t; |
2023 | n1 = force_gimple_operand_gsi (&gsi2, n1, true, NULL_TREE(tree) nullptr, |
2024 | true, GSI_SAME_STMT); |
2025 | t = fold_convert (itype, unshare_expr (fd->loops[i].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n2)); |
2026 | if (fd->loops[i].m2) |
2027 | { |
2028 | n2 = fold_convert (itype, unshare_expr (fd->loops[i].m2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m2)); |
2029 | n2 = fold_build2 (MULT_EXPR, itype, n1o, n2)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, n1o, n2 ); |
2030 | n2 = fold_build2 (PLUS_EXPR, itype, n2, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n2, t ); |
2031 | } |
2032 | else |
2033 | n2 = t; |
2034 | n2 = force_gimple_operand_gsi (&gsi2, n2, true, NULL_TREE(tree) nullptr, |
2035 | true, GSI_SAME_STMT); |
2036 | t = fold_convert (itype, unshare_expr (fd->loops[i].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n1)); |
2037 | if (fd->loops[i].m1) |
2038 | { |
2039 | n1e = fold_convert (itype, unshare_expr (fd->loops[i].m1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m1)); |
2040 | n1e = fold_build2 (MULT_EXPR, itype, last, n1e)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, last, n1e ); |
2041 | n1e = fold_build2 (PLUS_EXPR, itype, n1e, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1e, t ); |
2042 | } |
2043 | else |
2044 | n1e = t; |
2045 | n1e = force_gimple_operand_gsi (&gsi2, n1e, true, NULL_TREE(tree) nullptr, |
2046 | true, GSI_SAME_STMT); |
2047 | t = fold_convert (itype, unshare_expr (fd->loops[i].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n2)); |
2048 | if (fd->loops[i].m2) |
2049 | { |
2050 | n2e = fold_convert (itype, unshare_expr (fd->loops[i].m2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m2)); |
2051 | n2e = fold_build2 (MULT_EXPR, itype, last, n2e)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, last, n2e ); |
2052 | n2e = fold_build2 (PLUS_EXPR, itype, n2e, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n2e, t ); |
2053 | } |
2054 | else |
2055 | n2e = t; |
2056 | n2e = force_gimple_operand_gsi (&gsi2, n2e, true, NULL_TREE(tree) nullptr, |
2057 | true, GSI_SAME_STMT); |
2058 | gcond *cond_stmt |
2059 | = gimple_build_cond (fd->loops[i].cond_code, n1, n2, |
2060 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2061 | gsi_insert_before (&gsi2, cond_stmt, GSI_SAME_STMT); |
2062 | e = split_block (bb1, cond_stmt); |
2063 | e->flags = EDGE_TRUE_VALUE; |
2064 | e->probability = profile_probability::likely ().guessed (); |
2065 | basic_block bb2 = e->dest; |
2066 | gsi2 = gsi_after_labels (bb2); |
2067 | |
2068 | cond_stmt = gimple_build_cond (fd->loops[i].cond_code, n1e, n2e, |
2069 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2070 | gsi_insert_before (&gsi2, cond_stmt, GSI_SAME_STMT); |
2071 | e = split_block (bb2, cond_stmt); |
2072 | e->flags = EDGE_TRUE_VALUE; |
2073 | e->probability = profile_probability::likely ().guessed (); |
2074 | gsi2 = gsi_after_labels (e->dest); |
2075 | |
2076 | tree step = fold_convert (itype, fd->loops[i].step)fold_convert_loc (((location_t) 0), itype, fd->loops[i].step ); |
2077 | t = build_int_cst (itype, (fd->loops[i].cond_code |
2078 | == LT_EXPR ? -1 : 1)); |
2079 | t = fold_build2 (PLUS_EXPR, itype, step, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, step, t ); |
2080 | t = fold_build2 (PLUS_EXPR, itype, t, n2)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, n2 ); |
2081 | t = fold_build2 (MINUS_EXPR, itype, t, n1)fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, t, n1 ); |
2082 | if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2082, __FUNCTION__))->base.u.bits.unsigned_flag) |
2083 | && fd->loops[i].cond_code == GT_EXPR) |
2084 | t = fold_build2 (TRUNC_DIV_EXPR, itype,fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ) |
2085 | fold_build1 (NEGATE_EXPR, itype, t),fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ) |
2086 | fold_build1 (NEGATE_EXPR, itype, step))fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ); |
2087 | else |
2088 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t, step)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, step ); |
2089 | tree first_inner_iterations |
2090 | = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
2091 | true, GSI_SAME_STMT); |
2092 | t = fold_build2 (MULT_EXPR, itype, m2minusm1, ostep)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, m2minusm1 , ostep ); |
2093 | if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2093, __FUNCTION__))->base.u.bits.unsigned_flag) |
2094 | && fd->loops[i].cond_code == GT_EXPR) |
2095 | t = fold_build2 (TRUNC_DIV_EXPR, itype,fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ) |
2096 | fold_build1 (NEGATE_EXPR, itype, t),fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ) |
2097 | fold_build1 (NEGATE_EXPR, itype, step))fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ); |
2098 | else |
2099 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t, step)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, step ); |
2100 | tree factor |
2101 | = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
2102 | true, GSI_SAME_STMT); |
2103 | t = fold_build2 (MINUS_EXPR, itype, outer_niters,fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, outer_niters , build_one_cst (itype) ) |
2104 | build_one_cst (itype))fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, outer_niters , build_one_cst (itype) ); |
2105 | t = fold_build2 (MULT_EXPR, itype, t, outer_niters)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, outer_niters ); |
2106 | t = fold_build2 (RSHIFT_EXPR, itype, t, integer_one_node)fold_build2_loc (((location_t) 0), RSHIFT_EXPR, itype, t, global_trees [TI_INTEGER_ONE] ); |
2107 | t = fold_build2 (MULT_EXPR, itype, factor, t)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, factor, t ); |
2108 | t = fold_build2 (PLUS_EXPR, itype,fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fold_build2_loc (((location_t) 0), MULT_EXPR, itype, outer_niters, first_inner_iterations ), t ) |
2109 | fold_build2 (MULT_EXPR, itype, outer_niters,fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fold_build2_loc (((location_t) 0), MULT_EXPR, itype, outer_niters, first_inner_iterations ), t ) |
2110 | first_inner_iterations), t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fold_build2_loc (((location_t) 0), MULT_EXPR, itype, outer_niters, first_inner_iterations ), t ); |
2111 | expand_omp_build_assign (&gsi2, counts[fd->last_nonrect], |
2112 | fold_convert (type, t)fold_convert_loc (((location_t) 0), type, t)); |
2113 | |
2114 | basic_block bb3 = create_empty_bb (bb1); |
2115 | add_bb_to_loop (bb3, bb1->loop_father); |
2116 | |
2117 | e = make_edge (bb1, bb3, EDGE_FALSE_VALUE); |
2118 | e->probability = profile_probability::unlikely ().guessed (); |
2119 | |
2120 | gsi2 = gsi_after_labels (bb3); |
2121 | cond_stmt = gimple_build_cond (fd->loops[i].cond_code, n1e, n2e, |
2122 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2123 | gsi_insert_before (&gsi2, cond_stmt, GSI_SAME_STMT); |
2124 | e = split_block (bb3, cond_stmt); |
2125 | e->flags = EDGE_TRUE_VALUE; |
2126 | e->probability = profile_probability::likely ().guessed (); |
2127 | basic_block bb4 = e->dest; |
2128 | |
2129 | ne = make_edge (bb3, entry_bb, EDGE_FALSE_VALUE); |
2130 | ne->probability = e->probability.invert (); |
2131 | |
2132 | basic_block bb5 = create_empty_bb (bb2); |
2133 | add_bb_to_loop (bb5, bb2->loop_father); |
2134 | |
2135 | ne = make_edge (bb2, bb5, EDGE_FALSE_VALUE); |
2136 | ne->probability = profile_probability::unlikely ().guessed (); |
2137 | |
2138 | for (int j = 0; j < 2; j++) |
2139 | { |
2140 | gsi2 = gsi_after_labels (j ? bb5 : bb4); |
2141 | t = fold_build2 (MINUS_EXPR, itype,fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, unshare_expr (fd->loops[i].n1), unshare_expr (fd->loops[i].n2) ) |
2142 | unshare_expr (fd->loops[i].n1),fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, unshare_expr (fd->loops[i].n1), unshare_expr (fd->loops[i].n2) ) |
2143 | unshare_expr (fd->loops[i].n2))fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, unshare_expr (fd->loops[i].n1), unshare_expr (fd->loops[i].n2) ); |
2144 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t, m2minusm1)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, m2minusm1 ); |
2145 | tree tem |
2146 | = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
2147 | true, GSI_SAME_STMT); |
2148 | t = fold_build2 (MINUS_EXPR, itype, tem, n1o)fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, tem, n1o ); |
2149 | t = fold_build2 (TRUNC_MOD_EXPR, itype, t, ostep)fold_build2_loc (((location_t) 0), TRUNC_MOD_EXPR, itype, t, ostep ); |
2150 | t = fold_build2 (MINUS_EXPR, itype, tem, t)fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, tem, t ); |
2151 | tem = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
2152 | true, GSI_SAME_STMT); |
2153 | t = fold_convert (itype, unshare_expr (fd->loops[i].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n1)); |
2154 | if (fd->loops[i].m1) |
2155 | { |
2156 | n1 = fold_convert (itype, unshare_expr (fd->loops[i].m1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m1)); |
2157 | n1 = fold_build2 (MULT_EXPR, itype, tem, n1)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, tem, n1 ); |
2158 | n1 = fold_build2 (PLUS_EXPR, itype, n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1, t ); |
2159 | } |
2160 | else |
2161 | n1 = t; |
2162 | n1 = force_gimple_operand_gsi (&gsi2, n1, true, NULL_TREE(tree) nullptr, |
2163 | true, GSI_SAME_STMT); |
2164 | t = fold_convert (itype, unshare_expr (fd->loops[i].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n2)); |
2165 | if (fd->loops[i].m2) |
2166 | { |
2167 | n2 = fold_convert (itype, unshare_expr (fd->loops[i].m2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m2)); |
2168 | n2 = fold_build2 (MULT_EXPR, itype, tem, n2)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, tem, n2 ); |
2169 | n2 = fold_build2 (PLUS_EXPR, itype, n2, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n2, t ); |
2170 | } |
2171 | else |
2172 | n2 = t; |
2173 | n2 = force_gimple_operand_gsi (&gsi2, n2, true, NULL_TREE(tree) nullptr, |
2174 | true, GSI_SAME_STMT); |
2175 | expand_omp_build_assign (&gsi2, j ? n2o : n1o, tem); |
2176 | |
2177 | cond_stmt = gimple_build_cond (fd->loops[i].cond_code, n1, n2, |
2178 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2179 | gsi_insert_before (&gsi2, cond_stmt, GSI_SAME_STMT); |
2180 | e = split_block (gsi_bb (gsi2), cond_stmt); |
2181 | e->flags = j ? EDGE_TRUE_VALUE : EDGE_FALSE_VALUE; |
2182 | e->probability = profile_probability::unlikely ().guessed (); |
2183 | ne = make_edge (e->src, bb1, |
2184 | j ? EDGE_FALSE_VALUE : EDGE_TRUE_VALUE); |
2185 | ne->probability = e->probability.invert (); |
2186 | gsi2 = gsi_after_labels (e->dest); |
2187 | |
2188 | t = fold_build2 (PLUS_EXPR, itype, tem, ostep)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, tem, ostep ); |
2189 | expand_omp_build_assign (&gsi2, j ? n2o : n1o, t); |
2190 | |
2191 | make_edge (e->dest, bb1, EDGE_FALLTHRU); |
2192 | } |
2193 | |
2194 | set_immediate_dominator (CDI_DOMINATORS, bb3, bb1); |
2195 | set_immediate_dominator (CDI_DOMINATORS, bb5, bb2); |
2196 | set_immediate_dominator (CDI_DOMINATORS, entry_bb, bb1); |
2197 | |
2198 | if (fd->first_nonrect + 1 == fd->last_nonrect) |
2199 | { |
2200 | fd->first_inner_iterations = first_inner_iterations; |
2201 | fd->factor = factor; |
2202 | fd->adjn1 = n1o; |
2203 | } |
2204 | } |
2205 | else |
2206 | { |
2207 | /* Fallback implementation. Evaluate the loops with m1/m2 |
2208 | non-NULL as well as their outer loops at runtime using temporaries |
2209 | instead of the original iteration variables, and in the |
2210 | body just bump the counter. */ |
2211 | gimple_stmt_iterator gsi2 = *gsi; |
2212 | gsi_prev (&gsi2); |
2213 | e = split_block (entry_bb, gsi_stmt (gsi2)); |
2214 | e = split_block (e->dest, (gimple *) NULLnullptr); |
2215 | basic_block cur_bb = e->src; |
2216 | basic_block next_bb = e->dest; |
2217 | entry_bb = e->dest; |
2218 | *gsi = gsi_after_labels (entry_bb); |
2219 | |
2220 | tree *vs = XALLOCAVEC (tree, fd->last_nonrect)((tree *) __builtin_alloca(sizeof (tree) * (fd->last_nonrect ))); |
2221 | memset (vs, 0, fd->last_nonrect * sizeof (tree)); |
2222 | |
2223 | for (i = 0; i <= fd->last_nonrect; i++) |
2224 | { |
2225 | if (fd->loops[i].m1 == NULL_TREE(tree) nullptr |
2226 | && fd->loops[i].m2 == NULL_TREE(tree) nullptr |
2227 | && !fd->loops[i].non_rect_referenced) |
2228 | continue; |
2229 | |
2230 | tree itype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2230, __FUNCTION__))->typed.type); |
2231 | |
2232 | gsi2 = gsi_after_labels (cur_bb); |
2233 | tree n1, n2; |
2234 | t = fold_convert (itype, unshare_expr (fd->loops[i].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n1)); |
2235 | if (fd->loops[i].m1) |
2236 | { |
2237 | n1 = fold_convert (itype, unshare_expr (fd->loops[i].m1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m1)); |
2238 | n1 = fold_build2 (MULT_EXPR, itype,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[i - fd ->loops[i].outer], n1 ) |
2239 | vs[i - fd->loops[i].outer], n1)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[i - fd ->loops[i].outer], n1 ); |
2240 | n1 = fold_build2 (PLUS_EXPR, itype, n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1, t ); |
2241 | } |
2242 | else |
2243 | n1 = t; |
2244 | n1 = force_gimple_operand_gsi (&gsi2, n1, true, NULL_TREE(tree) nullptr, |
2245 | true, GSI_SAME_STMT); |
2246 | if (i < fd->last_nonrect) |
2247 | { |
2248 | vs[i] = create_tmp_reg (itype, ".it"); |
2249 | expand_omp_build_assign (&gsi2, vs[i], n1); |
2250 | } |
2251 | t = fold_convert (itype, unshare_expr (fd->loops[i].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n2)); |
2252 | if (fd->loops[i].m2) |
2253 | { |
2254 | n2 = fold_convert (itype, unshare_expr (fd->loops[i].m2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m2)); |
2255 | n2 = fold_build2 (MULT_EXPR, itype,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[i - fd ->loops[i].outer], n2 ) |
2256 | vs[i - fd->loops[i].outer], n2)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[i - fd ->loops[i].outer], n2 ); |
2257 | n2 = fold_build2 (PLUS_EXPR, itype, n2, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n2, t ); |
2258 | } |
2259 | else |
2260 | n2 = t; |
2261 | n2 = force_gimple_operand_gsi (&gsi2, n2, true, NULL_TREE(tree) nullptr, |
2262 | true, GSI_SAME_STMT); |
2263 | if (i == fd->last_nonrect) |
2264 | { |
2265 | gcond *cond_stmt |
2266 | = gimple_build_cond (fd->loops[i].cond_code, n1, n2, |
2267 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2268 | gsi_insert_before (&gsi2, cond_stmt, GSI_SAME_STMT); |
2269 | e = split_block (cur_bb, cond_stmt); |
2270 | e->flags = EDGE_TRUE_VALUE; |
2271 | ne = make_edge (cur_bb, next_bb, EDGE_FALSE_VALUE); |
2272 | e->probability = profile_probability::likely ().guessed (); |
2273 | ne->probability = e->probability.invert (); |
2274 | gsi2 = gsi_after_labels (e->dest); |
2275 | |
2276 | t = build_int_cst (itype, (fd->loops[i].cond_code == LT_EXPR |
2277 | ? -1 : 1)); |
2278 | t = fold_build2 (PLUS_EXPR, itype,fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fold_convert_loc (((location_t) 0), itype, fd->loops[i].step), t ) |
2279 | fold_convert (itype, fd->loops[i].step), t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fold_convert_loc (((location_t) 0), itype, fd->loops[i].step), t ); |
2280 | t = fold_build2 (PLUS_EXPR, itype, t, n2)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, n2 ); |
2281 | t = fold_build2 (MINUS_EXPR, itype, t, n1)fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, t, n1 ); |
2282 | tree step = fold_convert (itype, fd->loops[i].step)fold_convert_loc (((location_t) 0), itype, fd->loops[i].step ); |
2283 | if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2283, __FUNCTION__))->base.u.bits.unsigned_flag) |
2284 | && fd->loops[i].cond_code == GT_EXPR) |
2285 | t = fold_build2 (TRUNC_DIV_EXPR, itype,fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ) |
2286 | fold_build1 (NEGATE_EXPR, itype, t),fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ) |
2287 | fold_build1 (NEGATE_EXPR, itype, step))fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ); |
2288 | else |
2289 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t, step)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, step ); |
2290 | t = fold_convert (type, t)fold_convert_loc (((location_t) 0), type, t); |
2291 | t = fold_build2 (PLUS_EXPR, type,fold_build2_loc (((location_t) 0), PLUS_EXPR, type, counts[fd ->last_nonrect], t ) |
2292 | counts[fd->last_nonrect], t)fold_build2_loc (((location_t) 0), PLUS_EXPR, type, counts[fd ->last_nonrect], t ); |
2293 | t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
2294 | true, GSI_SAME_STMT); |
2295 | expand_omp_build_assign (&gsi2, counts[fd->last_nonrect], t); |
2296 | e = make_edge (e->dest, next_bb, EDGE_FALLTHRU); |
2297 | set_immediate_dominator (CDI_DOMINATORS, next_bb, cur_bb); |
2298 | break; |
2299 | } |
2300 | e = split_block (cur_bb, last_stmt (cur_bb)); |
2301 | |
2302 | basic_block new_cur_bb = create_empty_bb (cur_bb); |
2303 | add_bb_to_loop (new_cur_bb, cur_bb->loop_father); |
2304 | |
2305 | gsi2 = gsi_after_labels (e->dest); |
2306 | tree step = fold_convert (itype,fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].step)) |
2307 | unshare_expr (fd->loops[i].step))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].step)); |
2308 | t = fold_build2 (PLUS_EXPR, itype, vs[i], step)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, vs[i], step ); |
2309 | t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
2310 | true, GSI_SAME_STMT); |
2311 | expand_omp_build_assign (&gsi2, vs[i], t); |
2312 | |
2313 | ne = split_block (e->dest, last_stmt (e->dest)); |
2314 | gsi2 = gsi_after_labels (ne->dest); |
2315 | |
2316 | gcond *cond_stmt |
2317 | = gimple_build_cond (fd->loops[i].cond_code, vs[i], n2, |
2318 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2319 | gsi_insert_before (&gsi2, cond_stmt, GSI_SAME_STMT); |
2320 | edge e3, e4; |
2321 | if (next_bb == entry_bb) |
2322 | { |
2323 | e3 = find_edge (ne->dest, next_bb); |
2324 | e3->flags = EDGE_FALSE_VALUE; |
2325 | } |
2326 | else |
2327 | e3 = make_edge (ne->dest, next_bb, EDGE_FALSE_VALUE); |
2328 | e4 = make_edge (ne->dest, new_cur_bb, EDGE_TRUE_VALUE); |
2329 | e4->probability = profile_probability::likely ().guessed (); |
2330 | e3->probability = e4->probability.invert (); |
2331 | basic_block esrc = e->src; |
2332 | make_edge (e->src, ne->dest, EDGE_FALLTHRU); |
2333 | cur_bb = new_cur_bb; |
2334 | basic_block latch_bb = next_bb; |
2335 | next_bb = e->dest; |
2336 | remove_edge (e); |
2337 | set_immediate_dominator (CDI_DOMINATORS, ne->dest, esrc); |
2338 | set_immediate_dominator (CDI_DOMINATORS, latch_bb, ne->dest); |
2339 | set_immediate_dominator (CDI_DOMINATORS, cur_bb, ne->dest); |
2340 | } |
2341 | } |
2342 | t = NULL_TREE(tree) nullptr; |
2343 | for (i = fd->first_nonrect; i < fd->last_nonrect; i++) |
2344 | if (!fd->loops[i].non_rect_referenced |
2345 | && fd->loops[i].m1 == NULL_TREE(tree) nullptr |
2346 | && fd->loops[i].m2 == NULL_TREE(tree) nullptr) |
2347 | { |
2348 | if (t == NULL_TREE(tree) nullptr) |
2349 | t = counts[i]; |
2350 | else |
2351 | t = fold_build2 (MULT_EXPR, type, t, counts[i])fold_build2_loc (((location_t) 0), MULT_EXPR, type, t, counts [i] ); |
2352 | } |
2353 | if (t) |
2354 | { |
2355 | t = fold_build2 (MULT_EXPR, type, counts[fd->last_nonrect], t)fold_build2_loc (((location_t) 0), MULT_EXPR, type, counts[fd ->last_nonrect], t ); |
2356 | expand_omp_build_assign (gsi, counts[fd->last_nonrect], t); |
2357 | } |
2358 | if (!rect_count_seen) |
2359 | t = counts[fd->last_nonrect]; |
2360 | else |
2361 | t = fold_build2 (MULT_EXPR, type, fd->loop.n2,fold_build2_loc (((location_t) 0), MULT_EXPR, type, fd->loop .n2, counts[fd->last_nonrect] ) |
2362 | counts[fd->last_nonrect])fold_build2_loc (((location_t) 0), MULT_EXPR, type, fd->loop .n2, counts[fd->last_nonrect] ); |
2363 | expand_omp_build_assign (gsi, fd->loop.n2, t); |
2364 | } |
2365 | else if (fd->non_rect) |
2366 | { |
2367 | tree t = fd->loop.n2; |
2368 | gcc_assert (TREE_CODE (t) == INTEGER_CST)((void)(!(((enum tree_code) (t)->base.code) == INTEGER_CST ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2368, __FUNCTION__), 0 : 0)); |
2369 | int non_rect_referenced = 0, non_rect = 0; |
2370 | for (i = 0; i < fd->collapse; i++) |
2371 | { |
2372 | if ((i < fd->first_nonrect || i > fd->last_nonrect) |
2373 | && !integer_zerop (counts[i])) |
2374 | t = fold_build2 (TRUNC_DIV_EXPR, type, t, counts[i])fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, type, t, counts [i] ); |
2375 | if (fd->loops[i].non_rect_referenced) |
2376 | non_rect_referenced++; |
2377 | if (fd->loops[i].m1 || fd->loops[i].m2) |
2378 | non_rect++; |
2379 | } |
2380 | gcc_assert (non_rect == 1 && non_rect_referenced == 1)((void)(!(non_rect == 1 && non_rect_referenced == 1) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2380, __FUNCTION__), 0 : 0)); |
2381 | counts[fd->last_nonrect] = t; |
2382 | } |
2383 | } |
2384 | |
2385 | /* Helper function for expand_omp_{for_*,simd}. Generate code like: |
2386 | T = V; |
2387 | V3 = N31 + (T % count3) * STEP3; |
2388 | T = T / count3; |
2389 | V2 = N21 + (T % count2) * STEP2; |
2390 | T = T / count2; |
2391 | V1 = N11 + T * STEP1; |
2392 | if this loop doesn't have an inner loop construct combined with it. |
2393 | If it does have an inner loop construct combined with it and the |
2394 | iteration count isn't known constant, store values from counts array |
2395 | into its _looptemp_ temporaries instead. |
2396 | For non-rectangular loops (between fd->first_nonrect and fd->last_nonrect |
2397 | inclusive), use the count of all those loops together, and either |
2398 | find quadratic etc. equation roots, or as a fallback, do: |
2399 | COUNT = 0; |
2400 | for (tmpi = N11; tmpi COND1 N12; tmpi += STEP1) |
2401 | for (tmpj = M21 * tmpi + N21; |
2402 | tmpj COND2 M22 * tmpi + N22; tmpj += STEP2) |
2403 | { |
2404 | int tmpk1 = M31 * tmpj + N31; |
2405 | int tmpk2 = M32 * tmpj + N32; |
2406 | if (tmpk1 COND3 tmpk2) |
2407 | { |
2408 | if (COND3 is <) |
2409 | adj = STEP3 - 1; |
2410 | else |
2411 | adj = STEP3 + 1; |
2412 | int temp = (adj + tmpk2 - tmpk1) / STEP3; |
2413 | if (COUNT + temp > T) |
2414 | { |
2415 | V1 = tmpi; |
2416 | V2 = tmpj; |
2417 | V3 = tmpk1 + (T - COUNT) * STEP3; |
2418 | goto done; |
2419 | } |
2420 | else |
2421 | COUNT += temp; |
2422 | } |
2423 | } |
2424 | done:; |
2425 | but for optional innermost or outermost rectangular loops that aren't |
2426 | referenced by other loop expressions keep doing the division/modulo. */ |
2427 | |
2428 | static void |
2429 | expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi, |
2430 | tree *counts, tree *nonrect_bounds, |
2431 | gimple *inner_stmt, tree startvar) |
2432 | { |
2433 | int i; |
2434 | if (gimple_omp_for_combined_p (fd->for_stmt)) |
2435 | { |
2436 | /* If fd->loop.n2 is constant, then no propagation of the counts |
2437 | is needed, they are constant. */ |
2438 | if (TREE_CODE (fd->loop.n2)((enum tree_code) (fd->loop.n2)->base.code) == INTEGER_CST) |
2439 | return; |
2440 | |
2441 | tree clauses = gimple_code (inner_stmt) != GIMPLE_OMP_FOR |
2442 | ? gimple_omp_taskreg_clauses (inner_stmt) |
2443 | : gimple_omp_for_clauses (inner_stmt); |
2444 | /* First two _looptemp_ clauses are for istart/iend, counts[0] |
2445 | isn't supposed to be handled, as the inner loop doesn't |
2446 | use it. */ |
2447 | tree innerc = omp_find_clause (clauses, OMP_CLAUSE__LOOPTEMP_); |
2448 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2448, __FUNCTION__), 0 : 0)); |
2449 | int count = 0; |
2450 | if (fd->non_rect |
2451 | && fd->last_nonrect == fd->first_nonrect + 1 |
2452 | && !TYPE_UNSIGNED (TREE_TYPE (fd->loops[fd->last_nonrect].v))((tree_class_check ((((contains_struct_check ((fd->loops[fd ->last_nonrect].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2452, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2452, __FUNCTION__))->base.u.bits.unsigned_flag)) |
2453 | count = 4; |
2454 | for (i = 0; i < fd->collapse + count; i++) |
2455 | { |
2456 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2456, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2456, __FUNCTION__))->common.chain), |
2457 | OMP_CLAUSE__LOOPTEMP_); |
2458 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2458, __FUNCTION__), 0 : 0)); |
2459 | if (i) |
2460 | { |
2461 | tree tem = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2461, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2461, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2461, __FUNCTION__))); |
2462 | tree t; |
2463 | if (i < fd->collapse) |
2464 | t = counts[i]; |
2465 | else |
2466 | switch (i - fd->collapse) |
2467 | { |
2468 | case 0: t = counts[0]; break; |
2469 | case 1: t = fd->first_inner_iterations; break; |
2470 | case 2: t = fd->factor; break; |
2471 | case 3: t = fd->adjn1; break; |
2472 | default: gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2472, __FUNCTION__)); |
2473 | } |
2474 | t = fold_convert (TREE_TYPE (tem), t)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (tem), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2474, __FUNCTION__))->typed.type), t); |
2475 | t = force_gimple_operand_gsi (gsi, t, false, NULL_TREE(tree) nullptr, |
2476 | false, GSI_CONTINUE_LINKING); |
2477 | gassign *stmt = gimple_build_assign (tem, t); |
2478 | gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING); |
2479 | } |
2480 | } |
2481 | return; |
2482 | } |
2483 | |
2484 | tree type = TREE_TYPE (fd->loop.v)((contains_struct_check ((fd->loop.v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2484, __FUNCTION__))->typed.type); |
2485 | tree tem = create_tmp_reg (type, ".tem"); |
2486 | gassign *stmt = gimple_build_assign (tem, startvar); |
2487 | gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING); |
2488 | |
2489 | for (i = fd->collapse - 1; i >= 0; i--) |
2490 | { |
2491 | tree vtype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2491, __FUNCTION__))->typed.type), itype, t; |
2492 | itype = vtype; |
2493 | if (POINTER_TYPE_P (vtype)(((enum tree_code) (vtype)->base.code) == POINTER_TYPE || ( (enum tree_code) (vtype)->base.code) == REFERENCE_TYPE)) |
2494 | itype = signed_type_for (vtype); |
2495 | if (i != 0 && (i != fd->last_nonrect || fd->first_nonrect)) |
2496 | t = fold_build2 (TRUNC_MOD_EXPR, type, tem, counts[i])fold_build2_loc (((location_t) 0), TRUNC_MOD_EXPR, type, tem, counts[i] ); |
2497 | else |
2498 | t = tem; |
2499 | if (i == fd->last_nonrect) |
2500 | { |
2501 | t = force_gimple_operand_gsi (gsi, t, true, NULL_TREE(tree) nullptr, |
2502 | false, GSI_CONTINUE_LINKING); |
2503 | tree stopval = t; |
2504 | tree idx = create_tmp_reg (type, ".count"); |
2505 | expand_omp_build_assign (gsi, idx, |
2506 | build_zero_cst (type), true); |
2507 | basic_block bb_triang = NULLnullptr, bb_triang_dom = NULLnullptr; |
2508 | if (fd->first_nonrect + 1 == fd->last_nonrect |
2509 | && (TREE_CODE (fd->loop.n2)((enum tree_code) (fd->loop.n2)->base.code) == INTEGER_CST |
2510 | || fd->first_inner_iterations) |
2511 | && (optab_handler (sqrt_optab, TYPE_MODE (double_type_node)((((enum tree_code) ((tree_class_check ((global_trees[TI_DOUBLE_TYPE ]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2511, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (global_trees[TI_DOUBLE_TYPE]) : (global_trees[TI_DOUBLE_TYPE ])->type_common.mode)) |
2512 | != CODE_FOR_nothing) |
2513 | && !integer_zerop (fd->loop.n2)) |
2514 | { |
2515 | tree outer_n1 = fd->adjn1 ? fd->adjn1 : fd->loops[i - 1].n1; |
2516 | tree itype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2516, __FUNCTION__))->typed.type); |
2517 | tree first_inner_iterations = fd->first_inner_iterations; |
2518 | tree factor = fd->factor; |
2519 | gcond *cond_stmt |
2520 | = gimple_build_cond (NE_EXPR, factor, |
2521 | build_zero_cst (TREE_TYPE (factor)((contains_struct_check ((factor), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2521, __FUNCTION__))->typed.type)), |
2522 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2523 | gsi_insert_after (gsi, cond_stmt, GSI_CONTINUE_LINKING); |
2524 | edge e = split_block (gsi_bb (*gsi), cond_stmt); |
2525 | basic_block bb0 = e->src; |
2526 | e->flags = EDGE_TRUE_VALUE; |
2527 | e->probability = profile_probability::likely (); |
2528 | bb_triang_dom = bb0; |
2529 | *gsi = gsi_after_labels (e->dest); |
2530 | tree slltype = long_long_integer_type_nodeinteger_types[itk_long_long]; |
2531 | tree ulltype = long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long]; |
2532 | tree stopvalull = fold_convert (ulltype, stopval)fold_convert_loc (((location_t) 0), ulltype, stopval); |
2533 | stopvalull |
2534 | = force_gimple_operand_gsi (gsi, stopvalull, true, NULL_TREE(tree) nullptr, |
2535 | false, GSI_CONTINUE_LINKING); |
2536 | first_inner_iterations |
2537 | = fold_convert (slltype, first_inner_iterations)fold_convert_loc (((location_t) 0), slltype, first_inner_iterations ); |
2538 | first_inner_iterations |
2539 | = force_gimple_operand_gsi (gsi, first_inner_iterations, true, |
2540 | NULL_TREE(tree) nullptr, false, |
2541 | GSI_CONTINUE_LINKING); |
2542 | factor = fold_convert (slltype, factor)fold_convert_loc (((location_t) 0), slltype, factor); |
2543 | factor |
2544 | = force_gimple_operand_gsi (gsi, factor, true, NULL_TREE(tree) nullptr, |
2545 | false, GSI_CONTINUE_LINKING); |
2546 | tree first_inner_iterationsd |
2547 | = fold_build1 (FLOAT_EXPR, double_type_node,fold_build1_loc (((location_t) 0), FLOAT_EXPR, global_trees[TI_DOUBLE_TYPE ], first_inner_iterations ) |
2548 | first_inner_iterations)fold_build1_loc (((location_t) 0), FLOAT_EXPR, global_trees[TI_DOUBLE_TYPE ], first_inner_iterations ); |
2549 | first_inner_iterationsd |
2550 | = force_gimple_operand_gsi (gsi, first_inner_iterationsd, true, |
2551 | NULL_TREE(tree) nullptr, false, |
2552 | GSI_CONTINUE_LINKING); |
2553 | tree factord = fold_build1 (FLOAT_EXPR, double_type_node,fold_build1_loc (((location_t) 0), FLOAT_EXPR, global_trees[TI_DOUBLE_TYPE ], factor ) |
2554 | factor)fold_build1_loc (((location_t) 0), FLOAT_EXPR, global_trees[TI_DOUBLE_TYPE ], factor ); |
2555 | factord = force_gimple_operand_gsi (gsi, factord, true, |
2556 | NULL_TREE(tree) nullptr, false, |
2557 | GSI_CONTINUE_LINKING); |
2558 | tree stopvald = fold_build1 (FLOAT_EXPR, double_type_node,fold_build1_loc (((location_t) 0), FLOAT_EXPR, global_trees[TI_DOUBLE_TYPE ], stopvalull ) |
2559 | stopvalull)fold_build1_loc (((location_t) 0), FLOAT_EXPR, global_trees[TI_DOUBLE_TYPE ], stopvalull ); |
2560 | stopvald = force_gimple_operand_gsi (gsi, stopvald, true, |
2561 | NULL_TREE(tree) nullptr, false, |
2562 | GSI_CONTINUE_LINKING); |
2563 | /* Temporarily disable flag_rounding_math, values will be |
2564 | decimal numbers divided by 2 and worst case imprecisions |
2565 | due to too large values ought to be caught later by the |
2566 | checks for fallback. */ |
2567 | int save_flag_rounding_math = flag_rounding_mathglobal_options.x_flag_rounding_math; |
2568 | flag_rounding_mathglobal_options.x_flag_rounding_math = 0; |
2569 | t = fold_build2 (RDIV_EXPR, double_type_node, factord,fold_build2_loc (((location_t) 0), RDIV_EXPR, global_trees[TI_DOUBLE_TYPE ], factord, build_real (global_trees[TI_DOUBLE_TYPE], dconst2 ) ) |
2570 | build_real (double_type_node, dconst2))fold_build2_loc (((location_t) 0), RDIV_EXPR, global_trees[TI_DOUBLE_TYPE ], factord, build_real (global_trees[TI_DOUBLE_TYPE], dconst2 ) ); |
2571 | tree t3 = fold_build2 (MINUS_EXPR, double_type_node,fold_build2_loc (((location_t) 0), MINUS_EXPR, global_trees[TI_DOUBLE_TYPE ], first_inner_iterationsd, t ) |
2572 | first_inner_iterationsd, t)fold_build2_loc (((location_t) 0), MINUS_EXPR, global_trees[TI_DOUBLE_TYPE ], first_inner_iterationsd, t ); |
2573 | t3 = force_gimple_operand_gsi (gsi, t3, true, NULL_TREE(tree) nullptr, false, |
2574 | GSI_CONTINUE_LINKING); |
2575 | t = fold_build2 (MULT_EXPR, double_type_node, factord,fold_build2_loc (((location_t) 0), MULT_EXPR, global_trees[TI_DOUBLE_TYPE ], factord, build_real (global_trees[TI_DOUBLE_TYPE], dconst2 ) ) |
2576 | build_real (double_type_node, dconst2))fold_build2_loc (((location_t) 0), MULT_EXPR, global_trees[TI_DOUBLE_TYPE ], factord, build_real (global_trees[TI_DOUBLE_TYPE], dconst2 ) ); |
2577 | t = fold_build2 (MULT_EXPR, double_type_node, t, stopvald)fold_build2_loc (((location_t) 0), MULT_EXPR, global_trees[TI_DOUBLE_TYPE ], t, stopvald ); |
2578 | t = fold_build2 (PLUS_EXPR, double_type_node, t,fold_build2_loc (((location_t) 0), PLUS_EXPR, global_trees[TI_DOUBLE_TYPE ], t, fold_build2_loc (((location_t) 0), MULT_EXPR, global_trees [TI_DOUBLE_TYPE], t3, t3 ) ) |
2579 | fold_build2 (MULT_EXPR, double_type_node,fold_build2_loc (((location_t) 0), PLUS_EXPR, global_trees[TI_DOUBLE_TYPE ], t, fold_build2_loc (((location_t) 0), MULT_EXPR, global_trees [TI_DOUBLE_TYPE], t3, t3 ) ) |
2580 | t3, t3))fold_build2_loc (((location_t) 0), PLUS_EXPR, global_trees[TI_DOUBLE_TYPE ], t, fold_build2_loc (((location_t) 0), MULT_EXPR, global_trees [TI_DOUBLE_TYPE], t3, t3 ) ); |
2581 | flag_rounding_mathglobal_options.x_flag_rounding_math = save_flag_rounding_math; |
2582 | t = force_gimple_operand_gsi (gsi, t, true, NULL_TREE(tree) nullptr, false, |
2583 | GSI_CONTINUE_LINKING); |
2584 | if (flag_exceptionsglobal_options.x_flag_exceptions |
2585 | && cfun(cfun + 0)->can_throw_non_call_exceptions |
2586 | && operation_could_trap_p (LT_EXPR, true, false, NULL_TREE(tree) nullptr)) |
2587 | { |
2588 | tree tem = fold_build2 (LT_EXPR, boolean_type_node, t,fold_build2_loc (((location_t) 0), LT_EXPR, global_trees[TI_BOOLEAN_TYPE ], t, build_zero_cst (global_trees[TI_DOUBLE_TYPE]) ) |
2589 | build_zero_cst (double_type_node))fold_build2_loc (((location_t) 0), LT_EXPR, global_trees[TI_BOOLEAN_TYPE ], t, build_zero_cst (global_trees[TI_DOUBLE_TYPE]) ); |
2590 | tem = force_gimple_operand_gsi (gsi, tem, true, NULL_TREE(tree) nullptr, |
2591 | false, GSI_CONTINUE_LINKING); |
2592 | cond_stmt = gimple_build_cond (NE_EXPR, tem, |
2593 | boolean_false_nodeglobal_trees[TI_BOOLEAN_FALSE], |
2594 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2595 | } |
2596 | else |
2597 | cond_stmt |
2598 | = gimple_build_cond (LT_EXPR, t, |
2599 | build_zero_cst (double_type_nodeglobal_trees[TI_DOUBLE_TYPE]), |
2600 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2601 | gsi_insert_after (gsi, cond_stmt, GSI_CONTINUE_LINKING); |
2602 | e = split_block (gsi_bb (*gsi), cond_stmt); |
2603 | basic_block bb1 = e->src; |
2604 | e->flags = EDGE_FALSE_VALUE; |
2605 | e->probability = profile_probability::very_likely (); |
2606 | *gsi = gsi_after_labels (e->dest); |
2607 | gcall *call = gimple_build_call_internal (IFN_SQRT, 1, t); |
2608 | tree sqrtr = create_tmp_var (double_type_nodeglobal_trees[TI_DOUBLE_TYPE]); |
2609 | gimple_call_set_lhs (call, sqrtr); |
2610 | gsi_insert_after (gsi, call, GSI_CONTINUE_LINKING); |
2611 | t = fold_build2 (MINUS_EXPR, double_type_node, sqrtr, t3)fold_build2_loc (((location_t) 0), MINUS_EXPR, global_trees[TI_DOUBLE_TYPE ], sqrtr, t3 ); |
2612 | t = fold_build2 (RDIV_EXPR, double_type_node, t, factord)fold_build2_loc (((location_t) 0), RDIV_EXPR, global_trees[TI_DOUBLE_TYPE ], t, factord ); |
2613 | t = fold_build1 (FIX_TRUNC_EXPR, ulltype, t)fold_build1_loc (((location_t) 0), FIX_TRUNC_EXPR, ulltype, t ); |
2614 | tree c = create_tmp_var (ulltype); |
2615 | tree d = create_tmp_var (ulltype); |
2616 | expand_omp_build_assign (gsi, c, t, true); |
2617 | t = fold_build2 (MINUS_EXPR, ulltype, c,fold_build2_loc (((location_t) 0), MINUS_EXPR, ulltype, c, build_one_cst (ulltype) ) |
2618 | build_one_cst (ulltype))fold_build2_loc (((location_t) 0), MINUS_EXPR, ulltype, c, build_one_cst (ulltype) ); |
2619 | t = fold_build2 (MULT_EXPR, ulltype, c, t)fold_build2_loc (((location_t) 0), MULT_EXPR, ulltype, c, t ); |
2620 | t = fold_build2 (RSHIFT_EXPR, ulltype, t, integer_one_node)fold_build2_loc (((location_t) 0), RSHIFT_EXPR, ulltype, t, global_trees [TI_INTEGER_ONE] ); |
2621 | t = fold_build2 (MULT_EXPR, ulltype,fold_build2_loc (((location_t) 0), MULT_EXPR, ulltype, fold_convert_loc (((location_t) 0), ulltype, fd->factor), t ) |
2622 | fold_convert (ulltype, fd->factor), t)fold_build2_loc (((location_t) 0), MULT_EXPR, ulltype, fold_convert_loc (((location_t) 0), ulltype, fd->factor), t ); |
2623 | tree t2 |
2624 | = fold_build2 (MULT_EXPR, ulltype, c,fold_build2_loc (((location_t) 0), MULT_EXPR, ulltype, c, fold_convert_loc (((location_t) 0), ulltype, fd->first_inner_iterations) ) |
2625 | fold_convert (ulltype,fold_build2_loc (((location_t) 0), MULT_EXPR, ulltype, c, fold_convert_loc (((location_t) 0), ulltype, fd->first_inner_iterations) ) |
2626 | fd->first_inner_iterations))fold_build2_loc (((location_t) 0), MULT_EXPR, ulltype, c, fold_convert_loc (((location_t) 0), ulltype, fd->first_inner_iterations) ); |
2627 | t = fold_build2 (PLUS_EXPR, ulltype, t, t2)fold_build2_loc (((location_t) 0), PLUS_EXPR, ulltype, t, t2 ); |
2628 | expand_omp_build_assign (gsi, d, t, true); |
2629 | t = fold_build2 (MULT_EXPR, ulltype,fold_build2_loc (((location_t) 0), MULT_EXPR, ulltype, fold_convert_loc (((location_t) 0), ulltype, fd->factor), c ) |
2630 | fold_convert (ulltype, fd->factor), c)fold_build2_loc (((location_t) 0), MULT_EXPR, ulltype, fold_convert_loc (((location_t) 0), ulltype, fd->factor), c ); |
2631 | t = fold_build2 (PLUS_EXPR, ulltype,fold_build2_loc (((location_t) 0), PLUS_EXPR, ulltype, t, fold_convert_loc (((location_t) 0), ulltype, fd->first_inner_iterations) ) |
2632 | t, fold_convert (ulltype,fold_build2_loc (((location_t) 0), PLUS_EXPR, ulltype, t, fold_convert_loc (((location_t) 0), ulltype, fd->first_inner_iterations) ) |
2633 | fd->first_inner_iterations))fold_build2_loc (((location_t) 0), PLUS_EXPR, ulltype, t, fold_convert_loc (((location_t) 0), ulltype, fd->first_inner_iterations) ); |
2634 | t2 = force_gimple_operand_gsi (gsi, t, true, NULL_TREE(tree) nullptr, false, |
2635 | GSI_CONTINUE_LINKING); |
2636 | cond_stmt = gimple_build_cond (GE_EXPR, stopvalull, d, |
2637 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2638 | gsi_insert_after (gsi, cond_stmt, GSI_CONTINUE_LINKING); |
2639 | e = split_block (gsi_bb (*gsi), cond_stmt); |
2640 | basic_block bb2 = e->src; |
2641 | e->flags = EDGE_TRUE_VALUE; |
2642 | e->probability = profile_probability::very_likely (); |
2643 | *gsi = gsi_after_labels (e->dest); |
2644 | t = fold_build2 (PLUS_EXPR, ulltype, d, t2)fold_build2_loc (((location_t) 0), PLUS_EXPR, ulltype, d, t2 ); |
2645 | t = force_gimple_operand_gsi (gsi, t, true, NULL_TREE(tree) nullptr, false, |
2646 | GSI_CONTINUE_LINKING); |
2647 | cond_stmt = gimple_build_cond (GE_EXPR, stopvalull, t, |
2648 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2649 | gsi_insert_after (gsi, cond_stmt, GSI_CONTINUE_LINKING); |
2650 | e = split_block (gsi_bb (*gsi), cond_stmt); |
2651 | basic_block bb3 = e->src; |
2652 | e->flags = EDGE_FALSE_VALUE; |
2653 | e->probability = profile_probability::very_likely (); |
2654 | *gsi = gsi_after_labels (e->dest); |
2655 | t = fold_convert (itype, c)fold_convert_loc (((location_t) 0), itype, c); |
2656 | t = fold_build2 (MULT_EXPR, itype, t, fd->loops[i - 1].step)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, fd-> loops[i - 1].step ); |
2657 | t = fold_build2 (PLUS_EXPR, itype, outer_n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, outer_n1 , t ); |
2658 | t = force_gimple_operand_gsi (gsi, t, true, NULL_TREE(tree) nullptr, false, |
2659 | GSI_CONTINUE_LINKING); |
2660 | expand_omp_build_assign (gsi, fd->loops[i - 1].v, t, true); |
2661 | t2 = fold_build2 (MINUS_EXPR, ulltype, stopvalull, d)fold_build2_loc (((location_t) 0), MINUS_EXPR, ulltype, stopvalull , d ); |
2662 | t2 = fold_convert (itype, t2)fold_convert_loc (((location_t) 0), itype, t2); |
2663 | t2 = fold_build2 (MULT_EXPR, itype, t2, fd->loops[i].step)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t2, fd-> loops[i].step ); |
2664 | t2 = fold_build2 (PLUS_EXPR, itype, t2, fd->loops[i].n1)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t2, fd-> loops[i].n1 ); |
2665 | if (fd->loops[i].m1) |
2666 | { |
2667 | t = fold_build2 (MULT_EXPR, itype, t, fd->loops[i].m1)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, fd-> loops[i].m1 ); |
2668 | t2 = fold_build2 (PLUS_EXPR, itype, t2, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t2, t ); |
2669 | } |
2670 | expand_omp_build_assign (gsi, fd->loops[i].v, t2, true); |
2671 | e = split_block (gsi_bb (*gsi), gsi_stmt (*gsi)); |
2672 | bb_triang = e->src; |
2673 | *gsi = gsi_after_labels (e->dest); |
2674 | remove_edge (e); |
2675 | e = make_edge (bb1, gsi_bb (*gsi), EDGE_TRUE_VALUE); |
2676 | e->probability = profile_probability::very_unlikely (); |
2677 | e = make_edge (bb2, gsi_bb (*gsi), EDGE_FALSE_VALUE); |
2678 | e->probability = profile_probability::very_unlikely (); |
2679 | e = make_edge (bb3, gsi_bb (*gsi), EDGE_TRUE_VALUE); |
2680 | e->probability = profile_probability::very_unlikely (); |
2681 | |
2682 | basic_block bb4 = create_empty_bb (bb0); |
2683 | add_bb_to_loop (bb4, bb0->loop_father); |
2684 | e = make_edge (bb0, bb4, EDGE_FALSE_VALUE); |
2685 | e->probability = profile_probability::unlikely (); |
2686 | make_edge (bb4, gsi_bb (*gsi), EDGE_FALLTHRU); |
2687 | set_immediate_dominator (CDI_DOMINATORS, bb4, bb0); |
2688 | set_immediate_dominator (CDI_DOMINATORS, gsi_bb (*gsi), bb0); |
2689 | gimple_stmt_iterator gsi2 = gsi_after_labels (bb4); |
2690 | t2 = fold_build2 (TRUNC_DIV_EXPR, type,fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, type, counts [i], counts[i - 1] ) |
2691 | counts[i], counts[i - 1])fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, type, counts [i], counts[i - 1] ); |
2692 | t2 = force_gimple_operand_gsi (&gsi2, t2, true, NULL_TREE(tree) nullptr, false, |
2693 | GSI_CONTINUE_LINKING); |
2694 | t = fold_build2 (TRUNC_MOD_EXPR, type, stopval, t2)fold_build2_loc (((location_t) 0), TRUNC_MOD_EXPR, type, stopval , t2 ); |
2695 | t2 = fold_build2 (TRUNC_DIV_EXPR, type, stopval, t2)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, type, stopval , t2 ); |
2696 | t = fold_convert (itype, t)fold_convert_loc (((location_t) 0), itype, t); |
2697 | t2 = fold_convert (itype, t2)fold_convert_loc (((location_t) 0), itype, t2); |
2698 | t = fold_build2 (MULT_EXPR, itype, t,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, fd->loops[i].step) ) |
2699 | fold_convert (itype, fd->loops[i].step))fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, fd->loops[i].step) ); |
2700 | t = fold_build2 (PLUS_EXPR, itype, fd->loops[i].n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fd->loops [i].n1, t ); |
2701 | t2 = fold_build2 (MULT_EXPR, itype, t2,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t2, fold_convert_loc (((location_t) 0), itype, fd->loops[i - 1].step) ) |
2702 | fold_convert (itype, fd->loops[i - 1].step))fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t2, fold_convert_loc (((location_t) 0), itype, fd->loops[i - 1].step) ); |
2703 | t2 = fold_build2 (PLUS_EXPR, itype, fd->loops[i - 1].n1, t2)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fd->loops [i - 1].n1, t2 ); |
2704 | t2 = force_gimple_operand_gsi (&gsi2, t2, false, NULL_TREE(tree) nullptr, |
2705 | false, GSI_CONTINUE_LINKING); |
2706 | stmt = gimple_build_assign (fd->loops[i - 1].v, t2); |
2707 | gsi_insert_after (&gsi2, stmt, GSI_CONTINUE_LINKING); |
2708 | if (fd->loops[i].m1) |
2709 | { |
2710 | t2 = fold_build2 (MULT_EXPR, itype, fd->loops[i].m1,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, fd->loops [i].m1, fd->loops[i - 1].v ) |
2711 | fd->loops[i - 1].v)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, fd->loops [i].m1, fd->loops[i - 1].v ); |
2712 | t = fold_build2 (PLUS_EXPR, itype, t, t2)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, t2 ); |
2713 | } |
2714 | t = force_gimple_operand_gsi (&gsi2, t, false, NULL_TREE(tree) nullptr, |
2715 | false, GSI_CONTINUE_LINKING); |
2716 | stmt = gimple_build_assign (fd->loops[i].v, t); |
2717 | gsi_insert_after (&gsi2, stmt, GSI_CONTINUE_LINKING); |
2718 | } |
2719 | /* Fallback implementation. Evaluate the loops in between |
2720 | (inclusive) fd->first_nonrect and fd->last_nonrect at |
2721 | runtime unsing temporaries instead of the original iteration |
2722 | variables, in the body just bump the counter and compare |
2723 | with the desired value. */ |
2724 | gimple_stmt_iterator gsi2 = *gsi; |
2725 | basic_block entry_bb = gsi_bb (gsi2); |
2726 | edge e = split_block (entry_bb, gsi_stmt (gsi2)); |
2727 | e = split_block (e->dest, (gimple *) NULLnullptr); |
2728 | basic_block dom_bb = NULLnullptr; |
2729 | basic_block cur_bb = e->src; |
2730 | basic_block next_bb = e->dest; |
2731 | entry_bb = e->dest; |
2732 | *gsi = gsi_after_labels (entry_bb); |
2733 | |
2734 | tree *vs = XALLOCAVEC (tree, fd->last_nonrect)((tree *) __builtin_alloca(sizeof (tree) * (fd->last_nonrect ))); |
2735 | tree n1 = NULL_TREE(tree) nullptr, n2 = NULL_TREE(tree) nullptr; |
2736 | memset (vs, 0, fd->last_nonrect * sizeof (tree)); |
2737 | |
2738 | for (int j = fd->first_nonrect; j <= fd->last_nonrect; j++) |
2739 | { |
2740 | tree itype = TREE_TYPE (fd->loops[j].v)((contains_struct_check ((fd->loops[j].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2740, __FUNCTION__))->typed.type); |
2741 | bool rect_p = (fd->loops[j].m1 == NULL_TREE(tree) nullptr |
2742 | && fd->loops[j].m2 == NULL_TREE(tree) nullptr |
2743 | && !fd->loops[j].non_rect_referenced); |
2744 | gsi2 = gsi_after_labels (cur_bb); |
2745 | t = fold_convert (itype, unshare_expr (fd->loops[j].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[j].n1)); |
2746 | if (fd->loops[j].m1) |
2747 | { |
2748 | n1 = fold_convert (itype, unshare_expr (fd->loops[j].m1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[j].m1)); |
2749 | n1 = fold_build2 (MULT_EXPR, itype,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[j - fd ->loops[j].outer], n1 ) |
2750 | vs[j - fd->loops[j].outer], n1)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[j - fd ->loops[j].outer], n1 ); |
2751 | n1 = fold_build2 (PLUS_EXPR, itype, n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1, t ); |
2752 | } |
2753 | else if (rect_p) |
2754 | n1 = build_zero_cst (type); |
2755 | else |
2756 | n1 = t; |
2757 | n1 = force_gimple_operand_gsi (&gsi2, n1, true, NULL_TREE(tree) nullptr, |
2758 | true, GSI_SAME_STMT); |
2759 | if (j < fd->last_nonrect) |
2760 | { |
2761 | vs[j] = create_tmp_reg (rect_p ? type : itype, ".it"); |
2762 | expand_omp_build_assign (&gsi2, vs[j], n1); |
2763 | } |
2764 | t = fold_convert (itype, unshare_expr (fd->loops[j].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[j].n2)); |
2765 | if (fd->loops[j].m2) |
2766 | { |
2767 | n2 = fold_convert (itype, unshare_expr (fd->loops[j].m2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[j].m2)); |
2768 | n2 = fold_build2 (MULT_EXPR, itype,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[j - fd ->loops[j].outer], n2 ) |
2769 | vs[j - fd->loops[j].outer], n2)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[j - fd ->loops[j].outer], n2 ); |
2770 | n2 = fold_build2 (PLUS_EXPR, itype, n2, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n2, t ); |
2771 | } |
2772 | else if (rect_p) |
2773 | n2 = counts[j]; |
2774 | else |
2775 | n2 = t; |
2776 | n2 = force_gimple_operand_gsi (&gsi2, n2, true, NULL_TREE(tree) nullptr, |
2777 | true, GSI_SAME_STMT); |
2778 | if (j == fd->last_nonrect) |
2779 | { |
2780 | gcond *cond_stmt |
2781 | = gimple_build_cond (fd->loops[j].cond_code, n1, n2, |
2782 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2783 | gsi_insert_before (&gsi2, cond_stmt, GSI_SAME_STMT); |
2784 | e = split_block (cur_bb, cond_stmt); |
2785 | e->flags = EDGE_TRUE_VALUE; |
2786 | edge ne = make_edge (cur_bb, next_bb, EDGE_FALSE_VALUE); |
2787 | e->probability = profile_probability::likely ().guessed (); |
2788 | ne->probability = e->probability.invert (); |
2789 | gsi2 = gsi_after_labels (e->dest); |
2790 | |
2791 | t = build_int_cst (itype, (fd->loops[j].cond_code == LT_EXPR |
2792 | ? -1 : 1)); |
2793 | t = fold_build2 (PLUS_EXPR, itype,fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fold_convert_loc (((location_t) 0), itype, fd->loops[j].step), t ) |
2794 | fold_convert (itype, fd->loops[j].step), t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fold_convert_loc (((location_t) 0), itype, fd->loops[j].step), t ); |
2795 | t = fold_build2 (PLUS_EXPR, itype, t, n2)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, n2 ); |
2796 | t = fold_build2 (MINUS_EXPR, itype, t, n1)fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, t, n1 ); |
2797 | tree step = fold_convert (itype, fd->loops[j].step)fold_convert_loc (((location_t) 0), itype, fd->loops[j].step ); |
2798 | if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2798, __FUNCTION__))->base.u.bits.unsigned_flag) |
2799 | && fd->loops[j].cond_code == GT_EXPR) |
2800 | t = fold_build2 (TRUNC_DIV_EXPR, itype,fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ) |
2801 | fold_build1 (NEGATE_EXPR, itype, t),fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ) |
2802 | fold_build1 (NEGATE_EXPR, itype, step))fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ); |
2803 | else |
2804 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t, step)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, step ); |
2805 | t = fold_convert (type, t)fold_convert_loc (((location_t) 0), type, t); |
2806 | t = fold_build2 (PLUS_EXPR, type, idx, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, type, idx, t ); |
2807 | t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
2808 | true, GSI_SAME_STMT); |
2809 | e = make_edge (e->dest, next_bb, EDGE_FALLTHRU); |
2810 | set_immediate_dominator (CDI_DOMINATORS, next_bb, cur_bb); |
2811 | cond_stmt |
2812 | = gimple_build_cond (LE_EXPR, t, stopval, NULL_TREE(tree) nullptr, |
2813 | NULL_TREE(tree) nullptr); |
2814 | gsi_insert_before (&gsi2, cond_stmt, GSI_SAME_STMT); |
2815 | e = split_block (gsi_bb (gsi2), cond_stmt); |
2816 | e->flags = EDGE_TRUE_VALUE; |
2817 | e->probability = profile_probability::likely ().guessed (); |
2818 | ne = make_edge (e->src, entry_bb, EDGE_FALSE_VALUE); |
2819 | ne->probability = e->probability.invert (); |
2820 | gsi2 = gsi_after_labels (e->dest); |
2821 | expand_omp_build_assign (&gsi2, idx, t); |
2822 | set_immediate_dominator (CDI_DOMINATORS, entry_bb, dom_bb); |
2823 | break; |
2824 | } |
2825 | e = split_block (cur_bb, last_stmt (cur_bb)); |
2826 | |
2827 | basic_block new_cur_bb = create_empty_bb (cur_bb); |
2828 | add_bb_to_loop (new_cur_bb, cur_bb->loop_father); |
2829 | |
2830 | gsi2 = gsi_after_labels (e->dest); |
2831 | if (rect_p) |
2832 | t = fold_build2 (PLUS_EXPR, type, vs[j],fold_build2_loc (((location_t) 0), PLUS_EXPR, type, vs[j], build_one_cst (type) ) |
2833 | build_one_cst (type))fold_build2_loc (((location_t) 0), PLUS_EXPR, type, vs[j], build_one_cst (type) ); |
2834 | else |
2835 | { |
2836 | tree step |
2837 | = fold_convert (itype, unshare_expr (fd->loops[j].step))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[j].step)); |
2838 | t = fold_build2 (PLUS_EXPR, itype, vs[j], step)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, vs[j], step ); |
2839 | } |
2840 | t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
2841 | true, GSI_SAME_STMT); |
2842 | expand_omp_build_assign (&gsi2, vs[j], t); |
2843 | |
2844 | edge ne = split_block (e->dest, last_stmt (e->dest)); |
2845 | gsi2 = gsi_after_labels (ne->dest); |
2846 | |
2847 | gcond *cond_stmt; |
2848 | if (next_bb == entry_bb) |
2849 | /* No need to actually check the outermost condition. */ |
2850 | cond_stmt |
2851 | = gimple_build_cond (EQ_EXPR, boolean_true_nodeglobal_trees[TI_BOOLEAN_TRUE], |
2852 | boolean_true_nodeglobal_trees[TI_BOOLEAN_TRUE], |
2853 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2854 | else |
2855 | cond_stmt |
2856 | = gimple_build_cond (rect_p ? LT_EXPR |
2857 | : fd->loops[j].cond_code, |
2858 | vs[j], n2, NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
2859 | gsi_insert_before (&gsi2, cond_stmt, GSI_SAME_STMT); |
2860 | edge e3, e4; |
2861 | if (next_bb == entry_bb) |
2862 | { |
2863 | e3 = find_edge (ne->dest, next_bb); |
2864 | e3->flags = EDGE_FALSE_VALUE; |
2865 | dom_bb = ne->dest; |
2866 | } |
2867 | else |
2868 | e3 = make_edge (ne->dest, next_bb, EDGE_FALSE_VALUE); |
2869 | e4 = make_edge (ne->dest, new_cur_bb, EDGE_TRUE_VALUE); |
2870 | e4->probability = profile_probability::likely ().guessed (); |
2871 | e3->probability = e4->probability.invert (); |
2872 | basic_block esrc = e->src; |
2873 | make_edge (e->src, ne->dest, EDGE_FALLTHRU); |
2874 | cur_bb = new_cur_bb; |
2875 | basic_block latch_bb = next_bb; |
2876 | next_bb = e->dest; |
2877 | remove_edge (e); |
2878 | set_immediate_dominator (CDI_DOMINATORS, ne->dest, esrc); |
2879 | set_immediate_dominator (CDI_DOMINATORS, latch_bb, ne->dest); |
2880 | set_immediate_dominator (CDI_DOMINATORS, cur_bb, ne->dest); |
2881 | } |
2882 | for (int j = fd->last_nonrect; j >= fd->first_nonrect; j--) |
2883 | { |
2884 | tree itype = TREE_TYPE (fd->loops[j].v)((contains_struct_check ((fd->loops[j].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2884, __FUNCTION__))->typed.type); |
2885 | bool rect_p = (fd->loops[j].m1 == NULL_TREE(tree) nullptr |
2886 | && fd->loops[j].m2 == NULL_TREE(tree) nullptr |
2887 | && !fd->loops[j].non_rect_referenced); |
2888 | if (j == fd->last_nonrect) |
2889 | { |
2890 | t = fold_build2 (MINUS_EXPR, type, stopval, idx)fold_build2_loc (((location_t) 0), MINUS_EXPR, type, stopval, idx ); |
2891 | t = fold_convert (itype, t)fold_convert_loc (((location_t) 0), itype, t); |
2892 | tree t2 |
2893 | = fold_convert (itype, unshare_expr (fd->loops[j].step))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[j].step)); |
2894 | t = fold_build2 (MULT_EXPR, itype, t, t2)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, t2 ); |
2895 | t = fold_build2 (PLUS_EXPR, itype, n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1, t ); |
2896 | } |
2897 | else if (rect_p) |
2898 | { |
2899 | t = fold_convert (itype, vs[j])fold_convert_loc (((location_t) 0), itype, vs[j]); |
2900 | t = fold_build2 (MULT_EXPR, itype, t,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, fd->loops[j].step) ) |
2901 | fold_convert (itype, fd->loops[j].step))fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, fd->loops[j].step) ); |
2902 | if (POINTER_TYPE_P (vtype)(((enum tree_code) (vtype)->base.code) == POINTER_TYPE || ( (enum tree_code) (vtype)->base.code) == REFERENCE_TYPE)) |
2903 | t = fold_build_pointer_plus (fd->loops[j].n1, t)fold_build_pointer_plus_loc (((location_t) 0), fd->loops[j ].n1, t); |
2904 | else |
2905 | t = fold_build2 (PLUS_EXPR, itype, fd->loops[j].n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fd->loops [j].n1, t ); |
2906 | } |
2907 | else |
2908 | t = vs[j]; |
2909 | t = force_gimple_operand_gsi (gsi, t, false, |
2910 | NULL_TREE(tree) nullptr, true, |
2911 | GSI_SAME_STMT); |
2912 | stmt = gimple_build_assign (fd->loops[j].v, t); |
2913 | gsi_insert_before (gsi, stmt, GSI_SAME_STMT); |
2914 | } |
2915 | if (gsi_end_p (*gsi)) |
2916 | *gsi = gsi_last_bb (gsi_bb (*gsi)); |
2917 | else |
2918 | gsi_prev (gsi); |
2919 | if (bb_triang) |
2920 | { |
2921 | e = split_block (gsi_bb (*gsi), gsi_stmt (*gsi)); |
2922 | make_edge (bb_triang, e->dest, EDGE_FALLTHRU); |
2923 | *gsi = gsi_after_labels (e->dest); |
2924 | if (!gsi_end_p (*gsi)) |
2925 | gsi_insert_before (gsi, gimple_build_nop (), GSI_NEW_STMT); |
2926 | set_immediate_dominator (CDI_DOMINATORS, e->dest, bb_triang_dom); |
2927 | } |
2928 | } |
2929 | else |
2930 | { |
2931 | t = fold_convert (itype, t)fold_convert_loc (((location_t) 0), itype, t); |
2932 | t = fold_build2 (MULT_EXPR, itype, t,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, fd->loops[i].step) ) |
2933 | fold_convert (itype, fd->loops[i].step))fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, fd->loops[i].step) ); |
2934 | if (POINTER_TYPE_P (vtype)(((enum tree_code) (vtype)->base.code) == POINTER_TYPE || ( (enum tree_code) (vtype)->base.code) == REFERENCE_TYPE)) |
2935 | t = fold_build_pointer_plus (fd->loops[i].n1, t)fold_build_pointer_plus_loc (((location_t) 0), fd->loops[i ].n1, t); |
2936 | else |
2937 | t = fold_build2 (PLUS_EXPR, itype, fd->loops[i].n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fd->loops [i].n1, t ); |
2938 | t = force_gimple_operand_gsi (gsi, t, |
2939 | DECL_P (fd->loops[i].v)(tree_code_type[(int) (((enum tree_code) (fd->loops[i].v)-> base.code))] == tcc_declaration) |
2940 | && TREE_ADDRESSABLE (fd->loops[i].v)((fd->loops[i].v)->base.addressable_flag), |
2941 | NULL_TREE(tree) nullptr, false, |
2942 | GSI_CONTINUE_LINKING); |
2943 | stmt = gimple_build_assign (fd->loops[i].v, t); |
2944 | gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING); |
2945 | } |
2946 | if (i != 0 && (i != fd->last_nonrect || fd->first_nonrect)) |
2947 | { |
2948 | t = fold_build2 (TRUNC_DIV_EXPR, type, tem, counts[i])fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, type, tem, counts[i] ); |
2949 | t = force_gimple_operand_gsi (gsi, t, false, NULL_TREE(tree) nullptr, |
2950 | false, GSI_CONTINUE_LINKING); |
2951 | stmt = gimple_build_assign (tem, t); |
2952 | gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING); |
2953 | } |
2954 | if (i == fd->last_nonrect) |
2955 | i = fd->first_nonrect; |
2956 | } |
2957 | if (fd->non_rect) |
2958 | for (i = 0; i <= fd->last_nonrect; i++) |
2959 | if (fd->loops[i].m2) |
2960 | { |
2961 | tree itype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 2961, __FUNCTION__))->typed.type); |
2962 | |
2963 | tree t = fold_convert (itype, unshare_expr (fd->loops[i].m2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m2)); |
2964 | t = fold_build2 (MULT_EXPR, itype,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, fd->loops [i - fd->loops[i].outer].v, t ) |
2965 | fd->loops[i - fd->loops[i].outer].v, t)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, fd->loops [i - fd->loops[i].outer].v, t ); |
2966 | t = fold_build2 (PLUS_EXPR, itype, t,fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, unshare_expr (fd->loops[i].n2)) ) |
2967 | fold_convert (itype,fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, unshare_expr (fd->loops[i].n2)) ) |
2968 | unshare_expr (fd->loops[i].n2)))fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, unshare_expr (fd->loops[i].n2)) ); |
2969 | nonrect_bounds[i] = create_tmp_reg (itype, ".bound"); |
2970 | t = force_gimple_operand_gsi (gsi, t, false, |
2971 | NULL_TREE(tree) nullptr, false, |
2972 | GSI_CONTINUE_LINKING); |
2973 | stmt = gimple_build_assign (nonrect_bounds[i], t); |
2974 | gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING); |
2975 | } |
2976 | } |
2977 | |
2978 | /* Helper function for expand_omp_for_*. Generate code like: |
2979 | L10: |
2980 | V3 += STEP3; |
2981 | if (V3 cond3 N32) goto BODY_BB; else goto L11; |
2982 | L11: |
2983 | V3 = N31; |
2984 | V2 += STEP2; |
2985 | if (V2 cond2 N22) goto BODY_BB; else goto L12; |
2986 | L12: |
2987 | V2 = N21; |
2988 | V1 += STEP1; |
2989 | goto BODY_BB; |
2990 | For non-rectangular loops, use temporaries stored in nonrect_bounds |
2991 | for the upper bounds if M?2 multiplier is present. Given e.g. |
2992 | for (V1 = N11; V1 cond1 N12; V1 += STEP1) |
2993 | for (V2 = N21; V2 cond2 N22; V2 += STEP2) |
2994 | for (V3 = N31; V3 cond3 N32; V3 += STEP3) |
2995 | for (V4 = N41 + M41 * V2; V4 cond4 N42 + M42 * V2; V4 += STEP4) |
2996 | do: |
2997 | L10: |
2998 | V4 += STEP4; |
2999 | if (V4 cond4 NONRECT_BOUND4) goto BODY_BB; else goto L11; |
3000 | L11: |
3001 | V4 = N41 + M41 * V2; // This can be left out if the loop |
3002 | // refers to the immediate parent loop |
3003 | V3 += STEP3; |
3004 | if (V3 cond3 N32) goto BODY_BB; else goto L12; |
3005 | L12: |
3006 | V3 = N31; |
3007 | V2 += STEP2; |
3008 | if (V2 cond2 N22) goto L120; else goto L13; |
3009 | L120: |
3010 | V4 = N41 + M41 * V2; |
3011 | NONRECT_BOUND4 = N42 + M42 * V2; |
3012 | if (V4 cond4 NONRECT_BOUND4) goto BODY_BB; else goto L12; |
3013 | L13: |
3014 | V2 = N21; |
3015 | V1 += STEP1; |
3016 | goto L120; */ |
3017 | |
3018 | static basic_block |
3019 | extract_omp_for_update_vars (struct omp_for_data *fd, tree *nonrect_bounds, |
3020 | basic_block cont_bb, basic_block body_bb) |
3021 | { |
3022 | basic_block last_bb, bb, collapse_bb = NULLnullptr; |
3023 | int i; |
3024 | gimple_stmt_iterator gsi; |
3025 | edge e; |
3026 | tree t; |
3027 | gimple *stmt; |
3028 | |
3029 | last_bb = cont_bb; |
3030 | for (i = fd->collapse - 1; i >= 0; i--) |
3031 | { |
3032 | tree vtype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3032, __FUNCTION__))->typed.type); |
3033 | |
3034 | bb = create_empty_bb (last_bb); |
3035 | add_bb_to_loop (bb, last_bb->loop_father); |
3036 | gsi = gsi_start_bb (bb); |
3037 | |
3038 | if (i < fd->collapse - 1) |
3039 | { |
3040 | e = make_edge (last_bb, bb, EDGE_FALSE_VALUE); |
3041 | e->probability |
3042 | = profile_probability::guessed_always ().apply_scale (1, 8); |
3043 | |
3044 | struct omp_for_data_loop *l = &fd->loops[i + 1]; |
3045 | if (l->m1 == NULL_TREE(tree) nullptr || l->outer != 1) |
3046 | { |
3047 | t = l->n1; |
3048 | if (l->m1) |
3049 | { |
3050 | tree t2 |
3051 | = fold_build2 (MULT_EXPR, TREE_TYPE (t),fold_build2_loc (((location_t) 0), MULT_EXPR, ((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3051, __FUNCTION__))->typed.type), fd->loops[i + 1 - l ->outer].v, l->m1 ) |
3052 | fd->loops[i + 1 - l->outer].v, l->m1)fold_build2_loc (((location_t) 0), MULT_EXPR, ((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3051, __FUNCTION__))->typed.type), fd->loops[i + 1 - l ->outer].v, l->m1 ); |
3053 | t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t2, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3053, __FUNCTION__))->typed.type), t2, t ); |
3054 | } |
3055 | t = force_gimple_operand_gsi (&gsi, t, |
3056 | DECL_P (l->v)(tree_code_type[(int) (((enum tree_code) (l->v)->base.code ))] == tcc_declaration) |
3057 | && TREE_ADDRESSABLE (l->v)((l->v)->base.addressable_flag), |
3058 | NULL_TREE(tree) nullptr, false, |
3059 | GSI_CONTINUE_LINKING); |
3060 | stmt = gimple_build_assign (l->v, t); |
3061 | gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); |
3062 | } |
3063 | } |
3064 | else |
3065 | collapse_bb = bb; |
3066 | |
3067 | set_immediate_dominator (CDI_DOMINATORS, bb, last_bb); |
3068 | |
3069 | if (POINTER_TYPE_P (vtype)(((enum tree_code) (vtype)->base.code) == POINTER_TYPE || ( (enum tree_code) (vtype)->base.code) == REFERENCE_TYPE)) |
3070 | t = fold_build_pointer_plus (fd->loops[i].v, fd->loops[i].step)fold_build_pointer_plus_loc (((location_t) 0), fd->loops[i ].v, fd->loops[i].step); |
3071 | else |
3072 | t = fold_build2 (PLUS_EXPR, vtype, fd->loops[i].v, fd->loops[i].step)fold_build2_loc (((location_t) 0), PLUS_EXPR, vtype, fd->loops [i].v, fd->loops[i].step ); |
3073 | t = force_gimple_operand_gsi (&gsi, t, |
3074 | DECL_P (fd->loops[i].v)(tree_code_type[(int) (((enum tree_code) (fd->loops[i].v)-> base.code))] == tcc_declaration) |
3075 | && TREE_ADDRESSABLE (fd->loops[i].v)((fd->loops[i].v)->base.addressable_flag), |
3076 | NULL_TREE(tree) nullptr, false, GSI_CONTINUE_LINKING); |
3077 | stmt = gimple_build_assign (fd->loops[i].v, t); |
3078 | gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); |
3079 | |
3080 | if (fd->loops[i].non_rect_referenced) |
3081 | { |
3082 | basic_block update_bb = NULLnullptr, prev_bb = NULLnullptr; |
3083 | for (int j = i + 1; j <= fd->last_nonrect; j++) |
3084 | if (j - fd->loops[j].outer == i) |
3085 | { |
3086 | tree n1, n2; |
3087 | struct omp_for_data_loop *l = &fd->loops[j]; |
3088 | basic_block this_bb = create_empty_bb (last_bb); |
3089 | add_bb_to_loop (this_bb, last_bb->loop_father); |
3090 | gimple_stmt_iterator gsi2 = gsi_start_bb (this_bb); |
3091 | if (prev_bb) |
3092 | { |
3093 | e = make_edge (prev_bb, this_bb, EDGE_TRUE_VALUE); |
3094 | e->probability |
3095 | = profile_probability::guessed_always ().apply_scale (7, |
3096 | 8); |
3097 | set_immediate_dominator (CDI_DOMINATORS, this_bb, prev_bb); |
3098 | } |
3099 | if (l->m1) |
3100 | { |
3101 | t = fold_build2 (MULT_EXPR, TREE_TYPE (l->m1), l->m1,fold_build2_loc (((location_t) 0), MULT_EXPR, ((contains_struct_check ((l->m1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3101, __FUNCTION__))->typed.type), l->m1, fd->loops [i].v ) |
3102 | fd->loops[i].v)fold_build2_loc (((location_t) 0), MULT_EXPR, ((contains_struct_check ((l->m1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3101, __FUNCTION__))->typed.type), l->m1, fd->loops [i].v ); |
3103 | t = fold_build2 (PLUS_EXPR, TREE_TYPE (l->v), t, l->n1)fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((l->v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3103, __FUNCTION__))->typed.type), t, l->n1 ); |
3104 | n1 = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
3105 | false, |
3106 | GSI_CONTINUE_LINKING); |
3107 | stmt = gimple_build_assign (l->v, n1); |
3108 | gsi_insert_after (&gsi2, stmt, GSI_CONTINUE_LINKING); |
3109 | n1 = l->v; |
3110 | } |
3111 | else |
3112 | n1 = force_gimple_operand_gsi (&gsi2, l->n1, true, |
3113 | NULL_TREE(tree) nullptr, false, |
3114 | GSI_CONTINUE_LINKING); |
3115 | if (l->m2) |
3116 | { |
3117 | t = fold_build2 (MULT_EXPR, TREE_TYPE (l->m2), l->m2,fold_build2_loc (((location_t) 0), MULT_EXPR, ((contains_struct_check ((l->m2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3117, __FUNCTION__))->typed.type), l->m2, fd->loops [i].v ) |
3118 | fd->loops[i].v)fold_build2_loc (((location_t) 0), MULT_EXPR, ((contains_struct_check ((l->m2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3117, __FUNCTION__))->typed.type), l->m2, fd->loops [i].v ); |
3119 | t = fold_build2 (PLUS_EXPR, TREE_TYPE (nonrect_bounds[j]),fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((nonrect_bounds[j]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3119, __FUNCTION__))->typed.type), t, unshare_expr (l-> n2) ) |
3120 | t, unshare_expr (l->n2))fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((nonrect_bounds[j]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3119, __FUNCTION__))->typed.type), t, unshare_expr (l-> n2) ); |
3121 | n2 = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
3122 | false, |
3123 | GSI_CONTINUE_LINKING); |
3124 | stmt = gimple_build_assign (nonrect_bounds[j], n2); |
3125 | gsi_insert_after (&gsi2, stmt, GSI_CONTINUE_LINKING); |
3126 | n2 = nonrect_bounds[j]; |
3127 | } |
3128 | else |
3129 | n2 = force_gimple_operand_gsi (&gsi2, unshare_expr (l->n2), |
3130 | true, NULL_TREE(tree) nullptr, false, |
3131 | GSI_CONTINUE_LINKING); |
3132 | gcond *cond_stmt |
3133 | = gimple_build_cond (l->cond_code, n1, n2, |
3134 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
3135 | gsi_insert_after (&gsi2, cond_stmt, GSI_CONTINUE_LINKING); |
3136 | if (update_bb == NULLnullptr) |
3137 | update_bb = this_bb; |
3138 | e = make_edge (this_bb, bb, EDGE_FALSE_VALUE); |
3139 | e->probability |
3140 | = profile_probability::guessed_always ().apply_scale (1, 8); |
3141 | if (prev_bb == NULLnullptr) |
3142 | set_immediate_dominator (CDI_DOMINATORS, this_bb, bb); |
3143 | prev_bb = this_bb; |
3144 | } |
3145 | e = make_edge (prev_bb, body_bb, EDGE_TRUE_VALUE); |
3146 | e->probability |
3147 | = profile_probability::guessed_always ().apply_scale (7, 8); |
3148 | body_bb = update_bb; |
3149 | } |
3150 | |
3151 | if (i > 0) |
3152 | { |
3153 | if (fd->loops[i].m2) |
3154 | t = nonrect_bounds[i]; |
3155 | else |
3156 | t = unshare_expr (fd->loops[i].n2); |
3157 | t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, |
3158 | false, GSI_CONTINUE_LINKING); |
3159 | tree v = fd->loops[i].v; |
3160 | if (DECL_P (v)(tree_code_type[(int) (((enum tree_code) (v)->base.code))] == tcc_declaration) && TREE_ADDRESSABLE (v)((v)->base.addressable_flag)) |
3161 | v = force_gimple_operand_gsi (&gsi, v, true, NULL_TREE(tree) nullptr, |
3162 | false, GSI_CONTINUE_LINKING); |
3163 | t = fold_build2 (fd->loops[i].cond_code, boolean_type_node, v, t)fold_build2_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], v, t ); |
3164 | stmt = gimple_build_cond_empty (t); |
3165 | gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); |
3166 | if (walk_tree (gimple_cond_lhs_ptr (as_a <gcond *> (stmt)),walk_tree_1 (gimple_cond_lhs_ptr (as_a <gcond *> (stmt) ), expand_omp_regimplify_p, nullptr, nullptr, nullptr) |
3167 | expand_omp_regimplify_p, NULL, NULL)walk_tree_1 (gimple_cond_lhs_ptr (as_a <gcond *> (stmt) ), expand_omp_regimplify_p, nullptr, nullptr, nullptr) |
3168 | || walk_tree (gimple_cond_rhs_ptr (as_a <gcond *> (stmt)),walk_tree_1 (gimple_cond_rhs_ptr (as_a <gcond *> (stmt) ), expand_omp_regimplify_p, nullptr, nullptr, nullptr) |
3169 | expand_omp_regimplify_p, NULL, NULL)walk_tree_1 (gimple_cond_rhs_ptr (as_a <gcond *> (stmt) ), expand_omp_regimplify_p, nullptr, nullptr, nullptr)) |
3170 | gimple_regimplify_operands (stmt, &gsi); |
3171 | e = make_edge (bb, body_bb, EDGE_TRUE_VALUE); |
3172 | e->probability = profile_probability::guessed_always ().apply_scale (7, 8); |
3173 | } |
3174 | else |
3175 | make_edge (bb, body_bb, EDGE_FALLTHRU); |
3176 | set_immediate_dominator (CDI_DOMINATORS, bb, last_bb); |
3177 | last_bb = bb; |
3178 | } |
3179 | |
3180 | return collapse_bb; |
3181 | } |
3182 | |
3183 | /* Expand #pragma omp ordered depend(source). */ |
3184 | |
3185 | static void |
3186 | expand_omp_ordered_source (gimple_stmt_iterator *gsi, struct omp_for_data *fd, |
3187 | tree *counts, location_t loc) |
3188 | { |
3189 | enum built_in_function source_ix |
3190 | = fd->iter_type == long_integer_type_nodeinteger_types[itk_long] |
3191 | ? BUILT_IN_GOMP_DOACROSS_POST : BUILT_IN_GOMP_DOACROSS_ULL_POST; |
3192 | gimple *g |
3193 | = gimple_build_call (builtin_decl_explicit (source_ix), 1, |
3194 | build_fold_addr_expr (counts[fd->ordered])build_fold_addr_expr_loc (((location_t) 0), (counts[fd->ordered ]))); |
3195 | gimple_set_location (g, loc); |
3196 | gsi_insert_before (gsi, g, GSI_SAME_STMT); |
3197 | } |
3198 | |
3199 | /* Expand a single depend from #pragma omp ordered depend(sink:...). */ |
3200 | |
3201 | static void |
3202 | expand_omp_ordered_sink (gimple_stmt_iterator *gsi, struct omp_for_data *fd, |
3203 | tree *counts, tree c, location_t loc) |
3204 | { |
3205 | auto_vec<tree, 10> args; |
3206 | enum built_in_function sink_ix |
3207 | = fd->iter_type == long_integer_type_nodeinteger_types[itk_long] |
3208 | ? BUILT_IN_GOMP_DOACROSS_WAIT : BUILT_IN_GOMP_DOACROSS_ULL_WAIT; |
3209 | tree t, off, coff = NULL_TREE(tree) nullptr, deps = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3209, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3209, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3209, __FUNCTION__))), cond = NULL_TREE(tree) nullptr; |
3210 | int i; |
3211 | gimple_stmt_iterator gsi2 = *gsi; |
3212 | bool warned_step = false; |
3213 | |
3214 | for (i = 0; i < fd->ordered; i++) |
3215 | { |
3216 | tree step = NULL_TREE(tree) nullptr; |
3217 | off = TREE_PURPOSE (deps)((tree_check ((deps), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3217, __FUNCTION__, (TREE_LIST)))->list.purpose); |
3218 | if (TREE_CODE (off)((enum tree_code) (off)->base.code) == TRUNC_DIV_EXPR) |
3219 | { |
3220 | step = TREE_OPERAND (off, 1)(*((const_cast<tree*> (tree_operand_check ((off), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3220, __FUNCTION__))))); |
3221 | off = TREE_OPERAND (off, 0)(*((const_cast<tree*> (tree_operand_check ((off), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3221, __FUNCTION__))))); |
3222 | } |
3223 | if (!integer_zerop (off)) |
3224 | { |
3225 | gcc_assert (fd->loops[i].cond_code == LT_EXPR((void)(!(fd->loops[i].cond_code == LT_EXPR || fd->loops [i].cond_code == GT_EXPR) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3226, __FUNCTION__), 0 : 0)) |
3226 | || fd->loops[i].cond_code == GT_EXPR)((void)(!(fd->loops[i].cond_code == LT_EXPR || fd->loops [i].cond_code == GT_EXPR) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3226, __FUNCTION__), 0 : 0)); |
3227 | bool forward = fd->loops[i].cond_code == LT_EXPR; |
3228 | if (step) |
3229 | { |
3230 | /* Non-simple Fortran DO loops. If step is variable, |
3231 | we don't know at compile even the direction, so can't |
3232 | warn. */ |
3233 | if (TREE_CODE (step)((enum tree_code) (step)->base.code) != INTEGER_CST) |
3234 | break; |
3235 | forward = tree_int_cst_sgn (step) != -1; |
3236 | } |
3237 | if (forward ^ OMP_CLAUSE_DEPEND_SINK_NEGATIVE (deps)(((tree_check ((deps), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3237, __FUNCTION__, (TREE_LIST))))->base.public_flag)) |
3238 | warning_at (loc, 0, "%<depend%> clause with %<sink%> modifier " |
3239 | "waiting for lexically later iteration"); |
3240 | break; |
3241 | } |
3242 | deps = TREE_CHAIN (deps)((contains_struct_check ((deps), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3242, __FUNCTION__))->common.chain); |
3243 | } |
3244 | /* If all offsets corresponding to the collapsed loops are zero, |
3245 | this depend clause can be ignored. FIXME: but there is still a |
3246 | flush needed. We need to emit one __sync_synchronize () for it |
3247 | though (perhaps conditionally)? Solve this together with the |
3248 | conservative dependence folding optimization. |
3249 | if (i >= fd->collapse) |
3250 | return; */ |
3251 | |
3252 | deps = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3252, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3252, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3252, __FUNCTION__))); |
3253 | gsi_prev (&gsi2); |
3254 | edge e1 = split_block (gsi_bb (gsi2), gsi_stmt (gsi2)); |
3255 | edge e2 = split_block_after_labels (e1->dest); |
3256 | |
3257 | gsi2 = gsi_after_labels (e1->dest); |
3258 | *gsi = gsi_last_bb (e1->src); |
3259 | for (i = 0; i < fd->ordered; i++) |
3260 | { |
3261 | tree itype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3261, __FUNCTION__))->typed.type); |
3262 | tree step = NULL_TREE(tree) nullptr; |
3263 | tree orig_off = NULL_TREE(tree) nullptr; |
3264 | if (POINTER_TYPE_P (itype)(((enum tree_code) (itype)->base.code) == POINTER_TYPE || ( (enum tree_code) (itype)->base.code) == REFERENCE_TYPE)) |
3265 | itype = sizetypesizetype_tab[(int) stk_sizetype]; |
3266 | if (i) |
3267 | deps = TREE_CHAIN (deps)((contains_struct_check ((deps), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3267, __FUNCTION__))->common.chain); |
3268 | off = TREE_PURPOSE (deps)((tree_check ((deps), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3268, __FUNCTION__, (TREE_LIST)))->list.purpose); |
3269 | if (TREE_CODE (off)((enum tree_code) (off)->base.code) == TRUNC_DIV_EXPR) |
3270 | { |
3271 | step = TREE_OPERAND (off, 1)(*((const_cast<tree*> (tree_operand_check ((off), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3271, __FUNCTION__))))); |
3272 | off = TREE_OPERAND (off, 0)(*((const_cast<tree*> (tree_operand_check ((off), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3272, __FUNCTION__))))); |
3273 | gcc_assert (fd->loops[i].cond_code == LT_EXPR((void)(!(fd->loops[i].cond_code == LT_EXPR && integer_onep (fd->loops[i].step) && !(((enum tree_code) (((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3275, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((fd->loops [i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3275, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3275, __FUNCTION__), 0 : 0)) |
3274 | && integer_onep (fd->loops[i].step)((void)(!(fd->loops[i].cond_code == LT_EXPR && integer_onep (fd->loops[i].step) && !(((enum tree_code) (((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3275, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((fd->loops [i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3275, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3275, __FUNCTION__), 0 : 0)) |
3275 | && !POINTER_TYPE_P (TREE_TYPE (fd->loops[i].v)))((void)(!(fd->loops[i].cond_code == LT_EXPR && integer_onep (fd->loops[i].step) && !(((enum tree_code) (((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3275, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((fd->loops [i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3275, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3275, __FUNCTION__), 0 : 0)); |
3276 | } |
3277 | tree s = fold_convert_loc (loc, itype, step ? step : fd->loops[i].step); |
3278 | if (step) |
3279 | { |
3280 | off = fold_convert_loc (loc, itype, off); |
3281 | orig_off = off; |
3282 | off = fold_build2_loc (loc, TRUNC_DIV_EXPR, itype, off, s); |
3283 | } |
3284 | |
3285 | if (integer_zerop (off)) |
3286 | t = boolean_true_nodeglobal_trees[TI_BOOLEAN_TRUE]; |
3287 | else |
3288 | { |
3289 | tree a; |
3290 | tree co = fold_convert_loc (loc, itype, off); |
3291 | if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i].v))(((enum tree_code) (((contains_struct_check ((fd->loops[i] .v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3291, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((fd->loops [i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3291, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) |
3292 | { |
3293 | if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (deps)(((tree_check ((deps), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3293, __FUNCTION__, (TREE_LIST))))->base.public_flag)) |
3294 | co = fold_build1_loc (loc, NEGATE_EXPR, itype, co); |
3295 | a = fold_build2_loc (loc, POINTER_PLUS_EXPR, |
3296 | TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3296, __FUNCTION__))->typed.type), fd->loops[i].v, |
3297 | co); |
3298 | } |
3299 | else if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (deps)(((tree_check ((deps), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3299, __FUNCTION__, (TREE_LIST))))->base.public_flag)) |
3300 | a = fold_build2_loc (loc, MINUS_EXPR, TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3300, __FUNCTION__))->typed.type), |
3301 | fd->loops[i].v, co); |
3302 | else |
3303 | a = fold_build2_loc (loc, PLUS_EXPR, TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3303, __FUNCTION__))->typed.type), |
3304 | fd->loops[i].v, co); |
3305 | if (step) |
3306 | { |
3307 | tree t1, t2; |
3308 | if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (deps)(((tree_check ((deps), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3308, __FUNCTION__, (TREE_LIST))))->base.public_flag)) |
3309 | t1 = fold_build2_loc (loc, GE_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, |
3310 | fd->loops[i].n1); |
3311 | else |
3312 | t1 = fold_build2_loc (loc, LT_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, |
3313 | fd->loops[i].n2); |
3314 | if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (deps)(((tree_check ((deps), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3314, __FUNCTION__, (TREE_LIST))))->base.public_flag)) |
3315 | t2 = fold_build2_loc (loc, LT_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, |
3316 | fd->loops[i].n2); |
3317 | else |
3318 | t2 = fold_build2_loc (loc, GE_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, |
3319 | fd->loops[i].n1); |
3320 | t = fold_build2_loc (loc, LT_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], |
3321 | step, build_int_cst (TREE_TYPE (step)((contains_struct_check ((step), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3321, __FUNCTION__))->typed.type), 0)); |
3322 | if (TREE_CODE (step)((enum tree_code) (step)->base.code) != INTEGER_CST) |
3323 | { |
3324 | t1 = unshare_expr (t1); |
3325 | t1 = force_gimple_operand_gsi (gsi, t1, true, NULL_TREE(tree) nullptr, |
3326 | false, GSI_CONTINUE_LINKING); |
3327 | t2 = unshare_expr (t2); |
3328 | t2 = force_gimple_operand_gsi (gsi, t2, true, NULL_TREE(tree) nullptr, |
3329 | false, GSI_CONTINUE_LINKING); |
3330 | } |
3331 | t = fold_build3_loc (loc, COND_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], |
3332 | t, t2, t1); |
3333 | } |
3334 | else if (fd->loops[i].cond_code == LT_EXPR) |
3335 | { |
3336 | if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (deps)(((tree_check ((deps), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3336, __FUNCTION__, (TREE_LIST))))->base.public_flag)) |
3337 | t = fold_build2_loc (loc, GE_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, |
3338 | fd->loops[i].n1); |
3339 | else |
3340 | t = fold_build2_loc (loc, LT_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, |
3341 | fd->loops[i].n2); |
3342 | } |
3343 | else if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (deps)(((tree_check ((deps), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3343, __FUNCTION__, (TREE_LIST))))->base.public_flag)) |
3344 | t = fold_build2_loc (loc, GT_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, |
3345 | fd->loops[i].n2); |
3346 | else |
3347 | t = fold_build2_loc (loc, LE_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, |
3348 | fd->loops[i].n1); |
3349 | } |
3350 | if (cond) |
3351 | cond = fold_build2_loc (loc, BIT_AND_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], cond, t); |
3352 | else |
3353 | cond = t; |
3354 | |
3355 | off = fold_convert_loc (loc, itype, off); |
3356 | |
3357 | if (step |
3358 | || (fd->loops[i].cond_code == LT_EXPR |
3359 | ? !integer_onep (fd->loops[i].step) |
3360 | : !integer_minus_onep (fd->loops[i].step))) |
3361 | { |
3362 | if (step == NULL_TREE(tree) nullptr |
3363 | && TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3363, __FUNCTION__))->base.u.bits.unsigned_flag) |
3364 | && fd->loops[i].cond_code == GT_EXPR) |
3365 | t = fold_build2_loc (loc, TRUNC_MOD_EXPR, itype, off, |
3366 | fold_build1_loc (loc, NEGATE_EXPR, itype, |
3367 | s)); |
3368 | else |
3369 | t = fold_build2_loc (loc, TRUNC_MOD_EXPR, itype, |
3370 | orig_off ? orig_off : off, s); |
3371 | t = fold_build2_loc (loc, EQ_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], t, |
3372 | build_int_cst (itype, 0)); |
3373 | if (integer_zerop (t) && !warned_step) |
3374 | { |
3375 | warning_at (loc, 0, "%<depend%> clause with %<sink%> modifier " |
3376 | "refers to iteration never in the iteration " |
3377 | "space"); |
3378 | warned_step = true; |
3379 | } |
3380 | cond = fold_build2_loc (loc, BIT_AND_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], |
3381 | cond, t); |
3382 | } |
3383 | |
3384 | if (i <= fd->collapse - 1 && fd->collapse > 1) |
3385 | t = fd->loop.v; |
3386 | else if (counts[i]) |
3387 | t = counts[i]; |
3388 | else |
3389 | { |
3390 | t = fold_build2_loc (loc, MINUS_EXPR, TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3390, __FUNCTION__))->typed.type), |
3391 | fd->loops[i].v, fd->loops[i].n1); |
3392 | t = fold_convert_loc (loc, fd->iter_type, t); |
3393 | } |
3394 | if (step) |
3395 | /* We have divided off by step already earlier. */; |
3396 | else if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3396, __FUNCTION__))->base.u.bits.unsigned_flag) && fd->loops[i].cond_code == GT_EXPR) |
3397 | off = fold_build2_loc (loc, TRUNC_DIV_EXPR, itype, off, |
3398 | fold_build1_loc (loc, NEGATE_EXPR, itype, |
3399 | s)); |
3400 | else |
3401 | off = fold_build2_loc (loc, TRUNC_DIV_EXPR, itype, off, s); |
3402 | if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (deps)(((tree_check ((deps), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3402, __FUNCTION__, (TREE_LIST))))->base.public_flag)) |
3403 | off = fold_build1_loc (loc, NEGATE_EXPR, itype, off); |
3404 | off = fold_convert_loc (loc, fd->iter_type, off); |
3405 | if (i <= fd->collapse - 1 && fd->collapse > 1) |
3406 | { |
3407 | if (i) |
3408 | off = fold_build2_loc (loc, PLUS_EXPR, fd->iter_type, coff, |
3409 | off); |
3410 | if (i < fd->collapse - 1) |
3411 | { |
3412 | coff = fold_build2_loc (loc, MULT_EXPR, fd->iter_type, off, |
3413 | counts[i]); |
3414 | continue; |
3415 | } |
3416 | } |
3417 | off = unshare_expr (off); |
3418 | t = fold_build2_loc (loc, PLUS_EXPR, fd->iter_type, t, off); |
3419 | t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
3420 | true, GSI_SAME_STMT); |
3421 | args.safe_push (t); |
3422 | } |
3423 | gimple *g = gimple_build_call_vec (builtin_decl_explicit (sink_ix), args); |
3424 | gimple_set_location (g, loc); |
3425 | gsi_insert_before (&gsi2, g, GSI_SAME_STMT); |
3426 | |
3427 | cond = unshare_expr (cond); |
3428 | cond = force_gimple_operand_gsi (gsi, cond, true, NULL_TREE(tree) nullptr, false, |
3429 | GSI_CONTINUE_LINKING); |
3430 | gsi_insert_after (gsi, gimple_build_cond_empty (cond), GSI_NEW_STMT); |
3431 | edge e3 = make_edge (e1->src, e2->dest, EDGE_FALSE_VALUE); |
3432 | e3->probability = profile_probability::guessed_always ().apply_scale (1, 8); |
3433 | e1->probability = e3->probability.invert (); |
3434 | e1->flags = EDGE_TRUE_VALUE; |
3435 | set_immediate_dominator (CDI_DOMINATORS, e2->dest, e1->src); |
3436 | |
3437 | *gsi = gsi_after_labels (e2->dest); |
3438 | } |
3439 | |
3440 | /* Expand all #pragma omp ordered depend(source) and |
3441 | #pragma omp ordered depend(sink:...) constructs in the current |
3442 | #pragma omp for ordered(n) region. */ |
3443 | |
3444 | static void |
3445 | expand_omp_ordered_source_sink (struct omp_region *region, |
3446 | struct omp_for_data *fd, tree *counts, |
3447 | basic_block cont_bb) |
3448 | { |
3449 | struct omp_region *inner; |
3450 | int i; |
3451 | for (i = fd->collapse - 1; i < fd->ordered; i++) |
3452 | if (i == fd->collapse - 1 && fd->collapse > 1) |
3453 | counts[i] = NULL_TREE(tree) nullptr; |
3454 | else if (i >= fd->collapse && !cont_bb) |
3455 | counts[i] = build_zero_cst (fd->iter_type); |
3456 | else if (!POINTER_TYPE_P (TREE_TYPE (fd->loops[i].v))(((enum tree_code) (((contains_struct_check ((fd->loops[i] .v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3456, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((fd->loops [i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3456, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) |
3457 | && integer_onep (fd->loops[i].step)) |
3458 | counts[i] = NULL_TREE(tree) nullptr; |
3459 | else |
3460 | counts[i] = create_tmp_var (fd->iter_type, ".orditer"); |
3461 | tree atype |
3462 | = build_array_type_nelts (fd->iter_type, fd->ordered - fd->collapse + 1); |
3463 | counts[fd->ordered] = create_tmp_var (atype, ".orditera"); |
3464 | TREE_ADDRESSABLE (counts[fd->ordered])((counts[fd->ordered])->base.addressable_flag) = 1; |
3465 | |
3466 | for (inner = region->inner; inner; inner = inner->next) |
3467 | if (inner->type == GIMPLE_OMP_ORDERED) |
3468 | { |
3469 | gomp_ordered *ord_stmt = inner->ord_stmt; |
3470 | gimple_stmt_iterator gsi = gsi_for_stmt (ord_stmt); |
3471 | location_t loc = gimple_location (ord_stmt); |
3472 | tree c; |
3473 | for (c = gimple_omp_ordered_clauses (ord_stmt); |
3474 | c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3474, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3474, __FUNCTION__))->common.chain)) |
3475 | if (OMP_CLAUSE_DEPEND_KIND (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_DEPEND), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3475, __FUNCTION__))->omp_clause.subcode.depend_kind) == OMP_CLAUSE_DEPEND_SOURCE) |
3476 | break; |
3477 | if (c) |
3478 | expand_omp_ordered_source (&gsi, fd, counts, loc); |
3479 | for (c = gimple_omp_ordered_clauses (ord_stmt); |
3480 | c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3480, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3480, __FUNCTION__))->common.chain)) |
3481 | if (OMP_CLAUSE_DEPEND_KIND (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_DEPEND), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3481, __FUNCTION__))->omp_clause.subcode.depend_kind) == OMP_CLAUSE_DEPEND_SINK) |
3482 | expand_omp_ordered_sink (&gsi, fd, counts, c, loc); |
3483 | gsi_remove (&gsi, true); |
3484 | } |
3485 | } |
3486 | |
3487 | /* Wrap the body into fd->ordered - fd->collapse loops that aren't |
3488 | collapsed. */ |
3489 | |
3490 | static basic_block |
3491 | expand_omp_for_ordered_loops (struct omp_for_data *fd, tree *counts, |
3492 | basic_block cont_bb, basic_block body_bb, |
3493 | bool ordered_lastprivate) |
3494 | { |
3495 | if (fd->ordered == fd->collapse) |
3496 | return cont_bb; |
3497 | |
3498 | if (!cont_bb) |
3499 | { |
3500 | gimple_stmt_iterator gsi = gsi_after_labels (body_bb); |
3501 | for (int i = fd->collapse; i < fd->ordered; i++) |
3502 | { |
3503 | tree type = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3503, __FUNCTION__))->typed.type); |
3504 | tree n1 = fold_convert (type, fd->loops[i].n1)fold_convert_loc (((location_t) 0), type, fd->loops[i].n1); |
3505 | expand_omp_build_assign (&gsi, fd->loops[i].v, n1); |
3506 | tree aref = build4 (ARRAY_REF, fd->iter_type, counts[fd->ordered], |
3507 | size_int (i - fd->collapse + 1)size_int_kind (i - fd->collapse + 1, stk_sizetype), |
3508 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
3509 | expand_omp_build_assign (&gsi, aref, build_zero_cst (fd->iter_type)); |
3510 | } |
3511 | return NULLnullptr; |
3512 | } |
3513 | |
3514 | for (int i = fd->ordered - 1; i >= fd->collapse; i--) |
3515 | { |
3516 | tree t, type = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3516, __FUNCTION__))->typed.type); |
3517 | gimple_stmt_iterator gsi = gsi_after_labels (body_bb); |
3518 | expand_omp_build_assign (&gsi, fd->loops[i].v, |
3519 | fold_convert (type, fd->loops[i].n1)fold_convert_loc (((location_t) 0), type, fd->loops[i].n1)); |
3520 | if (counts[i]) |
3521 | expand_omp_build_assign (&gsi, counts[i], |
3522 | build_zero_cst (fd->iter_type)); |
3523 | tree aref = build4 (ARRAY_REF, fd->iter_type, counts[fd->ordered], |
3524 | size_int (i - fd->collapse + 1)size_int_kind (i - fd->collapse + 1, stk_sizetype), |
3525 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
3526 | expand_omp_build_assign (&gsi, aref, build_zero_cst (fd->iter_type)); |
3527 | if (!gsi_end_p (gsi)) |
3528 | gsi_prev (&gsi); |
3529 | else |
3530 | gsi = gsi_last_bb (body_bb); |
3531 | edge e1 = split_block (body_bb, gsi_stmt (gsi)); |
3532 | basic_block new_body = e1->dest; |
3533 | if (body_bb == cont_bb) |
3534 | cont_bb = new_body; |
3535 | edge e2 = NULLnullptr; |
3536 | basic_block new_header; |
3537 | if (EDGE_COUNT (cont_bb->preds)vec_safe_length (cont_bb->preds) > 0) |
3538 | { |
3539 | gsi = gsi_last_bb (cont_bb); |
3540 | if (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE)) |
3541 | t = fold_build_pointer_plus (fd->loops[i].v,fold_build_pointer_plus_loc (((location_t) 0), fd->loops[i ].v, fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype ], fd->loops[i].step)) |
3542 | fold_convert (sizetype,fold_build_pointer_plus_loc (((location_t) 0), fd->loops[i ].v, fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype ], fd->loops[i].step)) |
3543 | fd->loops[i].step))fold_build_pointer_plus_loc (((location_t) 0), fd->loops[i ].v, fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype ], fd->loops[i].step)); |
3544 | else |
3545 | t = fold_build2 (PLUS_EXPR, type, fd->loops[i].v,fold_build2_loc (((location_t) 0), PLUS_EXPR, type, fd->loops [i].v, fold_convert_loc (((location_t) 0), type, fd->loops [i].step) ) |
3546 | fold_convert (type, fd->loops[i].step))fold_build2_loc (((location_t) 0), PLUS_EXPR, type, fd->loops [i].v, fold_convert_loc (((location_t) 0), type, fd->loops [i].step) ); |
3547 | expand_omp_build_assign (&gsi, fd->loops[i].v, t); |
3548 | if (counts[i]) |
3549 | { |
3550 | t = fold_build2 (PLUS_EXPR, fd->iter_type, counts[i],fold_build2_loc (((location_t) 0), PLUS_EXPR, fd->iter_type , counts[i], build_int_cst (fd->iter_type, 1) ) |
3551 | build_int_cst (fd->iter_type, 1))fold_build2_loc (((location_t) 0), PLUS_EXPR, fd->iter_type , counts[i], build_int_cst (fd->iter_type, 1) ); |
3552 | expand_omp_build_assign (&gsi, counts[i], t); |
3553 | t = counts[i]; |
3554 | } |
3555 | else |
3556 | { |
3557 | t = fold_build2 (MINUS_EXPR, TREE_TYPE (fd->loops[i].v),fold_build2_loc (((location_t) 0), MINUS_EXPR, ((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3557, __FUNCTION__))->typed.type), fd->loops[i].v, fd ->loops[i].n1 ) |
3558 | fd->loops[i].v, fd->loops[i].n1)fold_build2_loc (((location_t) 0), MINUS_EXPR, ((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3557, __FUNCTION__))->typed.type), fd->loops[i].v, fd ->loops[i].n1 ); |
3559 | t = fold_convert (fd->iter_type, t)fold_convert_loc (((location_t) 0), fd->iter_type, t); |
3560 | t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, |
3561 | true, GSI_SAME_STMT); |
3562 | } |
3563 | aref = build4 (ARRAY_REF, fd->iter_type, counts[fd->ordered], |
3564 | size_int (i - fd->collapse + 1)size_int_kind (i - fd->collapse + 1, stk_sizetype), |
3565 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
3566 | expand_omp_build_assign (&gsi, aref, t); |
3567 | gsi_prev (&gsi); |
3568 | e2 = split_block (cont_bb, gsi_stmt (gsi)); |
3569 | new_header = e2->dest; |
3570 | } |
3571 | else |
3572 | new_header = cont_bb; |
3573 | gsi = gsi_after_labels (new_header); |
3574 | tree v = force_gimple_operand_gsi (&gsi, fd->loops[i].v, true, NULL_TREE(tree) nullptr, |
3575 | true, GSI_SAME_STMT); |
3576 | tree n2 |
3577 | = force_gimple_operand_gsi (&gsi, fold_convert (type, fd->loops[i].n2)fold_convert_loc (((location_t) 0), type, fd->loops[i].n2), |
3578 | true, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); |
3579 | t = build2 (fd->loops[i].cond_code, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], v, n2); |
3580 | gsi_insert_before (&gsi, gimple_build_cond_empty (t), GSI_NEW_STMT); |
3581 | edge e3 = split_block (new_header, gsi_stmt (gsi)); |
3582 | cont_bb = e3->dest; |
3583 | remove_edge (e1); |
3584 | make_edge (body_bb, new_header, EDGE_FALLTHRU); |
3585 | e3->flags = EDGE_FALSE_VALUE; |
3586 | e3->probability = profile_probability::guessed_always ().apply_scale (1, 8); |
3587 | e1 = make_edge (new_header, new_body, EDGE_TRUE_VALUE); |
3588 | e1->probability = e3->probability.invert (); |
3589 | |
3590 | set_immediate_dominator (CDI_DOMINATORS, new_header, body_bb); |
3591 | set_immediate_dominator (CDI_DOMINATORS, new_body, new_header); |
3592 | |
3593 | if (e2) |
3594 | { |
3595 | class loop *loop = alloc_loop (); |
3596 | loop->header = new_header; |
3597 | loop->latch = e2->src; |
3598 | add_loop (loop, body_bb->loop_father); |
3599 | } |
3600 | } |
3601 | |
3602 | /* If there are any lastprivate clauses and it is possible some loops |
3603 | might have zero iterations, ensure all the decls are initialized, |
3604 | otherwise we could crash evaluating C++ class iterators with lastprivate |
3605 | clauses. */ |
3606 | bool need_inits = false; |
3607 | for (int i = fd->collapse; ordered_lastprivate && i < fd->ordered; i++) |
3608 | if (need_inits) |
3609 | { |
3610 | tree type = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3610, __FUNCTION__))->typed.type); |
3611 | gimple_stmt_iterator gsi = gsi_after_labels (body_bb); |
3612 | expand_omp_build_assign (&gsi, fd->loops[i].v, |
3613 | fold_convert (type, fd->loops[i].n1)fold_convert_loc (((location_t) 0), type, fd->loops[i].n1)); |
3614 | } |
3615 | else |
3616 | { |
3617 | tree type = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3617, __FUNCTION__))->typed.type); |
3618 | tree this_cond = fold_build2 (fd->loops[i].cond_code,fold_build2_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], fold_convert_loc (((location_t ) 0), type, fd->loops[i].n1), fold_convert_loc (((location_t ) 0), type, fd->loops[i].n2) ) |
3619 | boolean_type_node,fold_build2_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], fold_convert_loc (((location_t ) 0), type, fd->loops[i].n1), fold_convert_loc (((location_t ) 0), type, fd->loops[i].n2) ) |
3620 | fold_convert (type, fd->loops[i].n1),fold_build2_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], fold_convert_loc (((location_t ) 0), type, fd->loops[i].n1), fold_convert_loc (((location_t ) 0), type, fd->loops[i].n2) ) |
3621 | fold_convert (type, fd->loops[i].n2))fold_build2_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], fold_convert_loc (((location_t ) 0), type, fd->loops[i].n1), fold_convert_loc (((location_t ) 0), type, fd->loops[i].n2) ); |
3622 | if (!integer_onep (this_cond)) |
3623 | need_inits = true; |
3624 | } |
3625 | |
3626 | return cont_bb; |
3627 | } |
3628 | |
3629 | /* A subroutine of expand_omp_for. Generate code for a parallel |
3630 | loop with any schedule. Given parameters: |
3631 | |
3632 | for (V = N1; V cond N2; V += STEP) BODY; |
3633 | |
3634 | where COND is "<" or ">", we generate pseudocode |
3635 | |
3636 | more = GOMP_loop_foo_start (N1, N2, STEP, CHUNK, &istart0, &iend0); |
3637 | if (more) goto L0; else goto L3; |
3638 | L0: |
3639 | V = istart0; |
3640 | iend = iend0; |
3641 | L1: |
3642 | BODY; |
3643 | V += STEP; |
3644 | if (V cond iend) goto L1; else goto L2; |
3645 | L2: |
3646 | if (GOMP_loop_foo_next (&istart0, &iend0)) goto L0; else goto L3; |
3647 | L3: |
3648 | |
3649 | If this is a combined omp parallel loop, instead of the call to |
3650 | GOMP_loop_foo_start, we call GOMP_loop_foo_next. |
3651 | If this is gimple_omp_for_combined_p loop, then instead of assigning |
3652 | V and iend in L0 we assign the first two _looptemp_ clause decls of the |
3653 | inner GIMPLE_OMP_FOR and V += STEP; and |
3654 | if (V cond iend) goto L1; else goto L2; are removed. |
3655 | |
3656 | For collapsed loops, given parameters: |
3657 | collapse(3) |
3658 | for (V1 = N11; V1 cond1 N12; V1 += STEP1) |
3659 | for (V2 = N21; V2 cond2 N22; V2 += STEP2) |
3660 | for (V3 = N31; V3 cond3 N32; V3 += STEP3) |
3661 | BODY; |
3662 | |
3663 | we generate pseudocode |
3664 | |
3665 | if (__builtin_expect (N32 cond3 N31, 0)) goto Z0; |
3666 | if (cond3 is <) |
3667 | adj = STEP3 - 1; |
3668 | else |
3669 | adj = STEP3 + 1; |
3670 | count3 = (adj + N32 - N31) / STEP3; |
3671 | if (__builtin_expect (N22 cond2 N21, 0)) goto Z0; |
3672 | if (cond2 is <) |
3673 | adj = STEP2 - 1; |
3674 | else |
3675 | adj = STEP2 + 1; |
3676 | count2 = (adj + N22 - N21) / STEP2; |
3677 | if (__builtin_expect (N12 cond1 N11, 0)) goto Z0; |
3678 | if (cond1 is <) |
3679 | adj = STEP1 - 1; |
3680 | else |
3681 | adj = STEP1 + 1; |
3682 | count1 = (adj + N12 - N11) / STEP1; |
3683 | count = count1 * count2 * count3; |
3684 | goto Z1; |
3685 | Z0: |
3686 | count = 0; |
3687 | Z1: |
3688 | more = GOMP_loop_foo_start (0, count, 1, CHUNK, &istart0, &iend0); |
3689 | if (more) goto L0; else goto L3; |
3690 | L0: |
3691 | V = istart0; |
3692 | T = V; |
3693 | V3 = N31 + (T % count3) * STEP3; |
3694 | T = T / count3; |
3695 | V2 = N21 + (T % count2) * STEP2; |
3696 | T = T / count2; |
3697 | V1 = N11 + T * STEP1; |
3698 | iend = iend0; |
3699 | L1: |
3700 | BODY; |
3701 | V += 1; |
3702 | if (V < iend) goto L10; else goto L2; |
3703 | L10: |
3704 | V3 += STEP3; |
3705 | if (V3 cond3 N32) goto L1; else goto L11; |
3706 | L11: |
3707 | V3 = N31; |
3708 | V2 += STEP2; |
3709 | if (V2 cond2 N22) goto L1; else goto L12; |
3710 | L12: |
3711 | V2 = N21; |
3712 | V1 += STEP1; |
3713 | goto L1; |
3714 | L2: |
3715 | if (GOMP_loop_foo_next (&istart0, &iend0)) goto L0; else goto L3; |
3716 | L3: |
3717 | |
3718 | */ |
3719 | |
3720 | static void |
3721 | expand_omp_for_generic (struct omp_region *region, |
3722 | struct omp_for_data *fd, |
3723 | enum built_in_function start_fn, |
3724 | enum built_in_function next_fn, |
3725 | tree sched_arg, |
3726 | gimple *inner_stmt) |
3727 | { |
3728 | tree type, istart0, iend0, iend; |
3729 | tree t, vmain, vback, bias = NULL_TREE(tree) nullptr; |
3730 | basic_block entry_bb, cont_bb, exit_bb, l0_bb, l1_bb, collapse_bb; |
3731 | basic_block l2_bb = NULLnullptr, l3_bb = NULLnullptr; |
3732 | gimple_stmt_iterator gsi; |
3733 | gassign *assign_stmt; |
3734 | bool in_combined_parallel = is_combined_parallel (region); |
3735 | bool broken_loop = region->cont == NULLnullptr; |
3736 | edge e, ne; |
3737 | tree *counts = NULLnullptr; |
3738 | int i; |
3739 | bool ordered_lastprivate = false; |
3740 | |
3741 | gcc_assert (!broken_loop || !in_combined_parallel)((void)(!(!broken_loop || !in_combined_parallel) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3741, __FUNCTION__), 0 : 0)); |
3742 | gcc_assert (fd->iter_type == long_integer_type_node((void)(!(fd->iter_type == integer_types[itk_long] || !in_combined_parallel ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3743, __FUNCTION__), 0 : 0)) |
3743 | || !in_combined_parallel)((void)(!(fd->iter_type == integer_types[itk_long] || !in_combined_parallel ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3743, __FUNCTION__), 0 : 0)); |
3744 | |
3745 | entry_bb = region->entry; |
3746 | cont_bb = region->cont; |
3747 | collapse_bb = NULLnullptr; |
3748 | gcc_assert (EDGE_COUNT (entry_bb->succs) == 2)((void)(!(vec_safe_length (entry_bb->succs) == 2) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3748, __FUNCTION__), 0 : 0)); |
3749 | gcc_assert (broken_loop((void)(!(broken_loop || ((*((entry_bb))->succs)[(0)]-> flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(1)] : ( *((entry_bb))->succs)[(0)])->dest == ((*((cont_bb))-> succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))-> succs)[(0)] : (*((cont_bb))->succs)[(1)])->dest) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3750, __FUNCTION__), 0 : 0)) |
3750 | || BRANCH_EDGE (entry_bb)->dest == FALLTHRU_EDGE (cont_bb)->dest)((void)(!(broken_loop || ((*((entry_bb))->succs)[(0)]-> flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(1)] : ( *((entry_bb))->succs)[(0)])->dest == ((*((cont_bb))-> succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))-> succs)[(0)] : (*((cont_bb))->succs)[(1)])->dest) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3750, __FUNCTION__), 0 : 0)); |
3751 | l0_bb = split_edge (FALLTHRU_EDGE (entry_bb)((*((entry_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(0)] : (*((entry_bb))->succs) [(1)])); |
3752 | l1_bb = single_succ (l0_bb); |
3753 | if (!broken_loop) |
3754 | { |
3755 | l2_bb = create_empty_bb (cont_bb); |
3756 | gcc_assert (BRANCH_EDGE (cont_bb)->dest == l1_bb((void)(!(((*((cont_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))->succs)[(1)] : (*((cont_bb))->succs)[( 0)])->dest == l1_bb || (single_succ_edge (((*((cont_bb))-> succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))-> succs)[(1)] : (*((cont_bb))->succs)[(0)])->dest)->dest == l1_bb)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3758, __FUNCTION__), 0 : 0)) |
3757 | || (single_succ_edge (BRANCH_EDGE (cont_bb)->dest)->dest((void)(!(((*((cont_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))->succs)[(1)] : (*((cont_bb))->succs)[( 0)])->dest == l1_bb || (single_succ_edge (((*((cont_bb))-> succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))-> succs)[(1)] : (*((cont_bb))->succs)[(0)])->dest)->dest == l1_bb)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3758, __FUNCTION__), 0 : 0)) |
3758 | == l1_bb))((void)(!(((*((cont_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))->succs)[(1)] : (*((cont_bb))->succs)[( 0)])->dest == l1_bb || (single_succ_edge (((*((cont_bb))-> succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))-> succs)[(1)] : (*((cont_bb))->succs)[(0)])->dest)->dest == l1_bb)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3758, __FUNCTION__), 0 : 0)); |
3759 | gcc_assert (EDGE_COUNT (cont_bb->succs) == 2)((void)(!(vec_safe_length (cont_bb->succs) == 2) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3759, __FUNCTION__), 0 : 0)); |
3760 | } |
3761 | else |
3762 | l2_bb = NULLnullptr; |
3763 | l3_bb = BRANCH_EDGE (entry_bb)((*((entry_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(1)] : (*((entry_bb))->succs) [(0)])->dest; |
3764 | exit_bb = region->exit; |
3765 | |
3766 | gsi = gsi_last_nondebug_bb (entry_bb); |
3767 | |
3768 | gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR)((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3768, __FUNCTION__), 0 : 0)); |
3769 | if (fd->ordered |
3770 | && omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), |
3771 | OMP_CLAUSE_LASTPRIVATE)) |
3772 | ordered_lastprivate = false; |
3773 | tree reductions = NULL_TREE(tree) nullptr; |
3774 | tree mem = NULL_TREE(tree) nullptr, cond_var = NULL_TREE(tree) nullptr, condtemp = NULL_TREE(tree) nullptr; |
3775 | tree memv = NULL_TREE(tree) nullptr; |
3776 | if (fd->lastprivate_conditional) |
3777 | { |
3778 | tree c = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), |
3779 | OMP_CLAUSE__CONDTEMP_); |
3780 | if (fd->have_pointer_condtemp) |
3781 | condtemp = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3781, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3781, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3781, __FUNCTION__))); |
3782 | c = omp_find_clause (OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3782, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3782, __FUNCTION__))->common.chain), OMP_CLAUSE__CONDTEMP_); |
3783 | cond_var = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3783, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3783, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3783, __FUNCTION__))); |
3784 | } |
3785 | if (sched_arg) |
3786 | { |
3787 | if (fd->have_reductemp) |
3788 | { |
3789 | tree c = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), |
3790 | OMP_CLAUSE__REDUCTEMP_); |
3791 | reductions = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3791, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3791, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3791, __FUNCTION__))); |
3792 | gcc_assert (TREE_CODE (reductions) == SSA_NAME)((void)(!(((enum tree_code) (reductions)->base.code) == SSA_NAME ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3792, __FUNCTION__), 0 : 0)); |
3793 | gimple *g = SSA_NAME_DEF_STMT (reductions)(tree_check ((reductions), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3793, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt; |
3794 | reductions = gimple_assign_rhs1 (g); |
3795 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3795, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3795, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3795, __FUNCTION__))) = reductions; |
3796 | entry_bb = gimple_bb (g); |
3797 | edge e = split_block (entry_bb, g); |
3798 | if (region->entry == entry_bb) |
3799 | region->entry = e->dest; |
3800 | gsi = gsi_last_bb (entry_bb); |
3801 | } |
3802 | else |
3803 | reductions = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; |
3804 | if (fd->have_pointer_condtemp) |
3805 | { |
3806 | tree type = TREE_TYPE (condtemp)((contains_struct_check ((condtemp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3806, __FUNCTION__))->typed.type); |
3807 | memv = create_tmp_var (type); |
3808 | TREE_ADDRESSABLE (memv)((memv)->base.addressable_flag) = 1; |
3809 | unsigned HOST_WIDE_INTlong sz |
3810 | = tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (type))((tree_class_check ((((contains_struct_check ((type), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3810, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3810, __FUNCTION__))->type_common.size_unit)); |
3811 | sz *= fd->lastprivate_conditional; |
3812 | expand_omp_build_assign (&gsi, memv, build_int_cst (type, sz), |
3813 | false); |
3814 | mem = build_fold_addr_expr (memv)build_fold_addr_expr_loc (((location_t) 0), (memv)); |
3815 | } |
3816 | else |
3817 | mem = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; |
3818 | } |
3819 | if (fd->collapse > 1 || fd->ordered) |
3820 | { |
3821 | int first_zero_iter1 = -1, first_zero_iter2 = -1; |
3822 | basic_block zero_iter1_bb = NULLnullptr, zero_iter2_bb = NULLnullptr, l2_dom_bb = NULLnullptr; |
3823 | |
3824 | counts = XALLOCAVEC (tree, fd->ordered ? fd->ordered + 1 : fd->collapse)((tree *) __builtin_alloca(sizeof (tree) * (fd->ordered ? fd ->ordered + 1 : fd->collapse))); |
3825 | expand_omp_for_init_counts (fd, &gsi, entry_bb, counts, |
3826 | zero_iter1_bb, first_zero_iter1, |
3827 | zero_iter2_bb, first_zero_iter2, l2_dom_bb); |
3828 | |
3829 | if (zero_iter1_bb) |
3830 | { |
3831 | /* Some counts[i] vars might be uninitialized if |
3832 | some loop has zero iterations. But the body shouldn't |
3833 | be executed in that case, so just avoid uninit warnings. */ |
3834 | for (i = first_zero_iter1; |
3835 | i < (fd->ordered ? fd->ordered : fd->collapse); i++) |
3836 | if (SSA_VAR_P (counts[i])(((enum tree_code) (counts[i])->base.code) == VAR_DECL || ( (enum tree_code) (counts[i])->base.code) == PARM_DECL || ( (enum tree_code) (counts[i])->base.code) == RESULT_DECL || ((enum tree_code) (counts[i])->base.code) == SSA_NAME)) |
3837 | TREE_NO_WARNING (counts[i])((counts[i])->base.nowarning_flag) = 1; |
3838 | gsi_prev (&gsi); |
3839 | e = split_block (entry_bb, gsi_stmt (gsi)); |
3840 | entry_bb = e->dest; |
3841 | make_edge (zero_iter1_bb, entry_bb, EDGE_FALLTHRU); |
3842 | gsi = gsi_last_nondebug_bb (entry_bb); |
3843 | set_immediate_dominator (CDI_DOMINATORS, entry_bb, |
3844 | get_immediate_dominator (CDI_DOMINATORS, |
3845 | zero_iter1_bb)); |
3846 | } |
3847 | if (zero_iter2_bb) |
3848 | { |
3849 | /* Some counts[i] vars might be uninitialized if |
3850 | some loop has zero iterations. But the body shouldn't |
3851 | be executed in that case, so just avoid uninit warnings. */ |
3852 | for (i = first_zero_iter2; i < fd->ordered; i++) |
3853 | if (SSA_VAR_P (counts[i])(((enum tree_code) (counts[i])->base.code) == VAR_DECL || ( (enum tree_code) (counts[i])->base.code) == PARM_DECL || ( (enum tree_code) (counts[i])->base.code) == RESULT_DECL || ((enum tree_code) (counts[i])->base.code) == SSA_NAME)) |
3854 | TREE_NO_WARNING (counts[i])((counts[i])->base.nowarning_flag) = 1; |
3855 | if (zero_iter1_bb) |
3856 | make_edge (zero_iter2_bb, entry_bb, EDGE_FALLTHRU); |
3857 | else |
3858 | { |
3859 | gsi_prev (&gsi); |
3860 | e = split_block (entry_bb, gsi_stmt (gsi)); |
3861 | entry_bb = e->dest; |
3862 | make_edge (zero_iter2_bb, entry_bb, EDGE_FALLTHRU); |
3863 | gsi = gsi_last_nondebug_bb (entry_bb); |
3864 | set_immediate_dominator (CDI_DOMINATORS, entry_bb, |
3865 | get_immediate_dominator |
3866 | (CDI_DOMINATORS, zero_iter2_bb)); |
3867 | } |
3868 | } |
3869 | if (fd->collapse == 1) |
3870 | { |
3871 | counts[0] = fd->loop.n2; |
3872 | fd->loop = fd->loops[0]; |
3873 | } |
3874 | } |
3875 | |
3876 | type = TREE_TYPE (fd->loop.v)((contains_struct_check ((fd->loop.v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3876, __FUNCTION__))->typed.type); |
3877 | istart0 = create_tmp_var (fd->iter_type, ".istart0"); |
3878 | iend0 = create_tmp_var (fd->iter_type, ".iend0"); |
3879 | TREE_ADDRESSABLE (istart0)((istart0)->base.addressable_flag) = 1; |
3880 | TREE_ADDRESSABLE (iend0)((iend0)->base.addressable_flag) = 1; |
3881 | |
3882 | /* See if we need to bias by LLONG_MIN. */ |
3883 | if (fd->iter_type == long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long] |
3884 | && TREE_CODE (type)((enum tree_code) (type)->base.code) == INTEGER_TYPE |
3885 | && !TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3885, __FUNCTION__))->base.u.bits.unsigned_flag) |
3886 | && fd->ordered == 0) |
3887 | { |
3888 | tree n1, n2; |
3889 | |
3890 | if (fd->loop.cond_code == LT_EXPR) |
3891 | { |
3892 | n1 = fd->loop.n1; |
3893 | n2 = fold_build2 (PLUS_EXPR, type, fd->loop.n2, fd->loop.step)fold_build2_loc (((location_t) 0), PLUS_EXPR, type, fd->loop .n2, fd->loop.step ); |
3894 | } |
3895 | else |
3896 | { |
3897 | n1 = fold_build2 (MINUS_EXPR, type, fd->loop.n2, fd->loop.step)fold_build2_loc (((location_t) 0), MINUS_EXPR, type, fd->loop .n2, fd->loop.step ); |
3898 | n2 = fd->loop.n1; |
3899 | } |
3900 | if (TREE_CODE (n1)((enum tree_code) (n1)->base.code) != INTEGER_CST |
3901 | || TREE_CODE (n2)((enum tree_code) (n2)->base.code) != INTEGER_CST |
3902 | || ((tree_int_cst_sgn (n1) < 0) ^ (tree_int_cst_sgn (n2) < 0))) |
3903 | bias = fold_convert (fd->iter_type, TYPE_MIN_VALUE (type))fold_convert_loc (((location_t) 0), fd->iter_type, ((tree_check5 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3903, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval )); |
3904 | } |
3905 | |
3906 | gimple_stmt_iterator gsif = gsi; |
3907 | gsi_prev (&gsif); |
3908 | |
3909 | tree arr = NULL_TREE(tree) nullptr; |
3910 | if (in_combined_parallel) |
3911 | { |
3912 | gcc_assert (fd->ordered == 0)((void)(!(fd->ordered == 0) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3912, __FUNCTION__), 0 : 0)); |
3913 | /* In a combined parallel loop, emit a call to |
3914 | GOMP_loop_foo_next. */ |
3915 | t = build_call_expr (builtin_decl_explicit (next_fn), 2, |
3916 | build_fold_addr_expr (istart0)build_fold_addr_expr_loc (((location_t) 0), (istart0)), |
3917 | build_fold_addr_expr (iend0)build_fold_addr_expr_loc (((location_t) 0), (iend0))); |
3918 | } |
3919 | else |
3920 | { |
3921 | tree t0, t1, t2, t3, t4; |
3922 | /* If this is not a combined parallel loop, emit a call to |
3923 | GOMP_loop_foo_start in ENTRY_BB. */ |
3924 | t4 = build_fold_addr_expr (iend0)build_fold_addr_expr_loc (((location_t) 0), (iend0)); |
3925 | t3 = build_fold_addr_expr (istart0)build_fold_addr_expr_loc (((location_t) 0), (istart0)); |
3926 | if (fd->ordered) |
3927 | { |
3928 | t0 = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], |
3929 | fd->ordered - fd->collapse + 1); |
3930 | arr = create_tmp_var (build_array_type_nelts (fd->iter_type, |
3931 | fd->ordered |
3932 | - fd->collapse + 1), |
3933 | ".omp_counts"); |
3934 | DECL_NAMELESS (arr)((contains_struct_check ((arr), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3934, __FUNCTION__))->base.u.bits.nameless_flag) = 1; |
3935 | TREE_ADDRESSABLE (arr)((arr)->base.addressable_flag) = 1; |
3936 | TREE_STATIC (arr)((arr)->base.static_flag) = 1; |
3937 | vec<constructor_elt, va_gc> *v; |
3938 | vec_alloc (v, fd->ordered - fd->collapse + 1); |
3939 | int idx; |
3940 | |
3941 | for (idx = 0; idx < fd->ordered - fd->collapse + 1; idx++) |
3942 | { |
3943 | tree c; |
3944 | if (idx == 0 && fd->collapse > 1) |
3945 | c = fd->loop.n2; |
3946 | else |
3947 | c = counts[idx + fd->collapse - 1]; |
3948 | tree purpose = size_int (idx)size_int_kind (idx, stk_sizetype); |
3949 | CONSTRUCTOR_APPEND_ELT (v, purpose, c)do { constructor_elt _ce___ = {purpose, c}; vec_safe_push ((v ), _ce___); } while (0); |
3950 | if (TREE_CODE (c)((enum tree_code) (c)->base.code) != INTEGER_CST) |
3951 | TREE_STATIC (arr)((arr)->base.static_flag) = 0; |
3952 | } |
3953 | |
3954 | DECL_INITIAL (arr)((contains_struct_check ((arr), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3954, __FUNCTION__))->decl_common.initial) = build_constructor (TREE_TYPE (arr)((contains_struct_check ((arr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3954, __FUNCTION__))->typed.type), v); |
3955 | if (!TREE_STATIC (arr)((arr)->base.static_flag)) |
3956 | force_gimple_operand_gsi (&gsi, build1 (DECL_EXPR, |
3957 | void_type_nodeglobal_trees[TI_VOID_TYPE], arr), |
3958 | true, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); |
3959 | t1 = build_fold_addr_expr (arr)build_fold_addr_expr_loc (((location_t) 0), (arr)); |
3960 | t2 = NULL_TREE(tree) nullptr; |
3961 | } |
3962 | else |
3963 | { |
3964 | t2 = fold_convert (fd->iter_type, fd->loop.step)fold_convert_loc (((location_t) 0), fd->iter_type, fd-> loop.step); |
3965 | t1 = fd->loop.n2; |
3966 | t0 = fd->loop.n1; |
3967 | if (gimple_omp_for_combined_into_p (fd->for_stmt)) |
3968 | { |
3969 | tree innerc |
3970 | = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), |
3971 | OMP_CLAUSE__LOOPTEMP_); |
3972 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3972, __FUNCTION__), 0 : 0)); |
3973 | t0 = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3973, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3973, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3973, __FUNCTION__))); |
3974 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3974, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3974, __FUNCTION__))->common.chain), |
3975 | OMP_CLAUSE__LOOPTEMP_); |
3976 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3976, __FUNCTION__), 0 : 0)); |
3977 | t1 = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3977, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3977, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3977, __FUNCTION__))); |
3978 | } |
3979 | if (POINTER_TYPE_P (TREE_TYPE (t0))(((enum tree_code) (((contains_struct_check ((t0), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3979, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((t0), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3979, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) |
3980 | && TYPE_PRECISION (TREE_TYPE (t0))((tree_class_check ((((contains_struct_check ((t0), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3980, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3980, __FUNCTION__))->type_common.precision) |
3981 | != TYPE_PRECISION (fd->iter_type)((tree_class_check ((fd->iter_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 3981, __FUNCTION__))->type_common.precision)) |
3982 | { |
3983 | /* Avoid casting pointers to integer of a different size. */ |
3984 | tree itype = signed_type_for (type); |
3985 | t1 = fold_convert (fd->iter_type, fold_convert (itype, t1))fold_convert_loc (((location_t) 0), fd->iter_type, fold_convert_loc (((location_t) 0), itype, t1)); |
3986 | t0 = fold_convert (fd->iter_type, fold_convert (itype, t0))fold_convert_loc (((location_t) 0), fd->iter_type, fold_convert_loc (((location_t) 0), itype, t0)); |
3987 | } |
3988 | else |
3989 | { |
3990 | t1 = fold_convert (fd->iter_type, t1)fold_convert_loc (((location_t) 0), fd->iter_type, t1); |
3991 | t0 = fold_convert (fd->iter_type, t0)fold_convert_loc (((location_t) 0), fd->iter_type, t0); |
3992 | } |
3993 | if (bias) |
3994 | { |
3995 | t1 = fold_build2 (PLUS_EXPR, fd->iter_type, t1, bias)fold_build2_loc (((location_t) 0), PLUS_EXPR, fd->iter_type , t1, bias ); |
3996 | t0 = fold_build2 (PLUS_EXPR, fd->iter_type, t0, bias)fold_build2_loc (((location_t) 0), PLUS_EXPR, fd->iter_type , t0, bias ); |
3997 | } |
3998 | } |
3999 | if (fd->iter_type == long_integer_type_nodeinteger_types[itk_long] || fd->ordered) |
4000 | { |
4001 | if (fd->chunk_size) |
4002 | { |
4003 | t = fold_convert (fd->iter_type, fd->chunk_size)fold_convert_loc (((location_t) 0), fd->iter_type, fd-> chunk_size); |
4004 | t = omp_adjust_chunk_size (t, fd->simd_schedule); |
4005 | if (sched_arg) |
4006 | { |
4007 | if (fd->ordered) |
4008 | t = build_call_expr (builtin_decl_explicit (start_fn), |
4009 | 8, t0, t1, sched_arg, t, t3, t4, |
4010 | reductions, mem); |
4011 | else |
4012 | t = build_call_expr (builtin_decl_explicit (start_fn), |
4013 | 9, t0, t1, t2, sched_arg, t, t3, t4, |
4014 | reductions, mem); |
4015 | } |
4016 | else if (fd->ordered) |
4017 | t = build_call_expr (builtin_decl_explicit (start_fn), |
4018 | 5, t0, t1, t, t3, t4); |
4019 | else |
4020 | t = build_call_expr (builtin_decl_explicit (start_fn), |
4021 | 6, t0, t1, t2, t, t3, t4); |
4022 | } |
4023 | else if (fd->ordered) |
4024 | t = build_call_expr (builtin_decl_explicit (start_fn), |
4025 | 4, t0, t1, t3, t4); |
4026 | else |
4027 | t = build_call_expr (builtin_decl_explicit (start_fn), |
4028 | 5, t0, t1, t2, t3, t4); |
4029 | } |
4030 | else |
4031 | { |
4032 | tree t5; |
4033 | tree c_bool_type; |
4034 | tree bfn_decl; |
4035 | |
4036 | /* The GOMP_loop_ull_*start functions have additional boolean |
4037 | argument, true for < loops and false for > loops. |
4038 | In Fortran, the C bool type can be different from |
4039 | boolean_type_node. */ |
4040 | bfn_decl = builtin_decl_explicit (start_fn); |
4041 | c_bool_type = TREE_TYPE (TREE_TYPE (bfn_decl))((contains_struct_check ((((contains_struct_check ((bfn_decl) , (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4041, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4041, __FUNCTION__))->typed.type); |
4042 | t5 = build_int_cst (c_bool_type, |
4043 | fd->loop.cond_code == LT_EXPR ? 1 : 0); |
4044 | if (fd->chunk_size) |
4045 | { |
4046 | tree bfn_decl = builtin_decl_explicit (start_fn); |
4047 | t = fold_convert (fd->iter_type, fd->chunk_size)fold_convert_loc (((location_t) 0), fd->iter_type, fd-> chunk_size); |
4048 | t = omp_adjust_chunk_size (t, fd->simd_schedule); |
4049 | if (sched_arg) |
4050 | t = build_call_expr (bfn_decl, 10, t5, t0, t1, t2, sched_arg, |
4051 | t, t3, t4, reductions, mem); |
4052 | else |
4053 | t = build_call_expr (bfn_decl, 7, t5, t0, t1, t2, t, t3, t4); |
4054 | } |
4055 | else |
4056 | t = build_call_expr (builtin_decl_explicit (start_fn), |
4057 | 6, t5, t0, t1, t2, t3, t4); |
4058 | } |
4059 | } |
4060 | if (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4060, __FUNCTION__))->typed.type) != boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE]) |
4061 | t = fold_build2 (NE_EXPR, boolean_type_node,fold_build2_loc (((location_t) 0), NE_EXPR, global_trees[TI_BOOLEAN_TYPE ], t, build_int_cst (((contains_struct_check ((t), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4062, __FUNCTION__))->typed.type), 0) ) |
4062 | t, build_int_cst (TREE_TYPE (t), 0))fold_build2_loc (((location_t) 0), NE_EXPR, global_trees[TI_BOOLEAN_TYPE ], t, build_int_cst (((contains_struct_check ((t), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4062, __FUNCTION__))->typed.type), 0) ); |
4063 | t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, |
4064 | true, GSI_SAME_STMT); |
4065 | if (arr && !TREE_STATIC (arr)((arr)->base.static_flag)) |
4066 | { |
4067 | tree clobber = build_clobber (TREE_TYPE (arr)((contains_struct_check ((arr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4067, __FUNCTION__))->typed.type)); |
4068 | gsi_insert_before (&gsi, gimple_build_assign (arr, clobber), |
4069 | GSI_SAME_STMT); |
4070 | } |
4071 | if (fd->have_pointer_condtemp) |
4072 | expand_omp_build_assign (&gsi, condtemp, memv, false); |
4073 | if (fd->have_reductemp) |
4074 | { |
4075 | gimple *g = gsi_stmt (gsi); |
4076 | gsi_remove (&gsi, true); |
4077 | release_ssa_name (gimple_assign_lhs (g)); |
4078 | |
4079 | entry_bb = region->entry; |
4080 | gsi = gsi_last_nondebug_bb (entry_bb); |
4081 | |
4082 | gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR)((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4082, __FUNCTION__), 0 : 0)); |
4083 | } |
4084 | gsi_insert_after (&gsi, gimple_build_cond_empty (t), GSI_SAME_STMT); |
4085 | |
4086 | /* Remove the GIMPLE_OMP_FOR statement. */ |
4087 | gsi_remove (&gsi, true); |
4088 | |
4089 | if (gsi_end_p (gsif)) |
4090 | gsif = gsi_after_labels (gsi_bb (gsif)); |
4091 | gsi_next (&gsif); |
4092 | |
4093 | /* Iteration setup for sequential loop goes in L0_BB. */ |
4094 | tree startvar = fd->loop.v; |
4095 | tree endvar = NULL_TREE(tree) nullptr; |
4096 | |
4097 | if (gimple_omp_for_combined_p (fd->for_stmt)) |
4098 | { |
4099 | gcc_assert (gimple_code (inner_stmt) == GIMPLE_OMP_FOR((void)(!(gimple_code (inner_stmt) == GIMPLE_OMP_FOR && gimple_omp_for_kind (inner_stmt) == GF_OMP_FOR_KIND_SIMD) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4101, __FUNCTION__), 0 : 0)) |
4100 | && gimple_omp_for_kind (inner_stmt)((void)(!(gimple_code (inner_stmt) == GIMPLE_OMP_FOR && gimple_omp_for_kind (inner_stmt) == GF_OMP_FOR_KIND_SIMD) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4101, __FUNCTION__), 0 : 0)) |
4101 | == GF_OMP_FOR_KIND_SIMD)((void)(!(gimple_code (inner_stmt) == GIMPLE_OMP_FOR && gimple_omp_for_kind (inner_stmt) == GF_OMP_FOR_KIND_SIMD) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4101, __FUNCTION__), 0 : 0)); |
4102 | tree innerc = omp_find_clause (gimple_omp_for_clauses (inner_stmt), |
4103 | OMP_CLAUSE__LOOPTEMP_); |
4104 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4104, __FUNCTION__), 0 : 0)); |
4105 | startvar = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4105, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4105, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4105, __FUNCTION__))); |
4106 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4106, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4106, __FUNCTION__))->common.chain), |
4107 | OMP_CLAUSE__LOOPTEMP_); |
4108 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4108, __FUNCTION__), 0 : 0)); |
4109 | endvar = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4109, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4109, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4109, __FUNCTION__))); |
4110 | } |
4111 | |
4112 | gsi = gsi_start_bb (l0_bb); |
4113 | t = istart0; |
4114 | if (fd->ordered && fd->collapse == 1) |
4115 | t = fold_build2 (MULT_EXPR, fd->iter_type, t,fold_build2_loc (((location_t) 0), MULT_EXPR, fd->iter_type , t, fold_convert_loc (((location_t) 0), fd->iter_type, fd ->loop.step) ) |
4116 | fold_convert (fd->iter_type, fd->loop.step))fold_build2_loc (((location_t) 0), MULT_EXPR, fd->iter_type , t, fold_convert_loc (((location_t) 0), fd->iter_type, fd ->loop.step) ); |
4117 | else if (bias) |
4118 | t = fold_build2 (MINUS_EXPR, fd->iter_type, t, bias)fold_build2_loc (((location_t) 0), MINUS_EXPR, fd->iter_type , t, bias ); |
4119 | if (fd->ordered && fd->collapse == 1) |
4120 | { |
4121 | if (POINTER_TYPE_P (TREE_TYPE (startvar))(((enum tree_code) (((contains_struct_check ((startvar), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4121, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((startvar), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4121, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) |
4122 | t = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (startvar),fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4122, __FUNCTION__))->typed.type), fd->loop.n1, fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype], t) ) |
4123 | fd->loop.n1, fold_convert (sizetype, t))fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4122, __FUNCTION__))->typed.type), fd->loop.n1, fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype], t) ); |
4124 | else |
4125 | { |
4126 | t = fold_convert (TREE_TYPE (startvar), t)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4126, __FUNCTION__))->typed.type), t); |
4127 | t = fold_build2 (PLUS_EXPR, TREE_TYPE (startvar),fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4127, __FUNCTION__))->typed.type), fd->loop.n1, t ) |
4128 | fd->loop.n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4127, __FUNCTION__))->typed.type), fd->loop.n1, t ); |
4129 | } |
4130 | } |
4131 | else |
4132 | { |
4133 | if (POINTER_TYPE_P (TREE_TYPE (startvar))(((enum tree_code) (((contains_struct_check ((startvar), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4133, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((startvar), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4133, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) |
4134 | t = fold_convert (signed_type_for (TREE_TYPE (startvar)), t)fold_convert_loc (((location_t) 0), signed_type_for (((contains_struct_check ((startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4134, __FUNCTION__))->typed.type)), t); |
4135 | t = fold_convert (TREE_TYPE (startvar), t)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4135, __FUNCTION__))->typed.type), t); |
4136 | } |
4137 | t = force_gimple_operand_gsi (&gsi, t, |
4138 | DECL_P (startvar)(tree_code_type[(int) (((enum tree_code) (startvar)->base. code))] == tcc_declaration) |
4139 | && TREE_ADDRESSABLE (startvar)((startvar)->base.addressable_flag), |
4140 | NULL_TREE(tree) nullptr, false, GSI_CONTINUE_LINKING); |
4141 | assign_stmt = gimple_build_assign (startvar, t); |
4142 | gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); |
4143 | if (cond_var) |
4144 | { |
4145 | tree itype = TREE_TYPE (cond_var)((contains_struct_check ((cond_var), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4145, __FUNCTION__))->typed.type); |
4146 | /* For lastprivate(conditional:) itervar, we need some iteration |
4147 | counter that starts at unsigned non-zero and increases. |
4148 | Prefer as few IVs as possible, so if we can use startvar |
4149 | itself, use that, or startvar + constant (those would be |
4150 | incremented with step), and as last resort use the s0 + 1 |
4151 | incremented by 1. */ |
4152 | if ((fd->ordered && fd->collapse == 1) |
4153 | || bias |
4154 | || POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE) |
4155 | || TREE_CODE (fd->loop.n1)((enum tree_code) (fd->loop.n1)->base.code) != INTEGER_CST |
4156 | || fd->loop.cond_code != LT_EXPR) |
4157 | t = fold_build2 (PLUS_EXPR, itype, fold_convert (itype, istart0),fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fold_convert_loc (((location_t) 0), itype, istart0), build_int_cst (itype, 1) ) |
4158 | build_int_cst (itype, 1))fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fold_convert_loc (((location_t) 0), itype, istart0), build_int_cst (itype, 1) ); |
4159 | else if (tree_int_cst_sgn (fd->loop.n1) == 1) |
4160 | t = fold_convert (itype, t)fold_convert_loc (((location_t) 0), itype, t); |
4161 | else |
4162 | { |
4163 | tree c = fold_convert (itype, fd->loop.n1)fold_convert_loc (((location_t) 0), itype, fd->loop.n1); |
4164 | c = fold_build2 (MINUS_EXPR, itype, build_int_cst (itype, 1), c)fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, build_int_cst (itype, 1), c ); |
4165 | t = fold_build2 (PLUS_EXPR, itype, fold_convert (itype, t), c)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, fold_convert_loc (((location_t) 0), itype, t), c ); |
4166 | } |
4167 | t = force_gimple_operand_gsi (&gsi, t, false, |
4168 | NULL_TREE(tree) nullptr, false, GSI_CONTINUE_LINKING); |
4169 | assign_stmt = gimple_build_assign (cond_var, t); |
4170 | gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); |
4171 | } |
4172 | |
4173 | t = iend0; |
4174 | if (fd->ordered && fd->collapse == 1) |
4175 | t = fold_build2 (MULT_EXPR, fd->iter_type, t,fold_build2_loc (((location_t) 0), MULT_EXPR, fd->iter_type , t, fold_convert_loc (((location_t) 0), fd->iter_type, fd ->loop.step) ) |
4176 | fold_convert (fd->iter_type, fd->loop.step))fold_build2_loc (((location_t) 0), MULT_EXPR, fd->iter_type , t, fold_convert_loc (((location_t) 0), fd->iter_type, fd ->loop.step) ); |
4177 | else if (bias) |
4178 | t = fold_build2 (MINUS_EXPR, fd->iter_type, t, bias)fold_build2_loc (((location_t) 0), MINUS_EXPR, fd->iter_type , t, bias ); |
4179 | if (fd->ordered && fd->collapse == 1) |
4180 | { |
4181 | if (POINTER_TYPE_P (TREE_TYPE (startvar))(((enum tree_code) (((contains_struct_check ((startvar), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4181, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((startvar), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4181, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) |
4182 | t = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (startvar),fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4182, __FUNCTION__))->typed.type), fd->loop.n1, fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype], t) ) |
4183 | fd->loop.n1, fold_convert (sizetype, t))fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4182, __FUNCTION__))->typed.type), fd->loop.n1, fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype], t) ); |
4184 | else |
4185 | { |
4186 | t = fold_convert (TREE_TYPE (startvar), t)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4186, __FUNCTION__))->typed.type), t); |
4187 | t = fold_build2 (PLUS_EXPR, TREE_TYPE (startvar),fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4187, __FUNCTION__))->typed.type), fd->loop.n1, t ) |
4188 | fd->loop.n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4187, __FUNCTION__))->typed.type), fd->loop.n1, t ); |
4189 | } |
4190 | } |
4191 | else |
4192 | { |
4193 | if (POINTER_TYPE_P (TREE_TYPE (startvar))(((enum tree_code) (((contains_struct_check ((startvar), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4193, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((startvar), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4193, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) |
4194 | t = fold_convert (signed_type_for (TREE_TYPE (startvar)), t)fold_convert_loc (((location_t) 0), signed_type_for (((contains_struct_check ((startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4194, __FUNCTION__))->typed.type)), t); |
4195 | t = fold_convert (TREE_TYPE (startvar), t)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (startvar), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4195, __FUNCTION__))->typed.type), t); |
4196 | } |
4197 | iend = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, |
4198 | false, GSI_CONTINUE_LINKING); |
4199 | if (endvar) |
4200 | { |
4201 | assign_stmt = gimple_build_assign (endvar, iend); |
4202 | gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); |
4203 | if (useless_type_conversion_p (TREE_TYPE (fd->loop.v)((contains_struct_check ((fd->loop.v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4203, __FUNCTION__))->typed.type), TREE_TYPE (iend)((contains_struct_check ((iend), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4203, __FUNCTION__))->typed.type))) |
4204 | assign_stmt = gimple_build_assign (fd->loop.v, iend); |
4205 | else |
4206 | assign_stmt = gimple_build_assign (fd->loop.v, NOP_EXPR, iend); |
4207 | gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); |
4208 | } |
4209 | /* Handle linear clause adjustments. */ |
4210 | tree itercnt = NULL_TREE(tree) nullptr; |
4211 | if (gimple_omp_for_kind (fd->for_stmt) == GF_OMP_FOR_KIND_FOR) |
4212 | for (tree c = gimple_omp_for_clauses (fd->for_stmt); |
4213 | c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4213, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4213, __FUNCTION__))->common.chain)) |
4214 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4214, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_LINEAR |
4215 | && !OMP_CLAUSE_LINEAR_NO_COPYIN (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_LINEAR), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4215, __FUNCTION__))->base.public_flag)) |
4216 | { |
4217 | tree d = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4217, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4217, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4217, __FUNCTION__))); |
4218 | bool is_ref = omp_is_reference (d); |
4219 | tree t = d, a, dest; |
4220 | if (is_ref) |
4221 | t = build_simple_mem_ref_loc (OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4221, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, t); |
4222 | tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4222, __FUNCTION__))->typed.type); |
4223 | if (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE)) |
4224 | type = sizetypesizetype_tab[(int) stk_sizetype]; |
4225 | dest = unshare_expr (t); |
4226 | tree v = create_tmp_var (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4226, __FUNCTION__))->typed.type), NULLnullptr); |
4227 | expand_omp_build_assign (&gsif, v, t); |
4228 | if (itercnt == NULL_TREE(tree) nullptr) |
4229 | { |
4230 | itercnt = startvar; |
4231 | tree n1 = fd->loop.n1; |
4232 | if (POINTER_TYPE_P (TREE_TYPE (itercnt))(((enum tree_code) (((contains_struct_check ((itercnt), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4232, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((itercnt), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4232, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) |
4233 | { |
4234 | itercnt |
4235 | = fold_convert (signed_type_for (TREE_TYPE (itercnt)),fold_convert_loc (((location_t) 0), signed_type_for (((contains_struct_check ((itercnt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4235, __FUNCTION__))->typed.type)), itercnt) |
4236 | itercnt)fold_convert_loc (((location_t) 0), signed_type_for (((contains_struct_check ((itercnt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4235, __FUNCTION__))->typed.type)), itercnt); |
4237 | n1 = fold_convert (TREE_TYPE (itercnt), n1)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (itercnt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4237, __FUNCTION__))->typed.type), n1); |
4238 | } |
4239 | itercnt = fold_build2 (MINUS_EXPR, TREE_TYPE (itercnt),fold_build2_loc (((location_t) 0), MINUS_EXPR, ((contains_struct_check ((itercnt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4239, __FUNCTION__))->typed.type), itercnt, n1 ) |
4240 | itercnt, n1)fold_build2_loc (((location_t) 0), MINUS_EXPR, ((contains_struct_check ((itercnt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4239, __FUNCTION__))->typed.type), itercnt, n1 ); |
4241 | itercnt = fold_build2 (EXACT_DIV_EXPR, TREE_TYPE (itercnt),fold_build2_loc (((location_t) 0), EXACT_DIV_EXPR, ((contains_struct_check ((itercnt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4241, __FUNCTION__))->typed.type), itercnt, fd->loop. step ) |
4242 | itercnt, fd->loop.step)fold_build2_loc (((location_t) 0), EXACT_DIV_EXPR, ((contains_struct_check ((itercnt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4241, __FUNCTION__))->typed.type), itercnt, fd->loop. step ); |
4243 | itercnt = force_gimple_operand_gsi (&gsi, itercnt, true, |
4244 | NULL_TREE(tree) nullptr, false, |
4245 | GSI_CONTINUE_LINKING); |
4246 | } |
4247 | a = fold_build2 (MULT_EXPR, type,fold_build2_loc (((location_t) 0), MULT_EXPR, type, fold_convert_loc (((location_t) 0), type, itercnt), fold_convert_loc (((location_t ) 0), type, (*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_LINEAR), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4249, __FUNCTION__))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4249, __FUNCTION__)))) ) |
4248 | fold_convert (type, itercnt),fold_build2_loc (((location_t) 0), MULT_EXPR, type, fold_convert_loc (((location_t) 0), type, itercnt), fold_convert_loc (((location_t ) 0), type, (*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_LINEAR), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4249, __FUNCTION__))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4249, __FUNCTION__)))) ) |
4249 | fold_convert (type, OMP_CLAUSE_LINEAR_STEP (c)))fold_build2_loc (((location_t) 0), MULT_EXPR, type, fold_convert_loc (((location_t) 0), type, itercnt), fold_convert_loc (((location_t ) 0), type, (*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_LINEAR), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4249, __FUNCTION__))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4249, __FUNCTION__)))) ); |
4250 | t = fold_build2 (type == TREE_TYPE (t) ? PLUS_EXPRfold_build2_loc (((location_t) 0), type == ((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4250, __FUNCTION__))->typed.type) ? PLUS_EXPR : POINTER_PLUS_EXPR , ((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4251, __FUNCTION__))->typed.type), v, a ) |
4251 | : POINTER_PLUS_EXPR, TREE_TYPE (t), v, a)fold_build2_loc (((location_t) 0), type == ((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4250, __FUNCTION__))->typed.type) ? PLUS_EXPR : POINTER_PLUS_EXPR , ((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4251, __FUNCTION__))->typed.type), v, a ); |
4252 | t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, |
4253 | false, GSI_CONTINUE_LINKING); |
4254 | expand_omp_build_assign (&gsi, dest, t, true); |
4255 | } |
4256 | if (fd->collapse > 1) |
4257 | expand_omp_for_init_vars (fd, &gsi, counts, NULLnullptr, inner_stmt, startvar); |
4258 | |
4259 | if (fd->ordered) |
4260 | { |
4261 | /* Until now, counts array contained number of iterations or |
4262 | variable containing it for ith loop. From now on, we need |
4263 | those counts only for collapsed loops, and only for the 2nd |
4264 | till the last collapsed one. Move those one element earlier, |
4265 | we'll use counts[fd->collapse - 1] for the first source/sink |
4266 | iteration counter and so on and counts[fd->ordered] |
4267 | as the array holding the current counter values for |
4268 | depend(source). */ |
4269 | if (fd->collapse > 1) |
4270 | memmove (counts, counts + 1, (fd->collapse - 1) * sizeof (counts[0])); |
4271 | if (broken_loop) |
4272 | { |
4273 | int i; |
4274 | for (i = fd->collapse; i < fd->ordered; i++) |
4275 | { |
4276 | tree type = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4276, __FUNCTION__))->typed.type); |
4277 | tree this_cond |
4278 | = fold_build2 (fd->loops[i].cond_code, boolean_type_node,fold_build2_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], fold_convert_loc (((location_t ) 0), type, fd->loops[i].n1), fold_convert_loc (((location_t ) 0), type, fd->loops[i].n2) ) |
4279 | fold_convert (type, fd->loops[i].n1),fold_build2_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], fold_convert_loc (((location_t ) 0), type, fd->loops[i].n1), fold_convert_loc (((location_t ) 0), type, fd->loops[i].n2) ) |
4280 | fold_convert (type, fd->loops[i].n2))fold_build2_loc (((location_t) 0), fd->loops[i].cond_code, global_trees[TI_BOOLEAN_TYPE], fold_convert_loc (((location_t ) 0), type, fd->loops[i].n1), fold_convert_loc (((location_t ) 0), type, fd->loops[i].n2) ); |
4281 | if (!integer_onep (this_cond)) |
4282 | break; |
4283 | } |
4284 | if (i < fd->ordered) |
4285 | { |
4286 | cont_bb |
4287 | = create_empty_bb (EXIT_BLOCK_PTR_FOR_FN (cfun)(((cfun + 0))->cfg->x_exit_block_ptr)->prev_bb); |
4288 | add_bb_to_loop (cont_bb, l1_bb->loop_father); |
4289 | gimple_stmt_iterator gsi = gsi_after_labels (cont_bb); |
4290 | gimple *g = gimple_build_omp_continue (fd->loop.v, fd->loop.v); |
4291 | gsi_insert_before (&gsi, g, GSI_SAME_STMT); |
4292 | make_edge (cont_bb, l3_bb, EDGE_FALLTHRU); |
4293 | make_edge (cont_bb, l1_bb, 0); |
4294 | l2_bb = create_empty_bb (cont_bb); |
4295 | broken_loop = false; |
4296 | } |
4297 | } |
4298 | expand_omp_ordered_source_sink (region, fd, counts, cont_bb); |
4299 | cont_bb = expand_omp_for_ordered_loops (fd, counts, cont_bb, l1_bb, |
4300 | ordered_lastprivate); |
4301 | if (counts[fd->collapse - 1]) |
4302 | { |
4303 | gcc_assert (fd->collapse == 1)((void)(!(fd->collapse == 1) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4303, __FUNCTION__), 0 : 0)); |
4304 | gsi = gsi_last_bb (l0_bb); |
4305 | expand_omp_build_assign (&gsi, counts[fd->collapse - 1], |
4306 | istart0, true); |
4307 | if (cont_bb) |
4308 | { |
4309 | gsi = gsi_last_bb (cont_bb); |
4310 | t = fold_build2 (PLUS_EXPR, fd->iter_type,fold_build2_loc (((location_t) 0), PLUS_EXPR, fd->iter_type , counts[fd->collapse - 1], build_int_cst (fd->iter_type , 1) ) |
4311 | counts[fd->collapse - 1],fold_build2_loc (((location_t) 0), PLUS_EXPR, fd->iter_type , counts[fd->collapse - 1], build_int_cst (fd->iter_type , 1) ) |
4312 | build_int_cst (fd->iter_type, 1))fold_build2_loc (((location_t) 0), PLUS_EXPR, fd->iter_type , counts[fd->collapse - 1], build_int_cst (fd->iter_type , 1) ); |
4313 | expand_omp_build_assign (&gsi, counts[fd->collapse - 1], t); |
4314 | tree aref = build4 (ARRAY_REF, fd->iter_type, |
4315 | counts[fd->ordered], size_zero_nodeglobal_trees[TI_SIZE_ZERO], |
4316 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
4317 | expand_omp_build_assign (&gsi, aref, counts[fd->collapse - 1]); |
4318 | } |
4319 | t = counts[fd->collapse - 1]; |
4320 | } |
4321 | else if (fd->collapse > 1) |
4322 | t = fd->loop.v; |
4323 | else |
4324 | { |
4325 | t = fold_build2 (MINUS_EXPR, TREE_TYPE (fd->loops[0].v),fold_build2_loc (((location_t) 0), MINUS_EXPR, ((contains_struct_check ((fd->loops[0].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4325, __FUNCTION__))->typed.type), fd->loops[0].v, fd ->loops[0].n1 ) |
4326 | fd->loops[0].v, fd->loops[0].n1)fold_build2_loc (((location_t) 0), MINUS_EXPR, ((contains_struct_check ((fd->loops[0].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4325, __FUNCTION__))->typed.type), fd->loops[0].v, fd ->loops[0].n1 ); |
4327 | t = fold_convert (fd->iter_type, t)fold_convert_loc (((location_t) 0), fd->iter_type, t); |
4328 | } |
4329 | gsi = gsi_last_bb (l0_bb); |
4330 | tree aref = build4 (ARRAY_REF, fd->iter_type, counts[fd->ordered], |
4331 | size_zero_nodeglobal_trees[TI_SIZE_ZERO], NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
4332 | t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, |
4333 | false, GSI_CONTINUE_LINKING); |
4334 | expand_omp_build_assign (&gsi, aref, t, true); |
4335 | } |
4336 | |
4337 | if (!broken_loop) |
4338 | { |
4339 | /* Code to control the increment and predicate for the sequential |
4340 | loop goes in the CONT_BB. */ |
4341 | gsi = gsi_last_nondebug_bb (cont_bb); |
4342 | gomp_continue *cont_stmt = as_a <gomp_continue *> (gsi_stmt (gsi)); |
4343 | gcc_assert (gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE)((void)(!(gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4343, __FUNCTION__), 0 : 0)); |
4344 | vmain = gimple_omp_continue_control_use (cont_stmt); |
4345 | vback = gimple_omp_continue_control_def (cont_stmt); |
4346 | |
4347 | if (cond_var) |
4348 | { |
4349 | tree itype = TREE_TYPE (cond_var)((contains_struct_check ((cond_var), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4349, __FUNCTION__))->typed.type); |
4350 | tree t2; |
4351 | if ((fd->ordered && fd->collapse == 1) |
4352 | || bias |
4353 | || POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE) |
4354 | || TREE_CODE (fd->loop.n1)((enum tree_code) (fd->loop.n1)->base.code) != INTEGER_CST |
4355 | || fd->loop.cond_code != LT_EXPR) |
4356 | t2 = build_int_cst (itype, 1); |
4357 | else |
4358 | t2 = fold_convert (itype, fd->loop.step)fold_convert_loc (((location_t) 0), itype, fd->loop.step); |
4359 | t2 = fold_build2 (PLUS_EXPR, itype, cond_var, t2)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, cond_var , t2 ); |
4360 | t2 = force_gimple_operand_gsi (&gsi, t2, false, |
4361 | NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); |
4362 | assign_stmt = gimple_build_assign (cond_var, t2); |
4363 | gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); |
4364 | } |
4365 | |
4366 | if (!gimple_omp_for_combined_p (fd->for_stmt)) |
4367 | { |
4368 | if (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE)) |
4369 | t = fold_build_pointer_plus (vmain, fd->loop.step)fold_build_pointer_plus_loc (((location_t) 0), vmain, fd-> loop.step); |
4370 | else |
4371 | t = fold_build2 (PLUS_EXPR, type, vmain, fd->loop.step)fold_build2_loc (((location_t) 0), PLUS_EXPR, type, vmain, fd ->loop.step ); |
4372 | t = force_gimple_operand_gsi (&gsi, t, |
4373 | DECL_P (vback)(tree_code_type[(int) (((enum tree_code) (vback)->base.code ))] == tcc_declaration) |
4374 | && TREE_ADDRESSABLE (vback)((vback)->base.addressable_flag), |
4375 | NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); |
4376 | assign_stmt = gimple_build_assign (vback, t); |
4377 | gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); |
4378 | |
4379 | if (fd->ordered && counts[fd->collapse - 1] == NULL_TREE(tree) nullptr) |
4380 | { |
4381 | tree tem; |
4382 | if (fd->collapse > 1) |
4383 | tem = fd->loop.v; |
4384 | else |
4385 | { |
4386 | tem = fold_build2 (MINUS_EXPR, TREE_TYPE (fd->loops[0].v),fold_build2_loc (((location_t) 0), MINUS_EXPR, ((contains_struct_check ((fd->loops[0].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4386, __FUNCTION__))->typed.type), fd->loops[0].v, fd ->loops[0].n1 ) |
4387 | fd->loops[0].v, fd->loops[0].n1)fold_build2_loc (((location_t) 0), MINUS_EXPR, ((contains_struct_check ((fd->loops[0].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4386, __FUNCTION__))->typed.type), fd->loops[0].v, fd ->loops[0].n1 ); |
4388 | tem = fold_convert (fd->iter_type, tem)fold_convert_loc (((location_t) 0), fd->iter_type, tem); |
4389 | } |
4390 | tree aref = build4 (ARRAY_REF, fd->iter_type, |
4391 | counts[fd->ordered], size_zero_nodeglobal_trees[TI_SIZE_ZERO], |
4392 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
4393 | tem = force_gimple_operand_gsi (&gsi, tem, true, NULL_TREE(tree) nullptr, |
4394 | true, GSI_SAME_STMT); |
4395 | expand_omp_build_assign (&gsi, aref, tem); |
4396 | } |
4397 | |
4398 | t = build2 (fd->loop.cond_code, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], |
4399 | DECL_P (vback)(tree_code_type[(int) (((enum tree_code) (vback)->base.code ))] == tcc_declaration) && TREE_ADDRESSABLE (vback)((vback)->base.addressable_flag) ? t : vback, |
4400 | iend); |
4401 | gcond *cond_stmt = gimple_build_cond_empty (t); |
4402 | gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT); |
4403 | } |
4404 | |
4405 | /* Remove GIMPLE_OMP_CONTINUE. */ |
4406 | gsi_remove (&gsi, true); |
4407 | |
4408 | if (fd->collapse > 1 && !gimple_omp_for_combined_p (fd->for_stmt)) |
4409 | collapse_bb = extract_omp_for_update_vars (fd, NULLnullptr, cont_bb, l1_bb); |
4410 | |
4411 | /* Emit code to get the next parallel iteration in L2_BB. */ |
4412 | gsi = gsi_start_bb (l2_bb); |
4413 | |
4414 | t = build_call_expr (builtin_decl_explicit (next_fn), 2, |
4415 | build_fold_addr_expr (istart0)build_fold_addr_expr_loc (((location_t) 0), (istart0)), |
4416 | build_fold_addr_expr (iend0)build_fold_addr_expr_loc (((location_t) 0), (iend0))); |
4417 | t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, |
4418 | false, GSI_CONTINUE_LINKING); |
4419 | if (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4419, __FUNCTION__))->typed.type) != boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE]) |
4420 | t = fold_build2 (NE_EXPR, boolean_type_node,fold_build2_loc (((location_t) 0), NE_EXPR, global_trees[TI_BOOLEAN_TYPE ], t, build_int_cst (((contains_struct_check ((t), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4421, __FUNCTION__))->typed.type), 0) ) |
4421 | t, build_int_cst (TREE_TYPE (t), 0))fold_build2_loc (((location_t) 0), NE_EXPR, global_trees[TI_BOOLEAN_TYPE ], t, build_int_cst (((contains_struct_check ((t), (TS_TYPED) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4421, __FUNCTION__))->typed.type), 0) ); |
4422 | gcond *cond_stmt = gimple_build_cond_empty (t); |
4423 | gsi_insert_after (&gsi, cond_stmt, GSI_CONTINUE_LINKING); |
4424 | } |
4425 | |
4426 | /* Add the loop cleanup function. */ |
4427 | gsi = gsi_last_nondebug_bb (exit_bb); |
4428 | if (gimple_omp_return_nowait_p (gsi_stmt (gsi))) |
4429 | t = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END_NOWAIT); |
4430 | else if (gimple_omp_return_lhs (gsi_stmt (gsi))) |
4431 | t = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END_CANCEL); |
4432 | else |
4433 | t = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END); |
4434 | gcall *call_stmt = gimple_build_call (t, 0); |
4435 | if (fd->ordered) |
4436 | { |
4437 | tree arr = counts[fd->ordered]; |
4438 | tree clobber = build_clobber (TREE_TYPE (arr)((contains_struct_check ((arr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4438, __FUNCTION__))->typed.type)); |
4439 | gsi_insert_after (&gsi, gimple_build_assign (arr, clobber), |
4440 | GSI_SAME_STMT); |
4441 | } |
4442 | if (gimple_omp_return_lhs (gsi_stmt (gsi))) |
4443 | { |
4444 | gimple_call_set_lhs (call_stmt, gimple_omp_return_lhs (gsi_stmt (gsi))); |
4445 | if (fd->have_reductemp) |
4446 | { |
4447 | gimple *g = gimple_build_assign (reductions, NOP_EXPR, |
4448 | gimple_call_lhs (call_stmt)); |
4449 | gsi_insert_after (&gsi, g, GSI_SAME_STMT); |
4450 | } |
4451 | } |
4452 | gsi_insert_after (&gsi, call_stmt, GSI_SAME_STMT); |
4453 | gsi_remove (&gsi, true); |
4454 | |
4455 | /* Connect the new blocks. */ |
4456 | find_edge (entry_bb, l0_bb)->flags = EDGE_TRUE_VALUE; |
4457 | find_edge (entry_bb, l3_bb)->flags = EDGE_FALSE_VALUE; |
4458 | |
4459 | if (!broken_loop) |
4460 | { |
4461 | gimple_seq phis; |
4462 | |
4463 | e = find_edge (cont_bb, l3_bb); |
4464 | ne = make_edge (l2_bb, l3_bb, EDGE_FALSE_VALUE); |
4465 | |
4466 | phis = phi_nodes (l3_bb); |
4467 | for (gsi = gsi_start (phis)gsi_start_1 (&(phis)); !gsi_end_p (gsi); gsi_next (&gsi)) |
4468 | { |
4469 | gimple *phi = gsi_stmt (gsi); |
4470 | SET_USE (PHI_ARG_DEF_PTR_FROM_EDGE (phi, ne),set_ssa_use_from_ptr (gimple_phi_arg_imm_use_ptr (((phi)), (( ne)->dest_idx)), gimple_phi_arg_def (((phi)), ((e)->dest_idx ))) |
4471 | PHI_ARG_DEF_FROM_EDGE (phi, e))set_ssa_use_from_ptr (gimple_phi_arg_imm_use_ptr (((phi)), (( ne)->dest_idx)), gimple_phi_arg_def (((phi)), ((e)->dest_idx ))); |
4472 | } |
4473 | remove_edge (e); |
4474 | |
4475 | make_edge (cont_bb, l2_bb, EDGE_FALSE_VALUE); |
4476 | e = find_edge (cont_bb, l1_bb); |
4477 | if (e == NULLnullptr) |
4478 | { |
4479 | e = BRANCH_EDGE (cont_bb)((*((cont_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))->succs)[(1)] : (*((cont_bb))->succs)[(0) ]); |
4480 | gcc_assert (single_succ (e->dest) == l1_bb)((void)(!(single_succ (e->dest) == l1_bb) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4480, __FUNCTION__), 0 : 0)); |
4481 | } |
4482 | if (gimple_omp_for_combined_p (fd->for_stmt)) |
4483 | { |
4484 | remove_edge (e); |
4485 | e = NULLnullptr; |
4486 | } |
4487 | else if (fd->collapse > 1) |
4488 | { |
4489 | remove_edge (e); |
4490 | e = make_edge (cont_bb, collapse_bb, EDGE_TRUE_VALUE); |
4491 | } |
4492 | else |
4493 | e->flags = EDGE_TRUE_VALUE; |
4494 | if (e) |
4495 | { |
4496 | e->probability = profile_probability::guessed_always ().apply_scale (7, 8); |
4497 | find_edge (cont_bb, l2_bb)->probability = e->probability.invert (); |
4498 | } |
4499 | else |
4500 | { |
4501 | e = find_edge (cont_bb, l2_bb); |
4502 | e->flags = EDGE_FALLTHRU; |
4503 | } |
4504 | make_edge (l2_bb, l0_bb, EDGE_TRUE_VALUE); |
4505 | |
4506 | if (gimple_in_ssa_p (cfun(cfun + 0))) |
4507 | { |
4508 | /* Add phis to the outer loop that connect to the phis in the inner, |
4509 | original loop, and move the loop entry value of the inner phi to |
4510 | the loop entry value of the outer phi. */ |
4511 | gphi_iterator psi; |
4512 | for (psi = gsi_start_phis (l3_bb); !gsi_end_p (psi); gsi_next (&psi)) |
4513 | { |
4514 | location_t locus; |
4515 | gphi *nphi; |
4516 | gphi *exit_phi = psi.phi (); |
4517 | |
4518 | if (virtual_operand_p (gimple_phi_result (exit_phi))) |
4519 | continue; |
4520 | |
4521 | edge l2_to_l3 = find_edge (l2_bb, l3_bb); |
4522 | tree exit_res = PHI_ARG_DEF_FROM_EDGE (exit_phi, l2_to_l3)gimple_phi_arg_def (((exit_phi)), ((l2_to_l3)->dest_idx)); |
4523 | |
4524 | basic_block latch = BRANCH_EDGE (cont_bb)((*((cont_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))->succs)[(1)] : (*((cont_bb))->succs)[(0) ])->dest; |
4525 | edge latch_to_l1 = find_edge (latch, l1_bb); |
4526 | gphi *inner_phi |
4527 | = find_phi_with_arg_on_edge (exit_res, latch_to_l1); |
4528 | |
4529 | tree t = gimple_phi_result (exit_phi); |
4530 | tree new_res = copy_ssa_name (t, NULLnullptr); |
4531 | nphi = create_phi_node (new_res, l0_bb); |
4532 | |
4533 | edge l0_to_l1 = find_edge (l0_bb, l1_bb); |
4534 | t = PHI_ARG_DEF_FROM_EDGE (inner_phi, l0_to_l1)gimple_phi_arg_def (((inner_phi)), ((l0_to_l1)->dest_idx)); |
4535 | locus = gimple_phi_arg_location_from_edge (inner_phi, l0_to_l1); |
4536 | edge entry_to_l0 = find_edge (entry_bb, l0_bb); |
4537 | add_phi_arg (nphi, t, entry_to_l0, locus); |
4538 | |
4539 | edge l2_to_l0 = find_edge (l2_bb, l0_bb); |
4540 | add_phi_arg (nphi, exit_res, l2_to_l0, UNKNOWN_LOCATION((location_t) 0)); |
4541 | |
4542 | add_phi_arg (inner_phi, new_res, l0_to_l1, UNKNOWN_LOCATION((location_t) 0)); |
4543 | } |
4544 | } |
4545 | |
4546 | set_immediate_dominator (CDI_DOMINATORS, l2_bb, |
4547 | recompute_dominator (CDI_DOMINATORS, l2_bb)); |
4548 | set_immediate_dominator (CDI_DOMINATORS, l3_bb, |
4549 | recompute_dominator (CDI_DOMINATORS, l3_bb)); |
4550 | set_immediate_dominator (CDI_DOMINATORS, l0_bb, |
4551 | recompute_dominator (CDI_DOMINATORS, l0_bb)); |
4552 | set_immediate_dominator (CDI_DOMINATORS, l1_bb, |
4553 | recompute_dominator (CDI_DOMINATORS, l1_bb)); |
4554 | |
4555 | /* We enter expand_omp_for_generic with a loop. This original loop may |
4556 | have its own loop struct, or it may be part of an outer loop struct |
4557 | (which may be the fake loop). */ |
4558 | class loop *outer_loop = entry_bb->loop_father; |
4559 | bool orig_loop_has_loop_struct = l1_bb->loop_father != outer_loop; |
4560 | |
4561 | add_bb_to_loop (l2_bb, outer_loop); |
4562 | |
4563 | /* We've added a new loop around the original loop. Allocate the |
4564 | corresponding loop struct. */ |
4565 | class loop *new_loop = alloc_loop (); |
4566 | new_loop->header = l0_bb; |
4567 | new_loop->latch = l2_bb; |
4568 | add_loop (new_loop, outer_loop); |
4569 | |
4570 | /* Allocate a loop structure for the original loop unless we already |
4571 | had one. */ |
4572 | if (!orig_loop_has_loop_struct |
4573 | && !gimple_omp_for_combined_p (fd->for_stmt)) |
4574 | { |
4575 | class loop *orig_loop = alloc_loop (); |
4576 | orig_loop->header = l1_bb; |
4577 | /* The loop may have multiple latches. */ |
4578 | add_loop (orig_loop, new_loop); |
4579 | } |
4580 | } |
4581 | } |
4582 | |
4583 | /* Helper function for expand_omp_for_static_nochunk. If PTR is NULL, |
4584 | compute needed allocation size. If !ALLOC of team allocations, |
4585 | if ALLOC of thread allocation. SZ is the initial needed size for |
4586 | other purposes, ALLOC_ALIGN guaranteed alignment of allocation in bytes, |
4587 | CNT number of elements of each array, for !ALLOC this is |
4588 | omp_get_num_threads (), for ALLOC number of iterations handled by the |
4589 | current thread. If PTR is non-NULL, it is the start of the allocation |
4590 | and this routine shall assign to OMP_CLAUSE_DECL (c) of those _scantemp_ |
4591 | clauses pointers to the corresponding arrays. */ |
4592 | |
4593 | static tree |
4594 | expand_omp_scantemp_alloc (tree clauses, tree ptr, unsigned HOST_WIDE_INTlong sz, |
4595 | unsigned HOST_WIDE_INTlong alloc_align, tree cnt, |
4596 | gimple_stmt_iterator *gsi, bool alloc) |
4597 | { |
4598 | tree eltsz = NULL_TREE(tree) nullptr; |
4599 | unsigned HOST_WIDE_INTlong preval = 0; |
4600 | if (ptr && sz) |
4601 | ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr),fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((ptr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4601, __FUNCTION__))->typed.type), ptr, size_int_kind (sz , stk_sizetype) ) |
4602 | ptr, size_int (sz))fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((ptr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4601, __FUNCTION__))->typed.type), ptr, size_int_kind (sz , stk_sizetype) ); |
4603 | for (tree c = clauses; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4603, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4603, __FUNCTION__))->common.chain)) |
4604 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4604, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE__SCANTEMP_ |
4605 | && !OMP_CLAUSE__SCANTEMP__CONTROL (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4605, __FUNCTION__)))->base.private_flag) |
4606 | && (!OMP_CLAUSE__SCANTEMP__ALLOC (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4606, __FUNCTION__))->base.public_flag)) != alloc) |
4607 | { |
4608 | tree pointee_type = TREE_TYPE (TREE_TYPE (OMP_CLAUSE_DECL (c)))((contains_struct_check ((((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4608, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4608, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4608, __FUNCTION__)))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4608, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4608, __FUNCTION__))->typed.type); |
4609 | unsigned HOST_WIDE_INTlong al = TYPE_ALIGN_UNIT (pointee_type)(((tree_class_check ((pointee_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4609, __FUNCTION__))->type_common.align ? ((unsigned)1) << ((pointee_type)->type_common.align - 1) : 0) / (8)); |
4610 | if (tree_fits_uhwi_p (TYPE_SIZE_UNIT (pointee_type)((tree_class_check ((pointee_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4610, __FUNCTION__))->type_common.size_unit))) |
4611 | { |
4612 | unsigned HOST_WIDE_INTlong szl |
4613 | = tree_to_uhwi (TYPE_SIZE_UNIT (pointee_type)((tree_class_check ((pointee_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4613, __FUNCTION__))->type_common.size_unit)); |
4614 | szl = least_bit_hwi (szl); |
4615 | if (szl) |
4616 | al = MIN (al, szl)((al) < (szl) ? (al) : (szl)); |
4617 | } |
4618 | if (ptr == NULL_TREE(tree) nullptr) |
4619 | { |
4620 | if (eltsz == NULL_TREE(tree) nullptr) |
4621 | eltsz = TYPE_SIZE_UNIT (pointee_type)((tree_class_check ((pointee_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4621, __FUNCTION__))->type_common.size_unit); |
4622 | else |
4623 | eltsz = size_binop (PLUS_EXPR, eltsz,size_binop_loc (((location_t) 0), PLUS_EXPR, eltsz, ((tree_class_check ((pointee_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4624, __FUNCTION__))->type_common.size_unit)) |
4624 | TYPE_SIZE_UNIT (pointee_type))size_binop_loc (((location_t) 0), PLUS_EXPR, eltsz, ((tree_class_check ((pointee_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4624, __FUNCTION__))->type_common.size_unit)); |
4625 | } |
4626 | if (preval == 0 && al <= alloc_align) |
4627 | { |
4628 | unsigned HOST_WIDE_INTlong diff = ROUND_UP (sz, al)(((sz) + (al) - 1) & ~((al) - 1)) - sz; |
4629 | sz += diff; |
4630 | if (diff && ptr) |
4631 | ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr),fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((ptr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4631, __FUNCTION__))->typed.type), ptr, size_int_kind (diff , stk_sizetype) ) |
4632 | ptr, size_int (diff))fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((ptr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4631, __FUNCTION__))->typed.type), ptr, size_int_kind (diff , stk_sizetype) ); |
4633 | } |
4634 | else if (al > preval) |
4635 | { |
4636 | if (ptr) |
4637 | { |
4638 | ptr = fold_convert (pointer_sized_int_node, ptr)fold_convert_loc (((location_t) 0), global_trees[TI_POINTER_SIZED_TYPE ], ptr); |
4639 | ptr = fold_build2 (PLUS_EXPR, pointer_sized_int_node, ptr,fold_build2_loc (((location_t) 0), PLUS_EXPR, global_trees[TI_POINTER_SIZED_TYPE ], ptr, build_int_cst (global_trees[TI_POINTER_SIZED_TYPE], al - 1) ) |
4640 | build_int_cst (pointer_sized_int_node,fold_build2_loc (((location_t) 0), PLUS_EXPR, global_trees[TI_POINTER_SIZED_TYPE ], ptr, build_int_cst (global_trees[TI_POINTER_SIZED_TYPE], al - 1) ) |
4641 | al - 1))fold_build2_loc (((location_t) 0), PLUS_EXPR, global_trees[TI_POINTER_SIZED_TYPE ], ptr, build_int_cst (global_trees[TI_POINTER_SIZED_TYPE], al - 1) ); |
4642 | ptr = fold_build2 (BIT_AND_EXPR, pointer_sized_int_node, ptr,fold_build2_loc (((location_t) 0), BIT_AND_EXPR, global_trees [TI_POINTER_SIZED_TYPE], ptr, build_int_cst (global_trees[TI_POINTER_SIZED_TYPE ], -(long) al) ) |
4643 | build_int_cst (pointer_sized_int_node,fold_build2_loc (((location_t) 0), BIT_AND_EXPR, global_trees [TI_POINTER_SIZED_TYPE], ptr, build_int_cst (global_trees[TI_POINTER_SIZED_TYPE ], -(long) al) ) |
4644 | -(HOST_WIDE_INT) al))fold_build2_loc (((location_t) 0), BIT_AND_EXPR, global_trees [TI_POINTER_SIZED_TYPE], ptr, build_int_cst (global_trees[TI_POINTER_SIZED_TYPE ], -(long) al) ); |
4645 | ptr = fold_convert (ptr_type_node, ptr)fold_convert_loc (((location_t) 0), global_trees[TI_PTR_TYPE] , ptr); |
4646 | } |
4647 | else |
4648 | sz += al - 1; |
4649 | } |
4650 | if (tree_fits_uhwi_p (TYPE_SIZE_UNIT (pointee_type)((tree_class_check ((pointee_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4650, __FUNCTION__))->type_common.size_unit))) |
4651 | preval = al; |
4652 | else |
4653 | preval = 1; |
4654 | if (ptr) |
4655 | { |
4656 | expand_omp_build_assign (gsi, OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4656, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4656, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4656, __FUNCTION__))), ptr, false); |
4657 | ptr = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4657, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4657, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4657, __FUNCTION__))); |
4658 | ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr,fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((ptr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4658, __FUNCTION__))->typed.type), ptr, size_binop_loc ( ((location_t) 0), MULT_EXPR, cnt, ((tree_class_check ((pointee_type ), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4660, __FUNCTION__))->type_common.size_unit)) ) |
4659 | size_binop (MULT_EXPR, cnt,fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((ptr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4658, __FUNCTION__))->typed.type), ptr, size_binop_loc ( ((location_t) 0), MULT_EXPR, cnt, ((tree_class_check ((pointee_type ), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4660, __FUNCTION__))->type_common.size_unit)) ) |
4660 | TYPE_SIZE_UNIT (pointee_type)))fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((ptr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4658, __FUNCTION__))->typed.type), ptr, size_binop_loc ( ((location_t) 0), MULT_EXPR, cnt, ((tree_class_check ((pointee_type ), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4660, __FUNCTION__))->type_common.size_unit)) ); |
4661 | } |
4662 | } |
4663 | |
4664 | if (ptr == NULL_TREE(tree) nullptr) |
4665 | { |
4666 | eltsz = size_binop (MULT_EXPR, eltsz, cnt)size_binop_loc (((location_t) 0), MULT_EXPR, eltsz, cnt); |
4667 | if (sz) |
4668 | eltsz = size_binop (PLUS_EXPR, eltsz, size_int (sz))size_binop_loc (((location_t) 0), PLUS_EXPR, eltsz, size_int_kind (sz, stk_sizetype)); |
4669 | return eltsz; |
4670 | } |
4671 | else |
4672 | return ptr; |
4673 | } |
4674 | |
4675 | /* Return the last _looptemp_ clause if one has been created for |
4676 | lastprivate on distribute parallel for{, simd} or taskloop. |
4677 | FD is the loop data and INNERC should be the second _looptemp_ |
4678 | clause (the one holding the end of the range). |
4679 | This is followed by collapse - 1 _looptemp_ clauses for the |
4680 | counts[1] and up, and for triangular loops followed by 4 |
4681 | further _looptemp_ clauses (one for counts[0], one first_inner_iterations, |
4682 | one factor and one adjn1). After this there is optionally one |
4683 | _looptemp_ clause that this function returns. */ |
4684 | |
4685 | static tree |
4686 | find_lastprivate_looptemp (struct omp_for_data *fd, tree innerc) |
4687 | { |
4688 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4688, __FUNCTION__), 0 : 0)); |
4689 | int count = fd->collapse - 1; |
4690 | if (fd->non_rect |
4691 | && fd->last_nonrect == fd->first_nonrect + 1 |
4692 | && !TYPE_UNSIGNED (TREE_TYPE (fd->loops[fd->last_nonrect].v))((tree_class_check ((((contains_struct_check ((fd->loops[fd ->last_nonrect].v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4692, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4692, __FUNCTION__))->base.u.bits.unsigned_flag)) |
4693 | count += 4; |
4694 | for (int i = 0; i < count; i++) |
4695 | { |
4696 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4696, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4696, __FUNCTION__))->common.chain), |
4697 | OMP_CLAUSE__LOOPTEMP_); |
4698 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4698, __FUNCTION__), 0 : 0)); |
4699 | } |
4700 | return omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4700, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4700, __FUNCTION__))->common.chain), |
4701 | OMP_CLAUSE__LOOPTEMP_); |
4702 | } |
4703 | |
4704 | /* A subroutine of expand_omp_for. Generate code for a parallel |
4705 | loop with static schedule and no specified chunk size. Given |
4706 | parameters: |
4707 | |
4708 | for (V = N1; V cond N2; V += STEP) BODY; |
4709 | |
4710 | where COND is "<" or ">", we generate pseudocode |
4711 | |
4712 | if ((__typeof (V)) -1 > 0 && N2 cond N1) goto L2; |
4713 | if (cond is <) |
4714 | adj = STEP - 1; |
4715 | else |
4716 | adj = STEP + 1; |
4717 | if ((__typeof (V)) -1 > 0 && cond is >) |
4718 | n = -(adj + N2 - N1) / -STEP; |
4719 | else |
4720 | n = (adj + N2 - N1) / STEP; |
4721 | q = n / nthreads; |
4722 | tt = n % nthreads; |
4723 | if (threadid < tt) goto L3; else goto L4; |
4724 | L3: |
4725 | tt = 0; |
4726 | q = q + 1; |
4727 | L4: |
4728 | s0 = q * threadid + tt; |
4729 | e0 = s0 + q; |
4730 | V = s0 * STEP + N1; |
4731 | if (s0 >= e0) goto L2; else goto L0; |
4732 | L0: |
4733 | e = e0 * STEP + N1; |
4734 | L1: |
4735 | BODY; |
4736 | V += STEP; |
4737 | if (V cond e) goto L1; |
4738 | L2: |
4739 | */ |
4740 | |
4741 | static void |
4742 | expand_omp_for_static_nochunk (struct omp_region *region, |
4743 | struct omp_for_data *fd, |
4744 | gimple *inner_stmt) |
4745 | { |
4746 | tree n, q, s0, e0, e, t, tt, nthreads = NULL_TREE(tree) nullptr, threadid; |
4747 | tree type, itype, vmain, vback; |
4748 | basic_block entry_bb, second_bb, third_bb, exit_bb, seq_start_bb; |
4749 | basic_block body_bb, cont_bb, collapse_bb = NULLnullptr; |
4750 | basic_block fin_bb, fourth_bb = NULLnullptr, fifth_bb = NULLnullptr, sixth_bb = NULLnullptr; |
4751 | basic_block exit1_bb = NULLnullptr, exit2_bb = NULLnullptr, exit3_bb = NULLnullptr; |
4752 | gimple_stmt_iterator gsi, gsip; |
4753 | edge ep; |
4754 | bool broken_loop = region->cont == NULLnullptr; |
4755 | tree *counts = NULLnullptr; |
4756 | tree n1, n2, step; |
4757 | tree reductions = NULL_TREE(tree) nullptr; |
4758 | tree cond_var = NULL_TREE(tree) nullptr, condtemp = NULL_TREE(tree) nullptr; |
4759 | |
4760 | itype = type = TREE_TYPE (fd->loop.v)((contains_struct_check ((fd->loop.v), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4760, __FUNCTION__))->typed.type); |
4761 | if (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE)) |
4762 | itype = signed_type_for (type); |
4763 | |
4764 | entry_bb = region->entry; |
4765 | cont_bb = region->cont; |
4766 | gcc_assert (EDGE_COUNT (entry_bb->succs) == 2)((void)(!(vec_safe_length (entry_bb->succs) == 2) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4766, __FUNCTION__), 0 : 0)); |
4767 | fin_bb = BRANCH_EDGE (entry_bb)((*((entry_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(1)] : (*((entry_bb))->succs) [(0)])->dest; |
4768 | gcc_assert (broken_loop((void)(!(broken_loop || (fin_bb == ((*((cont_bb))->succs) [(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))->succs )[(0)] : (*((cont_bb))->succs)[(1)])->dest)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4769, __FUNCTION__), 0 : 0)) |
4769 | || (fin_bb == FALLTHRU_EDGE (cont_bb)->dest))((void)(!(broken_loop || (fin_bb == ((*((cont_bb))->succs) [(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))->succs )[(0)] : (*((cont_bb))->succs)[(1)])->dest)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4769, __FUNCTION__), 0 : 0)); |
4770 | seq_start_bb = split_edge (FALLTHRU_EDGE (entry_bb)((*((entry_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(0)] : (*((entry_bb))->succs) [(1)])); |
4771 | body_bb = single_succ (seq_start_bb); |
4772 | if (!broken_loop) |
4773 | { |
4774 | gcc_assert (BRANCH_EDGE (cont_bb)->dest == body_bb((void)(!(((*((cont_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))->succs)[(1)] : (*((cont_bb))->succs)[( 0)])->dest == body_bb || single_succ (((*((cont_bb))->succs )[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))->succs )[(1)] : (*((cont_bb))->succs)[(0)])->dest) == body_bb) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4775, __FUNCTION__), 0 : 0)) |
4775 | || single_succ (BRANCH_EDGE (cont_bb)->dest) == body_bb)((void)(!(((*((cont_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))->succs)[(1)] : (*((cont_bb))->succs)[( 0)])->dest == body_bb || single_succ (((*((cont_bb))->succs )[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))->succs )[(1)] : (*((cont_bb))->succs)[(0)])->dest) == body_bb) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4775, __FUNCTION__), 0 : 0)); |
4776 | gcc_assert (EDGE_COUNT (cont_bb->succs) == 2)((void)(!(vec_safe_length (cont_bb->succs) == 2) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4776, __FUNCTION__), 0 : 0)); |
4777 | } |
4778 | exit_bb = region->exit; |
4779 | |
4780 | /* Iteration space partitioning goes in ENTRY_BB. */ |
4781 | gsi = gsi_last_nondebug_bb (entry_bb); |
4782 | gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR)((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4782, __FUNCTION__), 0 : 0)); |
4783 | gsip = gsi; |
4784 | gsi_prev (&gsip); |
4785 | |
4786 | if (fd->collapse > 1) |
4787 | { |
4788 | int first_zero_iter = -1, dummy = -1; |
4789 | basic_block l2_dom_bb = NULLnullptr, dummy_bb = NULLnullptr; |
4790 | |
4791 | counts = XALLOCAVEC (tree, fd->collapse)((tree *) __builtin_alloca(sizeof (tree) * (fd->collapse)) ); |
4792 | expand_omp_for_init_counts (fd, &gsi, entry_bb, counts, |
4793 | fin_bb, first_zero_iter, |
4794 | dummy_bb, dummy, l2_dom_bb); |
4795 | t = NULL_TREE(tree) nullptr; |
4796 | } |
4797 | else if (gimple_omp_for_combined_into_p (fd->for_stmt)) |
4798 | t = integer_one_nodeglobal_trees[TI_INTEGER_ONE]; |
4799 | else |
4800 | t = fold_binary (fd->loop.cond_code, boolean_type_node,fold_binary_loc (((location_t) 0), fd->loop.cond_code, global_trees [TI_BOOLEAN_TYPE], fold_convert_loc (((location_t) 0), type, fd ->loop.n1), fold_convert_loc (((location_t) 0), type, fd-> loop.n2)) |
4801 | fold_convert (type, fd->loop.n1),fold_binary_loc (((location_t) 0), fd->loop.cond_code, global_trees [TI_BOOLEAN_TYPE], fold_convert_loc (((location_t) 0), type, fd ->loop.n1), fold_convert_loc (((location_t) 0), type, fd-> loop.n2)) |
4802 | fold_convert (type, fd->loop.n2))fold_binary_loc (((location_t) 0), fd->loop.cond_code, global_trees [TI_BOOLEAN_TYPE], fold_convert_loc (((location_t) 0), type, fd ->loop.n1), fold_convert_loc (((location_t) 0), type, fd-> loop.n2)); |
4803 | if (fd->collapse == 1 |
4804 | && TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4804, __FUNCTION__))->base.u.bits.unsigned_flag) |
4805 | && (t == NULL_TREE(tree) nullptr || !integer_onep (t))) |
4806 | { |
4807 | n1 = fold_convert (type, unshare_expr (fd->loop.n1))fold_convert_loc (((location_t) 0), type, unshare_expr (fd-> loop.n1)); |
4808 | n1 = force_gimple_operand_gsi (&gsi, n1, true, NULL_TREE(tree) nullptr, |
4809 | true, GSI_SAME_STMT); |
4810 | n2 = fold_convert (type, unshare_expr (fd->loop.n2))fold_convert_loc (((location_t) 0), type, unshare_expr (fd-> loop.n2)); |
4811 | n2 = force_gimple_operand_gsi (&gsi, n2, true, NULL_TREE(tree) nullptr, |
4812 | true, GSI_SAME_STMT); |
4813 | gcond *cond_stmt = gimple_build_cond (fd->loop.cond_code, n1, n2, |
4814 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
4815 | gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT); |
4816 | if (walk_tree (gimple_cond_lhs_ptr (cond_stmt),walk_tree_1 (gimple_cond_lhs_ptr (cond_stmt), expand_omp_regimplify_p , nullptr, nullptr, nullptr) |
4817 | expand_omp_regimplify_p, NULL, NULL)walk_tree_1 (gimple_cond_lhs_ptr (cond_stmt), expand_omp_regimplify_p , nullptr, nullptr, nullptr) |
4818 | || walk_tree (gimple_cond_rhs_ptr (cond_stmt),walk_tree_1 (gimple_cond_rhs_ptr (cond_stmt), expand_omp_regimplify_p , nullptr, nullptr, nullptr) |
4819 | expand_omp_regimplify_p, NULL, NULL)walk_tree_1 (gimple_cond_rhs_ptr (cond_stmt), expand_omp_regimplify_p , nullptr, nullptr, nullptr)) |
4820 | { |
4821 | gsi = gsi_for_stmt (cond_stmt); |
4822 | gimple_regimplify_operands (cond_stmt, &gsi); |
4823 | } |
4824 | ep = split_block (entry_bb, cond_stmt); |
4825 | ep->flags = EDGE_TRUE_VALUE; |
4826 | entry_bb = ep->dest; |
4827 | ep->probability = profile_probability::very_likely (); |
4828 | ep = make_edge (ep->src, fin_bb, EDGE_FALSE_VALUE); |
4829 | ep->probability = profile_probability::very_unlikely (); |
4830 | if (gimple_in_ssa_p (cfun(cfun + 0))) |
4831 | { |
4832 | int dest_idx = find_edge (entry_bb, fin_bb)->dest_idx; |
4833 | for (gphi_iterator gpi = gsi_start_phis (fin_bb); |
4834 | !gsi_end_p (gpi); gsi_next (&gpi)) |
4835 | { |
4836 | gphi *phi = gpi.phi (); |
4837 | add_phi_arg (phi, gimple_phi_arg_def (phi, dest_idx), |
4838 | ep, UNKNOWN_LOCATION((location_t) 0)); |
4839 | } |
4840 | } |
4841 | gsi = gsi_last_bb (entry_bb); |
4842 | } |
4843 | |
4844 | if (fd->lastprivate_conditional) |
4845 | { |
4846 | tree clauses = gimple_omp_for_clauses (fd->for_stmt); |
4847 | tree c = omp_find_clause (clauses, OMP_CLAUSE__CONDTEMP_); |
4848 | if (fd->have_pointer_condtemp) |
4849 | condtemp = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4849, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4849, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4849, __FUNCTION__))); |
4850 | c = omp_find_clause (OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4850, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4850, __FUNCTION__))->common.chain), OMP_CLAUSE__CONDTEMP_); |
4851 | cond_var = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4851, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4851, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4851, __FUNCTION__))); |
4852 | } |
4853 | if (fd->have_reductemp |
4854 | /* For scan, we don't want to reinitialize condtemp before the |
4855 | second loop. */ |
4856 | || (fd->have_pointer_condtemp && !fd->have_scantemp) |
4857 | || fd->have_nonctrl_scantemp) |
4858 | { |
4859 | tree t1 = build_int_cst (long_integer_type_nodeinteger_types[itk_long], 0); |
4860 | tree t2 = build_int_cst (long_integer_type_nodeinteger_types[itk_long], 1); |
4861 | tree t3 = build_int_cstu (long_integer_type_nodeinteger_types[itk_long], |
4862 | (HOST_WIDE_INT_1U1UL << 31) + 1); |
4863 | tree clauses = gimple_omp_for_clauses (fd->for_stmt); |
4864 | gimple_stmt_iterator gsi2 = gsi_none (); |
4865 | gimple *g = NULLnullptr; |
4866 | tree mem = null_pointer_nodeglobal_trees[TI_NULL_POINTER], memv = NULL_TREE(tree) nullptr; |
4867 | unsigned HOST_WIDE_INTlong condtemp_sz = 0; |
4868 | unsigned HOST_WIDE_INTlong alloc_align = 0; |
4869 | if (fd->have_reductemp) |
4870 | { |
4871 | gcc_assert (!fd->have_nonctrl_scantemp)((void)(!(!fd->have_nonctrl_scantemp) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4871, __FUNCTION__), 0 : 0)); |
4872 | tree c = omp_find_clause (clauses, OMP_CLAUSE__REDUCTEMP_); |
4873 | reductions = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4873, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4873, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4873, __FUNCTION__))); |
4874 | gcc_assert (TREE_CODE (reductions) == SSA_NAME)((void)(!(((enum tree_code) (reductions)->base.code) == SSA_NAME ) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4874, __FUNCTION__), 0 : 0)); |
4875 | g = SSA_NAME_DEF_STMT (reductions)(tree_check ((reductions), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4875, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt; |
4876 | reductions = gimple_assign_rhs1 (g); |
4877 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4877, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4877, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4877, __FUNCTION__))) = reductions; |
4878 | gsi2 = gsi_for_stmt (g); |
4879 | } |
4880 | else |
4881 | { |
4882 | if (gsi_end_p (gsip)) |
4883 | gsi2 = gsi_after_labels (region->entry); |
4884 | else |
4885 | gsi2 = gsip; |
4886 | reductions = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; |
4887 | } |
4888 | if (fd->have_pointer_condtemp || fd->have_nonctrl_scantemp) |
4889 | { |
4890 | tree type; |
4891 | if (fd->have_pointer_condtemp) |
4892 | type = TREE_TYPE (condtemp)((contains_struct_check ((condtemp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4892, __FUNCTION__))->typed.type); |
4893 | else |
4894 | type = ptr_type_nodeglobal_trees[TI_PTR_TYPE]; |
4895 | memv = create_tmp_var (type); |
4896 | TREE_ADDRESSABLE (memv)((memv)->base.addressable_flag) = 1; |
4897 | unsigned HOST_WIDE_INTlong sz = 0; |
4898 | tree size = NULL_TREE(tree) nullptr; |
4899 | if (fd->have_pointer_condtemp) |
4900 | { |
4901 | sz = tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (type))((tree_class_check ((((contains_struct_check ((type), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4901, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4901, __FUNCTION__))->type_common.size_unit)); |
4902 | sz *= fd->lastprivate_conditional; |
4903 | condtemp_sz = sz; |
4904 | } |
4905 | if (fd->have_nonctrl_scantemp) |
4906 | { |
4907 | nthreads = builtin_decl_explicit (BUILT_IN_OMP_GET_NUM_THREADS); |
4908 | gimple *g = gimple_build_call (nthreads, 0); |
4909 | nthreads = create_tmp_var (integer_type_nodeinteger_types[itk_int]); |
4910 | gimple_call_set_lhs (g, nthreads); |
4911 | gsi_insert_before (&gsi2, g, GSI_SAME_STMT); |
4912 | nthreads = fold_convert (sizetype, nthreads)fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype ], nthreads); |
4913 | alloc_align = TYPE_ALIGN_UNIT (long_long_integer_type_node)(((tree_class_check ((integer_types[itk_long_long]), (tcc_type ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4913, __FUNCTION__))->type_common.align ? ((unsigned)1) << ((integer_types[itk_long_long])->type_common.align - 1) : 0) / (8)); |
4914 | size = expand_omp_scantemp_alloc (clauses, NULL_TREE(tree) nullptr, sz, |
4915 | alloc_align, nthreads, NULLnullptr, |
4916 | false); |
4917 | size = fold_convert (type, size)fold_convert_loc (((location_t) 0), type, size); |
4918 | } |
4919 | else |
4920 | size = build_int_cst (type, sz); |
4921 | expand_omp_build_assign (&gsi2, memv, size, false); |
4922 | mem = build_fold_addr_expr (memv)build_fold_addr_expr_loc (((location_t) 0), (memv)); |
4923 | } |
4924 | tree t |
4925 | = build_call_expr (builtin_decl_explicit (BUILT_IN_GOMP_LOOP_START), |
4926 | 9, t1, t2, t2, t3, t1, null_pointer_nodeglobal_trees[TI_NULL_POINTER], |
4927 | null_pointer_nodeglobal_trees[TI_NULL_POINTER], reductions, mem); |
4928 | force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, |
4929 | true, GSI_SAME_STMT); |
4930 | if (fd->have_pointer_condtemp) |
4931 | expand_omp_build_assign (&gsi2, condtemp, memv, false); |
4932 | if (fd->have_nonctrl_scantemp) |
4933 | { |
4934 | tree ptr = fd->have_pointer_condtemp ? condtemp : memv; |
4935 | expand_omp_scantemp_alloc (clauses, ptr, condtemp_sz, |
4936 | alloc_align, nthreads, &gsi2, false); |
4937 | } |
4938 | if (fd->have_reductemp) |
4939 | { |
4940 | gsi_remove (&gsi2, true); |
4941 | release_ssa_name (gimple_assign_lhs (g)); |
4942 | } |
4943 | } |
4944 | switch (gimple_omp_for_kind (fd->for_stmt)) |
4945 | { |
4946 | case GF_OMP_FOR_KIND_FOR: |
4947 | nthreads = builtin_decl_explicit (BUILT_IN_OMP_GET_NUM_THREADS); |
4948 | threadid = builtin_decl_explicit (BUILT_IN_OMP_GET_THREAD_NUM); |
4949 | break; |
4950 | case GF_OMP_FOR_KIND_DISTRIBUTE: |
4951 | nthreads = builtin_decl_explicit (BUILT_IN_OMP_GET_NUM_TEAMS); |
4952 | threadid = builtin_decl_explicit (BUILT_IN_OMP_GET_TEAM_NUM); |
4953 | break; |
4954 | default: |
4955 | gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4955, __FUNCTION__)); |
4956 | } |
4957 | nthreads = build_call_expr (nthreads, 0); |
4958 | nthreads = fold_convert (itype, nthreads)fold_convert_loc (((location_t) 0), itype, nthreads); |
4959 | nthreads = force_gimple_operand_gsi (&gsi, nthreads, true, NULL_TREE(tree) nullptr, |
4960 | true, GSI_SAME_STMT); |
4961 | threadid = build_call_expr (threadid, 0); |
4962 | threadid = fold_convert (itype, threadid)fold_convert_loc (((location_t) 0), itype, threadid); |
4963 | threadid = force_gimple_operand_gsi (&gsi, threadid, true, NULL_TREE(tree) nullptr, |
4964 | true, GSI_SAME_STMT); |
4965 | |
4966 | n1 = fd->loop.n1; |
4967 | n2 = fd->loop.n2; |
4968 | step = fd->loop.step; |
4969 | if (gimple_omp_for_combined_into_p (fd->for_stmt)) |
4970 | { |
4971 | tree innerc = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), |
4972 | OMP_CLAUSE__LOOPTEMP_); |
4973 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4973, __FUNCTION__), 0 : 0)); |
4974 | n1 = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4974, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4974, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4974, __FUNCTION__))); |
4975 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4975, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4975, __FUNCTION__))->common.chain), |
4976 | OMP_CLAUSE__LOOPTEMP_); |
4977 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4977, __FUNCTION__), 0 : 0)); |
4978 | n2 = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4978, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4978, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4978, __FUNCTION__))); |
4979 | } |
4980 | n1 = force_gimple_operand_gsi (&gsi, fold_convert (type, n1)fold_convert_loc (((location_t) 0), type, n1), |
4981 | true, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); |
4982 | n2 = force_gimple_operand_gsi (&gsi, fold_convert (itype, n2)fold_convert_loc (((location_t) 0), itype, n2), |
4983 | true, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); |
4984 | step = force_gimple_operand_gsi (&gsi, fold_convert (itype, step)fold_convert_loc (((location_t) 0), itype, step), |
4985 | true, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); |
4986 | |
4987 | t = build_int_cst (itype, (fd->loop.cond_code == LT_EXPR ? -1 : 1)); |
4988 | t = fold_build2 (PLUS_EXPR, itype, step, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, step, t ); |
4989 | t = fold_build2 (PLUS_EXPR, itype, t, n2)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, n2 ); |
4990 | t = fold_build2 (MINUS_EXPR, itype, t, fold_convert (itype, n1))fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, n1) ); |
4991 | if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 4991, __FUNCTION__))->base.u.bits.unsigned_flag) && fd->loop.cond_code == GT_EXPR) |
4992 | t = fold_build2 (TRUNC_DIV_EXPR, itype,fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ) |
4993 | fold_build1 (NEGATE_EXPR, itype, t),fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ) |
4994 | fold_build1 (NEGATE_EXPR, itype, step))fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, t ), fold_build1_loc ( ((location_t) 0), NEGATE_EXPR, itype, step ) ); |
4995 | else |
4996 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t, step)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, step ); |
4997 | t = fold_convert (itype, t)fold_convert_loc (((location_t) 0), itype, t); |
4998 | n = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); |
4999 | |
5000 | q = create_tmp_reg (itype, "q"); |
5001 | t = fold_build2 (TRUNC_DIV_EXPR, itype, n, nthreads)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, n, nthreads ); |
5002 | t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); |
5003 | gsi_insert_before (&gsi, gimple_build_assign (q, t), GSI_SAME_STMT); |
5004 | |
5005 | tt = create_tmp_reg (itype, "tt"); |
5006 | t = fold_build2 (TRUNC_MOD_EXPR, itype, n, nthreads)fold_build2_loc (((location_t) 0), TRUNC_MOD_EXPR, itype, n, nthreads ); |
5007 | t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); |
5008 | gsi_insert_before (&gsi, gimple_build_assign (tt, t), GSI_SAME_STMT); |
5009 | |
5010 | t = build2 (LT_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], threadid, tt); |
5011 | gcond *cond_stmt = gimple_build_cond_empty (t); |
5012 | gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT); |
5013 | |
5014 | second_bb = split_block (entry_bb, cond_stmt)->dest; |
5015 | gsi = gsi_last_nondebug_bb (second_bb); |
5016 | gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR)((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5016, __FUNCTION__), 0 : 0)); |
5017 | |
5018 | gsi_insert_before (&gsi, gimple_build_assign (tt, build_int_cst (itype, 0)), |
5019 | GSI_SAME_STMT); |
5020 | gassign *assign_stmt |
5021 | = gimple_build_assign (q, PLUS_EXPR, q, build_int_cst (itype, 1)); |
5022 | gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); |
5023 | |
5024 | third_bb = split_block (second_bb, assign_stmt)->dest; |
5025 | gsi = gsi_last_nondebug_bb (third_bb); |
5026 | gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR)((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5026, __FUNCTION__), 0 : 0)); |
5027 | |
5028 | if (fd->have_nonctrl_scantemp) |
5029 | { |
5030 | tree clauses = gimple_omp_for_clauses (fd->for_stmt); |
5031 | tree controlp = NULL_TREE(tree) nullptr, controlb = NULL_TREE(tree) nullptr; |
5032 | for (tree c = clauses; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5032, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5032, __FUNCTION__))->common.chain)) |
5033 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5033, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE__SCANTEMP_ |
5034 | && OMP_CLAUSE__SCANTEMP__CONTROL (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5034, __FUNCTION__)))->base.private_flag)) |
5035 | { |
5036 | if (TREE_TYPE (OMP_CLAUSE_DECL (c))((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5036, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5036, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5036, __FUNCTION__)))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5036, __FUNCTION__))->typed.type) == boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE]) |
5037 | controlb = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5037, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5037, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5037, __FUNCTION__))); |
5038 | else |
5039 | controlp = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5039, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5039, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5039, __FUNCTION__))); |
5040 | if (controlb && controlp) |
5041 | break; |
5042 | } |
5043 | gcc_assert (controlp && controlb)((void)(!(controlp && controlb) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5043, __FUNCTION__), 0 : 0)); |
5044 | tree cnt = create_tmp_var (sizetypesizetype_tab[(int) stk_sizetype]); |
5045 | gimple *g = gimple_build_assign (cnt, NOP_EXPR, q); |
5046 | gsi_insert_before (&gsi, g, GSI_SAME_STMT); |
5047 | unsigned HOST_WIDE_INTlong alloc_align = TYPE_ALIGN_UNIT (ptr_type_node)(((tree_class_check ((global_trees[TI_PTR_TYPE]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5047, __FUNCTION__))->type_common.align ? ((unsigned)1) << ((global_trees[TI_PTR_TYPE])->type_common.align - 1) : 0) / (8)); |
5048 | tree sz = expand_omp_scantemp_alloc (clauses, NULL_TREE(tree) nullptr, 0, |
5049 | alloc_align, cnt, NULLnullptr, true); |
5050 | tree size = create_tmp_var (sizetypesizetype_tab[(int) stk_sizetype]); |
5051 | expand_omp_build_assign (&gsi, size, sz, false); |
5052 | tree cmp = fold_build2 (GT_EXPR, boolean_type_node,fold_build2_loc (((location_t) 0), GT_EXPR, global_trees[TI_BOOLEAN_TYPE ], size, size_int_kind (16384, stk_sizetype) ) |
5053 | size, size_int (16384))fold_build2_loc (((location_t) 0), GT_EXPR, global_trees[TI_BOOLEAN_TYPE ], size, size_int_kind (16384, stk_sizetype) ); |
5054 | expand_omp_build_assign (&gsi, controlb, cmp); |
5055 | g = gimple_build_cond (NE_EXPR, controlb, boolean_false_nodeglobal_trees[TI_BOOLEAN_FALSE], |
5056 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); |
5057 | gsi_insert_before (&gsi, g, GSI_SAME_STMT); |
5058 | fourth_bb = split_block (third_bb, g)->dest; |
5059 | gsi = gsi_last_nondebug_bb (fourth_bb); |
5060 | /* FIXME: Once we have allocators, this should use allocator. */ |
5061 | g = gimple_build_call (builtin_decl_explicit (BUILT_IN_MALLOC), 1, size); |
5062 | gimple_call_set_lhs (g, controlp); |
5063 | gsi_insert_before (&gsi, g, GSI_SAME_STMT); |
5064 | expand_omp_scantemp_alloc (clauses, controlp, 0, alloc_align, cnt, |
5065 | &gsi, true); |
5066 | gsi_prev (&gsi); |
5067 | g = gsi_stmt (gsi); |
5068 | fifth_bb = split_block (fourth_bb, g)->dest; |
5069 | gsi = gsi_last_nondebug_bb (fifth_bb); |
5070 | |
5071 | g = gimple_build_call (builtin_decl_implicit (BUILT_IN_STACK_SAVE), 0); |
5072 | gimple_call_set_lhs (g, controlp); |
5073 | gsi_insert_before (&gsi, g, GSI_SAME_STMT); |
5074 | tree alloca_decl = builtin_decl_explicit (BUILT_IN_ALLOCA_WITH_ALIGN); |
5075 | for (tree c = clauses; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5075, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5075, __FUNCTION__))->common.chain)) |
5076 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5076, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE__SCANTEMP_ |
5077 | && OMP_CLAUSE__SCANTEMP__ALLOC (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5077, __FUNCTION__))->base.public_flag)) |
5078 | { |
5079 | tree tmp = create_tmp_var (sizetypesizetype_tab[(int) stk_sizetype]); |
5080 | tree pointee_type = TREE_TYPE (TREE_TYPE (OMP_CLAUSE_DECL (c)))((contains_struct_check ((((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5080, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5080, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5080, __FUNCTION__)))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5080, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5080, __FUNCTION__))->typed.type); |
5081 | g = gimple_build_assign (tmp, MULT_EXPR, cnt, |
5082 | TYPE_SIZE_UNIT (pointee_type)((tree_class_check ((pointee_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5082, __FUNCTION__))->type_common.size_unit)); |
5083 | gsi_insert_before (&gsi, g, GSI_SAME_STMT); |
5084 | g = gimple_build_call (alloca_decl, 2, tmp, |
5085 | size_int (TYPE_ALIGN (pointee_type))size_int_kind (((tree_class_check ((pointee_type), (tcc_type) , "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5085, __FUNCTION__))->type_common.align ? ((unsigned)1) << ((pointee_type)->type_common.align - 1) : 0), stk_sizetype )); |
5086 | gimple_call_set_lhs (g, OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5086, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5086, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5086, __FUNCTION__)))); |
5087 | gsi_insert_before (&gsi, g, GSI_SAME_STMT); |
5088 | } |
5089 | |
5090 | sixth_bb = split_block (fifth_bb, g)->dest; |
5091 | gsi = gsi_last_nondebug_bb (sixth_bb); |
5092 | } |
5093 | |
5094 | t = build2 (MULT_EXPR, itype, q, threadid); |
5095 | t = build2 (PLUS_EXPR, itype, t, tt); |
5096 | s0 = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); |
5097 | |
5098 | t = fold_build2 (PLUS_EXPR, itype, s0, q)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, s0, q ); |
5099 | e0 = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); |
5100 | |
5101 | t = build2 (GE_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], s0, e0); |
5102 | gsi_insert_before (&gsi, gimple_build_cond_empty (t), GSI_SAME_STMT); |
5103 | |
5104 | /* Remove the GIMPLE_OMP_FOR statement. */ |
5105 | gsi_remove (&gsi, true); |
5106 | |
5107 | /* Setup code for sequential iteration goes in SEQ_START_BB. */ |
5108 | gsi = gsi_start_bb (seq_start_bb); |
5109 | |
5110 | tree startvar = fd->loop.v; |
5111 | tree endvar = NULL_TREE(tree) nullptr; |
5112 | |
5113 | if (gimple_omp_for_combined_p (fd->for_stmt)) |
5114 | { |
5115 | tree clauses = gimple_code (inner_stmt) == GIMPLE_OMP_PARALLEL |
5116 | ? gimple_omp_parallel_clauses (inner_stmt) |
5117 | : gimple_omp_for_clauses (inner_stmt); |
5118 | tree innerc = omp_find_clause (clauses, OMP_CLAUSE__LOOPTEMP_); |
5119 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5119, __FUNCTION__), 0 : 0)); |
5120 | startvar = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5120, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5120, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5120, __FUNCTION__))); |
5121 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5121, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5121, __FUNCTION__))->common.chain), |
5122 | OMP_CLAUSE__LOOPTEMP_); |
5123 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5123, __FUNCTION__), 0 : 0)); |
5124 | endvar = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5124, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5124, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5124, __FUNCTION__))); |
5125 | if (fd->collapse > 1 && TREE_CODE (fd->loop.n2)((enum tree_code) (fd->loop.n2)->base.code) != INTEGER_CST |
5126 | && gimple_omp_for_kind (fd->for_stmt) == GF_OMP_FOR_KIND_DISTRIBUTE) |
5127 | { |
5128 | innerc = find_lastprivate_looptemp (fd, innerc); |
5129 | if (innerc) |
5130 | { |
5131 | /* If needed (distribute parallel for with lastprivate), |
5132 | propagate down the total number of iterations. */ |
5133 | tree t = fold_convert (TREE_TYPE (OMP_CLAUSE_DECL (innerc)),fold_convert_loc (((location_t) 0), ((contains_struct_check ( ((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5133, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5133, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5133, __FUNCTION__)))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5133, __FUNCTION__))->typed.type), fd->loop.n2) |
5134 | fd->loop.n2)fold_convert_loc (((location_t) 0), ((contains_struct_check ( ((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5133, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5133, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5133, __FUNCTION__)))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5133, __FUNCTION__))->typed.type), fd->loop.n2); |
5135 | t = force_gimple_operand_gsi (&gsi, t, false, NULL_TREE(tree) nullptr, false, |
5136 | GSI_CONTINUE_LINKING); |
5137 | assign_stmt = gimple_build_assign (OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5137, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5137, __FUNCTION__))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5137, __FUNCTION__))), t); |
5138 | gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); |
5139 | } |
5140 | } |
5141 | } |
5142 | t = fold_convert (itype, s0)fold_convert_loc (((location_t) 0), itype, s0); |
5143 | t = fold_build2 (MULT_EXPR, itype, t, step)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, step ); |
5144 | if (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE)) |
5145 | { |
5146 | t = fold_build_pointer_plus (n1, t)fold_build_pointer_plus_loc (((location_t) 0), n1, t); |
5147 | if (!POINTER_TYPE_P (TREE_TYPE (startvar))(((enum tree_code) (((contains_struct_check ((startvar), (TS_TYPED ), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5147, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((startvar), ( TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.c" , 5147, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) |
5148 | && TYPE_PRECISION (TREE_TYPE (startvar))((tree_class_check ((((contains_struct_chec |