File: | build/gcc/omp-expand.cc |
Warning: | line 726, column 3 Called C++ object pointer is null |
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-2023 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 | #include "opts.h" | ||||
63 | |||||
64 | /* OMP region information. Every parallel and workshare | ||||
65 | directive is enclosed between two markers, the OMP_* directive | ||||
66 | and a corresponding GIMPLE_OMP_RETURN statement. */ | ||||
67 | |||||
68 | struct omp_region | ||||
69 | { | ||||
70 | /* The enclosing region. */ | ||||
71 | struct omp_region *outer; | ||||
72 | |||||
73 | /* First child region. */ | ||||
74 | struct omp_region *inner; | ||||
75 | |||||
76 | /* Next peer region. */ | ||||
77 | struct omp_region *next; | ||||
78 | |||||
79 | /* Block containing the omp directive as its last stmt. */ | ||||
80 | basic_block entry; | ||||
81 | |||||
82 | /* Block containing the GIMPLE_OMP_RETURN as its last stmt. */ | ||||
83 | basic_block exit; | ||||
84 | |||||
85 | /* Block containing the GIMPLE_OMP_CONTINUE as its last stmt. */ | ||||
86 | basic_block cont; | ||||
87 | |||||
88 | /* If this is a combined parallel+workshare region, this is a list | ||||
89 | of additional arguments needed by the combined parallel+workshare | ||||
90 | library call. */ | ||||
91 | vec<tree, va_gc> *ws_args; | ||||
92 | |||||
93 | /* The code for the omp directive of this region. */ | ||||
94 | enum gimple_code type; | ||||
95 | |||||
96 | /* Schedule kind, only used for GIMPLE_OMP_FOR type regions. */ | ||||
97 | enum omp_clause_schedule_kind sched_kind; | ||||
98 | |||||
99 | /* Schedule modifiers. */ | ||||
100 | unsigned char sched_modifiers; | ||||
101 | |||||
102 | /* True if this is a combined parallel+workshare region. */ | ||||
103 | bool is_combined_parallel; | ||||
104 | |||||
105 | /* Copy of fd.lastprivate_conditional != 0. */ | ||||
106 | bool has_lastprivate_conditional; | ||||
107 | |||||
108 | /* The ordered stmt if type is GIMPLE_OMP_ORDERED and it has | ||||
109 | a depend clause. */ | ||||
110 | gomp_ordered *ord_stmt; | ||||
111 | }; | ||||
112 | |||||
113 | static struct omp_region *root_omp_region; | ||||
114 | static bool omp_any_child_fn_dumped; | ||||
115 | |||||
116 | static void expand_omp_build_assign (gimple_stmt_iterator *, tree, tree, | ||||
117 | bool = false); | ||||
118 | static gphi *find_phi_with_arg_on_edge (tree, edge); | ||||
119 | static void expand_omp (struct omp_region *region); | ||||
120 | |||||
121 | /* Return true if REGION is a combined parallel+workshare region. */ | ||||
122 | |||||
123 | static inline bool | ||||
124 | is_combined_parallel (struct omp_region *region) | ||||
125 | { | ||||
126 | return region->is_combined_parallel; | ||||
127 | } | ||||
128 | |||||
129 | /* Given two blocks PAR_ENTRY_BB and WS_ENTRY_BB such that WS_ENTRY_BB | ||||
130 | is the immediate dominator of PAR_ENTRY_BB, return true if there | ||||
131 | are no data dependencies that would prevent expanding the parallel | ||||
132 | directive at PAR_ENTRY_BB as a combined parallel+workshare region. | ||||
133 | |||||
134 | When expanding a combined parallel+workshare region, the call to | ||||
135 | the child function may need additional arguments in the case of | ||||
136 | GIMPLE_OMP_FOR regions. In some cases, these arguments are | ||||
137 | computed out of variables passed in from the parent to the child | ||||
138 | via 'struct .omp_data_s'. For instance: | ||||
139 | |||||
140 | #pragma omp parallel for schedule (guided, i * 4) | ||||
141 | for (j ...) | ||||
142 | |||||
143 | Is lowered into: | ||||
144 | |||||
145 | # BLOCK 2 (PAR_ENTRY_BB) | ||||
146 | .omp_data_o.i = i; | ||||
147 | #pragma omp parallel [child fn: bar.omp_fn.0 ( ..., D.1598) | ||||
148 | |||||
149 | # BLOCK 3 (WS_ENTRY_BB) | ||||
150 | .omp_data_i = &.omp_data_o; | ||||
151 | D.1667 = .omp_data_i->i; | ||||
152 | D.1598 = D.1667 * 4; | ||||
153 | #pragma omp for schedule (guided, D.1598) | ||||
154 | |||||
155 | When we outline the parallel region, the call to the child function | ||||
156 | 'bar.omp_fn.0' will need the value D.1598 in its argument list, but | ||||
157 | that value is computed *after* the call site. So, in principle we | ||||
158 | cannot do the transformation. | ||||
159 | |||||
160 | To see whether the code in WS_ENTRY_BB blocks the combined | ||||
161 | parallel+workshare call, we collect all the variables used in the | ||||
162 | GIMPLE_OMP_FOR header check whether they appear on the LHS of any | ||||
163 | statement in WS_ENTRY_BB. If so, then we cannot emit the combined | ||||
164 | call. | ||||
165 | |||||
166 | FIXME. If we had the SSA form built at this point, we could merely | ||||
167 | hoist the code in block 3 into block 2 and be done with it. But at | ||||
168 | this point we don't have dataflow information and though we could | ||||
169 | hack something up here, it is really not worth the aggravation. */ | ||||
170 | |||||
171 | static bool | ||||
172 | workshare_safe_to_combine_p (basic_block ws_entry_bb) | ||||
173 | { | ||||
174 | struct omp_for_data fd; | ||||
175 | gimple *ws_stmt = last_stmt (ws_entry_bb); | ||||
176 | |||||
177 | if (gimple_code (ws_stmt) == GIMPLE_OMP_SECTIONS) | ||||
178 | return true; | ||||
179 | |||||
180 | gcc_assert (gimple_code (ws_stmt) == GIMPLE_OMP_FOR)((void)(!(gimple_code (ws_stmt) == GIMPLE_OMP_FOR) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 180, __FUNCTION__), 0 : 0)); | ||||
181 | if (gimple_omp_for_kind (ws_stmt) != GF_OMP_FOR_KIND_FOR) | ||||
182 | return false; | ||||
183 | |||||
184 | omp_extract_for_data (as_a <gomp_for *> (ws_stmt), &fd, NULLnullptr); | ||||
185 | |||||
186 | if (fd.collapse > 1 && TREE_CODE (fd.loop.n2)((enum tree_code) (fd.loop.n2)->base.code) != INTEGER_CST) | ||||
187 | return false; | ||||
188 | if (fd.iter_type != long_integer_type_nodeinteger_types[itk_long]) | ||||
189 | return false; | ||||
190 | |||||
191 | /* FIXME. We give up too easily here. If any of these arguments | ||||
192 | are not constants, they will likely involve variables that have | ||||
193 | been mapped into fields of .omp_data_s for sharing with the child | ||||
194 | function. With appropriate data flow, it would be possible to | ||||
195 | see through this. */ | ||||
196 | if (!is_gimple_min_invariant (fd.loop.n1) | ||||
197 | || !is_gimple_min_invariant (fd.loop.n2) | ||||
198 | || !is_gimple_min_invariant (fd.loop.step) | ||||
199 | || (fd.chunk_size && !is_gimple_min_invariant (fd.chunk_size))) | ||||
200 | return false; | ||||
201 | |||||
202 | return true; | ||||
203 | } | ||||
204 | |||||
205 | /* Adjust CHUNK_SIZE from SCHEDULE clause, depending on simd modifier | ||||
206 | presence (SIMD_SCHEDULE). */ | ||||
207 | |||||
208 | static tree | ||||
209 | omp_adjust_chunk_size (tree chunk_size, bool simd_schedule) | ||||
210 | { | ||||
211 | if (!simd_schedule || integer_zerop (chunk_size)) | ||||
212 | return chunk_size; | ||||
213 | |||||
214 | poly_uint64 vf = omp_max_vf (); | ||||
215 | if (known_eq (vf, 1U)(!maybe_ne (vf, 1U))) | ||||
216 | return chunk_size; | ||||
217 | |||||
218 | tree type = TREE_TYPE (chunk_size)((contains_struct_check ((chunk_size), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 218, __FUNCTION__))->typed.type); | ||||
219 | 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) ) | ||||
220 | build_int_cst (type, vf - 1))fold_build2_loc (((location_t) 0), PLUS_EXPR, type, chunk_size , build_int_cst (type, vf - 1) ); | ||||
221 | 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) ) | ||||
222 | build_int_cst (type, -vf))fold_build2_loc (((location_t) 0), BIT_AND_EXPR, type, chunk_size , build_int_cst (type, -vf) ); | ||||
223 | } | ||||
224 | |||||
225 | /* Collect additional arguments needed to emit a combined | ||||
226 | parallel+workshare call. WS_STMT is the workshare directive being | ||||
227 | expanded. */ | ||||
228 | |||||
229 | static vec<tree, va_gc> * | ||||
230 | get_ws_args_for (gimple *par_stmt, gimple *ws_stmt) | ||||
231 | { | ||||
232 | tree t; | ||||
233 | location_t loc = gimple_location (ws_stmt); | ||||
234 | vec<tree, va_gc> *ws_args; | ||||
235 | |||||
236 | if (gomp_for *for_stmt = dyn_cast <gomp_for *> (ws_stmt)) | ||||
237 | { | ||||
238 | struct omp_for_data fd; | ||||
239 | tree n1, n2; | ||||
240 | |||||
241 | omp_extract_for_data (for_stmt, &fd, NULLnullptr); | ||||
242 | n1 = fd.loop.n1; | ||||
243 | n2 = fd.loop.n2; | ||||
244 | |||||
245 | if (gimple_omp_for_combined_into_p (for_stmt)) | ||||
246 | { | ||||
247 | tree innerc | ||||
248 | = omp_find_clause (gimple_omp_parallel_clauses (par_stmt), | ||||
249 | OMP_CLAUSE__LOOPTEMP_); | ||||
250 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 250, __FUNCTION__), 0 : 0)); | ||||
251 | n1 = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 251, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 251, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 251, __FUNCTION__))); | ||||
252 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 252, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 252, __FUNCTION__))->common.chain), | ||||
253 | OMP_CLAUSE__LOOPTEMP_); | ||||
254 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 254, __FUNCTION__), 0 : 0)); | ||||
255 | n2 = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 255, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 255, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 255, __FUNCTION__))); | ||||
256 | } | ||||
257 | |||||
258 | vec_alloc (ws_args, 3 + (fd.chunk_size != 0)); | ||||
259 | |||||
260 | t = fold_convert_loc (loc, long_integer_type_nodeinteger_types[itk_long], n1); | ||||
261 | ws_args->quick_push (t); | ||||
262 | |||||
263 | t = fold_convert_loc (loc, long_integer_type_nodeinteger_types[itk_long], n2); | ||||
264 | ws_args->quick_push (t); | ||||
265 | |||||
266 | t = fold_convert_loc (loc, long_integer_type_nodeinteger_types[itk_long], fd.loop.step); | ||||
267 | ws_args->quick_push (t); | ||||
268 | |||||
269 | if (fd.chunk_size) | ||||
270 | { | ||||
271 | t = fold_convert_loc (loc, long_integer_type_nodeinteger_types[itk_long], fd.chunk_size); | ||||
272 | t = omp_adjust_chunk_size (t, fd.simd_schedule); | ||||
273 | ws_args->quick_push (t); | ||||
274 | } | ||||
275 | |||||
276 | return ws_args; | ||||
277 | } | ||||
278 | else if (gimple_code (ws_stmt) == GIMPLE_OMP_SECTIONS) | ||||
279 | { | ||||
280 | /* Number of sections is equal to the number of edges from the | ||||
281 | GIMPLE_OMP_SECTIONS_SWITCH statement, except for the one to | ||||
282 | the exit of the sections region. */ | ||||
283 | basic_block bb = single_succ (gimple_bb (ws_stmt)); | ||||
284 | t = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], EDGE_COUNT (bb->succs)vec_safe_length (bb->succs) - 1); | ||||
285 | vec_alloc (ws_args, 1); | ||||
286 | ws_args->quick_push (t); | ||||
287 | return ws_args; | ||||
288 | } | ||||
289 | |||||
290 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 290, __FUNCTION__)); | ||||
291 | } | ||||
292 | |||||
293 | /* Discover whether REGION is a combined parallel+workshare region. */ | ||||
294 | |||||
295 | static void | ||||
296 | determine_parallel_type (struct omp_region *region) | ||||
297 | { | ||||
298 | basic_block par_entry_bb, par_exit_bb; | ||||
299 | basic_block ws_entry_bb, ws_exit_bb; | ||||
300 | |||||
301 | if (region == NULLnullptr || region->inner == NULLnullptr | ||||
302 | || region->exit == NULLnullptr || region->inner->exit == NULLnullptr | ||||
303 | || region->inner->cont == NULLnullptr) | ||||
304 | return; | ||||
305 | |||||
306 | /* We only support parallel+for and parallel+sections. */ | ||||
307 | if (region->type != GIMPLE_OMP_PARALLEL | ||||
308 | || (region->inner->type != GIMPLE_OMP_FOR | ||||
309 | && region->inner->type != GIMPLE_OMP_SECTIONS)) | ||||
310 | return; | ||||
311 | |||||
312 | /* Check for perfect nesting PAR_ENTRY_BB -> WS_ENTRY_BB and | ||||
313 | WS_EXIT_BB -> PAR_EXIT_BB. */ | ||||
314 | par_entry_bb = region->entry; | ||||
315 | par_exit_bb = region->exit; | ||||
316 | ws_entry_bb = region->inner->entry; | ||||
317 | ws_exit_bb = region->inner->exit; | ||||
318 | |||||
319 | /* Give up for task reductions on the parallel, while it is implementable, | ||||
320 | adding another big set of APIs or slowing down the normal paths is | ||||
321 | not acceptable. */ | ||||
322 | tree pclauses = gimple_omp_parallel_clauses (last_stmt (par_entry_bb)); | ||||
323 | if (omp_find_clause (pclauses, OMP_CLAUSE__REDUCTEMP_)) | ||||
324 | return; | ||||
325 | |||||
326 | if (single_succ (par_entry_bb) == ws_entry_bb | ||||
327 | && single_succ (ws_exit_bb) == par_exit_bb | ||||
328 | && workshare_safe_to_combine_p (ws_entry_bb) | ||||
329 | && (gimple_omp_parallel_combined_p (last_stmt (par_entry_bb)) | ||||
330 | || (last_and_only_stmt (ws_entry_bb) | ||||
331 | && last_and_only_stmt (par_exit_bb)))) | ||||
332 | { | ||||
333 | gimple *par_stmt = last_stmt (par_entry_bb); | ||||
334 | gimple *ws_stmt = last_stmt (ws_entry_bb); | ||||
335 | |||||
336 | if (region->inner->type == GIMPLE_OMP_FOR) | ||||
337 | { | ||||
338 | /* If this is a combined parallel loop, we need to determine | ||||
339 | whether or not to use the combined library calls. There | ||||
340 | are two cases where we do not apply the transformation: | ||||
341 | static loops and any kind of ordered loop. In the first | ||||
342 | case, we already open code the loop so there is no need | ||||
343 | to do anything else. In the latter case, the combined | ||||
344 | parallel loop call would still need extra synchronization | ||||
345 | to implement ordered semantics, so there would not be any | ||||
346 | gain in using the combined call. */ | ||||
347 | tree clauses = gimple_omp_for_clauses (ws_stmt); | ||||
348 | tree c = omp_find_clause (clauses, OMP_CLAUSE_SCHEDULE); | ||||
349 | if (c == NULLnullptr | ||||
350 | || ((OMP_CLAUSE_SCHEDULE_KIND (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_SCHEDULE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 350, __FUNCTION__))->omp_clause.subcode.schedule_kind) & OMP_CLAUSE_SCHEDULE_MASK) | ||||
351 | == OMP_CLAUSE_SCHEDULE_STATIC) | ||||
352 | || omp_find_clause (clauses, OMP_CLAUSE_ORDERED) | ||||
353 | || omp_find_clause (clauses, OMP_CLAUSE__REDUCTEMP_) | ||||
354 | || ((c = omp_find_clause (clauses, OMP_CLAUSE__CONDTEMP_)) | ||||
355 | && 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 355, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 355, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 355, __FUNCTION__)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 355, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 355, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 355, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 355, __FUNCTION__)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 355, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ))) | ||||
356 | return; | ||||
357 | } | ||||
358 | else if (region->inner->type == GIMPLE_OMP_SECTIONS | ||||
359 | && (omp_find_clause (gimple_omp_sections_clauses (ws_stmt), | ||||
360 | OMP_CLAUSE__REDUCTEMP_) | ||||
361 | || omp_find_clause (gimple_omp_sections_clauses (ws_stmt), | ||||
362 | OMP_CLAUSE__CONDTEMP_))) | ||||
363 | return; | ||||
364 | |||||
365 | region->is_combined_parallel = true; | ||||
366 | region->inner->is_combined_parallel = true; | ||||
367 | region->ws_args = get_ws_args_for (par_stmt, ws_stmt); | ||||
368 | } | ||||
369 | } | ||||
370 | |||||
371 | /* Debugging dumps for parallel regions. */ | ||||
372 | void dump_omp_region (FILE *, struct omp_region *, int); | ||||
373 | void debug_omp_region (struct omp_region *); | ||||
374 | void debug_all_omp_regions (void); | ||||
375 | |||||
376 | /* Dump the parallel region tree rooted at REGION. */ | ||||
377 | |||||
378 | void | ||||
379 | dump_omp_region (FILE *file, struct omp_region *region, int indent) | ||||
380 | { | ||||
381 | fprintf (file, "%*sbb %d: %s\n", indent, "", region->entry->index, | ||||
382 | gimple_code_name[region->type]); | ||||
383 | |||||
384 | if (region->inner) | ||||
385 | dump_omp_region (file, region->inner, indent + 4); | ||||
386 | |||||
387 | if (region->cont) | ||||
388 | { | ||||
389 | fprintf (file, "%*sbb %d: GIMPLE_OMP_CONTINUE\n", indent, "", | ||||
390 | region->cont->index); | ||||
391 | } | ||||
392 | |||||
393 | if (region->exit) | ||||
394 | fprintf (file, "%*sbb %d: GIMPLE_OMP_RETURN\n", indent, "", | ||||
395 | region->exit->index); | ||||
396 | else | ||||
397 | fprintf (file, "%*s[no exit marker]\n", indent, ""); | ||||
398 | |||||
399 | if (region->next) | ||||
400 | dump_omp_region (file, region->next, indent); | ||||
401 | } | ||||
402 | |||||
403 | DEBUG_FUNCTION__attribute__ ((__used__)) void | ||||
404 | debug_omp_region (struct omp_region *region) | ||||
405 | { | ||||
406 | dump_omp_region (stderrstderr, region, 0); | ||||
407 | } | ||||
408 | |||||
409 | DEBUG_FUNCTION__attribute__ ((__used__)) void | ||||
410 | debug_all_omp_regions (void) | ||||
411 | { | ||||
412 | dump_omp_region (stderrstderr, root_omp_region, 0); | ||||
413 | } | ||||
414 | |||||
415 | /* Create a new parallel region starting at STMT inside region PARENT. */ | ||||
416 | |||||
417 | static struct omp_region * | ||||
418 | new_omp_region (basic_block bb, enum gimple_code type, | ||||
419 | struct omp_region *parent) | ||||
420 | { | ||||
421 | struct omp_region *region = XCNEW (struct omp_region)((struct omp_region *) xcalloc (1, sizeof (struct omp_region) )); | ||||
422 | |||||
423 | region->outer = parent; | ||||
424 | region->entry = bb; | ||||
425 | region->type = type; | ||||
426 | |||||
427 | if (parent) | ||||
428 | { | ||||
429 | /* This is a nested region. Add it to the list of inner | ||||
430 | regions in PARENT. */ | ||||
431 | region->next = parent->inner; | ||||
432 | parent->inner = region; | ||||
433 | } | ||||
434 | else | ||||
435 | { | ||||
436 | /* This is a toplevel region. Add it to the list of toplevel | ||||
437 | regions in ROOT_OMP_REGION. */ | ||||
438 | region->next = root_omp_region; | ||||
439 | root_omp_region = region; | ||||
440 | } | ||||
441 | |||||
442 | return region; | ||||
443 | } | ||||
444 | |||||
445 | /* Release the memory associated with the region tree rooted at REGION. */ | ||||
446 | |||||
447 | static void | ||||
448 | free_omp_region_1 (struct omp_region *region) | ||||
449 | { | ||||
450 | struct omp_region *i, *n; | ||||
451 | |||||
452 | for (i = region->inner; i ; i = n) | ||||
453 | { | ||||
454 | n = i->next; | ||||
455 | free_omp_region_1 (i); | ||||
456 | } | ||||
457 | |||||
458 | free (region); | ||||
459 | } | ||||
460 | |||||
461 | /* Release the memory for the entire omp region tree. */ | ||||
462 | |||||
463 | void | ||||
464 | omp_free_regions (void) | ||||
465 | { | ||||
466 | struct omp_region *r, *n; | ||||
467 | for (r = root_omp_region; r ; r = n) | ||||
468 | { | ||||
469 | n = r->next; | ||||
470 | free_omp_region_1 (r); | ||||
471 | } | ||||
472 | root_omp_region = NULLnullptr; | ||||
473 | } | ||||
474 | |||||
475 | /* A convenience function to build an empty GIMPLE_COND with just the | ||||
476 | condition. */ | ||||
477 | |||||
478 | static gcond * | ||||
479 | gimple_build_cond_empty (tree cond) | ||||
480 | { | ||||
481 | enum tree_code pred_code; | ||||
482 | tree lhs, rhs; | ||||
483 | |||||
484 | gimple_cond_get_ops_from_tree (cond, &pred_code, &lhs, &rhs); | ||||
485 | return gimple_build_cond (pred_code, lhs, rhs, NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
486 | } | ||||
487 | |||||
488 | /* Change DECL_CONTEXT of CHILD_FNDECL to that of the parent function. | ||||
489 | Add CHILD_FNDECL to decl chain of the supercontext of the block | ||||
490 | ENTRY_BLOCK - this is the block which originally contained the | ||||
491 | code from which CHILD_FNDECL was created. | ||||
492 | |||||
493 | Together, these actions ensure that the debug info for the outlined | ||||
494 | function will be emitted with the correct lexical scope. */ | ||||
495 | |||||
496 | static void | ||||
497 | adjust_context_and_scope (struct omp_region *region, tree entry_block, | ||||
498 | tree child_fndecl) | ||||
499 | { | ||||
500 | tree parent_fndecl = NULL_TREE(tree) nullptr; | ||||
501 | gimple *entry_stmt; | ||||
502 | /* OMP expansion expands inner regions before outer ones, so if | ||||
503 | we e.g. have explicit task region nested in parallel region, when | ||||
504 | expanding the task region current_function_decl will be the original | ||||
505 | source function, but we actually want to use as context the child | ||||
506 | function of the parallel. */ | ||||
507 | for (region = region->outer; | ||||
508 | region && parent_fndecl == NULL_TREE(tree) nullptr; region = region->outer) | ||||
509 | switch (region->type) | ||||
510 | { | ||||
511 | case GIMPLE_OMP_PARALLEL: | ||||
512 | case GIMPLE_OMP_TASK: | ||||
513 | case GIMPLE_OMP_TEAMS: | ||||
514 | entry_stmt = last_stmt (region->entry); | ||||
515 | parent_fndecl = gimple_omp_taskreg_child_fn (entry_stmt); | ||||
516 | break; | ||||
517 | case GIMPLE_OMP_TARGET: | ||||
518 | entry_stmt = last_stmt (region->entry); | ||||
519 | parent_fndecl | ||||
520 | = gimple_omp_target_child_fn (as_a <gomp_target *> (entry_stmt)); | ||||
521 | break; | ||||
522 | default: | ||||
523 | break; | ||||
524 | } | ||||
525 | |||||
526 | if (parent_fndecl == NULL_TREE(tree) nullptr) | ||||
527 | parent_fndecl = current_function_decl; | ||||
528 | DECL_CONTEXT (child_fndecl)((contains_struct_check ((child_fndecl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 528, __FUNCTION__))->decl_minimal.context) = parent_fndecl; | ||||
529 | |||||
530 | if (entry_block != NULL_TREE(tree) nullptr && TREE_CODE (entry_block)((enum tree_code) (entry_block)->base.code) == BLOCK) | ||||
531 | { | ||||
532 | tree b = BLOCK_SUPERCONTEXT (entry_block)((tree_check ((entry_block), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 532, __FUNCTION__, (BLOCK)))->block.supercontext); | ||||
533 | if (TREE_CODE (b)((enum tree_code) (b)->base.code) == BLOCK) | ||||
534 | { | ||||
535 | DECL_CHAIN (child_fndecl)(((contains_struct_check (((contains_struct_check ((child_fndecl ), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 535, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 535, __FUNCTION__))->common.chain)) = BLOCK_VARS (b)((tree_check ((b), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 535, __FUNCTION__, (BLOCK)))->block.vars); | ||||
536 | BLOCK_VARS (b)((tree_check ((b), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 536, __FUNCTION__, (BLOCK)))->block.vars) = child_fndecl; | ||||
537 | } | ||||
538 | } | ||||
539 | } | ||||
540 | |||||
541 | /* Build the function calls to GOMP_parallel etc to actually | ||||
542 | generate the parallel operation. REGION is the parallel region | ||||
543 | being expanded. BB is the block where to insert the code. WS_ARGS | ||||
544 | will be set if this is a call to a combined parallel+workshare | ||||
545 | construct, it contains the list of additional arguments needed by | ||||
546 | the workshare construct. */ | ||||
547 | |||||
548 | static void | ||||
549 | expand_parallel_call (struct omp_region *region, basic_block bb, | ||||
550 | gomp_parallel *entry_stmt, | ||||
551 | vec<tree, va_gc> *ws_args) | ||||
552 | { | ||||
553 | tree t, t1, t2, val, cond, c, clauses, flags; | ||||
554 | gimple_stmt_iterator gsi; | ||||
555 | gimple *stmt; | ||||
556 | enum built_in_function start_ix; | ||||
557 | int start_ix2; | ||||
558 | location_t clause_loc; | ||||
559 | vec<tree, va_gc> *args; | ||||
560 | |||||
561 | clauses = gimple_omp_parallel_clauses (entry_stmt); | ||||
562 | |||||
563 | /* Determine what flavor of GOMP_parallel we will be | ||||
564 | emitting. */ | ||||
565 | start_ix = BUILT_IN_GOMP_PARALLEL; | ||||
566 | tree rtmp = omp_find_clause (clauses, OMP_CLAUSE__REDUCTEMP_); | ||||
567 | if (rtmp) | ||||
| |||||
568 | start_ix = BUILT_IN_GOMP_PARALLEL_REDUCTIONS; | ||||
569 | else if (is_combined_parallel (region)) | ||||
570 | { | ||||
571 | switch (region->inner->type) | ||||
572 | { | ||||
573 | case GIMPLE_OMP_FOR: | ||||
574 | gcc_assert (region->inner->sched_kind != OMP_CLAUSE_SCHEDULE_AUTO)((void)(!(region->inner->sched_kind != OMP_CLAUSE_SCHEDULE_AUTO ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 574, __FUNCTION__), 0 : 0)); | ||||
575 | switch (region->inner->sched_kind) | ||||
576 | { | ||||
577 | case OMP_CLAUSE_SCHEDULE_RUNTIME: | ||||
578 | /* For lastprivate(conditional:), our implementation | ||||
579 | requires monotonic behavior. */ | ||||
580 | if (region->inner->has_lastprivate_conditional != 0) | ||||
581 | start_ix2 = 3; | ||||
582 | else if ((region->inner->sched_modifiers | ||||
583 | & OMP_CLAUSE_SCHEDULE_NONMONOTONIC) != 0) | ||||
584 | start_ix2 = 6; | ||||
585 | else if ((region->inner->sched_modifiers | ||||
586 | & OMP_CLAUSE_SCHEDULE_MONOTONIC) == 0) | ||||
587 | start_ix2 = 7; | ||||
588 | else | ||||
589 | start_ix2 = 3; | ||||
590 | break; | ||||
591 | case OMP_CLAUSE_SCHEDULE_DYNAMIC: | ||||
592 | case OMP_CLAUSE_SCHEDULE_GUIDED: | ||||
593 | if ((region->inner->sched_modifiers | ||||
594 | & OMP_CLAUSE_SCHEDULE_MONOTONIC) == 0 | ||||
595 | && !region->inner->has_lastprivate_conditional) | ||||
596 | { | ||||
597 | start_ix2 = 3 + region->inner->sched_kind; | ||||
598 | break; | ||||
599 | } | ||||
600 | /* FALLTHRU */ | ||||
601 | default: | ||||
602 | start_ix2 = region->inner->sched_kind; | ||||
603 | break; | ||||
604 | } | ||||
605 | start_ix2 += (int) BUILT_IN_GOMP_PARALLEL_LOOP_STATIC; | ||||
606 | start_ix = (enum built_in_function) start_ix2; | ||||
607 | break; | ||||
608 | case GIMPLE_OMP_SECTIONS: | ||||
609 | start_ix = BUILT_IN_GOMP_PARALLEL_SECTIONS; | ||||
610 | break; | ||||
611 | default: | ||||
612 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 612, __FUNCTION__)); | ||||
613 | } | ||||
614 | } | ||||
615 | |||||
616 | /* By default, the value of NUM_THREADS is zero (selected at run time) | ||||
617 | and there is no conditional. */ | ||||
618 | cond = NULL_TREE(tree) nullptr; | ||||
619 | val = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 0); | ||||
620 | flags = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 0); | ||||
621 | |||||
622 | c = omp_find_clause (clauses, OMP_CLAUSE_IF); | ||||
623 | if (c) | ||||
624 | cond = OMP_CLAUSE_IF_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_IF ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 624, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 624, __FUNCTION__))); | ||||
625 | |||||
626 | c = omp_find_clause (clauses, OMP_CLAUSE_NUM_THREADS); | ||||
627 | if (c) | ||||
628 | { | ||||
629 | val = OMP_CLAUSE_NUM_THREADS_EXPR (c)(*(omp_clause_elt_check (((omp_clause_subcode_check ((c), (OMP_CLAUSE_NUM_THREADS ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 629, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 629, __FUNCTION__))); | ||||
630 | clause_loc = OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 630, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus; | ||||
631 | } | ||||
632 | else | ||||
633 | clause_loc = gimple_location (entry_stmt); | ||||
634 | |||||
635 | c = omp_find_clause (clauses, OMP_CLAUSE_PROC_BIND); | ||||
636 | if (c) | ||||
637 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 637, __FUNCTION__))->omp_clause.subcode.proc_bind_kind)); | ||||
638 | |||||
639 | /* Ensure 'val' is of the correct type. */ | ||||
640 | val = fold_convert_loc (clause_loc, unsigned_type_nodeinteger_types[itk_unsigned_int], val); | ||||
641 | |||||
642 | /* If we found the clause 'if (cond)', build either | ||||
643 | (cond != 0) or (cond ? val : 1u). */ | ||||
644 | if (cond
| ||||
645 | { | ||||
646 | cond = gimple_boolify (cond); | ||||
647 | |||||
648 | if (integer_zerop (val)) | ||||
649 | val = fold_build2_loc (clause_loc, | ||||
650 | EQ_EXPR, unsigned_type_nodeinteger_types[itk_unsigned_int], cond, | ||||
651 | build_int_cst (TREE_TYPE (cond)((contains_struct_check ((cond), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 651, __FUNCTION__))->typed.type), 0)); | ||||
652 | else | ||||
653 | { | ||||
654 | basic_block cond_bb, then_bb, else_bb; | ||||
655 | edge e, e_then, e_else; | ||||
656 | tree tmp_then, tmp_else, tmp_join, tmp_var; | ||||
657 | |||||
658 | tmp_var = create_tmp_var (TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 658, __FUNCTION__))->typed.type)); | ||||
659 | if (gimple_in_ssa_p (cfun(cfun + 0))) | ||||
660 | { | ||||
661 | tmp_then = make_ssa_name (tmp_var); | ||||
662 | tmp_else = make_ssa_name (tmp_var); | ||||
663 | tmp_join = make_ssa_name (tmp_var); | ||||
664 | } | ||||
665 | else | ||||
666 | { | ||||
667 | tmp_then = tmp_var; | ||||
668 | tmp_else = tmp_var; | ||||
669 | tmp_join = tmp_var; | ||||
670 | } | ||||
671 | |||||
672 | e = split_block_after_labels (bb); | ||||
673 | cond_bb = e->src; | ||||
674 | bb = e->dest; | ||||
675 | remove_edge (e); | ||||
676 | |||||
677 | then_bb = create_empty_bb (cond_bb); | ||||
678 | else_bb = create_empty_bb (then_bb); | ||||
679 | set_immediate_dominator (CDI_DOMINATORS, then_bb, cond_bb); | ||||
680 | set_immediate_dominator (CDI_DOMINATORS, else_bb, cond_bb); | ||||
681 | |||||
682 | stmt = gimple_build_cond_empty (cond); | ||||
683 | gsi = gsi_start_bb (cond_bb); | ||||
684 | gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); | ||||
685 | |||||
686 | gsi = gsi_start_bb (then_bb); | ||||
687 | expand_omp_build_assign (&gsi, tmp_then, val, true); | ||||
688 | |||||
689 | gsi = gsi_start_bb (else_bb); | ||||
690 | expand_omp_build_assign (&gsi, tmp_else, | ||||
691 | build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 1), | ||||
692 | true); | ||||
693 | |||||
694 | make_edge (cond_bb, then_bb, EDGE_TRUE_VALUE); | ||||
695 | make_edge (cond_bb, else_bb, EDGE_FALSE_VALUE); | ||||
696 | add_bb_to_loop (then_bb, cond_bb->loop_father); | ||||
697 | add_bb_to_loop (else_bb, cond_bb->loop_father); | ||||
698 | e_then = make_edge (then_bb, bb, EDGE_FALLTHRU); | ||||
699 | e_else = make_edge (else_bb, bb, EDGE_FALLTHRU); | ||||
700 | |||||
701 | if (gimple_in_ssa_p (cfun(cfun + 0))) | ||||
702 | { | ||||
703 | gphi *phi = create_phi_node (tmp_join, bb); | ||||
704 | add_phi_arg (phi, tmp_then, e_then, UNKNOWN_LOCATION((location_t) 0)); | ||||
705 | add_phi_arg (phi, tmp_else, e_else, UNKNOWN_LOCATION((location_t) 0)); | ||||
706 | } | ||||
707 | |||||
708 | val = tmp_join; | ||||
709 | } | ||||
710 | |||||
711 | gsi = gsi_start_bb (bb); | ||||
712 | val = force_gimple_operand_gsi (&gsi, val, true, NULL_TREE(tree) nullptr, | ||||
713 | false, GSI_CONTINUE_LINKING); | ||||
714 | } | ||||
715 | |||||
716 | gsi = gsi_last_nondebug_bb (bb); | ||||
717 | t = gimple_omp_parallel_data_arg (entry_stmt); | ||||
718 | if (t == NULLnullptr) | ||||
719 | t1 = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; | ||||
720 | else | ||||
721 | t1 = build_fold_addr_expr (t)build_fold_addr_expr_loc (((location_t) 0), (t)); | ||||
722 | tree child_fndecl = gimple_omp_parallel_child_fn (entry_stmt); | ||||
723 | t2 = build_fold_addr_expr (child_fndecl)build_fold_addr_expr_loc (((location_t) 0), (child_fndecl)); | ||||
724 | |||||
725 | vec_alloc (args, 4 + vec_safe_length (ws_args)); | ||||
726 | args->quick_push (t2); | ||||
| |||||
727 | args->quick_push (t1); | ||||
728 | args->quick_push (val); | ||||
729 | if (ws_args) | ||||
730 | args->splice (*ws_args); | ||||
731 | args->quick_push (flags); | ||||
732 | |||||
733 | t = build_call_expr_loc_vec (UNKNOWN_LOCATION((location_t) 0), | ||||
734 | builtin_decl_explicit (start_ix), args); | ||||
735 | |||||
736 | if (rtmp) | ||||
737 | { | ||||
738 | tree type = TREE_TYPE (OMP_CLAUSE_DECL (rtmp))((contains_struct_check (((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((rtmp), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 738, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 738, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 738, __FUNCTION__)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 738, __FUNCTION__))->typed.type); | ||||
739 | t = build2 (MODIFY_EXPR, type, OMP_CLAUSE_DECL (rtmp)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((rtmp), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 739, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 739, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 739, __FUNCTION__))), | ||||
740 | fold_convert (type,fold_convert_loc (((location_t) 0), type, fold_convert_loc (( (location_t) 0), global_trees[TI_POINTER_SIZED_TYPE], t)) | ||||
741 | 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))); | ||||
742 | } | ||||
743 | force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, | ||||
744 | false, GSI_CONTINUE_LINKING); | ||||
745 | } | ||||
746 | |||||
747 | /* Build the function call to GOMP_task to actually | ||||
748 | generate the task operation. BB is the block where to insert the code. */ | ||||
749 | |||||
750 | static void | ||||
751 | expand_task_call (struct omp_region *region, basic_block bb, | ||||
752 | gomp_task *entry_stmt) | ||||
753 | { | ||||
754 | tree t1, t2, t3; | ||||
755 | gimple_stmt_iterator gsi; | ||||
756 | location_t loc = gimple_location (entry_stmt); | ||||
757 | |||||
758 | tree clauses = gimple_omp_task_clauses (entry_stmt); | ||||
759 | |||||
760 | tree ifc = omp_find_clause (clauses, OMP_CLAUSE_IF); | ||||
761 | tree untied = omp_find_clause (clauses, OMP_CLAUSE_UNTIED); | ||||
762 | tree mergeable = omp_find_clause (clauses, OMP_CLAUSE_MERGEABLE); | ||||
763 | tree depend = omp_find_clause (clauses, OMP_CLAUSE_DEPEND); | ||||
764 | tree finalc = omp_find_clause (clauses, OMP_CLAUSE_FINAL); | ||||
765 | tree priority = omp_find_clause (clauses, OMP_CLAUSE_PRIORITY); | ||||
766 | tree detach = omp_find_clause (clauses, OMP_CLAUSE_DETACH); | ||||
767 | |||||
768 | unsigned int iflags | ||||
769 | = (untied ? GOMP_TASK_FLAG_UNTIED(1 << 0) : 0) | ||||
770 | | (mergeable ? GOMP_TASK_FLAG_MERGEABLE(1 << 2) : 0) | ||||
771 | | (depend ? GOMP_TASK_FLAG_DEPEND(1 << 3) : 0); | ||||
772 | |||||
773 | bool taskloop_p = gimple_omp_task_taskloop_p (entry_stmt); | ||||
774 | tree startvar = NULL_TREE(tree) nullptr, endvar = NULL_TREE(tree) nullptr, step = NULL_TREE(tree) nullptr; | ||||
775 | tree num_tasks = NULL_TREE(tree) nullptr; | ||||
776 | bool ull = false; | ||||
777 | if (taskloop_p) | ||||
778 | { | ||||
779 | gimple *g = last_stmt (region->outer->entry); | ||||
780 | 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 781, __FUNCTION__), 0 : 0)) | ||||
781 | && 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 781, __FUNCTION__), 0 : 0)); | ||||
782 | struct omp_for_data fd; | ||||
783 | omp_extract_for_data (as_a <gomp_for *> (g), &fd, NULLnullptr); | ||||
784 | startvar = omp_find_clause (clauses, OMP_CLAUSE__LOOPTEMP_); | ||||
785 | endvar = omp_find_clause (OMP_CLAUSE_CHAIN (startvar)((contains_struct_check (((tree_check ((startvar), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 785, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 785, __FUNCTION__))->common.chain), | ||||
786 | OMP_CLAUSE__LOOPTEMP_); | ||||
787 | startvar = OMP_CLAUSE_DECL (startvar)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((startvar), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 787, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 787, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 787, __FUNCTION__))); | ||||
788 | endvar = OMP_CLAUSE_DECL (endvar)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((endvar), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 788, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 788, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 788, __FUNCTION__))); | ||||
789 | step = fold_convert_loc (loc, fd.iter_type, fd.loop.step); | ||||
790 | if (fd.loop.cond_code == LT_EXPR) | ||||
791 | iflags |= GOMP_TASK_FLAG_UP(1 << 8); | ||||
792 | tree tclauses = gimple_omp_for_clauses (g); | ||||
793 | num_tasks = omp_find_clause (tclauses, OMP_CLAUSE_NUM_TASKS); | ||||
794 | if (num_tasks) | ||||
795 | { | ||||
796 | if (OMP_CLAUSE_NUM_TASKS_STRICT (num_tasks)(((omp_clause_subcode_check ((num_tasks), (OMP_CLAUSE_NUM_TASKS ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 796, __FUNCTION__)))->base.private_flag)) | ||||
797 | iflags |= GOMP_TASK_FLAG_STRICT(1 << 14); | ||||
798 | num_tasks = OMP_CLAUSE_NUM_TASKS_EXPR (num_tasks)(*(omp_clause_elt_check (((omp_clause_subcode_check ((num_tasks ), (OMP_CLAUSE_NUM_TASKS), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 798, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 798, __FUNCTION__))); | ||||
799 | } | ||||
800 | else | ||||
801 | { | ||||
802 | num_tasks = omp_find_clause (tclauses, OMP_CLAUSE_GRAINSIZE); | ||||
803 | if (num_tasks) | ||||
804 | { | ||||
805 | iflags |= GOMP_TASK_FLAG_GRAINSIZE(1 << 9); | ||||
806 | if (OMP_CLAUSE_GRAINSIZE_STRICT (num_tasks)(((omp_clause_subcode_check ((num_tasks), (OMP_CLAUSE_GRAINSIZE ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 806, __FUNCTION__)))->base.private_flag)) | ||||
807 | iflags |= GOMP_TASK_FLAG_STRICT(1 << 14); | ||||
808 | num_tasks = OMP_CLAUSE_GRAINSIZE_EXPR (num_tasks)(*(omp_clause_elt_check (((omp_clause_subcode_check ((num_tasks ), (OMP_CLAUSE_GRAINSIZE), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 808, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 808, __FUNCTION__))); | ||||
809 | } | ||||
810 | else | ||||
811 | num_tasks = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; | ||||
812 | } | ||||
813 | num_tasks = fold_convert_loc (loc, long_integer_type_nodeinteger_types[itk_long], num_tasks); | ||||
814 | if (ifc == NULL_TREE(tree) nullptr) | ||||
815 | iflags |= GOMP_TASK_FLAG_IF(1 << 10); | ||||
816 | if (omp_find_clause (tclauses, OMP_CLAUSE_NOGROUP)) | ||||
817 | iflags |= GOMP_TASK_FLAG_NOGROUP(1 << 11); | ||||
818 | ull = fd.iter_type == long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long]; | ||||
819 | if (omp_find_clause (clauses, OMP_CLAUSE_REDUCTION)) | ||||
820 | iflags |= GOMP_TASK_FLAG_REDUCTION(1 << 12); | ||||
821 | } | ||||
822 | else | ||||
823 | { | ||||
824 | if (priority) | ||||
825 | iflags |= GOMP_TASK_FLAG_PRIORITY(1 << 4); | ||||
826 | if (detach) | ||||
827 | iflags |= GOMP_TASK_FLAG_DETACH(1 << 13); | ||||
828 | } | ||||
829 | |||||
830 | tree flags = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], iflags); | ||||
831 | |||||
832 | tree cond = boolean_true_nodeglobal_trees[TI_BOOLEAN_TRUE]; | ||||
833 | if (ifc) | ||||
834 | { | ||||
835 | if (taskloop_p) | ||||
836 | { | ||||
837 | tree t = gimple_boolify (OMP_CLAUSE_IF_EXPR (ifc)(*(omp_clause_elt_check (((omp_clause_subcode_check ((ifc), ( OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 837, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 837, __FUNCTION__)))); | ||||
838 | t = fold_build3_loc (loc, COND_EXPR, unsigned_type_nodeinteger_types[itk_unsigned_int], t, | ||||
839 | build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], | ||||
840 | GOMP_TASK_FLAG_IF(1 << 10)), | ||||
841 | build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 0)); | ||||
842 | flags = fold_build2_loc (loc, PLUS_EXPR, unsigned_type_nodeinteger_types[itk_unsigned_int], | ||||
843 | flags, t); | ||||
844 | } | ||||
845 | else | ||||
846 | cond = gimple_boolify (OMP_CLAUSE_IF_EXPR (ifc)(*(omp_clause_elt_check (((omp_clause_subcode_check ((ifc), ( OMP_CLAUSE_IF), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 846, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 846, __FUNCTION__)))); | ||||
847 | } | ||||
848 | |||||
849 | if (finalc) | ||||
850 | { | ||||
851 | tree t = gimple_boolify (OMP_CLAUSE_FINAL_EXPR (finalc)(*(omp_clause_elt_check (((omp_clause_subcode_check ((finalc) , (OMP_CLAUSE_FINAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 851, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 851, __FUNCTION__)))); | ||||
852 | t = fold_build3_loc (loc, COND_EXPR, unsigned_type_nodeinteger_types[itk_unsigned_int], t, | ||||
853 | build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], | ||||
854 | GOMP_TASK_FLAG_FINAL(1 << 1)), | ||||
855 | build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 0)); | ||||
856 | flags = fold_build2_loc (loc, PLUS_EXPR, unsigned_type_nodeinteger_types[itk_unsigned_int], flags, t); | ||||
857 | } | ||||
858 | if (depend) | ||||
859 | depend = OMP_CLAUSE_DECL (depend)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((depend), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 859, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 859, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 859, __FUNCTION__))); | ||||
860 | else | ||||
861 | depend = build_int_cst (ptr_type_nodeglobal_trees[TI_PTR_TYPE], 0); | ||||
862 | if (priority) | ||||
863 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 864, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 864, __FUNCTION__)))) | ||||
864 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 864, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 864, __FUNCTION__)))); | ||||
865 | else | ||||
866 | priority = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]; | ||||
867 | |||||
868 | gsi = gsi_last_nondebug_bb (bb); | ||||
869 | |||||
870 | detach = (detach | ||||
871 | ? build_fold_addr_expr (OMP_CLAUSE_DECL (detach))build_fold_addr_expr_loc (((location_t) 0), ((*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((detach), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 871, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 871, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 871, __FUNCTION__))))) | ||||
872 | : null_pointer_nodeglobal_trees[TI_NULL_POINTER]); | ||||
873 | |||||
874 | tree t = gimple_omp_task_data_arg (entry_stmt); | ||||
875 | if (t == NULLnullptr) | ||||
876 | t2 = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; | ||||
877 | else | ||||
878 | t2 = build_fold_addr_expr_loc (loc, t); | ||||
879 | t1 = build_fold_addr_expr_loc (loc, gimple_omp_task_child_fn (entry_stmt)); | ||||
880 | t = gimple_omp_task_copy_fn (entry_stmt); | ||||
881 | if (t == NULLnullptr) | ||||
882 | t3 = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; | ||||
883 | else | ||||
884 | t3 = build_fold_addr_expr_loc (loc, t); | ||||
885 | |||||
886 | if (taskloop_p) | ||||
887 | t = build_call_expr (ull | ||||
888 | ? builtin_decl_explicit (BUILT_IN_GOMP_TASKLOOP_ULL) | ||||
889 | : builtin_decl_explicit (BUILT_IN_GOMP_TASKLOOP), | ||||
890 | 11, t1, t2, t3, | ||||
891 | gimple_omp_task_arg_size (entry_stmt), | ||||
892 | gimple_omp_task_arg_align (entry_stmt), flags, | ||||
893 | num_tasks, priority, startvar, endvar, step); | ||||
894 | else | ||||
895 | t = build_call_expr (builtin_decl_explicit (BUILT_IN_GOMP_TASK), | ||||
896 | 10, t1, t2, t3, | ||||
897 | gimple_omp_task_arg_size (entry_stmt), | ||||
898 | gimple_omp_task_arg_align (entry_stmt), cond, flags, | ||||
899 | depend, priority, detach); | ||||
900 | |||||
901 | force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, | ||||
902 | false, GSI_CONTINUE_LINKING); | ||||
903 | } | ||||
904 | |||||
905 | /* Build the function call to GOMP_taskwait_depend to actually | ||||
906 | generate the taskwait operation. BB is the block where to insert the | ||||
907 | code. */ | ||||
908 | |||||
909 | static void | ||||
910 | expand_taskwait_call (basic_block bb, gomp_task *entry_stmt) | ||||
911 | { | ||||
912 | tree clauses = gimple_omp_task_clauses (entry_stmt); | ||||
913 | tree depend = omp_find_clause (clauses, OMP_CLAUSE_DEPEND); | ||||
914 | if (depend == NULL_TREE(tree) nullptr) | ||||
915 | return; | ||||
916 | |||||
917 | depend = OMP_CLAUSE_DECL (depend)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((depend), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 917, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 917, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 917, __FUNCTION__))); | ||||
918 | |||||
919 | bool nowait = omp_find_clause (clauses, OMP_CLAUSE_NOWAIT) != NULL_TREE(tree) nullptr; | ||||
920 | gimple_stmt_iterator gsi = gsi_last_nondebug_bb (bb); | ||||
921 | enum built_in_function f = (nowait | ||||
922 | ? BUILT_IN_GOMP_TASKWAIT_DEPEND_NOWAIT | ||||
923 | : BUILT_IN_GOMP_TASKWAIT_DEPEND); | ||||
924 | tree t = build_call_expr (builtin_decl_explicit (f), 1, depend); | ||||
925 | |||||
926 | force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, | ||||
927 | false, GSI_CONTINUE_LINKING); | ||||
928 | } | ||||
929 | |||||
930 | /* Build the function call to GOMP_teams_reg to actually | ||||
931 | generate the host teams operation. REGION is the teams region | ||||
932 | being expanded. BB is the block where to insert the code. */ | ||||
933 | |||||
934 | static void | ||||
935 | expand_teams_call (basic_block bb, gomp_teams *entry_stmt) | ||||
936 | { | ||||
937 | tree clauses = gimple_omp_teams_clauses (entry_stmt); | ||||
938 | tree num_teams = omp_find_clause (clauses, OMP_CLAUSE_NUM_TEAMS); | ||||
939 | if (num_teams == NULL_TREE(tree) nullptr) | ||||
940 | num_teams = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 0); | ||||
941 | else | ||||
942 | { | ||||
943 | num_teams = OMP_CLAUSE_NUM_TEAMS_UPPER_EXPR (num_teams)(*(omp_clause_elt_check (((omp_clause_subcode_check ((num_teams ), (OMP_CLAUSE_NUM_TEAMS), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 943, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 943, __FUNCTION__))); | ||||
944 | num_teams = fold_convert (unsigned_type_node, num_teams)fold_convert_loc (((location_t) 0), integer_types[itk_unsigned_int ], num_teams); | ||||
945 | } | ||||
946 | tree thread_limit = omp_find_clause (clauses, OMP_CLAUSE_THREAD_LIMIT); | ||||
947 | if (thread_limit == NULL_TREE(tree) nullptr) | ||||
948 | thread_limit = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], 0); | ||||
949 | else | ||||
950 | { | ||||
951 | thread_limit = OMP_CLAUSE_THREAD_LIMIT_EXPR (thread_limit)(*(omp_clause_elt_check (((omp_clause_subcode_check ((thread_limit ), (OMP_CLAUSE_THREAD_LIMIT), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 951, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 951, __FUNCTION__))); | ||||
952 | thread_limit = fold_convert (unsigned_type_node, thread_limit)fold_convert_loc (((location_t) 0), integer_types[itk_unsigned_int ], thread_limit); | ||||
953 | } | ||||
954 | |||||
955 | gimple_stmt_iterator gsi = gsi_last_nondebug_bb (bb); | ||||
956 | tree t = gimple_omp_teams_data_arg (entry_stmt), t1; | ||||
957 | if (t == NULLnullptr) | ||||
958 | t1 = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; | ||||
959 | else | ||||
960 | t1 = build_fold_addr_expr (t)build_fold_addr_expr_loc (((location_t) 0), (t)); | ||||
961 | tree child_fndecl = gimple_omp_teams_child_fn (entry_stmt); | ||||
962 | tree t2 = build_fold_addr_expr (child_fndecl)build_fold_addr_expr_loc (((location_t) 0), (child_fndecl)); | ||||
963 | |||||
964 | vec<tree, va_gc> *args; | ||||
965 | vec_alloc (args, 5); | ||||
966 | args->quick_push (t2); | ||||
967 | args->quick_push (t1); | ||||
968 | args->quick_push (num_teams); | ||||
969 | args->quick_push (thread_limit); | ||||
970 | /* For future extensibility. */ | ||||
971 | args->quick_push (build_zero_cst (unsigned_type_nodeinteger_types[itk_unsigned_int])); | ||||
972 | |||||
973 | t = build_call_expr_loc_vec (UNKNOWN_LOCATION((location_t) 0), | ||||
974 | builtin_decl_explicit (BUILT_IN_GOMP_TEAMS_REG), | ||||
975 | args); | ||||
976 | |||||
977 | force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, | ||||
978 | false, GSI_CONTINUE_LINKING); | ||||
979 | } | ||||
980 | |||||
981 | /* Chain all the DECLs in LIST by their TREE_CHAIN fields. */ | ||||
982 | |||||
983 | static tree | ||||
984 | vec2chain (vec<tree, va_gc> *v) | ||||
985 | { | ||||
986 | tree chain = NULL_TREE(tree) nullptr, t; | ||||
987 | unsigned ix; | ||||
988 | |||||
989 | FOR_EACH_VEC_SAFE_ELT_REVERSE (v, ix, t)for (ix = vec_safe_length (v) - 1; vec_safe_iterate ((v), (ix ), &(t)); (ix)--) | ||||
990 | { | ||||
991 | DECL_CHAIN (t)(((contains_struct_check (((contains_struct_check ((t), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 991, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 991, __FUNCTION__))->common.chain)) = chain; | ||||
992 | chain = t; | ||||
993 | } | ||||
994 | |||||
995 | return chain; | ||||
996 | } | ||||
997 | |||||
998 | /* Remove barriers in REGION->EXIT's block. Note that this is only | ||||
999 | valid for GIMPLE_OMP_PARALLEL regions. Since the end of a parallel region | ||||
1000 | is an implicit barrier, any workshare inside the GIMPLE_OMP_PARALLEL that | ||||
1001 | left a barrier at the end of the GIMPLE_OMP_PARALLEL region can now be | ||||
1002 | removed. */ | ||||
1003 | |||||
1004 | static void | ||||
1005 | remove_exit_barrier (struct omp_region *region) | ||||
1006 | { | ||||
1007 | gimple_stmt_iterator gsi; | ||||
1008 | basic_block exit_bb; | ||||
1009 | edge_iterator ei; | ||||
1010 | edge e; | ||||
1011 | gimple *stmt; | ||||
1012 | int any_addressable_vars = -1; | ||||
1013 | |||||
1014 | exit_bb = region->exit; | ||||
1015 | |||||
1016 | /* If the parallel region doesn't return, we don't have REGION->EXIT | ||||
1017 | block at all. */ | ||||
1018 | if (! exit_bb) | ||||
1019 | return; | ||||
1020 | |||||
1021 | /* The last insn in the block will be the parallel's GIMPLE_OMP_RETURN. The | ||||
1022 | workshare's GIMPLE_OMP_RETURN will be in a preceding block. The kinds of | ||||
1023 | statements that can appear in between are extremely limited -- no | ||||
1024 | memory operations at all. Here, we allow nothing at all, so the | ||||
1025 | only thing we allow to precede this GIMPLE_OMP_RETURN is a label. */ | ||||
1026 | gsi = gsi_last_nondebug_bb (exit_bb); | ||||
1027 | gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN)((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1027, __FUNCTION__), 0 : 0)); | ||||
1028 | gsi_prev_nondebug (&gsi); | ||||
1029 | if (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) != GIMPLE_LABEL) | ||||
1030 | return; | ||||
1031 | |||||
1032 | FOR_EACH_EDGE (e, ei, exit_bb->preds)for ((ei) = ei_start_1 (&((exit_bb->preds))); ei_cond ( (ei), &(e)); ei_next (&(ei))) | ||||
1033 | { | ||||
1034 | gsi = gsi_last_nondebug_bb (e->src); | ||||
1035 | if (gsi_end_p (gsi)) | ||||
1036 | continue; | ||||
1037 | stmt = gsi_stmt (gsi); | ||||
1038 | if (gimple_code (stmt) == GIMPLE_OMP_RETURN | ||||
1039 | && !gimple_omp_return_nowait_p (stmt)) | ||||
1040 | { | ||||
1041 | /* OpenMP 3.0 tasks unfortunately prevent this optimization | ||||
1042 | in many cases. If there could be tasks queued, the barrier | ||||
1043 | might be needed to let the tasks run before some local | ||||
1044 | variable of the parallel that the task uses as shared | ||||
1045 | runs out of scope. The task can be spawned either | ||||
1046 | from within current function (this would be easy to check) | ||||
1047 | or from some function it calls and gets passed an address | ||||
1048 | of such a variable. */ | ||||
1049 | if (any_addressable_vars < 0) | ||||
1050 | { | ||||
1051 | gomp_parallel *parallel_stmt | ||||
1052 | = as_a <gomp_parallel *> (last_stmt (region->entry)); | ||||
1053 | tree child_fun = gimple_omp_parallel_child_fn (parallel_stmt); | ||||
1054 | tree local_decls, block, decl; | ||||
1055 | unsigned ix; | ||||
1056 | |||||
1057 | any_addressable_vars = 0; | ||||
1058 | FOR_EACH_LOCAL_DECL (DECL_STRUCT_FUNCTION (child_fun), ix, decl)for (ix = vec_safe_length ((((tree_check ((child_fun), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1058, __FUNCTION__, (FUNCTION_DECL)))->function_decl.f)) ->local_decls) - 1; vec_safe_iterate (((((tree_check ((child_fun ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1058, __FUNCTION__, (FUNCTION_DECL)))->function_decl.f)) ->local_decls), (ix), &(decl)); (ix)--) | ||||
1059 | if (TREE_ADDRESSABLE (decl)((decl)->base.addressable_flag)) | ||||
1060 | { | ||||
1061 | any_addressable_vars = 1; | ||||
1062 | break; | ||||
1063 | } | ||||
1064 | for (block = gimple_block (stmt); | ||||
1065 | !any_addressable_vars | ||||
1066 | && block | ||||
1067 | && TREE_CODE (block)((enum tree_code) (block)->base.code) == BLOCK; | ||||
1068 | block = BLOCK_SUPERCONTEXT (block)((tree_check ((block), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1068, __FUNCTION__, (BLOCK)))->block.supercontext)) | ||||
1069 | { | ||||
1070 | for (local_decls = BLOCK_VARS (block)((tree_check ((block), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1070, __FUNCTION__, (BLOCK)))->block.vars); | ||||
1071 | local_decls; | ||||
1072 | local_decls = DECL_CHAIN (local_decls)(((contains_struct_check (((contains_struct_check ((local_decls ), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1072, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1072, __FUNCTION__))->common.chain))) | ||||
1073 | if (TREE_ADDRESSABLE (local_decls)((local_decls)->base.addressable_flag)) | ||||
1074 | { | ||||
1075 | any_addressable_vars = 1; | ||||
1076 | break; | ||||
1077 | } | ||||
1078 | if (block == gimple_block (parallel_stmt)) | ||||
1079 | break; | ||||
1080 | } | ||||
1081 | } | ||||
1082 | if (!any_addressable_vars) | ||||
1083 | gimple_omp_return_set_nowait (stmt); | ||||
1084 | } | ||||
1085 | } | ||||
1086 | } | ||||
1087 | |||||
1088 | static void | ||||
1089 | remove_exit_barriers (struct omp_region *region) | ||||
1090 | { | ||||
1091 | if (region->type == GIMPLE_OMP_PARALLEL) | ||||
1092 | remove_exit_barrier (region); | ||||
1093 | |||||
1094 | if (region->inner) | ||||
1095 | { | ||||
1096 | region = region->inner; | ||||
1097 | remove_exit_barriers (region); | ||||
1098 | while (region->next) | ||||
1099 | { | ||||
1100 | region = region->next; | ||||
1101 | remove_exit_barriers (region); | ||||
1102 | } | ||||
1103 | } | ||||
1104 | } | ||||
1105 | |||||
1106 | /* Optimize omp_get_thread_num () and omp_get_num_threads () | ||||
1107 | calls. These can't be declared as const functions, but | ||||
1108 | within one parallel body they are constant, so they can be | ||||
1109 | transformed there into __builtin_omp_get_{thread_num,num_threads} () | ||||
1110 | which are declared const. Similarly for task body, except | ||||
1111 | that in untied task omp_get_thread_num () can change at any task | ||||
1112 | scheduling point. */ | ||||
1113 | |||||
1114 | static void | ||||
1115 | optimize_omp_library_calls (gimple *entry_stmt) | ||||
1116 | { | ||||
1117 | basic_block bb; | ||||
1118 | gimple_stmt_iterator gsi; | ||||
1119 | tree thr_num_tree = builtin_decl_explicit (BUILT_IN_OMP_GET_THREAD_NUM); | ||||
1120 | tree thr_num_id = DECL_ASSEMBLER_NAME (thr_num_tree)decl_assembler_name (thr_num_tree); | ||||
1121 | tree num_thr_tree = builtin_decl_explicit (BUILT_IN_OMP_GET_NUM_THREADS); | ||||
1122 | tree num_thr_id = DECL_ASSEMBLER_NAME (num_thr_tree)decl_assembler_name (num_thr_tree); | ||||
1123 | bool untied_task = (gimple_code (entry_stmt) == GIMPLE_OMP_TASK | ||||
1124 | && omp_find_clause (gimple_omp_task_clauses (entry_stmt), | ||||
1125 | OMP_CLAUSE_UNTIED) != NULLnullptr); | ||||
1126 | |||||
1127 | 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) | ||||
1128 | for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) | ||||
1129 | { | ||||
1130 | gimple *call = gsi_stmt (gsi); | ||||
1131 | tree decl; | ||||
1132 | |||||
1133 | if (is_gimple_call (call) | ||||
1134 | && (decl = gimple_call_fndecl (call)) | ||||
1135 | && DECL_EXTERNAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1135, __FUNCTION__))->decl_common.decl_flag_1) | ||||
1136 | && TREE_PUBLIC (decl)((decl)->base.public_flag) | ||||
1137 | && DECL_INITIAL (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1137, __FUNCTION__))->decl_common.initial) == NULLnullptr) | ||||
1138 | { | ||||
1139 | tree built_in; | ||||
1140 | |||||
1141 | if (DECL_NAME (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1141, __FUNCTION__))->decl_minimal.name) == thr_num_id) | ||||
1142 | { | ||||
1143 | /* In #pragma omp task untied omp_get_thread_num () can change | ||||
1144 | during the execution of the task region. */ | ||||
1145 | if (untied_task) | ||||
1146 | continue; | ||||
1147 | built_in = builtin_decl_explicit (BUILT_IN_OMP_GET_THREAD_NUM); | ||||
1148 | } | ||||
1149 | else if (DECL_NAME (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1149, __FUNCTION__))->decl_minimal.name) == num_thr_id) | ||||
1150 | built_in = builtin_decl_explicit (BUILT_IN_OMP_GET_NUM_THREADS); | ||||
1151 | else | ||||
1152 | continue; | ||||
1153 | |||||
1154 | if (DECL_ASSEMBLER_NAME (decl)decl_assembler_name (decl) != DECL_ASSEMBLER_NAME (built_in)decl_assembler_name (built_in) | ||||
1155 | || gimple_call_num_args (call) != 0) | ||||
1156 | continue; | ||||
1157 | |||||
1158 | if (flag_exceptionsglobal_options.x_flag_exceptions && !TREE_NOTHROW (decl)((decl)->base.nothrow_flag)) | ||||
1159 | continue; | ||||
1160 | |||||
1161 | if (TREE_CODE (TREE_TYPE (decl))((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1161, __FUNCTION__))->typed.type))->base.code) != FUNCTION_TYPE | ||||
1162 | || !types_compatible_p (TREE_TYPE (TREE_TYPE (decl))((contains_struct_check ((((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1162, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1162, __FUNCTION__))->typed.type), | ||||
1163 | TREE_TYPE (TREE_TYPE (built_in))((contains_struct_check ((((contains_struct_check ((built_in) , (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1163, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1163, __FUNCTION__))->typed.type))) | ||||
1164 | continue; | ||||
1165 | |||||
1166 | gimple_call_set_fndecl (call, built_in); | ||||
1167 | } | ||||
1168 | } | ||||
1169 | } | ||||
1170 | |||||
1171 | /* Callback for expand_omp_build_assign. Return non-NULL if *tp needs to be | ||||
1172 | regimplified. */ | ||||
1173 | |||||
1174 | static tree | ||||
1175 | expand_omp_regimplify_p (tree *tp, int *walk_subtrees, void *) | ||||
1176 | { | ||||
1177 | tree t = *tp; | ||||
1178 | |||||
1179 | /* Any variable with DECL_VALUE_EXPR needs to be regimplified. */ | ||||
1180 | if (VAR_P (t)(((enum tree_code) (t)->base.code) == VAR_DECL) && DECL_HAS_VALUE_EXPR_P (t)((tree_check3 ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1180, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL)) ) ->decl_common.decl_flag_2)) | ||||
1181 | return t; | ||||
1182 | |||||
1183 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == ADDR_EXPR) | ||||
1184 | recompute_tree_invariant_for_addr_expr (t); | ||||
1185 | |||||
1186 | *walk_subtrees = !TYPE_P (t)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (t)->base.code))] == tcc_type) && !DECL_P (t)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (t)->base.code))] == tcc_declaration); | ||||
1187 | return NULL_TREE(tree) nullptr; | ||||
1188 | } | ||||
1189 | |||||
1190 | /* Prepend or append TO = FROM assignment before or after *GSI_P. */ | ||||
1191 | |||||
1192 | static void | ||||
1193 | expand_omp_build_assign (gimple_stmt_iterator *gsi_p, tree to, tree from, | ||||
1194 | bool after) | ||||
1195 | { | ||||
1196 | bool simple_p = DECL_P (to)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (to)->base.code))] == tcc_declaration) && TREE_ADDRESSABLE (to)((to)->base.addressable_flag); | ||||
1197 | from = force_gimple_operand_gsi (gsi_p, from, simple_p, NULL_TREE(tree) nullptr, | ||||
1198 | !after, after ? GSI_CONTINUE_LINKING | ||||
1199 | : GSI_SAME_STMT); | ||||
1200 | gimple *stmt = gimple_build_assign (to, from); | ||||
1201 | if (after) | ||||
1202 | gsi_insert_after (gsi_p, stmt, GSI_CONTINUE_LINKING); | ||||
1203 | else | ||||
1204 | gsi_insert_before (gsi_p, stmt, GSI_SAME_STMT); | ||||
1205 | if (walk_tree (&from, expand_omp_regimplify_p, NULL, NULL)walk_tree_1 (&from, expand_omp_regimplify_p, nullptr, nullptr , nullptr) | ||||
1206 | || walk_tree (&to, expand_omp_regimplify_p, NULL, NULL)walk_tree_1 (&to, expand_omp_regimplify_p, nullptr, nullptr , nullptr)) | ||||
1207 | { | ||||
1208 | gimple_stmt_iterator gsi = gsi_for_stmt (stmt); | ||||
1209 | gimple_regimplify_operands (stmt, &gsi); | ||||
1210 | } | ||||
1211 | } | ||||
1212 | |||||
1213 | /* Prepend or append LHS CODE RHS condition before or after *GSI_P. */ | ||||
1214 | |||||
1215 | static gcond * | ||||
1216 | expand_omp_build_cond (gimple_stmt_iterator *gsi_p, enum tree_code code, | ||||
1217 | tree lhs, tree rhs, bool after = false) | ||||
1218 | { | ||||
1219 | gcond *cond_stmt = gimple_build_cond (code, lhs, rhs, NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
1220 | if (after) | ||||
1221 | gsi_insert_after (gsi_p, cond_stmt, GSI_CONTINUE_LINKING); | ||||
1222 | else | ||||
1223 | gsi_insert_before (gsi_p, cond_stmt, GSI_SAME_STMT); | ||||
1224 | if (walk_tree (gimple_cond_lhs_ptr (cond_stmt), expand_omp_regimplify_p,walk_tree_1 (gimple_cond_lhs_ptr (cond_stmt), expand_omp_regimplify_p , nullptr, nullptr, nullptr) | ||||
1225 | NULL, NULL)walk_tree_1 (gimple_cond_lhs_ptr (cond_stmt), expand_omp_regimplify_p , nullptr, nullptr, nullptr) | ||||
1226 | || walk_tree (gimple_cond_rhs_ptr (cond_stmt), expand_omp_regimplify_p,walk_tree_1 (gimple_cond_rhs_ptr (cond_stmt), expand_omp_regimplify_p , nullptr, nullptr, nullptr) | ||||
1227 | NULL, NULL)walk_tree_1 (gimple_cond_rhs_ptr (cond_stmt), expand_omp_regimplify_p , nullptr, nullptr, nullptr)) | ||||
1228 | { | ||||
1229 | gimple_stmt_iterator gsi = gsi_for_stmt (cond_stmt); | ||||
1230 | gimple_regimplify_operands (cond_stmt, &gsi); | ||||
1231 | } | ||||
1232 | return cond_stmt; | ||||
1233 | } | ||||
1234 | |||||
1235 | /* Expand the OpenMP parallel or task directive starting at REGION. */ | ||||
1236 | |||||
1237 | static void | ||||
1238 | expand_omp_taskreg (struct omp_region *region) | ||||
1239 | { | ||||
1240 | basic_block entry_bb, exit_bb, new_bb; | ||||
1241 | struct function *child_cfun; | ||||
1242 | tree child_fn, block, t; | ||||
1243 | gimple_stmt_iterator gsi; | ||||
1244 | gimple *entry_stmt, *stmt; | ||||
1245 | edge e; | ||||
1246 | vec<tree, va_gc> *ws_args; | ||||
1247 | |||||
1248 | entry_stmt = last_stmt (region->entry); | ||||
1249 | if (gimple_code (entry_stmt) == GIMPLE_OMP_TASK | ||||
1250 | && gimple_omp_task_taskwait_p (entry_stmt)) | ||||
1251 | { | ||||
1252 | new_bb = region->entry; | ||||
1253 | gsi = gsi_last_nondebug_bb (region->entry); | ||||
1254 | gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TASK)((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_TASK) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1254, __FUNCTION__), 0 : 0)); | ||||
1255 | gsi_remove (&gsi, true); | ||||
1256 | expand_taskwait_call (new_bb, as_a <gomp_task *> (entry_stmt)); | ||||
1257 | return; | ||||
1258 | } | ||||
1259 | |||||
1260 | child_fn = gimple_omp_taskreg_child_fn (entry_stmt); | ||||
1261 | child_cfun = DECL_STRUCT_FUNCTION (child_fn)((tree_check ((child_fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1261, __FUNCTION__, (FUNCTION_DECL)))->function_decl.f); | ||||
1262 | |||||
1263 | entry_bb = region->entry; | ||||
1264 | if (gimple_code (entry_stmt) == GIMPLE_OMP_TASK) | ||||
1265 | exit_bb = region->cont; | ||||
1266 | else | ||||
1267 | exit_bb = region->exit; | ||||
1268 | |||||
1269 | if (is_combined_parallel (region)) | ||||
1270 | ws_args = region->ws_args; | ||||
1271 | else | ||||
1272 | ws_args = NULLnullptr; | ||||
1273 | |||||
1274 | if (child_cfun->cfg) | ||||
1275 | { | ||||
1276 | /* Due to inlining, it may happen that we have already outlined | ||||
1277 | the region, in which case all we need to do is make the | ||||
1278 | sub-graph unreachable and emit the parallel call. */ | ||||
1279 | edge entry_succ_e, exit_succ_e; | ||||
1280 | |||||
1281 | entry_succ_e = single_succ_edge (entry_bb); | ||||
1282 | |||||
1283 | gsi = gsi_last_nondebug_bb (entry_bb); | ||||
1284 | 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1286, __FUNCTION__), 0 : 0)) | ||||
1285 | || 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1286, __FUNCTION__), 0 : 0)) | ||||
1286 | || 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1286, __FUNCTION__), 0 : 0)); | ||||
1287 | gsi_remove (&gsi, true); | ||||
1288 | |||||
1289 | new_bb = entry_bb; | ||||
1290 | if (exit_bb) | ||||
1291 | { | ||||
1292 | exit_succ_e = single_succ_edge (exit_bb); | ||||
1293 | make_edge (new_bb, exit_succ_e->dest, EDGE_FALLTHRU); | ||||
1294 | } | ||||
1295 | remove_edge_and_dominated_blocks (entry_succ_e); | ||||
1296 | } | ||||
1297 | else | ||||
1298 | { | ||||
1299 | unsigned srcidx, dstidx, num; | ||||
1300 | |||||
1301 | /* If the parallel region needs data sent from the parent | ||||
1302 | function, then the very first statement (except possible | ||||
1303 | tree profile counter updates) of the parallel body | ||||
1304 | is a copy assignment .OMP_DATA_I = &.OMP_DATA_O. Since | ||||
1305 | &.OMP_DATA_O is passed as an argument to the child function, | ||||
1306 | we need to replace it with the argument as seen by the child | ||||
1307 | function. | ||||
1308 | |||||
1309 | In most cases, this will end up being the identity assignment | ||||
1310 | .OMP_DATA_I = .OMP_DATA_I. However, if the parallel body had | ||||
1311 | a function call that has been inlined, the original PARM_DECL | ||||
1312 | .OMP_DATA_I may have been converted into a different local | ||||
1313 | variable. In which case, we need to keep the assignment. */ | ||||
1314 | if (gimple_omp_taskreg_data_arg (entry_stmt)) | ||||
1315 | { | ||||
1316 | basic_block entry_succ_bb | ||||
1317 | = single_succ_p (entry_bb) ? single_succ (entry_bb) | ||||
1318 | : FALLTHRU_EDGE (entry_bb)((*((entry_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(0)] : (*((entry_bb))->succs) [(1)])->dest; | ||||
1319 | tree arg; | ||||
1320 | gimple *parcopy_stmt = NULLnullptr; | ||||
1321 | |||||
1322 | for (gsi = gsi_start_bb (entry_succ_bb); ; gsi_next (&gsi)) | ||||
1323 | { | ||||
1324 | gimple *stmt; | ||||
1325 | |||||
1326 | gcc_assert (!gsi_end_p (gsi))((void)(!(!gsi_end_p (gsi)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1326, __FUNCTION__), 0 : 0)); | ||||
1327 | stmt = gsi_stmt (gsi); | ||||
1328 | if (gimple_code (stmt) != GIMPLE_ASSIGN) | ||||
1329 | continue; | ||||
1330 | |||||
1331 | if (gimple_num_ops (stmt) == 2) | ||||
1332 | { | ||||
1333 | tree arg = gimple_assign_rhs1 (stmt); | ||||
1334 | |||||
1335 | /* We're ignore the subcode because we're | ||||
1336 | effectively doing a STRIP_NOPS. */ | ||||
1337 | |||||
1338 | if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == ADDR_EXPR | ||||
1339 | && (TREE_OPERAND (arg, 0)(*((const_cast<tree*> (tree_operand_check ((arg), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1339, __FUNCTION__))))) | ||||
1340 | == gimple_omp_taskreg_data_arg (entry_stmt))) | ||||
1341 | { | ||||
1342 | parcopy_stmt = stmt; | ||||
1343 | break; | ||||
1344 | } | ||||
1345 | } | ||||
1346 | } | ||||
1347 | |||||
1348 | gcc_assert (parcopy_stmt != NULL)((void)(!(parcopy_stmt != nullptr) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1348, __FUNCTION__), 0 : 0)); | ||||
1349 | arg = DECL_ARGUMENTS (child_fn)((tree_check ((child_fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1349, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments ); | ||||
1350 | |||||
1351 | if (!gimple_in_ssa_p (cfun(cfun + 0))) | ||||
1352 | { | ||||
1353 | if (gimple_assign_lhs (parcopy_stmt) == arg) | ||||
1354 | gsi_remove (&gsi, true); | ||||
1355 | else | ||||
1356 | { | ||||
1357 | /* ?? Is setting the subcode really necessary ?? */ | ||||
1358 | gimple_omp_set_subcode (parcopy_stmt, TREE_CODE (arg)((enum tree_code) (arg)->base.code)); | ||||
1359 | gimple_assign_set_rhs1 (parcopy_stmt, arg); | ||||
1360 | } | ||||
1361 | } | ||||
1362 | else | ||||
1363 | { | ||||
1364 | tree lhs = gimple_assign_lhs (parcopy_stmt); | ||||
1365 | gcc_assert (SSA_NAME_VAR (lhs) == arg)((void)(!(((tree_check ((lhs), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1365, __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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1365, __FUNCTION__), 0 : 0)); | ||||
1366 | /* We'd like to set the rhs to the default def in the child_fn, | ||||
1367 | but it's too early to create ssa names in the child_fn. | ||||
1368 | Instead, we set the rhs to the parm. In | ||||
1369 | move_sese_region_to_fn, we introduce a default def for the | ||||
1370 | parm, map the parm to it's default def, and once we encounter | ||||
1371 | this stmt, replace the parm with the default def. */ | ||||
1372 | gimple_assign_set_rhs1 (parcopy_stmt, arg); | ||||
1373 | update_stmt (parcopy_stmt); | ||||
1374 | } | ||||
1375 | } | ||||
1376 | |||||
1377 | /* Declare local variables needed in CHILD_CFUN. */ | ||||
1378 | block = DECL_INITIAL (child_fn)((contains_struct_check ((child_fn), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1378, __FUNCTION__))->decl_common.initial); | ||||
1379 | BLOCK_VARS (block)((tree_check ((block), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1379, __FUNCTION__, (BLOCK)))->block.vars) = vec2chain (child_cfun->local_decls); | ||||
1380 | /* The gimplifier could record temporaries in parallel/task block | ||||
1381 | rather than in containing function's local_decls chain, | ||||
1382 | which would mean cgraph missed finalizing them. Do it now. */ | ||||
1383 | for (t = BLOCK_VARS (block)((tree_check ((block), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1383, __FUNCTION__, (BLOCK)))->block.vars); t; t = DECL_CHAIN (t)(((contains_struct_check (((contains_struct_check ((t), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1383, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1383, __FUNCTION__))->common.chain))) | ||||
1384 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1384, __FUNCTION__))->decl_common.decl_flag_1)) | ||||
1385 | varpool_node::finalize_decl (t); | ||||
1386 | DECL_SAVED_TREE (child_fn)((tree_check ((child_fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1386, __FUNCTION__, (FUNCTION_DECL)))->function_decl.saved_tree ) = NULLnullptr; | ||||
1387 | /* We'll create a CFG for child_fn, so no gimple body is needed. */ | ||||
1388 | gimple_set_body (child_fn, NULLnullptr); | ||||
1389 | TREE_USED (block)((block)->base.used_flag) = 1; | ||||
1390 | |||||
1391 | /* Reset DECL_CONTEXT on function arguments. */ | ||||
1392 | for (t = DECL_ARGUMENTS (child_fn)((tree_check ((child_fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1392, __FUNCTION__, (FUNCTION_DECL)))->function_decl.arguments ); t; t = DECL_CHAIN (t)(((contains_struct_check (((contains_struct_check ((t), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1392, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1392, __FUNCTION__))->common.chain))) | ||||
1393 | DECL_CONTEXT (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1393, __FUNCTION__))->decl_minimal.context) = child_fn; | ||||
1394 | |||||
1395 | /* Split ENTRY_BB at GIMPLE_OMP_PARALLEL or GIMPLE_OMP_TASK, | ||||
1396 | so that it can be moved to the child function. */ | ||||
1397 | gsi = gsi_last_nondebug_bb (entry_bb); | ||||
1398 | stmt = gsi_stmt (gsi); | ||||
1399 | 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1401, __FUNCTION__), 0 : 0)) | ||||
1400 | || 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1401, __FUNCTION__), 0 : 0)) | ||||
1401 | || 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1401, __FUNCTION__), 0 : 0)); | ||||
1402 | e = split_block (entry_bb, stmt); | ||||
1403 | gsi_remove (&gsi, true); | ||||
1404 | entry_bb = e->dest; | ||||
1405 | edge e2 = NULLnullptr; | ||||
1406 | if (gimple_code (entry_stmt) != GIMPLE_OMP_TASK) | ||||
1407 | single_succ_edge (entry_bb)->flags = EDGE_FALLTHRU; | ||||
1408 | else | ||||
1409 | { | ||||
1410 | 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); | ||||
1411 | gcc_assert (e2->dest == region->exit)((void)(!(e2->dest == region->exit) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1411, __FUNCTION__), 0 : 0)); | ||||
1412 | remove_edge (BRANCH_EDGE (entry_bb)((*((entry_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(1)] : (*((entry_bb))->succs) [(0)])); | ||||
1413 | set_immediate_dominator (CDI_DOMINATORS, e2->dest, e->src); | ||||
1414 | gsi = gsi_last_nondebug_bb (region->exit); | ||||
1415 | gcc_assert (!gsi_end_p (gsi)((void)(!(!gsi_end_p (gsi) && gimple_code (gsi_stmt ( gsi)) == GIMPLE_OMP_RETURN) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1416, __FUNCTION__), 0 : 0)) | ||||
1416 | && gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_RETURN)((void)(!(!gsi_end_p (gsi) && gimple_code (gsi_stmt ( gsi)) == GIMPLE_OMP_RETURN) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1416, __FUNCTION__), 0 : 0)); | ||||
1417 | gsi_remove (&gsi, true); | ||||
1418 | } | ||||
1419 | |||||
1420 | /* Convert GIMPLE_OMP_{RETURN,CONTINUE} into a RETURN_EXPR. */ | ||||
1421 | if (exit_bb) | ||||
1422 | { | ||||
1423 | gsi = gsi_last_nondebug_bb (exit_bb); | ||||
1424 | 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1426, __FUNCTION__), 0 : 0)) | ||||
1425 | && (gimple_code (gsi_stmt (gsi))((void)(!(!gsi_end_p (gsi) && (gimple_code (gsi_stmt ( gsi)) == (e2 ? GIMPLE_OMP_CONTINUE : GIMPLE_OMP_RETURN))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1426, __FUNCTION__), 0 : 0)) | ||||
1426 | == (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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1426, __FUNCTION__), 0 : 0)); | ||||
1427 | stmt = gimple_build_return (NULLnullptr); | ||||
1428 | gsi_insert_after (&gsi, stmt, GSI_SAME_STMT); | ||||
1429 | gsi_remove (&gsi, true); | ||||
1430 | } | ||||
1431 | |||||
1432 | /* Move the parallel region into CHILD_CFUN. */ | ||||
1433 | |||||
1434 | if (gimple_in_ssa_p (cfun(cfun + 0))) | ||||
1435 | { | ||||
1436 | init_tree_ssa (child_cfun); | ||||
1437 | init_ssa_operands (child_cfun); | ||||
1438 | child_cfun->gimple_df->in_ssa_p = true; | ||||
1439 | block = NULL_TREE(tree) nullptr; | ||||
1440 | } | ||||
1441 | else | ||||
1442 | block = gimple_block (entry_stmt); | ||||
1443 | |||||
1444 | new_bb = move_sese_region_to_fn (child_cfun, entry_bb, exit_bb, block); | ||||
1445 | if (exit_bb) | ||||
1446 | single_succ_edge (new_bb)->flags = EDGE_FALLTHRU; | ||||
1447 | if (e2) | ||||
1448 | { | ||||
1449 | basic_block dest_bb = e2->dest; | ||||
1450 | if (!exit_bb) | ||||
1451 | make_edge (new_bb, dest_bb, EDGE_FALLTHRU); | ||||
1452 | remove_edge (e2); | ||||
1453 | set_immediate_dominator (CDI_DOMINATORS, dest_bb, new_bb); | ||||
1454 | } | ||||
1455 | /* When the OMP expansion process cannot guarantee an up-to-date | ||||
1456 | loop tree arrange for the child function to fixup loops. */ | ||||
1457 | if (loops_state_satisfies_p (LOOPS_NEED_FIXUP)) | ||||
1458 | child_cfun->x_current_loops->state |= LOOPS_NEED_FIXUP; | ||||
1459 | |||||
1460 | /* Remove non-local VAR_DECLs from child_cfun->local_decls list. */ | ||||
1461 | num = vec_safe_length (child_cfun->local_decls); | ||||
1462 | for (srcidx = 0, dstidx = 0; srcidx < num; srcidx++) | ||||
1463 | { | ||||
1464 | t = (*child_cfun->local_decls)[srcidx]; | ||||
1465 | if (DECL_CONTEXT (t)((contains_struct_check ((t), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1465, __FUNCTION__))->decl_minimal.context) == cfun(cfun + 0)->decl) | ||||
1466 | continue; | ||||
1467 | if (srcidx != dstidx) | ||||
1468 | (*child_cfun->local_decls)[dstidx] = t; | ||||
1469 | dstidx++; | ||||
1470 | } | ||||
1471 | if (dstidx != num) | ||||
1472 | vec_safe_truncate (child_cfun->local_decls, dstidx); | ||||
1473 | |||||
1474 | /* Inform the callgraph about the new function. */ | ||||
1475 | child_cfun->curr_properties = cfun(cfun + 0)->curr_properties; | ||||
1476 | child_cfun->has_simduid_loops |= cfun(cfun + 0)->has_simduid_loops; | ||||
1477 | child_cfun->has_force_vectorize_loops |= cfun(cfun + 0)->has_force_vectorize_loops; | ||||
1478 | cgraph_node *node = cgraph_node::get_create (child_fn); | ||||
1479 | node->parallelized_function = 1; | ||||
1480 | cgraph_node::add_new_function (child_fn, true); | ||||
1481 | |||||
1482 | bool need_asm = DECL_ASSEMBLER_NAME_SET_P (current_function_decl)(((contains_struct_check ((current_function_decl), (TS_DECL_WITH_VIS ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1482, __FUNCTION__))->decl_with_vis.assembler_name) != ( tree) nullptr) | ||||
1483 | && !DECL_ASSEMBLER_NAME_SET_P (child_fn)(((contains_struct_check ((child_fn), (TS_DECL_WITH_VIS), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1483, __FUNCTION__))->decl_with_vis.assembler_name) != ( tree) nullptr); | ||||
1484 | |||||
1485 | /* Fix the callgraph edges for child_cfun. Those for cfun will be | ||||
1486 | fixed in a following pass. */ | ||||
1487 | push_cfun (child_cfun); | ||||
1488 | if (need_asm) | ||||
1489 | assign_assembler_name_if_needed (child_fn); | ||||
1490 | |||||
1491 | if (optimizeglobal_options.x_optimize) | ||||
1492 | optimize_omp_library_calls (entry_stmt); | ||||
1493 | update_max_bb_count (); | ||||
1494 | cgraph_edge::rebuild_edges (); | ||||
1495 | |||||
1496 | /* Some EH regions might become dead, see PR34608. If | ||||
1497 | pass_cleanup_cfg isn't the first pass to happen with the | ||||
1498 | new child, these dead EH edges might cause problems. | ||||
1499 | Clean them up now. */ | ||||
1500 | if (flag_exceptionsglobal_options.x_flag_exceptions) | ||||
1501 | { | ||||
1502 | basic_block bb; | ||||
1503 | bool changed = false; | ||||
1504 | |||||
1505 | 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) | ||||
1506 | changed |= gimple_purge_dead_eh_edges (bb); | ||||
1507 | if (changed) | ||||
1508 | cleanup_tree_cfg (); | ||||
1509 | } | ||||
1510 | if (gimple_in_ssa_p (cfun(cfun + 0))) | ||||
1511 | update_ssa (TODO_update_ssa(1 << 11)); | ||||
1512 | if (flag_checkingglobal_options.x_flag_checking && !loops_state_satisfies_p (LOOPS_NEED_FIXUP)) | ||||
1513 | verify_loop_structure (); | ||||
1514 | pop_cfun (); | ||||
1515 | |||||
1516 | if (dump_file && !gimple_in_ssa_p (cfun(cfun + 0))) | ||||
1517 | { | ||||
1518 | omp_any_child_fn_dumped = true; | ||||
1519 | dump_function_header (dump_file, child_fn, dump_flags); | ||||
1520 | dump_function_to_file (child_fn, dump_file, dump_flags); | ||||
1521 | } | ||||
1522 | } | ||||
1523 | |||||
1524 | adjust_context_and_scope (region, gimple_block (entry_stmt), child_fn); | ||||
1525 | |||||
1526 | if (gimple_code (entry_stmt) == GIMPLE_OMP_PARALLEL) | ||||
1527 | expand_parallel_call (region, new_bb, | ||||
1528 | as_a <gomp_parallel *> (entry_stmt), ws_args); | ||||
1529 | else if (gimple_code (entry_stmt) == GIMPLE_OMP_TEAMS) | ||||
1530 | expand_teams_call (new_bb, as_a <gomp_teams *> (entry_stmt)); | ||||
1531 | else | ||||
1532 | expand_task_call (region, new_bb, as_a <gomp_task *> (entry_stmt)); | ||||
1533 | } | ||||
1534 | |||||
1535 | /* Information about members of an OpenACC collapsed loop nest. */ | ||||
1536 | |||||
1537 | struct oacc_collapse | ||||
1538 | { | ||||
1539 | tree base; /* Base value. */ | ||||
1540 | tree iters; /* Number of steps. */ | ||||
1541 | tree step; /* Step size. */ | ||||
1542 | tree tile; /* Tile increment (if tiled). */ | ||||
1543 | tree outer; /* Tile iterator var. */ | ||||
1544 | }; | ||||
1545 | |||||
1546 | /* Helper for expand_oacc_for. Determine collapsed loop information. | ||||
1547 | Fill in COUNTS array. Emit any initialization code before GSI. | ||||
1548 | Return the calculated outer loop bound of BOUND_TYPE. */ | ||||
1549 | |||||
1550 | static tree | ||||
1551 | expand_oacc_collapse_init (const struct omp_for_data *fd, | ||||
1552 | gimple_stmt_iterator *gsi, | ||||
1553 | oacc_collapse *counts, tree diff_type, | ||||
1554 | tree bound_type, location_t loc) | ||||
1555 | { | ||||
1556 | tree tiling = fd->tiling; | ||||
1557 | tree total = build_int_cst (bound_type, 1); | ||||
1558 | int ix; | ||||
1559 | |||||
1560 | gcc_assert (integer_onep (fd->loop.step))((void)(!(integer_onep (fd->loop.step)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1560, __FUNCTION__), 0 : 0)); | ||||
1561 | gcc_assert (integer_zerop (fd->loop.n1))((void)(!(integer_zerop (fd->loop.n1)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1561, __FUNCTION__), 0 : 0)); | ||||
1562 | |||||
1563 | /* When tiling, the first operand of the tile clause applies to the | ||||
1564 | innermost loop, and we work outwards from there. Seems | ||||
1565 | backwards, but whatever. */ | ||||
1566 | for (ix = fd->collapse; ix--;) | ||||
1567 | { | ||||
1568 | const omp_for_data_loop *loop = &fd->loops[ix]; | ||||
1569 | |||||
1570 | tree iter_type = TREE_TYPE (loop->v)((contains_struct_check ((loop->v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1570, __FUNCTION__))->typed.type); | ||||
1571 | tree plus_type = iter_type; | ||||
1572 | |||||
1573 | gcc_assert (loop->cond_code == LT_EXPR || loop->cond_code == GT_EXPR)((void)(!(loop->cond_code == LT_EXPR || loop->cond_code == GT_EXPR) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1573, __FUNCTION__), 0 : 0)); | ||||
1574 | |||||
1575 | if (POINTER_TYPE_P (iter_type)(((enum tree_code) (iter_type)->base.code) == POINTER_TYPE || ((enum tree_code) (iter_type)->base.code) == REFERENCE_TYPE )) | ||||
1576 | plus_type = sizetypesizetype_tab[(int) stk_sizetype]; | ||||
1577 | |||||
1578 | if (tiling) | ||||
1579 | { | ||||
1580 | tree num = build_int_cst (integer_type_nodeinteger_types[itk_int], fd->collapse); | ||||
1581 | tree loop_no = build_int_cst (integer_type_nodeinteger_types[itk_int], ix); | ||||
1582 | tree tile = TREE_VALUE (tiling)((tree_check ((tiling), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1582, __FUNCTION__, (TREE_LIST)))->list.value); | ||||
1583 | gcall *call | ||||
1584 | = gimple_build_call_internal (IFN_GOACC_TILE, 5, num, loop_no, tile, | ||||
1585 | /* gwv-outer=*/integer_zero_nodeglobal_trees[TI_INTEGER_ZERO], | ||||
1586 | /* gwv-inner=*/integer_zero_nodeglobal_trees[TI_INTEGER_ZERO]); | ||||
1587 | |||||
1588 | counts[ix].outer = create_tmp_var (iter_type, ".outer"); | ||||
1589 | counts[ix].tile = create_tmp_var (diff_type, ".tile"); | ||||
1590 | gimple_call_set_lhs (call, counts[ix].tile); | ||||
1591 | gimple_set_location (call, loc); | ||||
1592 | gsi_insert_before (gsi, call, GSI_SAME_STMT); | ||||
1593 | |||||
1594 | tiling = TREE_CHAIN (tiling)((contains_struct_check ((tiling), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1594, __FUNCTION__))->common.chain); | ||||
1595 | } | ||||
1596 | else | ||||
1597 | { | ||||
1598 | counts[ix].tile = NULLnullptr; | ||||
1599 | counts[ix].outer = loop->v; | ||||
1600 | } | ||||
1601 | |||||
1602 | tree b = loop->n1; | ||||
1603 | tree e = loop->n2; | ||||
1604 | tree s = loop->step; | ||||
1605 | bool up = loop->cond_code == LT_EXPR; | ||||
1606 | tree dir = build_int_cst (diff_type, up ? +1 : -1); | ||||
1607 | bool negating; | ||||
1608 | tree expr; | ||||
1609 | |||||
1610 | b = force_gimple_operand_gsi (gsi, b, true, NULL_TREE(tree) nullptr, | ||||
1611 | true, GSI_SAME_STMT); | ||||
1612 | e = force_gimple_operand_gsi (gsi, e, true, NULL_TREE(tree) nullptr, | ||||
1613 | true, GSI_SAME_STMT); | ||||
1614 | |||||
1615 | /* Convert the step, avoiding possible unsigned->signed overflow. */ | ||||
1616 | negating = !up && TYPE_UNSIGNED (TREE_TYPE (s))((tree_class_check ((((contains_struct_check ((s), (TS_TYPED) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1616, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1616, __FUNCTION__))->base.u.bits.unsigned_flag); | ||||
1617 | if (negating) | ||||
1618 | s = fold_build1 (NEGATE_EXPR, TREE_TYPE (s), s)fold_build1_loc (((location_t) 0), NEGATE_EXPR, ((contains_struct_check ((s), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1618, __FUNCTION__))->typed.type), s ); | ||||
1619 | s = fold_convert (diff_type, s)fold_convert_loc (((location_t) 0), diff_type, s); | ||||
1620 | if (negating) | ||||
1621 | s = fold_build1 (NEGATE_EXPR, diff_type, s)fold_build1_loc (((location_t) 0), NEGATE_EXPR, diff_type, s ); | ||||
1622 | s = force_gimple_operand_gsi (gsi, s, true, NULL_TREE(tree) nullptr, | ||||
1623 | true, GSI_SAME_STMT); | ||||
1624 | |||||
1625 | /* Determine the range, avoiding possible unsigned->signed overflow. */ | ||||
1626 | negating = !up && TYPE_UNSIGNED (iter_type)((tree_class_check ((iter_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1626, __FUNCTION__))->base.u.bits.unsigned_flag); | ||||
1627 | 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) ) | ||||
1628 | 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) ) | ||||
1629 | 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) ); | ||||
1630 | expr = fold_convert (diff_type, expr)fold_convert_loc (((location_t) 0), diff_type, expr); | ||||
1631 | if (negating) | ||||
1632 | expr = fold_build1 (NEGATE_EXPR, diff_type, expr)fold_build1_loc (((location_t) 0), NEGATE_EXPR, diff_type, expr ); | ||||
1633 | tree range = force_gimple_operand_gsi | ||||
1634 | (gsi, expr, true, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); | ||||
1635 | |||||
1636 | /* Determine number of iterations. */ | ||||
1637 | expr = fold_build2 (MINUS_EXPR, diff_type, range, dir)fold_build2_loc (((location_t) 0), MINUS_EXPR, diff_type, range , dir ); | ||||
1638 | expr = fold_build2 (PLUS_EXPR, diff_type, expr, s)fold_build2_loc (((location_t) 0), PLUS_EXPR, diff_type, expr , s ); | ||||
1639 | expr = fold_build2 (TRUNC_DIV_EXPR, diff_type, expr, s)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, diff_type, expr, s ); | ||||
1640 | |||||
1641 | tree iters = force_gimple_operand_gsi (gsi, expr, true, NULL_TREE(tree) nullptr, | ||||
1642 | true, GSI_SAME_STMT); | ||||
1643 | |||||
1644 | counts[ix].base = b; | ||||
1645 | counts[ix].iters = iters; | ||||
1646 | counts[ix].step = s; | ||||
1647 | |||||
1648 | 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) ) | ||||
1649 | 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) ); | ||||
1650 | } | ||||
1651 | |||||
1652 | return total; | ||||
1653 | } | ||||
1654 | |||||
1655 | /* Emit initializers for collapsed loop members. INNER is true if | ||||
1656 | this is for the element loop of a TILE. IVAR is the outer | ||||
1657 | loop iteration variable, from which collapsed loop iteration values | ||||
1658 | are calculated. COUNTS array has been initialized by | ||||
1659 | expand_oacc_collapse_inits. */ | ||||
1660 | |||||
1661 | static void | ||||
1662 | expand_oacc_collapse_vars (const struct omp_for_data *fd, bool inner, | ||||
1663 | gimple_stmt_iterator *gsi, | ||||
1664 | const oacc_collapse *counts, tree ivar, | ||||
1665 | tree diff_type) | ||||
1666 | { | ||||
1667 | tree ivar_type = TREE_TYPE (ivar)((contains_struct_check ((ivar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1667, __FUNCTION__))->typed.type); | ||||
1668 | |||||
1669 | /* The most rapidly changing iteration variable is the innermost | ||||
1670 | one. */ | ||||
1671 | for (int ix = fd->collapse; ix--;) | ||||
1672 | { | ||||
1673 | const omp_for_data_loop *loop = &fd->loops[ix]; | ||||
1674 | const oacc_collapse *collapse = &counts[ix]; | ||||
1675 | tree v = inner ? loop->v : collapse->outer; | ||||
1676 | tree iter_type = TREE_TYPE (v)((contains_struct_check ((v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1676, __FUNCTION__))->typed.type); | ||||
1677 | tree plus_type = iter_type; | ||||
1678 | enum tree_code plus_code = PLUS_EXPR; | ||||
1679 | tree expr; | ||||
1680 | |||||
1681 | if (POINTER_TYPE_P (iter_type)(((enum tree_code) (iter_type)->base.code) == POINTER_TYPE || ((enum tree_code) (iter_type)->base.code) == REFERENCE_TYPE )) | ||||
1682 | { | ||||
1683 | plus_code = POINTER_PLUS_EXPR; | ||||
1684 | plus_type = sizetypesizetype_tab[(int) stk_sizetype]; | ||||
1685 | } | ||||
1686 | |||||
1687 | expr = ivar; | ||||
1688 | if (ix) | ||||
1689 | { | ||||
1690 | tree mod = fold_convert (ivar_type, collapse->iters)fold_convert_loc (((location_t) 0), ivar_type, collapse->iters ); | ||||
1691 | ivar = fold_build2 (TRUNC_DIV_EXPR, ivar_type, expr, mod)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, ivar_type, expr, mod ); | ||||
1692 | expr = fold_build2 (TRUNC_MOD_EXPR, ivar_type, expr, mod)fold_build2_loc (((location_t) 0), TRUNC_MOD_EXPR, ivar_type, expr, mod ); | ||||
1693 | ivar = force_gimple_operand_gsi (gsi, ivar, true, NULL_TREE(tree) nullptr, | ||||
1694 | true, GSI_SAME_STMT); | ||||
1695 | } | ||||
1696 | |||||
1697 | 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) ) | ||||
1698 | 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) ); | ||||
1699 | 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) ) | ||||
1700 | 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) ) | ||||
1701 | 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) ); | ||||
1702 | expr = force_gimple_operand_gsi (gsi, expr, false, NULL_TREE(tree) nullptr, | ||||
1703 | true, GSI_SAME_STMT); | ||||
1704 | gassign *ass = gimple_build_assign (v, expr); | ||||
1705 | gsi_insert_before (gsi, ass, GSI_SAME_STMT); | ||||
1706 | } | ||||
1707 | } | ||||
1708 | |||||
1709 | /* Helper function for expand_omp_{for_*,simd}. If this is the outermost | ||||
1710 | of the combined collapse > 1 loop constructs, generate code like: | ||||
1711 | if (__builtin_expect (N32 cond3 N31, 0)) goto ZERO_ITER_BB; | ||||
1712 | if (cond3 is <) | ||||
1713 | adj = STEP3 - 1; | ||||
1714 | else | ||||
1715 | adj = STEP3 + 1; | ||||
1716 | count3 = (adj + N32 - N31) / STEP3; | ||||
1717 | if (__builtin_expect (N22 cond2 N21, 0)) goto ZERO_ITER_BB; | ||||
1718 | if (cond2 is <) | ||||
1719 | adj = STEP2 - 1; | ||||
1720 | else | ||||
1721 | adj = STEP2 + 1; | ||||
1722 | count2 = (adj + N22 - N21) / STEP2; | ||||
1723 | if (__builtin_expect (N12 cond1 N11, 0)) goto ZERO_ITER_BB; | ||||
1724 | if (cond1 is <) | ||||
1725 | adj = STEP1 - 1; | ||||
1726 | else | ||||
1727 | adj = STEP1 + 1; | ||||
1728 | count1 = (adj + N12 - N11) / STEP1; | ||||
1729 | count = count1 * count2 * count3; | ||||
1730 | Furthermore, if ZERO_ITER_BB is NULL, create a BB which does: | ||||
1731 | count = 0; | ||||
1732 | and set ZERO_ITER_BB to that bb. If this isn't the outermost | ||||
1733 | of the combined loop constructs, just initialize COUNTS array | ||||
1734 | from the _looptemp_ clauses. For loop nests with non-rectangular | ||||
1735 | loops, do this only for the rectangular loops. Then pick | ||||
1736 | the loops which reference outer vars in their bound expressions | ||||
1737 | and the loops which they refer to and for this sub-nest compute | ||||
1738 | number of iterations. For triangular loops use Faulhaber's formula, | ||||
1739 | otherwise as a fallback, compute by iterating the loops. | ||||
1740 | If e.g. the sub-nest is | ||||
1741 | for (I = N11; I COND1 N12; I += STEP1) | ||||
1742 | for (J = M21 * I + N21; J COND2 M22 * I + N22; J += STEP2) | ||||
1743 | for (K = M31 * J + N31; K COND3 M32 * J + N32; K += STEP3) | ||||
1744 | do: | ||||
1745 | COUNT = 0; | ||||
1746 | for (tmpi = N11; tmpi COND1 N12; tmpi += STEP1) | ||||
1747 | for (tmpj = M21 * tmpi + N21; | ||||
1748 | tmpj COND2 M22 * tmpi + N22; tmpj += STEP2) | ||||
1749 | { | ||||
1750 | int tmpk1 = M31 * tmpj + N31; | ||||
1751 | int tmpk2 = M32 * tmpj + N32; | ||||
1752 | if (tmpk1 COND3 tmpk2) | ||||
1753 | { | ||||
1754 | if (COND3 is <) | ||||
1755 | adj = STEP3 - 1; | ||||
1756 | else | ||||
1757 | adj = STEP3 + 1; | ||||
1758 | COUNT += (adj + tmpk2 - tmpk1) / STEP3; | ||||
1759 | } | ||||
1760 | } | ||||
1761 | and finally multiply the counts of the rectangular loops not | ||||
1762 | in the sub-nest with COUNT. Also, as counts[fd->last_nonrect] | ||||
1763 | store number of iterations of the loops from fd->first_nonrect | ||||
1764 | to fd->last_nonrect inclusive, i.e. the above COUNT multiplied | ||||
1765 | by the counts of rectangular loops not referenced in any non-rectangular | ||||
1766 | loops sandwitched in between those. */ | ||||
1767 | |||||
1768 | /* NOTE: It *could* be better to moosh all of the BBs together, | ||||
1769 | creating one larger BB with all the computation and the unexpected | ||||
1770 | jump at the end. I.e. | ||||
1771 | |||||
1772 | bool zero3, zero2, zero1, zero; | ||||
1773 | |||||
1774 | zero3 = N32 c3 N31; | ||||
1775 | count3 = (N32 - N31) /[cl] STEP3; | ||||
1776 | zero2 = N22 c2 N21; | ||||
1777 | count2 = (N22 - N21) /[cl] STEP2; | ||||
1778 | zero1 = N12 c1 N11; | ||||
1779 | count1 = (N12 - N11) /[cl] STEP1; | ||||
1780 | zero = zero3 || zero2 || zero1; | ||||
1781 | count = count1 * count2 * count3; | ||||
1782 | if (__builtin_expect(zero, false)) goto zero_iter_bb; | ||||
1783 | |||||
1784 | After all, we expect the zero=false, and thus we expect to have to | ||||
1785 | evaluate all of the comparison expressions, so short-circuiting | ||||
1786 | oughtn't be a win. Since the condition isn't protecting a | ||||
1787 | denominator, we're not concerned about divide-by-zero, so we can | ||||
1788 | fully evaluate count even if a numerator turned out to be wrong. | ||||
1789 | |||||
1790 | It seems like putting this all together would create much better | ||||
1791 | scheduling opportunities, and less pressure on the chip's branch | ||||
1792 | predictor. */ | ||||
1793 | |||||
1794 | static void | ||||
1795 | expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi, | ||||
1796 | basic_block &entry_bb, tree *counts, | ||||
1797 | basic_block &zero_iter1_bb, int &first_zero_iter1, | ||||
1798 | basic_block &zero_iter2_bb, int &first_zero_iter2, | ||||
1799 | basic_block &l2_dom_bb) | ||||
1800 | { | ||||
1801 | tree t, type = TREE_TYPE (fd->loop.v)((contains_struct_check ((fd->loop.v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1801, __FUNCTION__))->typed.type); | ||||
1802 | edge e, ne; | ||||
1803 | int i; | ||||
1804 | |||||
1805 | /* Collapsed loops need work for expansion into SSA form. */ | ||||
1806 | gcc_assert (!gimple_in_ssa_p (cfun))((void)(!(!gimple_in_ssa_p ((cfun + 0))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1806, __FUNCTION__), 0 : 0)); | ||||
1807 | |||||
1808 | if (gimple_omp_for_combined_into_p (fd->for_stmt) | ||||
1809 | && TREE_CODE (fd->loop.n2)((enum tree_code) (fd->loop.n2)->base.code) != INTEGER_CST) | ||||
1810 | { | ||||
1811 | gcc_assert (fd->ordered == 0)((void)(!(fd->ordered == 0) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1811, __FUNCTION__), 0 : 0)); | ||||
1812 | /* First two _looptemp_ clauses are for istart/iend, counts[0] | ||||
1813 | isn't supposed to be handled, as the inner loop doesn't | ||||
1814 | use it. */ | ||||
1815 | tree innerc = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), | ||||
1816 | OMP_CLAUSE__LOOPTEMP_); | ||||
1817 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1817, __FUNCTION__), 0 : 0)); | ||||
1818 | for (i = 0; i < fd->collapse; i++) | ||||
1819 | { | ||||
1820 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1820, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1820, __FUNCTION__))->common.chain), | ||||
1821 | OMP_CLAUSE__LOOPTEMP_); | ||||
1822 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1822, __FUNCTION__), 0 : 0)); | ||||
1823 | if (i) | ||||
1824 | counts[i] = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1824, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1824, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1824, __FUNCTION__))); | ||||
1825 | else | ||||
1826 | counts[0] = NULL_TREE(tree) nullptr; | ||||
1827 | } | ||||
1828 | if (fd->non_rect | ||||
1829 | && fd->last_nonrect == fd->first_nonrect + 1 | ||||
1830 | && !TYPE_UNSIGNED (TREE_TYPE (fd->loops[fd->last_nonrect].v))((tree_class_check ((((contains_struct_check ((fd->loops[fd ->last_nonrect].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1830, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1830, __FUNCTION__))->base.u.bits.unsigned_flag)) | ||||
1831 | { | ||||
1832 | tree c[4]; | ||||
1833 | for (i = 0; i < 4; i++) | ||||
1834 | { | ||||
1835 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1835, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1835, __FUNCTION__))->common.chain), | ||||
1836 | OMP_CLAUSE__LOOPTEMP_); | ||||
1837 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1837, __FUNCTION__), 0 : 0)); | ||||
1838 | c[i] = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1838, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1838, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1838, __FUNCTION__))); | ||||
1839 | } | ||||
1840 | counts[0] = c[0]; | ||||
1841 | fd->first_inner_iterations = c[1]; | ||||
1842 | fd->factor = c[2]; | ||||
1843 | fd->adjn1 = c[3]; | ||||
1844 | } | ||||
1845 | return; | ||||
1846 | } | ||||
1847 | |||||
1848 | for (i = fd->collapse; i < fd->ordered; i++) | ||||
1849 | { | ||||
1850 | tree itype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1850, __FUNCTION__))->typed.type); | ||||
1851 | counts[i] = NULL_TREE(tree) nullptr; | ||||
1852 | 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)) | ||||
1853 | 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)) | ||||
1854 | 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)); | ||||
1855 | if (t && integer_zerop (t)) | ||||
1856 | { | ||||
1857 | for (i = fd->collapse; i < fd->ordered; i++) | ||||
1858 | counts[i] = build_int_cst (type, 0); | ||||
1859 | break; | ||||
1860 | } | ||||
1861 | } | ||||
1862 | bool rect_count_seen = false; | ||||
1863 | for (i = 0; i < (fd->ordered ? fd->ordered : fd->collapse); i++) | ||||
1864 | { | ||||
1865 | tree itype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1865, __FUNCTION__))->typed.type); | ||||
1866 | |||||
1867 | if (i >= fd->collapse && counts[i]) | ||||
1868 | continue; | ||||
1869 | if (fd->non_rect) | ||||
1870 | { | ||||
1871 | /* Skip loops that use outer iterators in their expressions | ||||
1872 | during this phase. */ | ||||
1873 | if (fd->loops[i].m1 || fd->loops[i].m2) | ||||
1874 | { | ||||
1875 | counts[i] = build_zero_cst (type); | ||||
1876 | continue; | ||||
1877 | } | ||||
1878 | } | ||||
1879 | 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) | ||||
1880 | && ((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)) | ||||
1881 | 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)) | ||||
1882 | 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))) | ||||
1883 | == NULL_TREE(tree) nullptr || !integer_onep (t))) | ||||
1884 | { | ||||
1885 | gcond *cond_stmt; | ||||
1886 | tree n1, n2; | ||||
1887 | n1 = fold_convert (itype, unshare_expr (fd->loops[i].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n1)); | ||||
1888 | n1 = force_gimple_operand_gsi (gsi, n1, true, NULL_TREE(tree) nullptr, | ||||
1889 | true, GSI_SAME_STMT); | ||||
1890 | n2 = fold_convert (itype, unshare_expr (fd->loops[i].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n2)); | ||||
1891 | n2 = force_gimple_operand_gsi (gsi, n2, true, NULL_TREE(tree) nullptr, | ||||
1892 | true, GSI_SAME_STMT); | ||||
1893 | cond_stmt = expand_omp_build_cond (gsi, fd->loops[i].cond_code, | ||||
1894 | n1, n2); | ||||
1895 | e = split_block (entry_bb, cond_stmt); | ||||
1896 | basic_block &zero_iter_bb | ||||
1897 | = i < fd->collapse ? zero_iter1_bb : zero_iter2_bb; | ||||
1898 | int &first_zero_iter | ||||
1899 | = i < fd->collapse ? first_zero_iter1 : first_zero_iter2; | ||||
1900 | if (zero_iter_bb == NULLnullptr) | ||||
1901 | { | ||||
1902 | gassign *assign_stmt; | ||||
1903 | first_zero_iter = i; | ||||
1904 | zero_iter_bb = create_empty_bb (entry_bb); | ||||
1905 | add_bb_to_loop (zero_iter_bb, entry_bb->loop_father); | ||||
1906 | *gsi = gsi_after_labels (zero_iter_bb); | ||||
1907 | if (i < fd->collapse) | ||||
1908 | assign_stmt = gimple_build_assign (fd->loop.n2, | ||||
1909 | build_zero_cst (type)); | ||||
1910 | else | ||||
1911 | { | ||||
1912 | counts[i] = create_tmp_reg (type, ".count"); | ||||
1913 | assign_stmt | ||||
1914 | = gimple_build_assign (counts[i], build_zero_cst (type)); | ||||
1915 | } | ||||
1916 | gsi_insert_before (gsi, assign_stmt, GSI_SAME_STMT); | ||||
1917 | set_immediate_dominator (CDI_DOMINATORS, zero_iter_bb, | ||||
1918 | entry_bb); | ||||
1919 | } | ||||
1920 | ne = make_edge (entry_bb, zero_iter_bb, EDGE_FALSE_VALUE); | ||||
1921 | ne->probability = profile_probability::very_unlikely (); | ||||
1922 | e->flags = EDGE_TRUE_VALUE; | ||||
1923 | e->probability = ne->probability.invert (); | ||||
1924 | if (l2_dom_bb == NULLnullptr) | ||||
1925 | l2_dom_bb = entry_bb; | ||||
1926 | entry_bb = e->dest; | ||||
1927 | *gsi = gsi_last_nondebug_bb (entry_bb); | ||||
1928 | } | ||||
1929 | |||||
1930 | if (POINTER_TYPE_P (itype)(((enum tree_code) (itype)->base.code) == POINTER_TYPE || ( (enum tree_code) (itype)->base.code) == REFERENCE_TYPE)) | ||||
1931 | itype = signed_type_for (itype); | ||||
1932 | t = build_int_cst (itype, (fd->loops[i].cond_code == LT_EXPR | ||||
1933 | ? -1 : 1)); | ||||
1934 | 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 ) | ||||
1935 | 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 ); | ||||
1936 | 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) ) | ||||
1937 | 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) ); | ||||
1938 | 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) ) | ||||
1939 | 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) ); | ||||
1940 | /* ?? We could probably use CEIL_DIV_EXPR instead of | ||||
1941 | TRUNC_DIV_EXPR and adjusting by hand. Unless we can't | ||||
1942 | generate the same code in the end because generically we | ||||
1943 | don't know that the values involved must be negative for | ||||
1944 | GT?? */ | ||||
1945 | if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1945, __FUNCTION__))->base.u.bits.unsigned_flag) && fd->loops[i].cond_code == GT_EXPR) | ||||
1946 | 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) ) ) | ||||
1947 | 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) ) ) | ||||
1948 | 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) ) ) | ||||
1949 | 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) ) ) | ||||
1950 | 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) ) ); | ||||
1951 | else | ||||
1952 | 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) ) | ||||
1953 | 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) ); | ||||
1954 | t = fold_convert (type, t)fold_convert_loc (((location_t) 0), type, t); | ||||
1955 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) == INTEGER_CST) | ||||
1956 | counts[i] = t; | ||||
1957 | else | ||||
1958 | { | ||||
1959 | if (i < fd->collapse || i != first_zero_iter2) | ||||
1960 | counts[i] = create_tmp_reg (type, ".count"); | ||||
1961 | expand_omp_build_assign (gsi, counts[i], t); | ||||
1962 | } | ||||
1963 | 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) | ||||
1964 | { | ||||
1965 | if (fd->non_rect && i >= fd->first_nonrect && i <= fd->last_nonrect) | ||||
1966 | continue; | ||||
1967 | if (!rect_count_seen) | ||||
1968 | { | ||||
1969 | t = counts[i]; | ||||
1970 | rect_count_seen = true; | ||||
1971 | } | ||||
1972 | else | ||||
1973 | 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] ); | ||||
1974 | expand_omp_build_assign (gsi, fd->loop.n2, t); | ||||
1975 | } | ||||
1976 | } | ||||
1977 | 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 )) | ||||
1978 | { | ||||
1979 | gcc_assert (fd->last_nonrect != -1)((void)(!(fd->last_nonrect != -1) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1979, __FUNCTION__), 0 : 0)); | ||||
1980 | |||||
1981 | counts[fd->last_nonrect] = create_tmp_reg (type, ".count"); | ||||
1982 | expand_omp_build_assign (gsi, counts[fd->last_nonrect], | ||||
1983 | build_zero_cst (type)); | ||||
1984 | for (i = fd->first_nonrect + 1; i < fd->last_nonrect; i++) | ||||
1985 | if (fd->loops[i].m1 | ||||
1986 | || fd->loops[i].m2 | ||||
1987 | || fd->loops[i].non_rect_referenced) | ||||
1988 | break; | ||||
1989 | if (i == fd->last_nonrect | ||||
1990 | && fd->loops[i].outer == fd->last_nonrect - fd->first_nonrect | ||||
1991 | && !POINTER_TYPE_P (TREE_TYPE (fd->loops[i].v))(((enum tree_code) (((contains_struct_check ((fd->loops[i] .v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1991, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((fd->loops [i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1991, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) | ||||
1992 | && !TYPE_UNSIGNED (TREE_TYPE (fd->loops[i].v))((tree_class_check ((((contains_struct_check ((fd->loops[i ].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1992, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1992, __FUNCTION__))->base.u.bits.unsigned_flag)) | ||||
1993 | { | ||||
1994 | int o = fd->first_nonrect; | ||||
1995 | tree itype = TREE_TYPE (fd->loops[o].v)((contains_struct_check ((fd->loops[o].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 1995, __FUNCTION__))->typed.type); | ||||
1996 | tree n1o = create_tmp_reg (itype, ".n1o"); | ||||
1997 | t = fold_convert (itype, unshare_expr (fd->loops[o].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[o].n1)); | ||||
1998 | expand_omp_build_assign (gsi, n1o, t); | ||||
1999 | tree n2o = create_tmp_reg (itype, ".n2o"); | ||||
2000 | t = fold_convert (itype, unshare_expr (fd->loops[o].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[o].n2)); | ||||
2001 | expand_omp_build_assign (gsi, n2o, t); | ||||
2002 | if (fd->loops[i].m1 && fd->loops[i].m2) | ||||
2003 | 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) ) | ||||
2004 | 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) ); | ||||
2005 | else if (fd->loops[i].m1) | ||||
2006 | t = fold_build1 (NEGATE_EXPR, itype,fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, unshare_expr (fd->loops[i].m1) ) | ||||
2007 | unshare_expr (fd->loops[i].m1))fold_build1_loc (((location_t) 0), NEGATE_EXPR, itype, unshare_expr (fd->loops[i].m1) ); | ||||
2008 | else | ||||
2009 | t = unshare_expr (fd->loops[i].m2); | ||||
2010 | tree m2minusm1 | ||||
2011 | = force_gimple_operand_gsi (gsi, t, true, NULL_TREE(tree) nullptr, | ||||
2012 | true, GSI_SAME_STMT); | ||||
2013 | |||||
2014 | gimple_stmt_iterator gsi2 = *gsi; | ||||
2015 | gsi_prev (&gsi2); | ||||
2016 | e = split_block (entry_bb, gsi_stmt (gsi2)); | ||||
2017 | e = split_block (e->dest, (gimple *) NULLnullptr); | ||||
2018 | basic_block bb1 = e->src; | ||||
2019 | entry_bb = e->dest; | ||||
2020 | *gsi = gsi_after_labels (entry_bb); | ||||
2021 | |||||
2022 | gsi2 = gsi_after_labels (bb1); | ||||
2023 | tree ostep = fold_convert (itype, fd->loops[o].step)fold_convert_loc (((location_t) 0), itype, fd->loops[o].step ); | ||||
2024 | t = build_int_cst (itype, (fd->loops[o].cond_code | ||||
2025 | == LT_EXPR ? -1 : 1)); | ||||
2026 | t = fold_build2 (PLUS_EXPR, itype, ostep, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, ostep, t ); | ||||
2027 | t = fold_build2 (PLUS_EXPR, itype, t, n2o)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, n2o ); | ||||
2028 | t = fold_build2 (MINUS_EXPR, itype, t, n1o)fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, t, n1o ); | ||||
2029 | if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2029, __FUNCTION__))->base.u.bits.unsigned_flag) | ||||
2030 | && fd->loops[o].cond_code == GT_EXPR) | ||||
2031 | 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 ) ) | ||||
2032 | 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 ) ) | ||||
2033 | 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 ) ); | ||||
2034 | else | ||||
2035 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t, ostep)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, ostep ); | ||||
2036 | tree outer_niters | ||||
2037 | = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
2038 | true, GSI_SAME_STMT); | ||||
2039 | t = fold_build2 (MINUS_EXPR, itype, outer_niters,fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, outer_niters , build_one_cst (itype) ) | ||||
2040 | build_one_cst (itype))fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, outer_niters , build_one_cst (itype) ); | ||||
2041 | t = fold_build2 (MULT_EXPR, itype, t, ostep)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, ostep ); | ||||
2042 | t = fold_build2 (PLUS_EXPR, itype, n1o, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1o, t ); | ||||
2043 | tree last = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
2044 | true, GSI_SAME_STMT); | ||||
2045 | tree n1, n2, n1e, n2e; | ||||
2046 | t = fold_convert (itype, unshare_expr (fd->loops[i].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n1)); | ||||
2047 | if (fd->loops[i].m1) | ||||
2048 | { | ||||
2049 | n1 = fold_convert (itype, unshare_expr (fd->loops[i].m1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m1)); | ||||
2050 | n1 = fold_build2 (MULT_EXPR, itype, n1o, n1)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, n1o, n1 ); | ||||
2051 | n1 = fold_build2 (PLUS_EXPR, itype, n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1, t ); | ||||
2052 | } | ||||
2053 | else | ||||
2054 | n1 = t; | ||||
2055 | n1 = force_gimple_operand_gsi (&gsi2, n1, true, NULL_TREE(tree) nullptr, | ||||
2056 | true, GSI_SAME_STMT); | ||||
2057 | t = fold_convert (itype, unshare_expr (fd->loops[i].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n2)); | ||||
2058 | if (fd->loops[i].m2) | ||||
2059 | { | ||||
2060 | n2 = fold_convert (itype, unshare_expr (fd->loops[i].m2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m2)); | ||||
2061 | n2 = fold_build2 (MULT_EXPR, itype, n1o, n2)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, n1o, n2 ); | ||||
2062 | n2 = fold_build2 (PLUS_EXPR, itype, n2, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n2, t ); | ||||
2063 | } | ||||
2064 | else | ||||
2065 | n2 = t; | ||||
2066 | n2 = force_gimple_operand_gsi (&gsi2, n2, true, NULL_TREE(tree) nullptr, | ||||
2067 | true, GSI_SAME_STMT); | ||||
2068 | t = fold_convert (itype, unshare_expr (fd->loops[i].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n1)); | ||||
2069 | if (fd->loops[i].m1) | ||||
2070 | { | ||||
2071 | n1e = fold_convert (itype, unshare_expr (fd->loops[i].m1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m1)); | ||||
2072 | n1e = fold_build2 (MULT_EXPR, itype, last, n1e)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, last, n1e ); | ||||
2073 | n1e = fold_build2 (PLUS_EXPR, itype, n1e, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1e, t ); | ||||
2074 | } | ||||
2075 | else | ||||
2076 | n1e = t; | ||||
2077 | n1e = force_gimple_operand_gsi (&gsi2, n1e, true, NULL_TREE(tree) nullptr, | ||||
2078 | true, GSI_SAME_STMT); | ||||
2079 | t = fold_convert (itype, unshare_expr (fd->loops[i].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n2)); | ||||
2080 | if (fd->loops[i].m2) | ||||
2081 | { | ||||
2082 | n2e = fold_convert (itype, unshare_expr (fd->loops[i].m2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m2)); | ||||
2083 | n2e = fold_build2 (MULT_EXPR, itype, last, n2e)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, last, n2e ); | ||||
2084 | n2e = fold_build2 (PLUS_EXPR, itype, n2e, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n2e, t ); | ||||
2085 | } | ||||
2086 | else | ||||
2087 | n2e = t; | ||||
2088 | n2e = force_gimple_operand_gsi (&gsi2, n2e, true, NULL_TREE(tree) nullptr, | ||||
2089 | true, GSI_SAME_STMT); | ||||
2090 | gcond *cond_stmt | ||||
2091 | = expand_omp_build_cond (&gsi2, fd->loops[i].cond_code, | ||||
2092 | n1, n2); | ||||
2093 | e = split_block (bb1, cond_stmt); | ||||
2094 | e->flags = EDGE_TRUE_VALUE; | ||||
2095 | e->probability = profile_probability::likely ().guessed (); | ||||
2096 | basic_block bb2 = e->dest; | ||||
2097 | gsi2 = gsi_after_labels (bb2); | ||||
2098 | |||||
2099 | cond_stmt = expand_omp_build_cond (&gsi2, fd->loops[i].cond_code, | ||||
2100 | n1e, n2e); | ||||
2101 | e = split_block (bb2, cond_stmt); | ||||
2102 | e->flags = EDGE_TRUE_VALUE; | ||||
2103 | e->probability = profile_probability::likely ().guessed (); | ||||
2104 | gsi2 = gsi_after_labels (e->dest); | ||||
2105 | |||||
2106 | tree step = fold_convert (itype, fd->loops[i].step)fold_convert_loc (((location_t) 0), itype, fd->loops[i].step ); | ||||
2107 | t = build_int_cst (itype, (fd->loops[i].cond_code | ||||
2108 | == LT_EXPR ? -1 : 1)); | ||||
2109 | t = fold_build2 (PLUS_EXPR, itype, step, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, step, t ); | ||||
2110 | t = fold_build2 (PLUS_EXPR, itype, t, n2)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, n2 ); | ||||
2111 | t = fold_build2 (MINUS_EXPR, itype, t, n1)fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, t, n1 ); | ||||
2112 | if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2112, __FUNCTION__))->base.u.bits.unsigned_flag) | ||||
2113 | && fd->loops[i].cond_code == GT_EXPR) | ||||
2114 | 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 ) ) | ||||
2115 | 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 ) ) | ||||
2116 | 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 ) ); | ||||
2117 | else | ||||
2118 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t, step)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, step ); | ||||
2119 | tree first_inner_iterations | ||||
2120 | = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
2121 | true, GSI_SAME_STMT); | ||||
2122 | t = fold_build2 (MULT_EXPR, itype, m2minusm1, ostep)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, m2minusm1 , ostep ); | ||||
2123 | if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2123, __FUNCTION__))->base.u.bits.unsigned_flag) | ||||
2124 | && fd->loops[i].cond_code == GT_EXPR) | ||||
2125 | 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 ) ) | ||||
2126 | 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 ) ) | ||||
2127 | 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 ) ); | ||||
2128 | else | ||||
2129 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t, step)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, step ); | ||||
2130 | tree factor | ||||
2131 | = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
2132 | true, GSI_SAME_STMT); | ||||
2133 | t = fold_build2 (MINUS_EXPR, itype, outer_niters,fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, outer_niters , build_one_cst (itype) ) | ||||
2134 | build_one_cst (itype))fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, outer_niters , build_one_cst (itype) ); | ||||
2135 | t = fold_build2 (MULT_EXPR, itype, t, outer_niters)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, outer_niters ); | ||||
2136 | 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] ); | ||||
2137 | t = fold_build2 (MULT_EXPR, itype, factor, t)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, factor, t ); | ||||
2138 | 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 ) | ||||
2139 | 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 ) | ||||
2140 | 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 ); | ||||
2141 | expand_omp_build_assign (&gsi2, counts[fd->last_nonrect], | ||||
2142 | fold_convert (type, t)fold_convert_loc (((location_t) 0), type, t)); | ||||
2143 | |||||
2144 | basic_block bb3 = create_empty_bb (bb1); | ||||
2145 | add_bb_to_loop (bb3, bb1->loop_father); | ||||
2146 | |||||
2147 | e = make_edge (bb1, bb3, EDGE_FALSE_VALUE); | ||||
2148 | e->probability = profile_probability::unlikely ().guessed (); | ||||
2149 | |||||
2150 | gsi2 = gsi_after_labels (bb3); | ||||
2151 | cond_stmt = expand_omp_build_cond (&gsi2, fd->loops[i].cond_code, | ||||
2152 | n1e, n2e); | ||||
2153 | e = split_block (bb3, cond_stmt); | ||||
2154 | e->flags = EDGE_TRUE_VALUE; | ||||
2155 | e->probability = profile_probability::likely ().guessed (); | ||||
2156 | basic_block bb4 = e->dest; | ||||
2157 | |||||
2158 | ne = make_edge (bb3, entry_bb, EDGE_FALSE_VALUE); | ||||
2159 | ne->probability = e->probability.invert (); | ||||
2160 | |||||
2161 | basic_block bb5 = create_empty_bb (bb2); | ||||
2162 | add_bb_to_loop (bb5, bb2->loop_father); | ||||
2163 | |||||
2164 | ne = make_edge (bb2, bb5, EDGE_FALSE_VALUE); | ||||
2165 | ne->probability = profile_probability::unlikely ().guessed (); | ||||
2166 | |||||
2167 | for (int j = 0; j < 2; j++) | ||||
2168 | { | ||||
2169 | gsi2 = gsi_after_labels (j ? bb5 : bb4); | ||||
2170 | 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) ) | ||||
2171 | 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) ) | ||||
2172 | 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) ); | ||||
2173 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t, m2minusm1)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, m2minusm1 ); | ||||
2174 | tree tem | ||||
2175 | = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
2176 | true, GSI_SAME_STMT); | ||||
2177 | t = fold_build2 (MINUS_EXPR, itype, tem, n1o)fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, tem, n1o ); | ||||
2178 | t = fold_build2 (TRUNC_MOD_EXPR, itype, t, ostep)fold_build2_loc (((location_t) 0), TRUNC_MOD_EXPR, itype, t, ostep ); | ||||
2179 | t = fold_build2 (MINUS_EXPR, itype, tem, t)fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, tem, t ); | ||||
2180 | tem = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
2181 | true, GSI_SAME_STMT); | ||||
2182 | t = fold_convert (itype, unshare_expr (fd->loops[i].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n1)); | ||||
2183 | if (fd->loops[i].m1) | ||||
2184 | { | ||||
2185 | n1 = fold_convert (itype, unshare_expr (fd->loops[i].m1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m1)); | ||||
2186 | n1 = fold_build2 (MULT_EXPR, itype, tem, n1)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, tem, n1 ); | ||||
2187 | n1 = fold_build2 (PLUS_EXPR, itype, n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1, t ); | ||||
2188 | } | ||||
2189 | else | ||||
2190 | n1 = t; | ||||
2191 | n1 = force_gimple_operand_gsi (&gsi2, n1, true, NULL_TREE(tree) nullptr, | ||||
2192 | true, GSI_SAME_STMT); | ||||
2193 | t = fold_convert (itype, unshare_expr (fd->loops[i].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n2)); | ||||
2194 | if (fd->loops[i].m2) | ||||
2195 | { | ||||
2196 | n2 = fold_convert (itype, unshare_expr (fd->loops[i].m2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m2)); | ||||
2197 | n2 = fold_build2 (MULT_EXPR, itype, tem, n2)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, tem, n2 ); | ||||
2198 | n2 = fold_build2 (PLUS_EXPR, itype, n2, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n2, t ); | ||||
2199 | } | ||||
2200 | else | ||||
2201 | n2 = t; | ||||
2202 | n2 = force_gimple_operand_gsi (&gsi2, n2, true, NULL_TREE(tree) nullptr, | ||||
2203 | true, GSI_SAME_STMT); | ||||
2204 | expand_omp_build_assign (&gsi2, j ? n2o : n1o, tem); | ||||
2205 | |||||
2206 | cond_stmt = expand_omp_build_cond (&gsi2, fd->loops[i].cond_code, | ||||
2207 | n1, n2); | ||||
2208 | e = split_block (gsi_bb (gsi2), cond_stmt); | ||||
2209 | e->flags = j ? EDGE_TRUE_VALUE : EDGE_FALSE_VALUE; | ||||
2210 | e->probability = profile_probability::unlikely ().guessed (); | ||||
2211 | ne = make_edge (e->src, bb1, | ||||
2212 | j ? EDGE_FALSE_VALUE : EDGE_TRUE_VALUE); | ||||
2213 | ne->probability = e->probability.invert (); | ||||
2214 | gsi2 = gsi_after_labels (e->dest); | ||||
2215 | |||||
2216 | t = fold_build2 (PLUS_EXPR, itype, tem, ostep)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, tem, ostep ); | ||||
2217 | expand_omp_build_assign (&gsi2, j ? n2o : n1o, t); | ||||
2218 | |||||
2219 | make_edge (e->dest, bb1, EDGE_FALLTHRU); | ||||
2220 | } | ||||
2221 | |||||
2222 | set_immediate_dominator (CDI_DOMINATORS, bb3, bb1); | ||||
2223 | set_immediate_dominator (CDI_DOMINATORS, bb5, bb2); | ||||
2224 | set_immediate_dominator (CDI_DOMINATORS, entry_bb, bb1); | ||||
2225 | |||||
2226 | if (fd->first_nonrect + 1 == fd->last_nonrect) | ||||
2227 | { | ||||
2228 | fd->first_inner_iterations = first_inner_iterations; | ||||
2229 | fd->factor = factor; | ||||
2230 | fd->adjn1 = n1o; | ||||
2231 | } | ||||
2232 | } | ||||
2233 | else | ||||
2234 | { | ||||
2235 | /* Fallback implementation. Evaluate the loops with m1/m2 | ||||
2236 | non-NULL as well as their outer loops at runtime using temporaries | ||||
2237 | instead of the original iteration variables, and in the | ||||
2238 | body just bump the counter. */ | ||||
2239 | gimple_stmt_iterator gsi2 = *gsi; | ||||
2240 | gsi_prev (&gsi2); | ||||
2241 | e = split_block (entry_bb, gsi_stmt (gsi2)); | ||||
2242 | e = split_block (e->dest, (gimple *) NULLnullptr); | ||||
2243 | basic_block cur_bb = e->src; | ||||
2244 | basic_block next_bb = e->dest; | ||||
2245 | entry_bb = e->dest; | ||||
2246 | *gsi = gsi_after_labels (entry_bb); | ||||
2247 | |||||
2248 | tree *vs = XALLOCAVEC (tree, fd->last_nonrect)((tree *) __builtin_alloca(sizeof (tree) * (fd->last_nonrect ))); | ||||
2249 | memset (vs, 0, fd->last_nonrect * sizeof (tree)); | ||||
2250 | |||||
2251 | for (i = 0; i <= fd->last_nonrect; i++) | ||||
2252 | { | ||||
2253 | if (fd->loops[i].m1 == NULL_TREE(tree) nullptr | ||||
2254 | && fd->loops[i].m2 == NULL_TREE(tree) nullptr | ||||
2255 | && !fd->loops[i].non_rect_referenced) | ||||
2256 | continue; | ||||
2257 | |||||
2258 | tree itype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2258, __FUNCTION__))->typed.type); | ||||
2259 | |||||
2260 | gsi2 = gsi_after_labels (cur_bb); | ||||
2261 | tree n1, n2; | ||||
2262 | t = fold_convert (itype, unshare_expr (fd->loops[i].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n1)); | ||||
2263 | if (fd->loops[i].m1 == NULL_TREE(tree) nullptr) | ||||
2264 | n1 = t; | ||||
2265 | else if (POINTER_TYPE_P (itype)(((enum tree_code) (itype)->base.code) == POINTER_TYPE || ( (enum tree_code) (itype)->base.code) == REFERENCE_TYPE)) | ||||
2266 | { | ||||
2267 | gcc_assert (integer_onep (fd->loops[i].m1))((void)(!(integer_onep (fd->loops[i].m1)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2267, __FUNCTION__), 0 : 0)); | ||||
2268 | t = unshare_expr (fd->loops[i].n1); | ||||
2269 | n1 = fold_build_pointer_plus (vs[i - fd->loops[i].outer], t)fold_build_pointer_plus_loc (((location_t) 0), vs[i - fd-> loops[i].outer], t); | ||||
2270 | } | ||||
2271 | else | ||||
2272 | { | ||||
2273 | n1 = fold_convert (itype, unshare_expr (fd->loops[i].m1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m1)); | ||||
2274 | n1 = fold_build2 (MULT_EXPR, itype,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[i - fd ->loops[i].outer], n1 ) | ||||
2275 | vs[i - fd->loops[i].outer], n1)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[i - fd ->loops[i].outer], n1 ); | ||||
2276 | n1 = fold_build2 (PLUS_EXPR, itype, n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1, t ); | ||||
2277 | } | ||||
2278 | n1 = force_gimple_operand_gsi (&gsi2, n1, true, NULL_TREE(tree) nullptr, | ||||
2279 | true, GSI_SAME_STMT); | ||||
2280 | if (i < fd->last_nonrect) | ||||
2281 | { | ||||
2282 | vs[i] = create_tmp_reg (itype, ".it"); | ||||
2283 | expand_omp_build_assign (&gsi2, vs[i], n1); | ||||
2284 | } | ||||
2285 | t = fold_convert (itype, unshare_expr (fd->loops[i].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].n2)); | ||||
2286 | if (fd->loops[i].m2 == NULL_TREE(tree) nullptr) | ||||
2287 | n2 = t; | ||||
2288 | else if (POINTER_TYPE_P (itype)(((enum tree_code) (itype)->base.code) == POINTER_TYPE || ( (enum tree_code) (itype)->base.code) == REFERENCE_TYPE)) | ||||
2289 | { | ||||
2290 | gcc_assert (integer_onep (fd->loops[i].m2))((void)(!(integer_onep (fd->loops[i].m2)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2290, __FUNCTION__), 0 : 0)); | ||||
2291 | t = unshare_expr (fd->loops[i].n2); | ||||
2292 | n2 = fold_build_pointer_plus (vs[i - fd->loops[i].outer], t)fold_build_pointer_plus_loc (((location_t) 0), vs[i - fd-> loops[i].outer], t); | ||||
2293 | } | ||||
2294 | else | ||||
2295 | { | ||||
2296 | n2 = fold_convert (itype, unshare_expr (fd->loops[i].m2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m2)); | ||||
2297 | n2 = fold_build2 (MULT_EXPR, itype,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[i - fd ->loops[i].outer], n2 ) | ||||
2298 | vs[i - fd->loops[i].outer], n2)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[i - fd ->loops[i].outer], n2 ); | ||||
2299 | n2 = fold_build2 (PLUS_EXPR, itype, n2, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n2, t ); | ||||
2300 | } | ||||
2301 | n2 = force_gimple_operand_gsi (&gsi2, n2, true, NULL_TREE(tree) nullptr, | ||||
2302 | true, GSI_SAME_STMT); | ||||
2303 | if (POINTER_TYPE_P (itype)(((enum tree_code) (itype)->base.code) == POINTER_TYPE || ( (enum tree_code) (itype)->base.code) == REFERENCE_TYPE)) | ||||
2304 | itype = signed_type_for (itype); | ||||
2305 | if (i == fd->last_nonrect) | ||||
2306 | { | ||||
2307 | gcond *cond_stmt | ||||
2308 | = expand_omp_build_cond (&gsi2, fd->loops[i].cond_code, | ||||
2309 | n1, n2); | ||||
2310 | e = split_block (cur_bb, cond_stmt); | ||||
2311 | e->flags = EDGE_TRUE_VALUE; | ||||
2312 | ne = make_edge (cur_bb, next_bb, EDGE_FALSE_VALUE); | ||||
2313 | e->probability = profile_probability::likely ().guessed (); | ||||
2314 | ne->probability = e->probability.invert (); | ||||
2315 | gsi2 = gsi_after_labels (e->dest); | ||||
2316 | |||||
2317 | t = build_int_cst (itype, (fd->loops[i].cond_code == LT_EXPR | ||||
2318 | ? -1 : 1)); | ||||
2319 | 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 ) | ||||
2320 | 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 ); | ||||
2321 | t = fold_build2 (PLUS_EXPR, itype, t,fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, n2) ) | ||||
2322 | fold_convert (itype, n2))fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, n2) ); | ||||
2323 | t = fold_build2 (MINUS_EXPR, itype, t,fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, n1) ) | ||||
2324 | fold_convert (itype, n1))fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, n1) ); | ||||
2325 | tree step = fold_convert (itype, fd->loops[i].step)fold_convert_loc (((location_t) 0), itype, fd->loops[i].step ); | ||||
2326 | if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2326, __FUNCTION__))->base.u.bits.unsigned_flag) | ||||
2327 | && fd->loops[i].cond_code == GT_EXPR) | ||||
2328 | 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 ) ) | ||||
2329 | 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 ) ) | ||||
2330 | 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 ) ); | ||||
2331 | else | ||||
2332 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t, step)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, step ); | ||||
2333 | t = fold_convert (type, t)fold_convert_loc (((location_t) 0), type, t); | ||||
2334 | t = fold_build2 (PLUS_EXPR, type,fold_build2_loc (((location_t) 0), PLUS_EXPR, type, counts[fd ->last_nonrect], t ) | ||||
2335 | counts[fd->last_nonrect], t)fold_build2_loc (((location_t) 0), PLUS_EXPR, type, counts[fd ->last_nonrect], t ); | ||||
2336 | t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
2337 | true, GSI_SAME_STMT); | ||||
2338 | expand_omp_build_assign (&gsi2, counts[fd->last_nonrect], t); | ||||
2339 | e = make_edge (e->dest, next_bb, EDGE_FALLTHRU); | ||||
2340 | set_immediate_dominator (CDI_DOMINATORS, next_bb, cur_bb); | ||||
2341 | break; | ||||
2342 | } | ||||
2343 | e = split_block (cur_bb, last_stmt (cur_bb)); | ||||
2344 | |||||
2345 | basic_block new_cur_bb = create_empty_bb (cur_bb); | ||||
2346 | add_bb_to_loop (new_cur_bb, cur_bb->loop_father); | ||||
2347 | |||||
2348 | gsi2 = gsi_after_labels (e->dest); | ||||
2349 | tree step = fold_convert (itype,fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].step)) | ||||
2350 | unshare_expr (fd->loops[i].step))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].step)); | ||||
2351 | if (POINTER_TYPE_P (TREE_TYPE (vs[i]))(((enum tree_code) (((contains_struct_check ((vs[i]), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2351, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((vs[i]), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2351, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) | ||||
2352 | t = fold_build_pointer_plus (vs[i], step)fold_build_pointer_plus_loc (((location_t) 0), vs[i], step); | ||||
2353 | else | ||||
2354 | t = fold_build2 (PLUS_EXPR, itype, vs[i], step)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, vs[i], step ); | ||||
2355 | t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
2356 | true, GSI_SAME_STMT); | ||||
2357 | expand_omp_build_assign (&gsi2, vs[i], t); | ||||
2358 | |||||
2359 | ne = split_block (e->dest, last_stmt (e->dest)); | ||||
2360 | gsi2 = gsi_after_labels (ne->dest); | ||||
2361 | |||||
2362 | expand_omp_build_cond (&gsi2, fd->loops[i].cond_code, vs[i], n2); | ||||
2363 | edge e3, e4; | ||||
2364 | if (next_bb == entry_bb) | ||||
2365 | { | ||||
2366 | e3 = find_edge (ne->dest, next_bb); | ||||
2367 | e3->flags = EDGE_FALSE_VALUE; | ||||
2368 | } | ||||
2369 | else | ||||
2370 | e3 = make_edge (ne->dest, next_bb, EDGE_FALSE_VALUE); | ||||
2371 | e4 = make_edge (ne->dest, new_cur_bb, EDGE_TRUE_VALUE); | ||||
2372 | e4->probability = profile_probability::likely ().guessed (); | ||||
2373 | e3->probability = e4->probability.invert (); | ||||
2374 | basic_block esrc = e->src; | ||||
2375 | make_edge (e->src, ne->dest, EDGE_FALLTHRU); | ||||
2376 | cur_bb = new_cur_bb; | ||||
2377 | basic_block latch_bb = next_bb; | ||||
2378 | next_bb = e->dest; | ||||
2379 | remove_edge (e); | ||||
2380 | set_immediate_dominator (CDI_DOMINATORS, ne->dest, esrc); | ||||
2381 | set_immediate_dominator (CDI_DOMINATORS, latch_bb, ne->dest); | ||||
2382 | set_immediate_dominator (CDI_DOMINATORS, cur_bb, ne->dest); | ||||
2383 | } | ||||
2384 | } | ||||
2385 | t = NULL_TREE(tree) nullptr; | ||||
2386 | for (i = fd->first_nonrect; i < fd->last_nonrect; i++) | ||||
2387 | if (!fd->loops[i].non_rect_referenced | ||||
2388 | && fd->loops[i].m1 == NULL_TREE(tree) nullptr | ||||
2389 | && fd->loops[i].m2 == NULL_TREE(tree) nullptr) | ||||
2390 | { | ||||
2391 | if (t == NULL_TREE(tree) nullptr) | ||||
2392 | t = counts[i]; | ||||
2393 | else | ||||
2394 | t = fold_build2 (MULT_EXPR, type, t, counts[i])fold_build2_loc (((location_t) 0), MULT_EXPR, type, t, counts [i] ); | ||||
2395 | } | ||||
2396 | if (t) | ||||
2397 | { | ||||
2398 | 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 ); | ||||
2399 | expand_omp_build_assign (gsi, counts[fd->last_nonrect], t); | ||||
2400 | } | ||||
2401 | if (!rect_count_seen) | ||||
2402 | t = counts[fd->last_nonrect]; | ||||
2403 | else | ||||
2404 | 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] ) | ||||
2405 | counts[fd->last_nonrect])fold_build2_loc (((location_t) 0), MULT_EXPR, type, fd->loop .n2, counts[fd->last_nonrect] ); | ||||
2406 | expand_omp_build_assign (gsi, fd->loop.n2, t); | ||||
2407 | } | ||||
2408 | else if (fd->non_rect) | ||||
2409 | { | ||||
2410 | tree t = fd->loop.n2; | ||||
2411 | gcc_assert (TREE_CODE (t) == INTEGER_CST)((void)(!(((enum tree_code) (t)->base.code) == INTEGER_CST ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2411, __FUNCTION__), 0 : 0)); | ||||
2412 | int non_rect_referenced = 0, non_rect = 0; | ||||
2413 | for (i = 0; i < fd->collapse; i++) | ||||
2414 | { | ||||
2415 | if ((i < fd->first_nonrect || i > fd->last_nonrect) | ||||
2416 | && !integer_zerop (counts[i])) | ||||
2417 | t = fold_build2 (TRUNC_DIV_EXPR, type, t, counts[i])fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, type, t, counts [i] ); | ||||
2418 | if (fd->loops[i].non_rect_referenced) | ||||
2419 | non_rect_referenced++; | ||||
2420 | if (fd->loops[i].m1 || fd->loops[i].m2) | ||||
2421 | non_rect++; | ||||
2422 | } | ||||
2423 | gcc_assert (non_rect == 1 && non_rect_referenced == 1)((void)(!(non_rect == 1 && non_rect_referenced == 1) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2423, __FUNCTION__), 0 : 0)); | ||||
2424 | counts[fd->last_nonrect] = t; | ||||
2425 | } | ||||
2426 | } | ||||
2427 | |||||
2428 | /* Helper function for expand_omp_{for_*,simd}. Generate code like: | ||||
2429 | T = V; | ||||
2430 | V3 = N31 + (T % count3) * STEP3; | ||||
2431 | T = T / count3; | ||||
2432 | V2 = N21 + (T % count2) * STEP2; | ||||
2433 | T = T / count2; | ||||
2434 | V1 = N11 + T * STEP1; | ||||
2435 | if this loop doesn't have an inner loop construct combined with it. | ||||
2436 | If it does have an inner loop construct combined with it and the | ||||
2437 | iteration count isn't known constant, store values from counts array | ||||
2438 | into its _looptemp_ temporaries instead. | ||||
2439 | For non-rectangular loops (between fd->first_nonrect and fd->last_nonrect | ||||
2440 | inclusive), use the count of all those loops together, and either | ||||
2441 | find quadratic etc. equation roots, or as a fallback, do: | ||||
2442 | COUNT = 0; | ||||
2443 | for (tmpi = N11; tmpi COND1 N12; tmpi += STEP1) | ||||
2444 | for (tmpj = M21 * tmpi + N21; | ||||
2445 | tmpj COND2 M22 * tmpi + N22; tmpj += STEP2) | ||||
2446 | { | ||||
2447 | int tmpk1 = M31 * tmpj + N31; | ||||
2448 | int tmpk2 = M32 * tmpj + N32; | ||||
2449 | if (tmpk1 COND3 tmpk2) | ||||
2450 | { | ||||
2451 | if (COND3 is <) | ||||
2452 | adj = STEP3 - 1; | ||||
2453 | else | ||||
2454 | adj = STEP3 + 1; | ||||
2455 | int temp = (adj + tmpk2 - tmpk1) / STEP3; | ||||
2456 | if (COUNT + temp > T) | ||||
2457 | { | ||||
2458 | V1 = tmpi; | ||||
2459 | V2 = tmpj; | ||||
2460 | V3 = tmpk1 + (T - COUNT) * STEP3; | ||||
2461 | goto done; | ||||
2462 | } | ||||
2463 | else | ||||
2464 | COUNT += temp; | ||||
2465 | } | ||||
2466 | } | ||||
2467 | done:; | ||||
2468 | but for optional innermost or outermost rectangular loops that aren't | ||||
2469 | referenced by other loop expressions keep doing the division/modulo. */ | ||||
2470 | |||||
2471 | static void | ||||
2472 | expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi, | ||||
2473 | tree *counts, tree *nonrect_bounds, | ||||
2474 | gimple *inner_stmt, tree startvar) | ||||
2475 | { | ||||
2476 | int i; | ||||
2477 | if (gimple_omp_for_combined_p (fd->for_stmt)) | ||||
2478 | { | ||||
2479 | /* If fd->loop.n2 is constant, then no propagation of the counts | ||||
2480 | is needed, they are constant. */ | ||||
2481 | if (TREE_CODE (fd->loop.n2)((enum tree_code) (fd->loop.n2)->base.code) == INTEGER_CST) | ||||
2482 | return; | ||||
2483 | |||||
2484 | tree clauses = gimple_code (inner_stmt) != GIMPLE_OMP_FOR | ||||
2485 | ? gimple_omp_taskreg_clauses (inner_stmt) | ||||
2486 | : gimple_omp_for_clauses (inner_stmt); | ||||
2487 | /* First two _looptemp_ clauses are for istart/iend, counts[0] | ||||
2488 | isn't supposed to be handled, as the inner loop doesn't | ||||
2489 | use it. */ | ||||
2490 | tree innerc = omp_find_clause (clauses, OMP_CLAUSE__LOOPTEMP_); | ||||
2491 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2491, __FUNCTION__), 0 : 0)); | ||||
2492 | int count = 0; | ||||
2493 | if (fd->non_rect | ||||
2494 | && fd->last_nonrect == fd->first_nonrect + 1 | ||||
2495 | && !TYPE_UNSIGNED (TREE_TYPE (fd->loops[fd->last_nonrect].v))((tree_class_check ((((contains_struct_check ((fd->loops[fd ->last_nonrect].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2495, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2495, __FUNCTION__))->base.u.bits.unsigned_flag)) | ||||
2496 | count = 4; | ||||
2497 | for (i = 0; i < fd->collapse + count; i++) | ||||
2498 | { | ||||
2499 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2499, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2499, __FUNCTION__))->common.chain), | ||||
2500 | OMP_CLAUSE__LOOPTEMP_); | ||||
2501 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2501, __FUNCTION__), 0 : 0)); | ||||
2502 | if (i) | ||||
2503 | { | ||||
2504 | tree tem = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2504, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2504, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2504, __FUNCTION__))); | ||||
2505 | tree t; | ||||
2506 | if (i < fd->collapse) | ||||
2507 | t = counts[i]; | ||||
2508 | else | ||||
2509 | switch (i - fd->collapse) | ||||
2510 | { | ||||
2511 | case 0: t = counts[0]; break; | ||||
2512 | case 1: t = fd->first_inner_iterations; break; | ||||
2513 | case 2: t = fd->factor; break; | ||||
2514 | case 3: t = fd->adjn1; break; | ||||
2515 | default: gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2515, __FUNCTION__)); | ||||
2516 | } | ||||
2517 | t = fold_convert (TREE_TYPE (tem), t)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (tem), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2517, __FUNCTION__))->typed.type), t); | ||||
2518 | t = force_gimple_operand_gsi (gsi, t, false, NULL_TREE(tree) nullptr, | ||||
2519 | false, GSI_CONTINUE_LINKING); | ||||
2520 | gassign *stmt = gimple_build_assign (tem, t); | ||||
2521 | gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING); | ||||
2522 | } | ||||
2523 | } | ||||
2524 | return; | ||||
2525 | } | ||||
2526 | |||||
2527 | tree type = TREE_TYPE (fd->loop.v)((contains_struct_check ((fd->loop.v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2527, __FUNCTION__))->typed.type); | ||||
2528 | tree tem = create_tmp_reg (type, ".tem"); | ||||
2529 | gassign *stmt = gimple_build_assign (tem, startvar); | ||||
2530 | gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING); | ||||
2531 | |||||
2532 | for (i = fd->collapse - 1; i >= 0; i--) | ||||
2533 | { | ||||
2534 | tree vtype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2534, __FUNCTION__))->typed.type), itype, t; | ||||
2535 | itype = vtype; | ||||
2536 | if (POINTER_TYPE_P (vtype)(((enum tree_code) (vtype)->base.code) == POINTER_TYPE || ( (enum tree_code) (vtype)->base.code) == REFERENCE_TYPE)) | ||||
2537 | itype = signed_type_for (vtype); | ||||
2538 | if (i != 0 && (i != fd->last_nonrect || fd->first_nonrect)) | ||||
2539 | t = fold_build2 (TRUNC_MOD_EXPR, type, tem, counts[i])fold_build2_loc (((location_t) 0), TRUNC_MOD_EXPR, type, tem, counts[i] ); | ||||
2540 | else | ||||
2541 | t = tem; | ||||
2542 | if (i == fd->last_nonrect) | ||||
2543 | { | ||||
2544 | t = force_gimple_operand_gsi (gsi, t, true, NULL_TREE(tree) nullptr, | ||||
2545 | false, GSI_CONTINUE_LINKING); | ||||
2546 | tree stopval = t; | ||||
2547 | tree idx = create_tmp_reg (type, ".count"); | ||||
2548 | expand_omp_build_assign (gsi, idx, | ||||
2549 | build_zero_cst (type), true); | ||||
2550 | basic_block bb_triang = NULLnullptr, bb_triang_dom = NULLnullptr; | ||||
2551 | if (fd->first_nonrect + 1 == fd->last_nonrect | ||||
2552 | && (TREE_CODE (fd->loop.n2)((enum tree_code) (fd->loop.n2)->base.code) == INTEGER_CST | ||||
2553 | || fd->first_inner_iterations) | ||||
2554 | && (optab_handler (sqrt_optab, TYPE_MODE (double_type_node)((((enum tree_code) ((tree_class_check ((global_trees[TI_DOUBLE_TYPE ]), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2554, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode (global_trees[TI_DOUBLE_TYPE]) : (global_trees[TI_DOUBLE_TYPE ])->type_common.mode)) | ||||
2555 | != CODE_FOR_nothing) | ||||
2556 | && !integer_zerop (fd->loop.n2)) | ||||
2557 | { | ||||
2558 | tree outer_n1 = fd->adjn1 ? fd->adjn1 : fd->loops[i - 1].n1; | ||||
2559 | tree itype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2559, __FUNCTION__))->typed.type); | ||||
2560 | tree first_inner_iterations = fd->first_inner_iterations; | ||||
2561 | tree factor = fd->factor; | ||||
2562 | gcond *cond_stmt | ||||
2563 | = expand_omp_build_cond (gsi, NE_EXPR, factor, | ||||
2564 | build_zero_cst (TREE_TYPE (factor)((contains_struct_check ((factor), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2564, __FUNCTION__))->typed.type))); | ||||
2565 | edge e = split_block (gsi_bb (*gsi), cond_stmt); | ||||
2566 | basic_block bb0 = e->src; | ||||
2567 | e->flags = EDGE_TRUE_VALUE; | ||||
2568 | e->probability = profile_probability::likely (); | ||||
2569 | bb_triang_dom = bb0; | ||||
2570 | *gsi = gsi_after_labels (e->dest); | ||||
2571 | tree slltype = long_long_integer_type_nodeinteger_types[itk_long_long]; | ||||
2572 | tree ulltype = long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long]; | ||||
2573 | tree stopvalull = fold_convert (ulltype, stopval)fold_convert_loc (((location_t) 0), ulltype, stopval); | ||||
2574 | stopvalull | ||||
2575 | = force_gimple_operand_gsi (gsi, stopvalull, true, NULL_TREE(tree) nullptr, | ||||
2576 | false, GSI_CONTINUE_LINKING); | ||||
2577 | first_inner_iterations | ||||
2578 | = fold_convert (slltype, first_inner_iterations)fold_convert_loc (((location_t) 0), slltype, first_inner_iterations ); | ||||
2579 | first_inner_iterations | ||||
2580 | = force_gimple_operand_gsi (gsi, first_inner_iterations, true, | ||||
2581 | NULL_TREE(tree) nullptr, false, | ||||
2582 | GSI_CONTINUE_LINKING); | ||||
2583 | factor = fold_convert (slltype, factor)fold_convert_loc (((location_t) 0), slltype, factor); | ||||
2584 | factor | ||||
2585 | = force_gimple_operand_gsi (gsi, factor, true, NULL_TREE(tree) nullptr, | ||||
2586 | false, GSI_CONTINUE_LINKING); | ||||
2587 | tree first_inner_iterationsd | ||||
2588 | = fold_build1 (FLOAT_EXPR, double_type_node,fold_build1_loc (((location_t) 0), FLOAT_EXPR, global_trees[TI_DOUBLE_TYPE ], first_inner_iterations ) | ||||
2589 | first_inner_iterations)fold_build1_loc (((location_t) 0), FLOAT_EXPR, global_trees[TI_DOUBLE_TYPE ], first_inner_iterations ); | ||||
2590 | first_inner_iterationsd | ||||
2591 | = force_gimple_operand_gsi (gsi, first_inner_iterationsd, true, | ||||
2592 | NULL_TREE(tree) nullptr, false, | ||||
2593 | GSI_CONTINUE_LINKING); | ||||
2594 | tree factord = fold_build1 (FLOAT_EXPR, double_type_node,fold_build1_loc (((location_t) 0), FLOAT_EXPR, global_trees[TI_DOUBLE_TYPE ], factor ) | ||||
2595 | factor)fold_build1_loc (((location_t) 0), FLOAT_EXPR, global_trees[TI_DOUBLE_TYPE ], factor ); | ||||
2596 | factord = force_gimple_operand_gsi (gsi, factord, true, | ||||
2597 | NULL_TREE(tree) nullptr, false, | ||||
2598 | GSI_CONTINUE_LINKING); | ||||
2599 | tree stopvald = fold_build1 (FLOAT_EXPR, double_type_node,fold_build1_loc (((location_t) 0), FLOAT_EXPR, global_trees[TI_DOUBLE_TYPE ], stopvalull ) | ||||
2600 | stopvalull)fold_build1_loc (((location_t) 0), FLOAT_EXPR, global_trees[TI_DOUBLE_TYPE ], stopvalull ); | ||||
2601 | stopvald = force_gimple_operand_gsi (gsi, stopvald, true, | ||||
2602 | NULL_TREE(tree) nullptr, false, | ||||
2603 | GSI_CONTINUE_LINKING); | ||||
2604 | /* Temporarily disable flag_rounding_math, values will be | ||||
2605 | decimal numbers divided by 2 and worst case imprecisions | ||||
2606 | due to too large values ought to be caught later by the | ||||
2607 | checks for fallback. */ | ||||
2608 | int save_flag_rounding_math = flag_rounding_mathglobal_options.x_flag_rounding_math; | ||||
2609 | flag_rounding_mathglobal_options.x_flag_rounding_math = 0; | ||||
2610 | 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 ) ) | ||||
2611 | 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 ) ); | ||||
2612 | 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 ) | ||||
2613 | first_inner_iterationsd, t)fold_build2_loc (((location_t) 0), MINUS_EXPR, global_trees[TI_DOUBLE_TYPE ], first_inner_iterationsd, t ); | ||||
2614 | t3 = force_gimple_operand_gsi (gsi, t3, true, NULL_TREE(tree) nullptr, false, | ||||
2615 | GSI_CONTINUE_LINKING); | ||||
2616 | 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 ) ) | ||||
2617 | 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 ) ); | ||||
2618 | 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 ); | ||||
2619 | 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 ) ) | ||||
2620 | 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 ) ) | ||||
2621 | 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 ) ); | ||||
2622 | flag_rounding_mathglobal_options.x_flag_rounding_math = save_flag_rounding_math; | ||||
2623 | t = force_gimple_operand_gsi (gsi, t, true, NULL_TREE(tree) nullptr, false, | ||||
2624 | GSI_CONTINUE_LINKING); | ||||
2625 | if (flag_exceptionsglobal_options.x_flag_exceptions | ||||
2626 | && cfun(cfun + 0)->can_throw_non_call_exceptions | ||||
2627 | && operation_could_trap_p (LT_EXPR, true, false, NULL_TREE(tree) nullptr)) | ||||
2628 | { | ||||
2629 | 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]) ) | ||||
2630 | 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]) ); | ||||
2631 | tem = force_gimple_operand_gsi (gsi, tem, true, NULL_TREE(tree) nullptr, | ||||
2632 | false, GSI_CONTINUE_LINKING); | ||||
2633 | cond_stmt = gimple_build_cond (NE_EXPR, tem, | ||||
2634 | boolean_false_nodeglobal_trees[TI_BOOLEAN_FALSE], | ||||
2635 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
2636 | } | ||||
2637 | else | ||||
2638 | cond_stmt | ||||
2639 | = gimple_build_cond (LT_EXPR, t, | ||||
2640 | build_zero_cst (double_type_nodeglobal_trees[TI_DOUBLE_TYPE]), | ||||
2641 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
2642 | gsi_insert_after (gsi, cond_stmt, GSI_CONTINUE_LINKING); | ||||
2643 | e = split_block (gsi_bb (*gsi), cond_stmt); | ||||
2644 | basic_block bb1 = e->src; | ||||
2645 | e->flags = EDGE_FALSE_VALUE; | ||||
2646 | e->probability = profile_probability::very_likely (); | ||||
2647 | *gsi = gsi_after_labels (e->dest); | ||||
2648 | gcall *call = gimple_build_call_internal (IFN_SQRT, 1, t); | ||||
2649 | tree sqrtr = create_tmp_var (double_type_nodeglobal_trees[TI_DOUBLE_TYPE]); | ||||
2650 | gimple_call_set_lhs (call, sqrtr); | ||||
2651 | gsi_insert_after (gsi, call, GSI_CONTINUE_LINKING); | ||||
2652 | 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 ); | ||||
2653 | 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 ); | ||||
2654 | t = fold_build1 (FIX_TRUNC_EXPR, ulltype, t)fold_build1_loc (((location_t) 0), FIX_TRUNC_EXPR, ulltype, t ); | ||||
2655 | tree c = create_tmp_var (ulltype); | ||||
2656 | tree d = create_tmp_var (ulltype); | ||||
2657 | expand_omp_build_assign (gsi, c, t, true); | ||||
2658 | t = fold_build2 (MINUS_EXPR, ulltype, c,fold_build2_loc (((location_t) 0), MINUS_EXPR, ulltype, c, build_one_cst (ulltype) ) | ||||
2659 | build_one_cst (ulltype))fold_build2_loc (((location_t) 0), MINUS_EXPR, ulltype, c, build_one_cst (ulltype) ); | ||||
2660 | t = fold_build2 (MULT_EXPR, ulltype, c, t)fold_build2_loc (((location_t) 0), MULT_EXPR, ulltype, c, t ); | ||||
2661 | 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] ); | ||||
2662 | 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 ) | ||||
2663 | 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 ); | ||||
2664 | tree t2 | ||||
2665 | = 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) ) | ||||
2666 | fold_convert (ulltype,fold_build2_loc (((location_t) 0), MULT_EXPR, ulltype, c, fold_convert_loc (((location_t) 0), ulltype, fd->first_inner_iterations) ) | ||||
2667 | 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) ); | ||||
2668 | t = fold_build2 (PLUS_EXPR, ulltype, t, t2)fold_build2_loc (((location_t) 0), PLUS_EXPR, ulltype, t, t2 ); | ||||
2669 | expand_omp_build_assign (gsi, d, t, true); | ||||
2670 | 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 ) | ||||
2671 | 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 ); | ||||
2672 | 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) ) | ||||
2673 | 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) ) | ||||
2674 | 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) ); | ||||
2675 | t2 = force_gimple_operand_gsi (gsi, t, true, NULL_TREE(tree) nullptr, false, | ||||
2676 | GSI_CONTINUE_LINKING); | ||||
2677 | cond_stmt = gimple_build_cond (GE_EXPR, stopvalull, d, | ||||
2678 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
2679 | gsi_insert_after (gsi, cond_stmt, GSI_CONTINUE_LINKING); | ||||
2680 | e = split_block (gsi_bb (*gsi), cond_stmt); | ||||
2681 | basic_block bb2 = e->src; | ||||
2682 | e->flags = EDGE_TRUE_VALUE; | ||||
2683 | e->probability = profile_probability::very_likely (); | ||||
2684 | *gsi = gsi_after_labels (e->dest); | ||||
2685 | t = fold_build2 (PLUS_EXPR, ulltype, d, t2)fold_build2_loc (((location_t) 0), PLUS_EXPR, ulltype, d, t2 ); | ||||
2686 | t = force_gimple_operand_gsi (gsi, t, true, NULL_TREE(tree) nullptr, false, | ||||
2687 | GSI_CONTINUE_LINKING); | ||||
2688 | cond_stmt = gimple_build_cond (GE_EXPR, stopvalull, t, | ||||
2689 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
2690 | gsi_insert_after (gsi, cond_stmt, GSI_CONTINUE_LINKING); | ||||
2691 | e = split_block (gsi_bb (*gsi), cond_stmt); | ||||
2692 | basic_block bb3 = e->src; | ||||
2693 | e->flags = EDGE_FALSE_VALUE; | ||||
2694 | e->probability = profile_probability::very_likely (); | ||||
2695 | *gsi = gsi_after_labels (e->dest); | ||||
2696 | t = fold_convert (itype, c)fold_convert_loc (((location_t) 0), itype, c); | ||||
2697 | 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 ); | ||||
2698 | t = fold_build2 (PLUS_EXPR, itype, outer_n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, outer_n1 , t ); | ||||
2699 | t = force_gimple_operand_gsi (gsi, t, true, NULL_TREE(tree) nullptr, false, | ||||
2700 | GSI_CONTINUE_LINKING); | ||||
2701 | expand_omp_build_assign (gsi, fd->loops[i - 1].v, t, true); | ||||
2702 | t2 = fold_build2 (MINUS_EXPR, ulltype, stopvalull, d)fold_build2_loc (((location_t) 0), MINUS_EXPR, ulltype, stopvalull , d ); | ||||
2703 | t2 = fold_convert (itype, t2)fold_convert_loc (((location_t) 0), itype, t2); | ||||
2704 | 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 ); | ||||
2705 | 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 ); | ||||
2706 | if (fd->loops[i].m1) | ||||
2707 | { | ||||
2708 | 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 ); | ||||
2709 | t2 = fold_build2 (PLUS_EXPR, itype, t2, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t2, t ); | ||||
2710 | } | ||||
2711 | expand_omp_build_assign (gsi, fd->loops[i].v, t2, true); | ||||
2712 | e = split_block (gsi_bb (*gsi), gsi_stmt (*gsi)); | ||||
2713 | bb_triang = e->src; | ||||
2714 | *gsi = gsi_after_labels (e->dest); | ||||
2715 | remove_edge (e); | ||||
2716 | e = make_edge (bb1, gsi_bb (*gsi), EDGE_TRUE_VALUE); | ||||
2717 | e->probability = profile_probability::very_unlikely (); | ||||
2718 | e = make_edge (bb2, gsi_bb (*gsi), EDGE_FALSE_VALUE); | ||||
2719 | e->probability = profile_probability::very_unlikely (); | ||||
2720 | e = make_edge (bb3, gsi_bb (*gsi), EDGE_TRUE_VALUE); | ||||
2721 | e->probability = profile_probability::very_unlikely (); | ||||
2722 | |||||
2723 | basic_block bb4 = create_empty_bb (bb0); | ||||
2724 | add_bb_to_loop (bb4, bb0->loop_father); | ||||
2725 | e = make_edge (bb0, bb4, EDGE_FALSE_VALUE); | ||||
2726 | e->probability = profile_probability::unlikely (); | ||||
2727 | make_edge (bb4, gsi_bb (*gsi), EDGE_FALLTHRU); | ||||
2728 | set_immediate_dominator (CDI_DOMINATORS, bb4, bb0); | ||||
2729 | set_immediate_dominator (CDI_DOMINATORS, gsi_bb (*gsi), bb0); | ||||
2730 | gimple_stmt_iterator gsi2 = gsi_after_labels (bb4); | ||||
2731 | t2 = fold_build2 (TRUNC_DIV_EXPR, type,fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, type, counts [i], counts[i - 1] ) | ||||
2732 | counts[i], counts[i - 1])fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, type, counts [i], counts[i - 1] ); | ||||
2733 | t2 = force_gimple_operand_gsi (&gsi2, t2, true, NULL_TREE(tree) nullptr, false, | ||||
2734 | GSI_CONTINUE_LINKING); | ||||
2735 | t = fold_build2 (TRUNC_MOD_EXPR, type, stopval, t2)fold_build2_loc (((location_t) 0), TRUNC_MOD_EXPR, type, stopval , t2 ); | ||||
2736 | t2 = fold_build2 (TRUNC_DIV_EXPR, type, stopval, t2)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, type, stopval , t2 ); | ||||
2737 | t = fold_convert (itype, t)fold_convert_loc (((location_t) 0), itype, t); | ||||
2738 | t2 = fold_convert (itype, t2)fold_convert_loc (((location_t) 0), itype, t2); | ||||
2739 | 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) ) | ||||
2740 | 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) ); | ||||
2741 | 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 ); | ||||
2742 | 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) ) | ||||
2743 | 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) ); | ||||
2744 | 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 ); | ||||
2745 | t2 = force_gimple_operand_gsi (&gsi2, t2, false, NULL_TREE(tree) nullptr, | ||||
2746 | false, GSI_CONTINUE_LINKING); | ||||
2747 | stmt = gimple_build_assign (fd->loops[i - 1].v, t2); | ||||
2748 | gsi_insert_after (&gsi2, stmt, GSI_CONTINUE_LINKING); | ||||
2749 | if (fd->loops[i].m1) | ||||
2750 | { | ||||
2751 | 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 ) | ||||
2752 | fd->loops[i - 1].v)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, fd->loops [i].m1, fd->loops[i - 1].v ); | ||||
2753 | t = fold_build2 (PLUS_EXPR, itype, t, t2)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, t2 ); | ||||
2754 | } | ||||
2755 | t = force_gimple_operand_gsi (&gsi2, t, false, NULL_TREE(tree) nullptr, | ||||
2756 | false, GSI_CONTINUE_LINKING); | ||||
2757 | stmt = gimple_build_assign (fd->loops[i].v, t); | ||||
2758 | gsi_insert_after (&gsi2, stmt, GSI_CONTINUE_LINKING); | ||||
2759 | } | ||||
2760 | /* Fallback implementation. Evaluate the loops in between | ||||
2761 | (inclusive) fd->first_nonrect and fd->last_nonrect at | ||||
2762 | runtime unsing temporaries instead of the original iteration | ||||
2763 | variables, in the body just bump the counter and compare | ||||
2764 | with the desired value. */ | ||||
2765 | gimple_stmt_iterator gsi2 = *gsi; | ||||
2766 | basic_block entry_bb = gsi_bb (gsi2); | ||||
2767 | edge e = split_block (entry_bb, gsi_stmt (gsi2)); | ||||
2768 | e = split_block (e->dest, (gimple *) NULLnullptr); | ||||
2769 | basic_block dom_bb = NULLnullptr; | ||||
2770 | basic_block cur_bb = e->src; | ||||
2771 | basic_block next_bb = e->dest; | ||||
2772 | entry_bb = e->dest; | ||||
2773 | *gsi = gsi_after_labels (entry_bb); | ||||
2774 | |||||
2775 | tree *vs = XALLOCAVEC (tree, fd->last_nonrect)((tree *) __builtin_alloca(sizeof (tree) * (fd->last_nonrect ))); | ||||
2776 | tree n1 = NULL_TREE(tree) nullptr, n2 = NULL_TREE(tree) nullptr; | ||||
2777 | memset (vs, 0, fd->last_nonrect * sizeof (tree)); | ||||
2778 | |||||
2779 | for (int j = fd->first_nonrect; j <= fd->last_nonrect; j++) | ||||
2780 | { | ||||
2781 | tree itype = TREE_TYPE (fd->loops[j].v)((contains_struct_check ((fd->loops[j].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2781, __FUNCTION__))->typed.type); | ||||
2782 | bool rect_p = (fd->loops[j].m1 == NULL_TREE(tree) nullptr | ||||
2783 | && fd->loops[j].m2 == NULL_TREE(tree) nullptr | ||||
2784 | && !fd->loops[j].non_rect_referenced); | ||||
2785 | gsi2 = gsi_after_labels (cur_bb); | ||||
2786 | t = fold_convert (itype, unshare_expr (fd->loops[j].n1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[j].n1)); | ||||
2787 | if (fd->loops[j].m1 == NULL_TREE(tree) nullptr) | ||||
2788 | n1 = rect_p ? build_zero_cst (type) : t; | ||||
2789 | else if (POINTER_TYPE_P (itype)(((enum tree_code) (itype)->base.code) == POINTER_TYPE || ( (enum tree_code) (itype)->base.code) == REFERENCE_TYPE)) | ||||
2790 | { | ||||
2791 | gcc_assert (integer_onep (fd->loops[j].m1))((void)(!(integer_onep (fd->loops[j].m1)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2791, __FUNCTION__), 0 : 0)); | ||||
2792 | t = unshare_expr (fd->loops[j].n1); | ||||
2793 | n1 = fold_build_pointer_plus (vs[j - fd->loops[j].outer], t)fold_build_pointer_plus_loc (((location_t) 0), vs[j - fd-> loops[j].outer], t); | ||||
2794 | } | ||||
2795 | else | ||||
2796 | { | ||||
2797 | n1 = fold_convert (itype, unshare_expr (fd->loops[j].m1))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[j].m1)); | ||||
2798 | n1 = fold_build2 (MULT_EXPR, itype,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[j - fd ->loops[j].outer], n1 ) | ||||
2799 | vs[j - fd->loops[j].outer], n1)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[j - fd ->loops[j].outer], n1 ); | ||||
2800 | n1 = fold_build2 (PLUS_EXPR, itype, n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1, t ); | ||||
2801 | } | ||||
2802 | n1 = force_gimple_operand_gsi (&gsi2, n1, true, NULL_TREE(tree) nullptr, | ||||
2803 | true, GSI_SAME_STMT); | ||||
2804 | if (j < fd->last_nonrect) | ||||
2805 | { | ||||
2806 | vs[j] = create_tmp_reg (rect_p ? type : itype, ".it"); | ||||
2807 | expand_omp_build_assign (&gsi2, vs[j], n1); | ||||
2808 | } | ||||
2809 | t = fold_convert (itype, unshare_expr (fd->loops[j].n2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[j].n2)); | ||||
2810 | if (fd->loops[j].m2 == NULL_TREE(tree) nullptr) | ||||
2811 | n2 = rect_p ? counts[j] : t; | ||||
2812 | else if (POINTER_TYPE_P (itype)(((enum tree_code) (itype)->base.code) == POINTER_TYPE || ( (enum tree_code) (itype)->base.code) == REFERENCE_TYPE)) | ||||
2813 | { | ||||
2814 | gcc_assert (integer_onep (fd->loops[j].m2))((void)(!(integer_onep (fd->loops[j].m2)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2814, __FUNCTION__), 0 : 0)); | ||||
2815 | t = unshare_expr (fd->loops[j].n2); | ||||
2816 | n2 = fold_build_pointer_plus (vs[j - fd->loops[j].outer], t)fold_build_pointer_plus_loc (((location_t) 0), vs[j - fd-> loops[j].outer], t); | ||||
2817 | } | ||||
2818 | else | ||||
2819 | { | ||||
2820 | n2 = fold_convert (itype, unshare_expr (fd->loops[j].m2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[j].m2)); | ||||
2821 | n2 = fold_build2 (MULT_EXPR, itype,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[j - fd ->loops[j].outer], n2 ) | ||||
2822 | vs[j - fd->loops[j].outer], n2)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, vs[j - fd ->loops[j].outer], n2 ); | ||||
2823 | n2 = fold_build2 (PLUS_EXPR, itype, n2, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n2, t ); | ||||
2824 | } | ||||
2825 | n2 = force_gimple_operand_gsi (&gsi2, n2, true, NULL_TREE(tree) nullptr, | ||||
2826 | true, GSI_SAME_STMT); | ||||
2827 | if (POINTER_TYPE_P (itype)(((enum tree_code) (itype)->base.code) == POINTER_TYPE || ( (enum tree_code) (itype)->base.code) == REFERENCE_TYPE)) | ||||
2828 | itype = signed_type_for (itype); | ||||
2829 | if (j == fd->last_nonrect) | ||||
2830 | { | ||||
2831 | gcond *cond_stmt | ||||
2832 | = expand_omp_build_cond (&gsi2, fd->loops[i].cond_code, | ||||
2833 | n1, n2); | ||||
2834 | e = split_block (cur_bb, cond_stmt); | ||||
2835 | e->flags = EDGE_TRUE_VALUE; | ||||
2836 | edge ne = make_edge (cur_bb, next_bb, EDGE_FALSE_VALUE); | ||||
2837 | e->probability = profile_probability::likely ().guessed (); | ||||
2838 | ne->probability = e->probability.invert (); | ||||
2839 | gsi2 = gsi_after_labels (e->dest); | ||||
2840 | |||||
2841 | t = build_int_cst (itype, (fd->loops[j].cond_code == LT_EXPR | ||||
2842 | ? -1 : 1)); | ||||
2843 | 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 ) | ||||
2844 | 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 ); | ||||
2845 | t = fold_build2 (PLUS_EXPR, itype, t,fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, n2) ) | ||||
2846 | fold_convert (itype, n2))fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, n2) ); | ||||
2847 | t = fold_build2 (MINUS_EXPR, itype, t,fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, n1) ) | ||||
2848 | fold_convert (itype, n1))fold_build2_loc (((location_t) 0), MINUS_EXPR, itype, t, fold_convert_loc (((location_t) 0), itype, n1) ); | ||||
2849 | tree step = fold_convert (itype, fd->loops[j].step)fold_convert_loc (((location_t) 0), itype, fd->loops[j].step ); | ||||
2850 | if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2850, __FUNCTION__))->base.u.bits.unsigned_flag) | ||||
2851 | && fd->loops[j].cond_code == GT_EXPR) | ||||
2852 | 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 ) ) | ||||
2853 | 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 ) ) | ||||
2854 | 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 ) ); | ||||
2855 | else | ||||
2856 | t = fold_build2 (TRUNC_DIV_EXPR, itype, t, step)fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, itype, t, step ); | ||||
2857 | t = fold_convert (type, t)fold_convert_loc (((location_t) 0), type, t); | ||||
2858 | t = fold_build2 (PLUS_EXPR, type, idx, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, type, idx, t ); | ||||
2859 | t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
2860 | true, GSI_SAME_STMT); | ||||
2861 | e = make_edge (e->dest, next_bb, EDGE_FALLTHRU); | ||||
2862 | set_immediate_dominator (CDI_DOMINATORS, next_bb, cur_bb); | ||||
2863 | cond_stmt | ||||
2864 | = gimple_build_cond (LE_EXPR, t, stopval, NULL_TREE(tree) nullptr, | ||||
2865 | NULL_TREE(tree) nullptr); | ||||
2866 | gsi_insert_before (&gsi2, cond_stmt, GSI_SAME_STMT); | ||||
2867 | e = split_block (gsi_bb (gsi2), cond_stmt); | ||||
2868 | e->flags = EDGE_TRUE_VALUE; | ||||
2869 | e->probability = profile_probability::likely ().guessed (); | ||||
2870 | ne = make_edge (e->src, entry_bb, EDGE_FALSE_VALUE); | ||||
2871 | ne->probability = e->probability.invert (); | ||||
2872 | gsi2 = gsi_after_labels (e->dest); | ||||
2873 | expand_omp_build_assign (&gsi2, idx, t); | ||||
2874 | set_immediate_dominator (CDI_DOMINATORS, entry_bb, dom_bb); | ||||
2875 | break; | ||||
2876 | } | ||||
2877 | e = split_block (cur_bb, last_stmt (cur_bb)); | ||||
2878 | |||||
2879 | basic_block new_cur_bb = create_empty_bb (cur_bb); | ||||
2880 | add_bb_to_loop (new_cur_bb, cur_bb->loop_father); | ||||
2881 | |||||
2882 | gsi2 = gsi_after_labels (e->dest); | ||||
2883 | if (rect_p) | ||||
2884 | t = fold_build2 (PLUS_EXPR, type, vs[j],fold_build2_loc (((location_t) 0), PLUS_EXPR, type, vs[j], build_one_cst (type) ) | ||||
2885 | build_one_cst (type))fold_build2_loc (((location_t) 0), PLUS_EXPR, type, vs[j], build_one_cst (type) ); | ||||
2886 | else | ||||
2887 | { | ||||
2888 | tree step | ||||
2889 | = fold_convert (itype, unshare_expr (fd->loops[j].step))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[j].step)); | ||||
2890 | if (POINTER_TYPE_P (vtype)(((enum tree_code) (vtype)->base.code) == POINTER_TYPE || ( (enum tree_code) (vtype)->base.code) == REFERENCE_TYPE)) | ||||
2891 | t = fold_build_pointer_plus (vs[j], step)fold_build_pointer_plus_loc (((location_t) 0), vs[j], step); | ||||
2892 | else | ||||
2893 | t = fold_build2 (PLUS_EXPR, itype, vs[j], step)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, vs[j], step ); | ||||
2894 | } | ||||
2895 | t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
2896 | true, GSI_SAME_STMT); | ||||
2897 | expand_omp_build_assign (&gsi2, vs[j], t); | ||||
2898 | |||||
2899 | edge ne = split_block (e->dest, last_stmt (e->dest)); | ||||
2900 | gsi2 = gsi_after_labels (ne->dest); | ||||
2901 | |||||
2902 | gcond *cond_stmt; | ||||
2903 | if (next_bb == entry_bb) | ||||
2904 | /* No need to actually check the outermost condition. */ | ||||
2905 | cond_stmt | ||||
2906 | = gimple_build_cond (EQ_EXPR, boolean_true_nodeglobal_trees[TI_BOOLEAN_TRUE], | ||||
2907 | boolean_true_nodeglobal_trees[TI_BOOLEAN_TRUE], | ||||
2908 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
2909 | else | ||||
2910 | cond_stmt | ||||
2911 | = gimple_build_cond (rect_p ? LT_EXPR | ||||
2912 | : fd->loops[j].cond_code, | ||||
2913 | vs[j], n2, NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
2914 | gsi_insert_before (&gsi2, cond_stmt, GSI_SAME_STMT); | ||||
2915 | edge e3, e4; | ||||
2916 | if (next_bb == entry_bb) | ||||
2917 | { | ||||
2918 | e3 = find_edge (ne->dest, next_bb); | ||||
2919 | e3->flags = EDGE_FALSE_VALUE; | ||||
2920 | dom_bb = ne->dest; | ||||
2921 | } | ||||
2922 | else | ||||
2923 | e3 = make_edge (ne->dest, next_bb, EDGE_FALSE_VALUE); | ||||
2924 | e4 = make_edge (ne->dest, new_cur_bb, EDGE_TRUE_VALUE); | ||||
2925 | e4->probability = profile_probability::likely ().guessed (); | ||||
2926 | e3->probability = e4->probability.invert (); | ||||
2927 | basic_block esrc = e->src; | ||||
2928 | make_edge (e->src, ne->dest, EDGE_FALLTHRU); | ||||
2929 | cur_bb = new_cur_bb; | ||||
2930 | basic_block latch_bb = next_bb; | ||||
2931 | next_bb = e->dest; | ||||
2932 | remove_edge (e); | ||||
2933 | set_immediate_dominator (CDI_DOMINATORS, ne->dest, esrc); | ||||
2934 | set_immediate_dominator (CDI_DOMINATORS, latch_bb, ne->dest); | ||||
2935 | set_immediate_dominator (CDI_DOMINATORS, cur_bb, ne->dest); | ||||
2936 | } | ||||
2937 | for (int j = fd->last_nonrect; j >= fd->first_nonrect; j--) | ||||
2938 | { | ||||
2939 | tree vtype = TREE_TYPE (fd->loops[j].v)((contains_struct_check ((fd->loops[j].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 2939, __FUNCTION__))->typed.type); | ||||
2940 | tree itype = vtype; | ||||
2941 | if (POINTER_TYPE_P (itype)(((enum tree_code) (itype)->base.code) == POINTER_TYPE || ( (enum tree_code) (itype)->base.code) == REFERENCE_TYPE)) | ||||
2942 | itype = signed_type_for (itype); | ||||
2943 | bool rect_p = (fd->loops[j].m1 == NULL_TREE(tree) nullptr | ||||
2944 | && fd->loops[j].m2 == NULL_TREE(tree) nullptr | ||||
2945 | && !fd->loops[j].non_rect_referenced); | ||||
2946 | if (j == fd->last_nonrect) | ||||
2947 | { | ||||
2948 | t = fold_build2 (MINUS_EXPR, type, stopval, idx)fold_build2_loc (((location_t) 0), MINUS_EXPR, type, stopval, idx ); | ||||
2949 | t = fold_convert (itype, t)fold_convert_loc (((location_t) 0), itype, t); | ||||
2950 | tree t2 | ||||
2951 | = fold_convert (itype, unshare_expr (fd->loops[j].step))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[j].step)); | ||||
2952 | t = fold_build2 (MULT_EXPR, itype, t, t2)fold_build2_loc (((location_t) 0), MULT_EXPR, itype, t, t2 ); | ||||
2953 | if (POINTER_TYPE_P (vtype)(((enum tree_code) (vtype)->base.code) == POINTER_TYPE || ( (enum tree_code) (vtype)->base.code) == REFERENCE_TYPE)) | ||||
2954 | t = fold_build_pointer_plus (n1, t)fold_build_pointer_plus_loc (((location_t) 0), n1, t); | ||||
2955 | else | ||||
2956 | t = fold_build2 (PLUS_EXPR, itype, n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, n1, t ); | ||||
2957 | } | ||||
2958 | else if (rect_p) | ||||
2959 | { | ||||
2960 | t = fold_convert (itype, vs[j])fold_convert_loc (((location_t) 0), itype, vs[j]); | ||||
2961 | 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) ) | ||||
2962 | 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) ); | ||||
2963 | if (POINTER_TYPE_P (vtype)(((enum tree_code) (vtype)->base.code) == POINTER_TYPE || ( (enum tree_code) (vtype)->base.code) == REFERENCE_TYPE)) | ||||
2964 | t = fold_build_pointer_plus (fd->loops[j].n1, t)fold_build_pointer_plus_loc (((location_t) 0), fd->loops[j ].n1, t); | ||||
2965 | else | ||||
2966 | 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 ); | ||||
2967 | } | ||||
2968 | else | ||||
2969 | t = vs[j]; | ||||
2970 | t = force_gimple_operand_gsi (gsi, t, false, | ||||
2971 | NULL_TREE(tree) nullptr, true, | ||||
2972 | GSI_SAME_STMT); | ||||
2973 | stmt = gimple_build_assign (fd->loops[j].v, t); | ||||
2974 | gsi_insert_before (gsi, stmt, GSI_SAME_STMT); | ||||
2975 | } | ||||
2976 | if (gsi_end_p (*gsi)) | ||||
2977 | *gsi = gsi_last_bb (gsi_bb (*gsi)); | ||||
2978 | else | ||||
2979 | gsi_prev (gsi); | ||||
2980 | if (bb_triang) | ||||
2981 | { | ||||
2982 | e = split_block (gsi_bb (*gsi), gsi_stmt (*gsi)); | ||||
2983 | make_edge (bb_triang, e->dest, EDGE_FALLTHRU); | ||||
2984 | *gsi = gsi_after_labels (e->dest); | ||||
2985 | if (!gsi_end_p (*gsi)) | ||||
2986 | gsi_insert_before (gsi, gimple_build_nop (), GSI_NEW_STMT); | ||||
2987 | set_immediate_dominator (CDI_DOMINATORS, e->dest, bb_triang_dom); | ||||
2988 | } | ||||
2989 | } | ||||
2990 | else | ||||
2991 | { | ||||
2992 | t = fold_convert (itype, t)fold_convert_loc (((location_t) 0), itype, t); | ||||
2993 | 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) ) | ||||
2994 | 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) ); | ||||
2995 | if (POINTER_TYPE_P (vtype)(((enum tree_code) (vtype)->base.code) == POINTER_TYPE || ( (enum tree_code) (vtype)->base.code) == REFERENCE_TYPE)) | ||||
2996 | t = fold_build_pointer_plus (fd->loops[i].n1, t)fold_build_pointer_plus_loc (((location_t) 0), fd->loops[i ].n1, t); | ||||
2997 | else | ||||
2998 | 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 ); | ||||
2999 | t = force_gimple_operand_gsi (gsi, t, | ||||
3000 | DECL_P (fd->loops[i].v)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (fd->loops[i].v)->base.code))] == tcc_declaration) | ||||
3001 | && TREE_ADDRESSABLE (fd->loops[i].v)((fd->loops[i].v)->base.addressable_flag), | ||||
3002 | NULL_TREE(tree) nullptr, false, | ||||
3003 | GSI_CONTINUE_LINKING); | ||||
3004 | stmt = gimple_build_assign (fd->loops[i].v, t); | ||||
3005 | gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING); | ||||
3006 | } | ||||
3007 | if (i != 0 && (i != fd->last_nonrect || fd->first_nonrect)) | ||||
3008 | { | ||||
3009 | t = fold_build2 (TRUNC_DIV_EXPR, type, tem, counts[i])fold_build2_loc (((location_t) 0), TRUNC_DIV_EXPR, type, tem, counts[i] ); | ||||
3010 | t = force_gimple_operand_gsi (gsi, t, false, NULL_TREE(tree) nullptr, | ||||
3011 | false, GSI_CONTINUE_LINKING); | ||||
3012 | stmt = gimple_build_assign (tem, t); | ||||
3013 | gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING); | ||||
3014 | } | ||||
3015 | if (i == fd->last_nonrect) | ||||
3016 | i = fd->first_nonrect; | ||||
3017 | } | ||||
3018 | if (fd->non_rect) | ||||
3019 | for (i = 0; i <= fd->last_nonrect; i++) | ||||
3020 | if (fd->loops[i].m2) | ||||
3021 | { | ||||
3022 | tree itype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3022, __FUNCTION__))->typed.type); | ||||
3023 | |||||
3024 | tree t; | ||||
3025 | if (POINTER_TYPE_P (itype)(((enum tree_code) (itype)->base.code) == POINTER_TYPE || ( (enum tree_code) (itype)->base.code) == REFERENCE_TYPE)) | ||||
3026 | { | ||||
3027 | gcc_assert (integer_onep (fd->loops[i].m2))((void)(!(integer_onep (fd->loops[i].m2)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3027, __FUNCTION__), 0 : 0)); | ||||
3028 | t = fold_build_pointer_plus (fd->loops[i - fd->loops[i].outer].v,fold_build_pointer_plus_loc (((location_t) 0), fd->loops[i - fd->loops[i].outer].v, unshare_expr (fd->loops[i].n2 )) | ||||
3029 | unshare_expr (fd->loops[i].n2))fold_build_pointer_plus_loc (((location_t) 0), fd->loops[i - fd->loops[i].outer].v, unshare_expr (fd->loops[i].n2 )); | ||||
3030 | } | ||||
3031 | else | ||||
3032 | { | ||||
3033 | t = fold_convert (itype, unshare_expr (fd->loops[i].m2))fold_convert_loc (((location_t) 0), itype, unshare_expr (fd-> loops[i].m2)); | ||||
3034 | t = fold_build2 (MULT_EXPR, itype,fold_build2_loc (((location_t) 0), MULT_EXPR, itype, fd->loops [i - fd->loops[i].outer].v, t ) | ||||
3035 | 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 ); | ||||
3036 | 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)) ) | ||||
3037 | 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)) ) | ||||
3038 | 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)) ); | ||||
3039 | } | ||||
3040 | nonrect_bounds[i] = create_tmp_reg (itype, ".bound"); | ||||
3041 | t = force_gimple_operand_gsi (gsi, t, false, | ||||
3042 | NULL_TREE(tree) nullptr, false, | ||||
3043 | GSI_CONTINUE_LINKING); | ||||
3044 | stmt = gimple_build_assign (nonrect_bounds[i], t); | ||||
3045 | gsi_insert_after (gsi, stmt, GSI_CONTINUE_LINKING); | ||||
3046 | } | ||||
3047 | } | ||||
3048 | |||||
3049 | /* Helper function for expand_omp_for_*. Generate code like: | ||||
3050 | L10: | ||||
3051 | V3 += STEP3; | ||||
3052 | if (V3 cond3 N32) goto BODY_BB; else goto L11; | ||||
3053 | L11: | ||||
3054 | V3 = N31; | ||||
3055 | V2 += STEP2; | ||||
3056 | if (V2 cond2 N22) goto BODY_BB; else goto L12; | ||||
3057 | L12: | ||||
3058 | V2 = N21; | ||||
3059 | V1 += STEP1; | ||||
3060 | goto BODY_BB; | ||||
3061 | For non-rectangular loops, use temporaries stored in nonrect_bounds | ||||
3062 | for the upper bounds if M?2 multiplier is present. Given e.g. | ||||
3063 | for (V1 = N11; V1 cond1 N12; V1 += STEP1) | ||||
3064 | for (V2 = N21; V2 cond2 N22; V2 += STEP2) | ||||
3065 | for (V3 = N31; V3 cond3 N32; V3 += STEP3) | ||||
3066 | for (V4 = N41 + M41 * V2; V4 cond4 N42 + M42 * V2; V4 += STEP4) | ||||
3067 | do: | ||||
3068 | L10: | ||||
3069 | V4 += STEP4; | ||||
3070 | if (V4 cond4 NONRECT_BOUND4) goto BODY_BB; else goto L11; | ||||
3071 | L11: | ||||
3072 | V4 = N41 + M41 * V2; // This can be left out if the loop | ||||
3073 | // refers to the immediate parent loop | ||||
3074 | V3 += STEP3; | ||||
3075 | if (V3 cond3 N32) goto BODY_BB; else goto L12; | ||||
3076 | L12: | ||||
3077 | V3 = N31; | ||||
3078 | V2 += STEP2; | ||||
3079 | if (V2 cond2 N22) goto L120; else goto L13; | ||||
3080 | L120: | ||||
3081 | V4 = N41 + M41 * V2; | ||||
3082 | NONRECT_BOUND4 = N42 + M42 * V2; | ||||
3083 | if (V4 cond4 NONRECT_BOUND4) goto BODY_BB; else goto L12; | ||||
3084 | L13: | ||||
3085 | V2 = N21; | ||||
3086 | V1 += STEP1; | ||||
3087 | goto L120; */ | ||||
3088 | |||||
3089 | static basic_block | ||||
3090 | extract_omp_for_update_vars (struct omp_for_data *fd, tree *nonrect_bounds, | ||||
3091 | basic_block cont_bb, basic_block body_bb) | ||||
3092 | { | ||||
3093 | basic_block last_bb, bb, collapse_bb = NULLnullptr; | ||||
3094 | int i; | ||||
3095 | gimple_stmt_iterator gsi; | ||||
3096 | edge e; | ||||
3097 | tree t; | ||||
3098 | gimple *stmt; | ||||
3099 | |||||
3100 | last_bb = cont_bb; | ||||
3101 | for (i = fd->collapse - 1; i >= 0; i--) | ||||
3102 | { | ||||
3103 | tree vtype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3103, __FUNCTION__))->typed.type); | ||||
3104 | |||||
3105 | bb = create_empty_bb (last_bb); | ||||
3106 | add_bb_to_loop (bb, last_bb->loop_father); | ||||
3107 | gsi = gsi_start_bb (bb); | ||||
3108 | |||||
3109 | if (i < fd->collapse - 1) | ||||
3110 | { | ||||
3111 | e = make_edge (last_bb, bb, EDGE_FALSE_VALUE); | ||||
3112 | e->probability = profile_probability::guessed_always () / 8; | ||||
3113 | |||||
3114 | struct omp_for_data_loop *l = &fd->loops[i + 1]; | ||||
3115 | if (l->m1 == NULL_TREE(tree) nullptr || l->outer != 1) | ||||
3116 | { | ||||
3117 | t = l->n1; | ||||
3118 | if (l->m1) | ||||
3119 | { | ||||
3120 | if (POINTER_TYPE_P (TREE_TYPE (l->v))(((enum tree_code) (((contains_struct_check ((l->v), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3120, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((l->v), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3120, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) | ||||
3121 | t = fold_build_pointer_plus (fd->loops[i + 1 - l->outer].v,fold_build_pointer_plus_loc (((location_t) 0), fd->loops[i + 1 - l->outer].v, t) | ||||
3122 | t)fold_build_pointer_plus_loc (((location_t) 0), fd->loops[i + 1 - l->outer].v, t); | ||||
3123 | else | ||||
3124 | { | ||||
3125 | tree t2 | ||||
3126 | = fold_build2 (MULT_EXPR, TREE_TYPE (t),fold_build2_loc (((location_t) 0), MULT_EXPR, ((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3126, __FUNCTION__))->typed.type), fd->loops[i + 1 - l ->outer].v, l->m1 ) | ||||
3127 | fd->loops[i + 1 - l->outer].v, l->m1)fold_build2_loc (((location_t) 0), MULT_EXPR, ((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3126, __FUNCTION__))->typed.type), fd->loops[i + 1 - l ->outer].v, l->m1 ); | ||||
3128 | t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t2, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3128, __FUNCTION__))->typed.type), t2, t ); | ||||
3129 | } | ||||
3130 | } | ||||
3131 | t = force_gimple_operand_gsi (&gsi, t, | ||||
3132 | DECL_P (l->v)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (l->v)->base.code))] == tcc_declaration) | ||||
3133 | && TREE_ADDRESSABLE (l->v)((l->v)->base.addressable_flag), | ||||
3134 | NULL_TREE(tree) nullptr, false, | ||||
3135 | GSI_CONTINUE_LINKING); | ||||
3136 | stmt = gimple_build_assign (l->v, t); | ||||
3137 | gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); | ||||
3138 | } | ||||
3139 | } | ||||
3140 | else | ||||
3141 | collapse_bb = bb; | ||||
3142 | |||||
3143 | set_immediate_dominator (CDI_DOMINATORS, bb, last_bb); | ||||
3144 | |||||
3145 | if (POINTER_TYPE_P (vtype)(((enum tree_code) (vtype)->base.code) == POINTER_TYPE || ( (enum tree_code) (vtype)->base.code) == REFERENCE_TYPE)) | ||||
3146 | 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); | ||||
3147 | else | ||||
3148 | 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 ); | ||||
3149 | t = force_gimple_operand_gsi (&gsi, t, | ||||
3150 | DECL_P (fd->loops[i].v)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (fd->loops[i].v)->base.code))] == tcc_declaration) | ||||
3151 | && TREE_ADDRESSABLE (fd->loops[i].v)((fd->loops[i].v)->base.addressable_flag), | ||||
3152 | NULL_TREE(tree) nullptr, false, GSI_CONTINUE_LINKING); | ||||
3153 | stmt = gimple_build_assign (fd->loops[i].v, t); | ||||
3154 | gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); | ||||
3155 | |||||
3156 | if (fd->loops[i].non_rect_referenced) | ||||
3157 | { | ||||
3158 | basic_block update_bb = NULLnullptr, prev_bb = NULLnullptr; | ||||
3159 | for (int j = i + 1; j <= fd->last_nonrect; j++) | ||||
3160 | if (j - fd->loops[j].outer == i) | ||||
3161 | { | ||||
3162 | tree n1, n2; | ||||
3163 | struct omp_for_data_loop *l = &fd->loops[j]; | ||||
3164 | basic_block this_bb = create_empty_bb (last_bb); | ||||
3165 | add_bb_to_loop (this_bb, last_bb->loop_father); | ||||
3166 | gimple_stmt_iterator gsi2 = gsi_start_bb (this_bb); | ||||
3167 | if (prev_bb) | ||||
3168 | { | ||||
3169 | e = make_edge (prev_bb, this_bb, EDGE_TRUE_VALUE); | ||||
3170 | e->probability | ||||
3171 | = profile_probability::guessed_always ().apply_scale (7, | ||||
3172 | 8); | ||||
3173 | set_immediate_dominator (CDI_DOMINATORS, this_bb, prev_bb); | ||||
3174 | } | ||||
3175 | if (l->m1) | ||||
3176 | { | ||||
3177 | if (POINTER_TYPE_P (TREE_TYPE (l->v))(((enum tree_code) (((contains_struct_check ((l->v), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3177, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((l->v), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3177, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) | ||||
3178 | t = fold_build_pointer_plus (fd->loops[i].v, l->n1)fold_build_pointer_plus_loc (((location_t) 0), fd->loops[i ].v, l->n1); | ||||
3179 | else | ||||
3180 | { | ||||
3181 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3181, __FUNCTION__))->typed.type), l->m1, fd->loops [i].v ) | ||||
3182 | fd->loops[i].v)fold_build2_loc (((location_t) 0), MULT_EXPR, ((contains_struct_check ((l->m1), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3181, __FUNCTION__))->typed.type), l->m1, fd->loops [i].v ); | ||||
3183 | t = fold_build2 (PLUS_EXPR, TREE_TYPE (l->v),fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((l->v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3183, __FUNCTION__))->typed.type), t, l->n1 ) | ||||
3184 | t, l->n1)fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((l->v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3183, __FUNCTION__))->typed.type), t, l->n1 ); | ||||
3185 | } | ||||
3186 | n1 = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
3187 | false, | ||||
3188 | GSI_CONTINUE_LINKING); | ||||
3189 | stmt = gimple_build_assign (l->v, n1); | ||||
3190 | gsi_insert_after (&gsi2, stmt, GSI_CONTINUE_LINKING); | ||||
3191 | n1 = l->v; | ||||
3192 | } | ||||
3193 | else | ||||
3194 | n1 = force_gimple_operand_gsi (&gsi2, l->n1, true, | ||||
3195 | NULL_TREE(tree) nullptr, false, | ||||
3196 | GSI_CONTINUE_LINKING); | ||||
3197 | if (l->m2) | ||||
3198 | { | ||||
3199 | if (POINTER_TYPE_P (TREE_TYPE (l->v))(((enum tree_code) (((contains_struct_check ((l->v), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3199, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((l->v), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3199, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) | ||||
3200 | t = fold_build_pointer_plus (fd->loops[i].v, l->n2)fold_build_pointer_plus_loc (((location_t) 0), fd->loops[i ].v, l->n2); | ||||
3201 | else | ||||
3202 | { | ||||
3203 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3203, __FUNCTION__))->typed.type), l->m2, fd->loops [i].v ) | ||||
3204 | fd->loops[i].v)fold_build2_loc (((location_t) 0), MULT_EXPR, ((contains_struct_check ((l->m2), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3203, __FUNCTION__))->typed.type), l->m2, fd->loops [i].v ); | ||||
3205 | t = fold_build2 (PLUS_EXPR,fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((nonrect_bounds[j]), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3206, __FUNCTION__))->typed.type), t, unshare_expr (l-> n2) ) | ||||
3206 | TREE_TYPE (nonrect_bounds[j]),fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((nonrect_bounds[j]), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3206, __FUNCTION__))->typed.type), t, unshare_expr (l-> n2) ) | ||||
3207 | t, unshare_expr (l->n2))fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((nonrect_bounds[j]), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3206, __FUNCTION__))->typed.type), t, unshare_expr (l-> n2) ); | ||||
3208 | } | ||||
3209 | n2 = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
3210 | false, | ||||
3211 | GSI_CONTINUE_LINKING); | ||||
3212 | stmt = gimple_build_assign (nonrect_bounds[j], n2); | ||||
3213 | gsi_insert_after (&gsi2, stmt, GSI_CONTINUE_LINKING); | ||||
3214 | n2 = nonrect_bounds[j]; | ||||
3215 | } | ||||
3216 | else | ||||
3217 | n2 = force_gimple_operand_gsi (&gsi2, unshare_expr (l->n2), | ||||
3218 | true, NULL_TREE(tree) nullptr, false, | ||||
3219 | GSI_CONTINUE_LINKING); | ||||
3220 | gcond *cond_stmt | ||||
3221 | = gimple_build_cond (l->cond_code, n1, n2, | ||||
3222 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
3223 | gsi_insert_after (&gsi2, cond_stmt, GSI_CONTINUE_LINKING); | ||||
3224 | if (update_bb == NULLnullptr) | ||||
3225 | update_bb = this_bb; | ||||
3226 | e = make_edge (this_bb, bb, EDGE_FALSE_VALUE); | ||||
3227 | e->probability = profile_probability::guessed_always () / 8; | ||||
3228 | if (prev_bb == NULLnullptr) | ||||
3229 | set_immediate_dominator (CDI_DOMINATORS, this_bb, bb); | ||||
3230 | prev_bb = this_bb; | ||||
3231 | } | ||||
3232 | e = make_edge (prev_bb, body_bb, EDGE_TRUE_VALUE); | ||||
3233 | e->probability | ||||
3234 | = profile_probability::guessed_always ().apply_scale (7, 8); | ||||
3235 | body_bb = update_bb; | ||||
3236 | } | ||||
3237 | |||||
3238 | if (i > 0) | ||||
3239 | { | ||||
3240 | if (fd->loops[i].m2) | ||||
3241 | t = nonrect_bounds[i]; | ||||
3242 | else | ||||
3243 | t = unshare_expr (fd->loops[i].n2); | ||||
3244 | t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, | ||||
3245 | false, GSI_CONTINUE_LINKING); | ||||
3246 | tree v = fd->loops[i].v; | ||||
3247 | if (DECL_P (v)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (v)->base.code))] == tcc_declaration) && TREE_ADDRESSABLE (v)((v)->base.addressable_flag)) | ||||
3248 | v = force_gimple_operand_gsi (&gsi, v, true, NULL_TREE(tree) nullptr, | ||||
3249 | false, GSI_CONTINUE_LINKING); | ||||
3250 | 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 ); | ||||
3251 | stmt = gimple_build_cond_empty (t); | ||||
3252 | gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING); | ||||
3253 | 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) | ||||
3254 | expand_omp_regimplify_p, NULL, NULL)walk_tree_1 (gimple_cond_lhs_ptr (as_a <gcond *> (stmt) ), expand_omp_regimplify_p, nullptr, nullptr, nullptr) | ||||
3255 | || 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) | ||||
3256 | expand_omp_regimplify_p, NULL, NULL)walk_tree_1 (gimple_cond_rhs_ptr (as_a <gcond *> (stmt) ), expand_omp_regimplify_p, nullptr, nullptr, nullptr)) | ||||
3257 | gimple_regimplify_operands (stmt, &gsi); | ||||
3258 | e = make_edge (bb, body_bb, EDGE_TRUE_VALUE); | ||||
3259 | e->probability = profile_probability::guessed_always ().apply_scale (7, 8); | ||||
3260 | } | ||||
3261 | else | ||||
3262 | make_edge (bb, body_bb, EDGE_FALLTHRU); | ||||
3263 | set_immediate_dominator (CDI_DOMINATORS, bb, last_bb); | ||||
3264 | last_bb = bb; | ||||
3265 | } | ||||
3266 | |||||
3267 | return collapse_bb; | ||||
3268 | } | ||||
3269 | |||||
3270 | /* Expand #pragma omp ordered depend(source). */ | ||||
3271 | |||||
3272 | static void | ||||
3273 | expand_omp_ordered_source (gimple_stmt_iterator *gsi, struct omp_for_data *fd, | ||||
3274 | tree *counts, location_t loc) | ||||
3275 | { | ||||
3276 | enum built_in_function source_ix | ||||
3277 | = fd->iter_type == long_integer_type_nodeinteger_types[itk_long] | ||||
3278 | ? BUILT_IN_GOMP_DOACROSS_POST : BUILT_IN_GOMP_DOACROSS_ULL_POST; | ||||
3279 | gimple *g | ||||
3280 | = gimple_build_call (builtin_decl_explicit (source_ix), 1, | ||||
3281 | build_fold_addr_expr (counts[fd->ordered])build_fold_addr_expr_loc (((location_t) 0), (counts[fd->ordered ]))); | ||||
3282 | gimple_set_location (g, loc); | ||||
3283 | gsi_insert_before (gsi, g, GSI_SAME_STMT); | ||||
3284 | } | ||||
3285 | |||||
3286 | /* Expand a single depend from #pragma omp ordered depend(sink:...). */ | ||||
3287 | |||||
3288 | static void | ||||
3289 | expand_omp_ordered_sink (gimple_stmt_iterator *gsi, struct omp_for_data *fd, | ||||
3290 | tree *counts, tree c, location_t loc, | ||||
3291 | basic_block cont_bb) | ||||
3292 | { | ||||
3293 | auto_vec<tree, 10> args; | ||||
3294 | enum built_in_function sink_ix | ||||
3295 | = fd->iter_type == long_integer_type_nodeinteger_types[itk_long] | ||||
3296 | ? BUILT_IN_GOMP_DOACROSS_WAIT : BUILT_IN_GOMP_DOACROSS_ULL_WAIT; | ||||
3297 | tree t, off, coff = NULL_TREE(tree) nullptr, deps = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3297, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3297, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3297, __FUNCTION__))), cond = NULL_TREE(tree) nullptr; | ||||
3298 | int i; | ||||
3299 | gimple_stmt_iterator gsi2 = *gsi; | ||||
3300 | bool warned_step = false; | ||||
3301 | |||||
3302 | if (deps == NULLnullptr) | ||||
3303 | { | ||||
3304 | /* Handle doacross(sink: omp_cur_iteration - 1). */ | ||||
3305 | gsi_prev (&gsi2); | ||||
3306 | edge e1 = split_block (gsi_bb (gsi2), gsi_stmt (gsi2)); | ||||
3307 | edge e2 = split_block_after_labels (e1->dest); | ||||
3308 | gsi2 = gsi_after_labels (e1->dest); | ||||
3309 | *gsi = gsi_last_bb (e1->src); | ||||
3310 | gimple_stmt_iterator gsi3 = *gsi; | ||||
3311 | |||||
3312 | if (counts[fd->collapse - 1]) | ||||
3313 | { | ||||
3314 | gcc_assert (fd->collapse == 1)((void)(!(fd->collapse == 1) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3314, __FUNCTION__), 0 : 0)); | ||||
3315 | t = counts[fd->collapse - 1]; | ||||
3316 | } | ||||
3317 | else if (fd->collapse > 1) | ||||
3318 | t = fd->loop.v; | ||||
3319 | else | ||||
3320 | { | ||||
3321 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3321, __FUNCTION__))->typed.type), fd->loops[0].v, fd ->loops[0].n1 ) | ||||
3322 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3321, __FUNCTION__))->typed.type), fd->loops[0].v, fd ->loops[0].n1 ); | ||||
3323 | t = fold_convert (fd->iter_type, t)fold_convert_loc (((location_t) 0), fd->iter_type, t); | ||||
3324 | } | ||||
3325 | |||||
3326 | t = force_gimple_operand_gsi (gsi, t, true, NULL_TREE(tree) nullptr, | ||||
3327 | false, GSI_CONTINUE_LINKING); | ||||
3328 | gsi_insert_after (gsi, gimple_build_cond (NE_EXPR, t, | ||||
3329 | build_zero_cst (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3329, __FUNCTION__))->typed.type)), | ||||
3330 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr), | ||||
3331 | GSI_NEW_STMT); | ||||
3332 | |||||
3333 | t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t,fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3333, __FUNCTION__))->typed.type), t, build_minus_one_cst (((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3334, __FUNCTION__))->typed.type)) ) | ||||
3334 | build_minus_one_cst (TREE_TYPE (t)))fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3333, __FUNCTION__))->typed.type), t, build_minus_one_cst (((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3334, __FUNCTION__))->typed.type)) ); | ||||
3335 | t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
3336 | true, GSI_SAME_STMT); | ||||
3337 | args.safe_push (t); | ||||
3338 | for (i = fd->collapse; i < fd->ordered; i++) | ||||
3339 | { | ||||
3340 | t = counts[fd->ordered + 2 + (i - fd->collapse)]; | ||||
3341 | t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t,fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3341, __FUNCTION__))->typed.type), t, build_minus_one_cst (((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3342, __FUNCTION__))->typed.type)) ) | ||||
3342 | build_minus_one_cst (TREE_TYPE (t)))fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3341, __FUNCTION__))->typed.type), t, build_minus_one_cst (((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3342, __FUNCTION__))->typed.type)) ); | ||||
3343 | t = fold_convert (fd->iter_type, t)fold_convert_loc (((location_t) 0), fd->iter_type, t); | ||||
3344 | t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
3345 | true, GSI_SAME_STMT); | ||||
3346 | args.safe_push (t); | ||||
3347 | } | ||||
3348 | |||||
3349 | gimple *g = gimple_build_call_vec (builtin_decl_explicit (sink_ix), | ||||
3350 | args); | ||||
3351 | gimple_set_location (g, loc); | ||||
3352 | gsi_insert_before (&gsi2, g, GSI_SAME_STMT); | ||||
3353 | |||||
3354 | edge e3 = make_edge (e1->src, e2->dest, EDGE_FALSE_VALUE); | ||||
3355 | e3->probability = profile_probability::guessed_always () / 8; | ||||
3356 | e1->probability = e3->probability.invert (); | ||||
3357 | e1->flags = EDGE_TRUE_VALUE; | ||||
3358 | set_immediate_dominator (CDI_DOMINATORS, e2->dest, e1->src); | ||||
3359 | |||||
3360 | if (fd->ordered > fd->collapse && cont_bb) | ||||
3361 | { | ||||
3362 | if (counts[fd->ordered + 1] == NULL_TREE(tree) nullptr) | ||||
3363 | counts[fd->ordered + 1] | ||||
3364 | = create_tmp_var (boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], ".first"); | ||||
3365 | |||||
3366 | edge e4; | ||||
3367 | if (gsi_end_p (gsi3)) | ||||
3368 | e4 = split_block_after_labels (e1->src); | ||||
3369 | else | ||||
3370 | { | ||||
3371 | gsi_prev (&gsi3); | ||||
3372 | e4 = split_block (gsi_bb (gsi3), gsi_stmt (gsi3)); | ||||
3373 | } | ||||
3374 | gsi3 = gsi_last_bb (e4->src); | ||||
3375 | |||||
3376 | gsi_insert_after (&gsi3, | ||||
3377 | gimple_build_cond (NE_EXPR, | ||||
3378 | counts[fd->ordered + 1], | ||||
3379 | boolean_false_nodeglobal_trees[TI_BOOLEAN_FALSE], | ||||
3380 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr), | ||||
3381 | GSI_NEW_STMT); | ||||
3382 | |||||
3383 | edge e5 = make_edge (e4->src, e2->dest, EDGE_FALSE_VALUE); | ||||
3384 | e4->probability = profile_probability::guessed_always () / 8; | ||||
3385 | e5->probability = e4->probability.invert (); | ||||
3386 | e4->flags = EDGE_TRUE_VALUE; | ||||
3387 | set_immediate_dominator (CDI_DOMINATORS, e2->dest, e4->src); | ||||
3388 | } | ||||
3389 | |||||
3390 | *gsi = gsi_after_labels (e2->dest); | ||||
3391 | return; | ||||
3392 | } | ||||
3393 | for (i = 0; i < fd->ordered; i++) | ||||
3394 | { | ||||
3395 | tree step = NULL_TREE(tree) nullptr; | ||||
3396 | off = TREE_PURPOSE (deps)((tree_check ((deps), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3396, __FUNCTION__, (TREE_LIST)))->list.purpose); | ||||
3397 | if (TREE_CODE (off)((enum tree_code) (off)->base.code) == TRUNC_DIV_EXPR) | ||||
3398 | { | ||||
3399 | step = TREE_OPERAND (off, 1)(*((const_cast<tree*> (tree_operand_check ((off), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3399, __FUNCTION__))))); | ||||
3400 | off = TREE_OPERAND (off, 0)(*((const_cast<tree*> (tree_operand_check ((off), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3400, __FUNCTION__))))); | ||||
3401 | } | ||||
3402 | if (!integer_zerop (off)) | ||||
3403 | { | ||||
3404 | 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3405, __FUNCTION__), 0 : 0)) | ||||
3405 | || fd->loops[i].cond_code == GT_EXPR)((void)(!(fd->loops[i].cond_code == LT_EXPR || fd->loops [i].cond_code == GT_EXPR) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3405, __FUNCTION__), 0 : 0)); | ||||
3406 | bool forward = fd->loops[i].cond_code == LT_EXPR; | ||||
3407 | if (step) | ||||
3408 | { | ||||
3409 | /* Non-simple Fortran DO loops. If step is variable, | ||||
3410 | we don't know at compile even the direction, so can't | ||||
3411 | warn. */ | ||||
3412 | if (TREE_CODE (step)((enum tree_code) (step)->base.code) != INTEGER_CST) | ||||
3413 | break; | ||||
3414 | forward = tree_int_cst_sgn (step) != -1; | ||||
3415 | } | ||||
3416 | if (forward ^ OMP_CLAUSE_DOACROSS_SINK_NEGATIVE (deps)(((tree_check ((deps), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3416, __FUNCTION__, (TREE_LIST))))->base.public_flag)) | ||||
3417 | warning_at (loc, 0, "%qs clause with %<sink%> modifier " | ||||
3418 | "waiting for lexically later iteration", | ||||
3419 | OMP_CLAUSE_DOACROSS_DEPEND (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_DOACROSS), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3419, __FUNCTION__)))->base.protected_flag) | ||||
3420 | ? "depend" : "doacross"); | ||||
3421 | break; | ||||
3422 | } | ||||
3423 | deps = TREE_CHAIN (deps)((contains_struct_check ((deps), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3423, __FUNCTION__))->common.chain); | ||||
3424 | } | ||||
3425 | /* If all offsets corresponding to the collapsed loops are zero, | ||||
3426 | this depend clause can be ignored. FIXME: but there is still a | ||||
3427 | flush needed. We need to emit one __sync_synchronize () for it | ||||
3428 | though (perhaps conditionally)? Solve this together with the | ||||
3429 | conservative dependence folding optimization. | ||||
3430 | if (i >= fd->collapse) | ||||
3431 | return; */ | ||||
3432 | |||||
3433 | deps = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3433, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3433, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3433, __FUNCTION__))); | ||||
3434 | gsi_prev (&gsi2); | ||||
3435 | edge e1 = split_block (gsi_bb (gsi2), gsi_stmt (gsi2)); | ||||
3436 | edge e2 = split_block_after_labels (e1->dest); | ||||
3437 | |||||
3438 | gsi2 = gsi_after_labels (e1->dest); | ||||
3439 | *gsi = gsi_last_bb (e1->src); | ||||
3440 | for (i = 0; i < fd->ordered; i++) | ||||
3441 | { | ||||
3442 | tree itype = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3442, __FUNCTION__))->typed.type); | ||||
3443 | tree step = NULL_TREE(tree) nullptr; | ||||
3444 | tree orig_off = NULL_TREE(tree) nullptr; | ||||
3445 | if (POINTER_TYPE_P (itype)(((enum tree_code) (itype)->base.code) == POINTER_TYPE || ( (enum tree_code) (itype)->base.code) == REFERENCE_TYPE)) | ||||
3446 | itype = sizetypesizetype_tab[(int) stk_sizetype]; | ||||
3447 | if (i) | ||||
3448 | deps = TREE_CHAIN (deps)((contains_struct_check ((deps), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3448, __FUNCTION__))->common.chain); | ||||
3449 | off = TREE_PURPOSE (deps)((tree_check ((deps), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3449, __FUNCTION__, (TREE_LIST)))->list.purpose); | ||||
3450 | if (TREE_CODE (off)((enum tree_code) (off)->base.code) == TRUNC_DIV_EXPR) | ||||
3451 | { | ||||
3452 | step = TREE_OPERAND (off, 1)(*((const_cast<tree*> (tree_operand_check ((off), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3452, __FUNCTION__))))); | ||||
3453 | off = TREE_OPERAND (off, 0)(*((const_cast<tree*> (tree_operand_check ((off), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3453, __FUNCTION__))))); | ||||
3454 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3456, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((fd->loops [i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3456, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3456, __FUNCTION__), 0 : 0)) | ||||
3455 | && 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3456, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((fd->loops [i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3456, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3456, __FUNCTION__), 0 : 0)) | ||||
3456 | && !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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3456, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((fd->loops [i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3456, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3456, __FUNCTION__), 0 : 0)); | ||||
3457 | } | ||||
3458 | tree s = fold_convert_loc (loc, itype, step ? step : fd->loops[i].step); | ||||
3459 | if (step) | ||||
3460 | { | ||||
3461 | off = fold_convert_loc (loc, itype, off); | ||||
3462 | orig_off = off; | ||||
3463 | off = fold_build2_loc (loc, TRUNC_DIV_EXPR, itype, off, s); | ||||
3464 | } | ||||
3465 | |||||
3466 | if (integer_zerop (off)) | ||||
3467 | t = boolean_true_nodeglobal_trees[TI_BOOLEAN_TRUE]; | ||||
3468 | else | ||||
3469 | { | ||||
3470 | tree a; | ||||
3471 | tree co = fold_convert_loc (loc, itype, off); | ||||
3472 | if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i].v))(((enum tree_code) (((contains_struct_check ((fd->loops[i] .v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3472, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((fd->loops [i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3472, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) | ||||
3473 | { | ||||
3474 | if (OMP_CLAUSE_DOACROSS_SINK_NEGATIVE (deps)(((tree_check ((deps), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3474, __FUNCTION__, (TREE_LIST))))->base.public_flag)) | ||||
3475 | co = fold_build1_loc (loc, NEGATE_EXPR, itype, co); | ||||
3476 | a = fold_build2_loc (loc, POINTER_PLUS_EXPR, | ||||
3477 | TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3477, __FUNCTION__))->typed.type), fd->loops[i].v, | ||||
3478 | co); | ||||
3479 | } | ||||
3480 | else if (OMP_CLAUSE_DOACROSS_SINK_NEGATIVE (deps)(((tree_check ((deps), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3480, __FUNCTION__, (TREE_LIST))))->base.public_flag)) | ||||
3481 | a = fold_build2_loc (loc, MINUS_EXPR, TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3481, __FUNCTION__))->typed.type), | ||||
3482 | fd->loops[i].v, co); | ||||
3483 | else | ||||
3484 | a = fold_build2_loc (loc, PLUS_EXPR, TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3484, __FUNCTION__))->typed.type), | ||||
3485 | fd->loops[i].v, co); | ||||
3486 | if (step) | ||||
3487 | { | ||||
3488 | tree t1, t2; | ||||
3489 | if (OMP_CLAUSE_DOACROSS_SINK_NEGATIVE (deps)(((tree_check ((deps), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3489, __FUNCTION__, (TREE_LIST))))->base.public_flag)) | ||||
3490 | t1 = fold_build2_loc (loc, GE_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, | ||||
3491 | fd->loops[i].n1); | ||||
3492 | else | ||||
3493 | t1 = fold_build2_loc (loc, LT_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, | ||||
3494 | fd->loops[i].n2); | ||||
3495 | if (OMP_CLAUSE_DOACROSS_SINK_NEGATIVE (deps)(((tree_check ((deps), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3495, __FUNCTION__, (TREE_LIST))))->base.public_flag)) | ||||
3496 | t2 = fold_build2_loc (loc, LT_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, | ||||
3497 | fd->loops[i].n2); | ||||
3498 | else | ||||
3499 | t2 = fold_build2_loc (loc, GE_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, | ||||
3500 | fd->loops[i].n1); | ||||
3501 | t = fold_build2_loc (loc, LT_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], | ||||
3502 | step, build_int_cst (TREE_TYPE (step)((contains_struct_check ((step), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3502, __FUNCTION__))->typed.type), 0)); | ||||
3503 | if (TREE_CODE (step)((enum tree_code) (step)->base.code) != INTEGER_CST) | ||||
3504 | { | ||||
3505 | t1 = unshare_expr (t1); | ||||
3506 | t1 = force_gimple_operand_gsi (gsi, t1, true, NULL_TREE(tree) nullptr, | ||||
3507 | false, GSI_CONTINUE_LINKING); | ||||
3508 | t2 = unshare_expr (t2); | ||||
3509 | t2 = force_gimple_operand_gsi (gsi, t2, true, NULL_TREE(tree) nullptr, | ||||
3510 | false, GSI_CONTINUE_LINKING); | ||||
3511 | } | ||||
3512 | t = fold_build3_loc (loc, COND_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], | ||||
3513 | t, t2, t1); | ||||
3514 | } | ||||
3515 | else if (fd->loops[i].cond_code == LT_EXPR) | ||||
3516 | { | ||||
3517 | if (OMP_CLAUSE_DOACROSS_SINK_NEGATIVE (deps)(((tree_check ((deps), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3517, __FUNCTION__, (TREE_LIST))))->base.public_flag)) | ||||
3518 | t = fold_build2_loc (loc, GE_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, | ||||
3519 | fd->loops[i].n1); | ||||
3520 | else | ||||
3521 | t = fold_build2_loc (loc, LT_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, | ||||
3522 | fd->loops[i].n2); | ||||
3523 | } | ||||
3524 | else if (OMP_CLAUSE_DOACROSS_SINK_NEGATIVE (deps)(((tree_check ((deps), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3524, __FUNCTION__, (TREE_LIST))))->base.public_flag)) | ||||
3525 | t = fold_build2_loc (loc, GT_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, | ||||
3526 | fd->loops[i].n2); | ||||
3527 | else | ||||
3528 | t = fold_build2_loc (loc, LE_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], a, | ||||
3529 | fd->loops[i].n1); | ||||
3530 | } | ||||
3531 | if (cond) | ||||
3532 | cond = fold_build2_loc (loc, BIT_AND_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], cond, t); | ||||
3533 | else | ||||
3534 | cond = t; | ||||
3535 | |||||
3536 | off = fold_convert_loc (loc, itype, off); | ||||
3537 | |||||
3538 | if (step | ||||
3539 | || (fd->loops[i].cond_code == LT_EXPR | ||||
3540 | ? !integer_onep (fd->loops[i].step) | ||||
3541 | : !integer_minus_onep (fd->loops[i].step))) | ||||
3542 | { | ||||
3543 | if (step == NULL_TREE(tree) nullptr | ||||
3544 | && TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3544, __FUNCTION__))->base.u.bits.unsigned_flag) | ||||
3545 | && fd->loops[i].cond_code == GT_EXPR) | ||||
3546 | t = fold_build2_loc (loc, TRUNC_MOD_EXPR, itype, off, | ||||
3547 | fold_build1_loc (loc, NEGATE_EXPR, itype, | ||||
3548 | s)); | ||||
3549 | else | ||||
3550 | t = fold_build2_loc (loc, TRUNC_MOD_EXPR, itype, | ||||
3551 | orig_off ? orig_off : off, s); | ||||
3552 | t = fold_build2_loc (loc, EQ_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], t, | ||||
3553 | build_int_cst (itype, 0)); | ||||
3554 | if (integer_zerop (t) && !warned_step) | ||||
3555 | { | ||||
3556 | warning_at (loc, 0, "%qs clause with %<sink%> modifier " | ||||
3557 | "refers to iteration never in the iteration " | ||||
3558 | "space", | ||||
3559 | OMP_CLAUSE_DOACROSS_DEPEND (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE_DOACROSS), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3559, __FUNCTION__)))->base.protected_flag) | ||||
3560 | ? "depend" : "doacross"); | ||||
3561 | warned_step = true; | ||||
3562 | } | ||||
3563 | cond = fold_build2_loc (loc, BIT_AND_EXPR, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], | ||||
3564 | cond, t); | ||||
3565 | } | ||||
3566 | |||||
3567 | if (i <= fd->collapse - 1 && fd->collapse > 1) | ||||
3568 | t = fd->loop.v; | ||||
3569 | else if (counts[i]) | ||||
3570 | t = counts[i]; | ||||
3571 | else | ||||
3572 | { | ||||
3573 | t = fold_build2_loc (loc, MINUS_EXPR, TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3573, __FUNCTION__))->typed.type), | ||||
3574 | fd->loops[i].v, fd->loops[i].n1); | ||||
3575 | t = fold_convert_loc (loc, fd->iter_type, t); | ||||
3576 | } | ||||
3577 | if (step) | ||||
3578 | /* We have divided off by step already earlier. */; | ||||
3579 | else if (TYPE_UNSIGNED (itype)((tree_class_check ((itype), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3579, __FUNCTION__))->base.u.bits.unsigned_flag) && fd->loops[i].cond_code == GT_EXPR) | ||||
3580 | off = fold_build2_loc (loc, TRUNC_DIV_EXPR, itype, off, | ||||
3581 | fold_build1_loc (loc, NEGATE_EXPR, itype, | ||||
3582 | s)); | ||||
3583 | else | ||||
3584 | off = fold_build2_loc (loc, TRUNC_DIV_EXPR, itype, off, s); | ||||
3585 | if (OMP_CLAUSE_DOACROSS_SINK_NEGATIVE (deps)(((tree_check ((deps), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3585, __FUNCTION__, (TREE_LIST))))->base.public_flag)) | ||||
3586 | off = fold_build1_loc (loc, NEGATE_EXPR, itype, off); | ||||
3587 | off = fold_convert_loc (loc, fd->iter_type, off); | ||||
3588 | if (i <= fd->collapse - 1 && fd->collapse > 1) | ||||
3589 | { | ||||
3590 | if (i) | ||||
3591 | off = fold_build2_loc (loc, PLUS_EXPR, fd->iter_type, coff, | ||||
3592 | off); | ||||
3593 | if (i < fd->collapse - 1) | ||||
3594 | { | ||||
3595 | coff = fold_build2_loc (loc, MULT_EXPR, fd->iter_type, off, | ||||
3596 | counts[i]); | ||||
3597 | continue; | ||||
3598 | } | ||||
3599 | } | ||||
3600 | off = unshare_expr (off); | ||||
3601 | t = fold_build2_loc (loc, PLUS_EXPR, fd->iter_type, t, off); | ||||
3602 | t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE(tree) nullptr, | ||||
3603 | true, GSI_SAME_STMT); | ||||
3604 | args.safe_push (t); | ||||
3605 | } | ||||
3606 | gimple *g = gimple_build_call_vec (builtin_decl_explicit (sink_ix), args); | ||||
3607 | gimple_set_location (g, loc); | ||||
3608 | gsi_insert_before (&gsi2, g, GSI_SAME_STMT); | ||||
3609 | |||||
3610 | cond = unshare_expr (cond); | ||||
3611 | cond = force_gimple_operand_gsi (gsi, cond, true, NULL_TREE(tree) nullptr, false, | ||||
3612 | GSI_CONTINUE_LINKING); | ||||
3613 | gsi_insert_after (gsi, gimple_build_cond_empty (cond), GSI_NEW_STMT); | ||||
3614 | edge e3 = make_edge (e1->src, e2->dest, EDGE_FALSE_VALUE); | ||||
3615 | e3->probability = profile_probability::guessed_always () / 8; | ||||
3616 | e1->probability = e3->probability.invert (); | ||||
3617 | e1->flags = EDGE_TRUE_VALUE; | ||||
3618 | set_immediate_dominator (CDI_DOMINATORS, e2->dest, e1->src); | ||||
3619 | |||||
3620 | *gsi = gsi_after_labels (e2->dest); | ||||
3621 | } | ||||
3622 | |||||
3623 | /* Expand all #pragma omp ordered depend(source) and | ||||
3624 | #pragma omp ordered depend(sink:...) constructs in the current | ||||
3625 | #pragma omp for ordered(n) region. */ | ||||
3626 | |||||
3627 | static void | ||||
3628 | expand_omp_ordered_source_sink (struct omp_region *region, | ||||
3629 | struct omp_for_data *fd, tree *counts, | ||||
3630 | basic_block cont_bb) | ||||
3631 | { | ||||
3632 | struct omp_region *inner; | ||||
3633 | int i; | ||||
3634 | for (i = fd->collapse - 1; i < fd->ordered; i++) | ||||
3635 | if (i == fd->collapse - 1 && fd->collapse > 1) | ||||
3636 | counts[i] = NULL_TREE(tree) nullptr; | ||||
3637 | else if (i >= fd->collapse && !cont_bb) | ||||
3638 | counts[i] = build_zero_cst (fd->iter_type); | ||||
3639 | else if (!POINTER_TYPE_P (TREE_TYPE (fd->loops[i].v))(((enum tree_code) (((contains_struct_check ((fd->loops[i] .v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3639, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((fd->loops [i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3639, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) | ||||
3640 | && integer_onep (fd->loops[i].step)) | ||||
3641 | counts[i] = NULL_TREE(tree) nullptr; | ||||
3642 | else | ||||
3643 | counts[i] = create_tmp_var (fd->iter_type, ".orditer"); | ||||
3644 | tree atype | ||||
3645 | = build_array_type_nelts (fd->iter_type, fd->ordered - fd->collapse + 1); | ||||
3646 | counts[fd->ordered] = create_tmp_var (atype, ".orditera"); | ||||
3647 | TREE_ADDRESSABLE (counts[fd->ordered])((counts[fd->ordered])->base.addressable_flag) = 1; | ||||
3648 | counts[fd->ordered + 1] = NULL_TREE(tree) nullptr; | ||||
3649 | |||||
3650 | for (inner = region->inner; inner; inner = inner->next) | ||||
3651 | if (inner->type == GIMPLE_OMP_ORDERED) | ||||
3652 | { | ||||
3653 | gomp_ordered *ord_stmt = inner->ord_stmt; | ||||
3654 | gimple_stmt_iterator gsi = gsi_for_stmt (ord_stmt); | ||||
3655 | location_t loc = gimple_location (ord_stmt); | ||||
3656 | tree c; | ||||
3657 | for (c = gimple_omp_ordered_clauses (ord_stmt); | ||||
3658 | c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3658, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3658, __FUNCTION__))->common.chain)) | ||||
3659 | if (OMP_CLAUSE_DOACROSS_KIND (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_DOACROSS), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3659, __FUNCTION__))->omp_clause.subcode.doacross_kind) == OMP_CLAUSE_DOACROSS_SOURCE) | ||||
3660 | break; | ||||
3661 | if (c) | ||||
3662 | expand_omp_ordered_source (&gsi, fd, counts, loc); | ||||
3663 | for (c = gimple_omp_ordered_clauses (ord_stmt); | ||||
3664 | c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3664, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3664, __FUNCTION__))->common.chain)) | ||||
3665 | if (OMP_CLAUSE_DOACROSS_KIND (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_DOACROSS), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3665, __FUNCTION__))->omp_clause.subcode.doacross_kind) == OMP_CLAUSE_DOACROSS_SINK) | ||||
3666 | expand_omp_ordered_sink (&gsi, fd, counts, c, loc, cont_bb); | ||||
3667 | gsi_remove (&gsi, true); | ||||
3668 | } | ||||
3669 | } | ||||
3670 | |||||
3671 | /* Wrap the body into fd->ordered - fd->collapse loops that aren't | ||||
3672 | collapsed. */ | ||||
3673 | |||||
3674 | static basic_block | ||||
3675 | expand_omp_for_ordered_loops (struct omp_for_data *fd, tree *counts, | ||||
3676 | basic_block cont_bb, basic_block body_bb, | ||||
3677 | basic_block l0_bb, bool ordered_lastprivate) | ||||
3678 | { | ||||
3679 | if (fd->ordered == fd->collapse) | ||||
3680 | return cont_bb; | ||||
3681 | |||||
3682 | if (!cont_bb) | ||||
3683 | { | ||||
3684 | gimple_stmt_iterator gsi = gsi_after_labels (body_bb); | ||||
3685 | for (int i = fd->collapse; i < fd->ordered; i++) | ||||
3686 | { | ||||
3687 | tree type = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3687, __FUNCTION__))->typed.type); | ||||
3688 | tree n1 = fold_convert (type, fd->loops[i].n1)fold_convert_loc (((location_t) 0), type, fd->loops[i].n1); | ||||
3689 | expand_omp_build_assign (&gsi, fd->loops[i].v, n1); | ||||
3690 | tree aref = build4 (ARRAY_REF, fd->iter_type, counts[fd->ordered], | ||||
3691 | size_int (i - fd->collapse + 1)size_int_kind (i - fd->collapse + 1, stk_sizetype), | ||||
3692 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
3693 | expand_omp_build_assign (&gsi, aref, build_zero_cst (fd->iter_type)); | ||||
3694 | } | ||||
3695 | return NULLnullptr; | ||||
3696 | } | ||||
3697 | |||||
3698 | for (int i = fd->ordered - 1; i >= fd->collapse; i--) | ||||
3699 | { | ||||
3700 | tree t, type = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3700, __FUNCTION__))->typed.type); | ||||
3701 | gimple_stmt_iterator gsi = gsi_after_labels (body_bb); | ||||
3702 | if (counts[fd->ordered + 1] && i == fd->collapse) | ||||
3703 | expand_omp_build_assign (&gsi, counts[fd->ordered + 1], | ||||
3704 | boolean_true_nodeglobal_trees[TI_BOOLEAN_TRUE]); | ||||
3705 | expand_omp_build_assign (&gsi, fd->loops[i].v, | ||||
3706 | fold_convert (type, fd->loops[i].n1)fold_convert_loc (((location_t) 0), type, fd->loops[i].n1)); | ||||
3707 | if (counts[i]) | ||||
3708 | expand_omp_build_assign (&gsi, counts[i], | ||||
3709 | build_zero_cst (fd->iter_type)); | ||||
3710 | tree aref = build4 (ARRAY_REF, fd->iter_type, counts[fd->ordered], | ||||
3711 | size_int (i - fd->collapse + 1)size_int_kind (i - fd->collapse + 1, stk_sizetype), | ||||
3712 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
3713 | expand_omp_build_assign (&gsi, aref, build_zero_cst (fd->iter_type)); | ||||
3714 | if (!gsi_end_p (gsi)) | ||||
3715 | gsi_prev (&gsi); | ||||
3716 | else | ||||
3717 | gsi = gsi_last_bb (body_bb); | ||||
3718 | edge e1 = split_block (body_bb, gsi_stmt (gsi)); | ||||
3719 | basic_block new_body = e1->dest; | ||||
3720 | if (body_bb == cont_bb) | ||||
3721 | cont_bb = new_body; | ||||
3722 | edge e2 = NULLnullptr; | ||||
3723 | basic_block new_header; | ||||
3724 | if (EDGE_COUNT (cont_bb->preds)vec_safe_length (cont_bb->preds) > 0) | ||||
3725 | { | ||||
3726 | gsi = gsi_last_bb (cont_bb); | ||||
3727 | if (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE)) | ||||
3728 | 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); | ||||
3729 | else | ||||
3730 | 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) ) | ||||
3731 | 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) ); | ||||
3732 | expand_omp_build_assign (&gsi, fd->loops[i].v, t); | ||||
3733 | if (counts[i]) | ||||
3734 | { | ||||
3735 | 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) ) | ||||
3736 | 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) ); | ||||
3737 | expand_omp_build_assign (&gsi, counts[i], t); | ||||
3738 | t = counts[i]; | ||||
3739 | } | ||||
3740 | else | ||||
3741 | { | ||||
3742 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3742, __FUNCTION__))->typed.type), fd->loops[i].v, fd ->loops[i].n1 ) | ||||
3743 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3742, __FUNCTION__))->typed.type), fd->loops[i].v, fd ->loops[i].n1 ); | ||||
3744 | t = fold_convert (fd->iter_type, t)fold_convert_loc (((location_t) 0), fd->iter_type, t); | ||||
3745 | t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, | ||||
3746 | true, GSI_SAME_STMT); | ||||
3747 | } | ||||
3748 | aref = build4 (ARRAY_REF, fd->iter_type, counts[fd->ordered], | ||||
3749 | size_int (i - fd->collapse + 1)size_int_kind (i - fd->collapse + 1, stk_sizetype), | ||||
3750 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
3751 | expand_omp_build_assign (&gsi, aref, t); | ||||
3752 | if (counts[fd->ordered + 1] && i == fd->ordered - 1) | ||||
3753 | expand_omp_build_assign (&gsi, counts[fd->ordered + 1], | ||||
3754 | boolean_false_nodeglobal_trees[TI_BOOLEAN_FALSE]); | ||||
3755 | gsi_prev (&gsi); | ||||
3756 | e2 = split_block (cont_bb, gsi_stmt (gsi)); | ||||
3757 | new_header = e2->dest; | ||||
3758 | } | ||||
3759 | else | ||||
3760 | new_header = cont_bb; | ||||
3761 | gsi = gsi_after_labels (new_header); | ||||
3762 | tree v = force_gimple_operand_gsi (&gsi, fd->loops[i].v, true, NULL_TREE(tree) nullptr, | ||||
3763 | true, GSI_SAME_STMT); | ||||
3764 | tree n2 | ||||
3765 | = force_gimple_operand_gsi (&gsi, fold_convert (type, fd->loops[i].n2)fold_convert_loc (((location_t) 0), type, fd->loops[i].n2), | ||||
3766 | true, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); | ||||
3767 | t = build2 (fd->loops[i].cond_code, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], v, n2); | ||||
3768 | gsi_insert_before (&gsi, gimple_build_cond_empty (t), GSI_NEW_STMT); | ||||
3769 | edge e3 = split_block (new_header, gsi_stmt (gsi)); | ||||
3770 | cont_bb = e3->dest; | ||||
3771 | remove_edge (e1); | ||||
3772 | make_edge (body_bb, new_header, EDGE_FALLTHRU); | ||||
3773 | e3->flags = EDGE_FALSE_VALUE; | ||||
3774 | e3->probability = profile_probability::guessed_always () / 8; | ||||
3775 | e1 = make_edge (new_header, new_body, EDGE_TRUE_VALUE); | ||||
3776 | e1->probability = e3->probability.invert (); | ||||
3777 | |||||
3778 | set_immediate_dominator (CDI_DOMINATORS, new_header, body_bb); | ||||
3779 | set_immediate_dominator (CDI_DOMINATORS, new_body, new_header); | ||||
3780 | |||||
3781 | if (e2) | ||||
3782 | { | ||||
3783 | class loop *loop = alloc_loop (); | ||||
3784 | loop->header = new_header; | ||||
3785 | loop->latch = e2->src; | ||||
3786 | add_loop (loop, l0_bb->loop_father); | ||||
3787 | } | ||||
3788 | } | ||||
3789 | |||||
3790 | /* If there are any lastprivate clauses and it is possible some loops | ||||
3791 | might have zero iterations, ensure all the decls are initialized, | ||||
3792 | otherwise we could crash evaluating C++ class iterators with lastprivate | ||||
3793 | clauses. */ | ||||
3794 | bool need_inits = false; | ||||
3795 | for (int i = fd->collapse; ordered_lastprivate && i < fd->ordered; i++) | ||||
3796 | if (need_inits) | ||||
3797 | { | ||||
3798 | tree type = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3798, __FUNCTION__))->typed.type); | ||||
3799 | gimple_stmt_iterator gsi = gsi_after_labels (body_bb); | ||||
3800 | expand_omp_build_assign (&gsi, fd->loops[i].v, | ||||
3801 | fold_convert (type, fd->loops[i].n1)fold_convert_loc (((location_t) 0), type, fd->loops[i].n1)); | ||||
3802 | } | ||||
3803 | else | ||||
3804 | { | ||||
3805 | tree type = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3805, __FUNCTION__))->typed.type); | ||||
3806 | 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) ) | ||||
3807 | 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) ) | ||||
3808 | 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) ) | ||||
3809 | 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) ); | ||||
3810 | if (!integer_onep (this_cond)) | ||||
3811 | need_inits = true; | ||||
3812 | } | ||||
3813 | |||||
3814 | return cont_bb; | ||||
3815 | } | ||||
3816 | |||||
3817 | /* A subroutine of expand_omp_for. Generate code for a parallel | ||||
3818 | loop with any schedule. Given parameters: | ||||
3819 | |||||
3820 | for (V = N1; V cond N2; V += STEP) BODY; | ||||
3821 | |||||
3822 | where COND is "<" or ">", we generate pseudocode | ||||
3823 | |||||
3824 | more = GOMP_loop_foo_start (N1, N2, STEP, CHUNK, &istart0, &iend0); | ||||
3825 | if (more) goto L0; else goto L3; | ||||
3826 | L0: | ||||
3827 | V = istart0; | ||||
3828 | iend = iend0; | ||||
3829 | L1: | ||||
3830 | BODY; | ||||
3831 | V += STEP; | ||||
3832 | if (V cond iend) goto L1; else goto L2; | ||||
3833 | L2: | ||||
3834 | if (GOMP_loop_foo_next (&istart0, &iend0)) goto L0; else goto L3; | ||||
3835 | L3: | ||||
3836 | |||||
3837 | If this is a combined omp parallel loop, instead of the call to | ||||
3838 | GOMP_loop_foo_start, we call GOMP_loop_foo_next. | ||||
3839 | If this is gimple_omp_for_combined_p loop, then instead of assigning | ||||
3840 | V and iend in L0 we assign the first two _looptemp_ clause decls of the | ||||
3841 | inner GIMPLE_OMP_FOR and V += STEP; and | ||||
3842 | if (V cond iend) goto L1; else goto L2; are removed. | ||||
3843 | |||||
3844 | For collapsed loops, given parameters: | ||||
3845 | collapse(3) | ||||
3846 | for (V1 = N11; V1 cond1 N12; V1 += STEP1) | ||||
3847 | for (V2 = N21; V2 cond2 N22; V2 += STEP2) | ||||
3848 | for (V3 = N31; V3 cond3 N32; V3 += STEP3) | ||||
3849 | BODY; | ||||
3850 | |||||
3851 | we generate pseudocode | ||||
3852 | |||||
3853 | if (__builtin_expect (N32 cond3 N31, 0)) goto Z0; | ||||
3854 | if (cond3 is <) | ||||
3855 | adj = STEP3 - 1; | ||||
3856 | else | ||||
3857 | adj = STEP3 + 1; | ||||
3858 | count3 = (adj + N32 - N31) / STEP3; | ||||
3859 | if (__builtin_expect (N22 cond2 N21, 0)) goto Z0; | ||||
3860 | if (cond2 is <) | ||||
3861 | adj = STEP2 - 1; | ||||
3862 | else | ||||
3863 | adj = STEP2 + 1; | ||||
3864 | count2 = (adj + N22 - N21) / STEP2; | ||||
3865 | if (__builtin_expect (N12 cond1 N11, 0)) goto Z0; | ||||
3866 | if (cond1 is <) | ||||
3867 | adj = STEP1 - 1; | ||||
3868 | else | ||||
3869 | adj = STEP1 + 1; | ||||
3870 | count1 = (adj + N12 - N11) / STEP1; | ||||
3871 | count = count1 * count2 * count3; | ||||
3872 | goto Z1; | ||||
3873 | Z0: | ||||
3874 | count = 0; | ||||
3875 | Z1: | ||||
3876 | more = GOMP_loop_foo_start (0, count, 1, CHUNK, &istart0, &iend0); | ||||
3877 | if (more) goto L0; else goto L3; | ||||
3878 | L0: | ||||
3879 | V = istart0; | ||||
3880 | T = V; | ||||
3881 | V3 = N31 + (T % count3) * STEP3; | ||||
3882 | T = T / count3; | ||||
3883 | V2 = N21 + (T % count2) * STEP2; | ||||
3884 | T = T / count2; | ||||
3885 | V1 = N11 + T * STEP1; | ||||
3886 | iend = iend0; | ||||
3887 | L1: | ||||
3888 | BODY; | ||||
3889 | V += 1; | ||||
3890 | if (V < iend) goto L10; else goto L2; | ||||
3891 | L10: | ||||
3892 | V3 += STEP3; | ||||
3893 | if (V3 cond3 N32) goto L1; else goto L11; | ||||
3894 | L11: | ||||
3895 | V3 = N31; | ||||
3896 | V2 += STEP2; | ||||
3897 | if (V2 cond2 N22) goto L1; else goto L12; | ||||
3898 | L12: | ||||
3899 | V2 = N21; | ||||
3900 | V1 += STEP1; | ||||
3901 | goto L1; | ||||
3902 | L2: | ||||
3903 | if (GOMP_loop_foo_next (&istart0, &iend0)) goto L0; else goto L3; | ||||
3904 | L3: | ||||
3905 | |||||
3906 | */ | ||||
3907 | |||||
3908 | static void | ||||
3909 | expand_omp_for_generic (struct omp_region *region, | ||||
3910 | struct omp_for_data *fd, | ||||
3911 | enum built_in_function start_fn, | ||||
3912 | enum built_in_function next_fn, | ||||
3913 | tree sched_arg, | ||||
3914 | gimple *inner_stmt) | ||||
3915 | { | ||||
3916 | tree type, istart0, iend0, iend; | ||||
3917 | tree t, vmain, vback, bias = NULL_TREE(tree) nullptr; | ||||
3918 | basic_block entry_bb, cont_bb, exit_bb, l0_bb, l1_bb, collapse_bb; | ||||
3919 | basic_block l2_bb = NULLnullptr, l3_bb = NULLnullptr; | ||||
3920 | gimple_stmt_iterator gsi; | ||||
3921 | gassign *assign_stmt; | ||||
3922 | bool in_combined_parallel = is_combined_parallel (region); | ||||
3923 | bool broken_loop = region->cont == NULLnullptr; | ||||
3924 | edge e, ne; | ||||
3925 | tree *counts = NULLnullptr; | ||||
3926 | int i; | ||||
3927 | bool ordered_lastprivate = false; | ||||
3928 | |||||
3929 | gcc_assert (!broken_loop || !in_combined_parallel)((void)(!(!broken_loop || !in_combined_parallel) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3929, __FUNCTION__), 0 : 0)); | ||||
3930 | gcc_assert (fd->iter_type == long_integer_type_node((void)(!(fd->iter_type == integer_types[itk_long] || !in_combined_parallel ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3931, __FUNCTION__), 0 : 0)) | ||||
3931 | || !in_combined_parallel)((void)(!(fd->iter_type == integer_types[itk_long] || !in_combined_parallel ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3931, __FUNCTION__), 0 : 0)); | ||||
3932 | |||||
3933 | entry_bb = region->entry; | ||||
3934 | cont_bb = region->cont; | ||||
3935 | collapse_bb = NULLnullptr; | ||||
3936 | gcc_assert (EDGE_COUNT (entry_bb->succs) == 2)((void)(!(vec_safe_length (entry_bb->succs) == 2) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3936, __FUNCTION__), 0 : 0)); | ||||
3937 | 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3938, __FUNCTION__), 0 : 0)) | ||||
3938 | || 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3938, __FUNCTION__), 0 : 0)); | ||||
3939 | l0_bb = split_edge (FALLTHRU_EDGE (entry_bb)((*((entry_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(0)] : (*((entry_bb))->succs) [(1)])); | ||||
3940 | l1_bb = single_succ (l0_bb); | ||||
3941 | if (!broken_loop) | ||||
3942 | { | ||||
3943 | l2_bb = create_empty_bb (cont_bb); | ||||
3944 | 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3946, __FUNCTION__), 0 : 0)) | ||||
3945 | || (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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3946, __FUNCTION__), 0 : 0)) | ||||
3946 | == 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3946, __FUNCTION__), 0 : 0)); | ||||
3947 | gcc_assert (EDGE_COUNT (cont_bb->succs) == 2)((void)(!(vec_safe_length (cont_bb->succs) == 2) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3947, __FUNCTION__), 0 : 0)); | ||||
3948 | } | ||||
3949 | else | ||||
3950 | l2_bb = NULLnullptr; | ||||
3951 | l3_bb = BRANCH_EDGE (entry_bb)((*((entry_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(1)] : (*((entry_bb))->succs) [(0)])->dest; | ||||
3952 | exit_bb = region->exit; | ||||
3953 | |||||
3954 | gsi = gsi_last_nondebug_bb (entry_bb); | ||||
3955 | |||||
3956 | gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR)((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3956, __FUNCTION__), 0 : 0)); | ||||
3957 | if (fd->ordered | ||||
3958 | && omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), | ||||
3959 | OMP_CLAUSE_LASTPRIVATE)) | ||||
3960 | ordered_lastprivate = false; | ||||
3961 | tree reductions = NULL_TREE(tree) nullptr; | ||||
3962 | tree mem = NULL_TREE(tree) nullptr, cond_var = NULL_TREE(tree) nullptr, condtemp = NULL_TREE(tree) nullptr; | ||||
3963 | tree memv = NULL_TREE(tree) nullptr; | ||||
3964 | if (fd->lastprivate_conditional) | ||||
3965 | { | ||||
3966 | tree c = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), | ||||
3967 | OMP_CLAUSE__CONDTEMP_); | ||||
3968 | if (fd->have_pointer_condtemp) | ||||
3969 | condtemp = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3969, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3969, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3969, __FUNCTION__))); | ||||
3970 | c = omp_find_clause (OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3970, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3970, __FUNCTION__))->common.chain), OMP_CLAUSE__CONDTEMP_); | ||||
3971 | cond_var = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3971, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3971, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3971, __FUNCTION__))); | ||||
3972 | } | ||||
3973 | if (sched_arg) | ||||
3974 | { | ||||
3975 | if (fd->have_reductemp) | ||||
3976 | { | ||||
3977 | tree c = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), | ||||
3978 | OMP_CLAUSE__REDUCTEMP_); | ||||
3979 | reductions = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3979, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3979, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3979, __FUNCTION__))); | ||||
3980 | gcc_assert (TREE_CODE (reductions) == SSA_NAME)((void)(!(((enum tree_code) (reductions)->base.code) == SSA_NAME ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3980, __FUNCTION__), 0 : 0)); | ||||
3981 | gimple *g = SSA_NAME_DEF_STMT (reductions)(tree_check ((reductions), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3981, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt; | ||||
3982 | reductions = gimple_assign_rhs1 (g); | ||||
3983 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3983, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3983, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3983, __FUNCTION__))) = reductions; | ||||
3984 | entry_bb = gimple_bb (g); | ||||
3985 | edge e = split_block (entry_bb, g); | ||||
3986 | if (region->entry == entry_bb) | ||||
3987 | region->entry = e->dest; | ||||
3988 | gsi = gsi_last_bb (entry_bb); | ||||
3989 | } | ||||
3990 | else | ||||
3991 | reductions = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; | ||||
3992 | if (fd->have_pointer_condtemp) | ||||
3993 | { | ||||
3994 | tree type = TREE_TYPE (condtemp)((contains_struct_check ((condtemp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3994, __FUNCTION__))->typed.type); | ||||
3995 | memv = create_tmp_var (type); | ||||
3996 | TREE_ADDRESSABLE (memv)((memv)->base.addressable_flag) = 1; | ||||
3997 | unsigned HOST_WIDE_INTlong sz | ||||
3998 | = tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (type))((tree_class_check ((((contains_struct_check ((type), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3998, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 3998, __FUNCTION__))->type_common.size_unit)); | ||||
3999 | sz *= fd->lastprivate_conditional; | ||||
4000 | expand_omp_build_assign (&gsi, memv, build_int_cst (type, sz), | ||||
4001 | false); | ||||
4002 | mem = build_fold_addr_expr (memv)build_fold_addr_expr_loc (((location_t) 0), (memv)); | ||||
4003 | } | ||||
4004 | else | ||||
4005 | mem = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; | ||||
4006 | } | ||||
4007 | if (fd->collapse > 1 || fd->ordered) | ||||
4008 | { | ||||
4009 | int first_zero_iter1 = -1, first_zero_iter2 = -1; | ||||
4010 | basic_block zero_iter1_bb = NULLnullptr, zero_iter2_bb = NULLnullptr, l2_dom_bb = NULLnullptr; | ||||
4011 | |||||
4012 | counts = XALLOCAVEC (tree, fd->ordered((tree *) __builtin_alloca(sizeof (tree) * (fd->ordered ? fd ->ordered + 2 + (fd->ordered - fd->collapse) : fd-> collapse))) | ||||
4013 | ? fd->ordered + 2((tree *) __builtin_alloca(sizeof (tree) * (fd->ordered ? fd ->ordered + 2 + (fd->ordered - fd->collapse) : fd-> collapse))) | ||||
4014 | + (fd->ordered - fd->collapse)((tree *) __builtin_alloca(sizeof (tree) * (fd->ordered ? fd ->ordered + 2 + (fd->ordered - fd->collapse) : fd-> collapse))) | ||||
4015 | : fd->collapse)((tree *) __builtin_alloca(sizeof (tree) * (fd->ordered ? fd ->ordered + 2 + (fd->ordered - fd->collapse) : fd-> collapse))); | ||||
4016 | expand_omp_for_init_counts (fd, &gsi, entry_bb, counts, | ||||
4017 | zero_iter1_bb, first_zero_iter1, | ||||
4018 | zero_iter2_bb, first_zero_iter2, l2_dom_bb); | ||||
4019 | |||||
4020 | if (zero_iter1_bb) | ||||
4021 | { | ||||
4022 | /* Some counts[i] vars might be uninitialized if | ||||
4023 | some loop has zero iterations. But the body shouldn't | ||||
4024 | be executed in that case, so just avoid uninit warnings. */ | ||||
4025 | for (i = first_zero_iter1; | ||||
4026 | i < (fd->ordered ? fd->ordered : fd->collapse); i++) | ||||
4027 | 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)) | ||||
4028 | suppress_warning (counts[i], OPT_Wuninitialized); | ||||
4029 | gsi_prev (&gsi); | ||||
4030 | e = split_block (entry_bb, gsi_stmt (gsi)); | ||||
4031 | entry_bb = e->dest; | ||||
4032 | make_edge (zero_iter1_bb, entry_bb, EDGE_FALLTHRU); | ||||
4033 | gsi = gsi_last_nondebug_bb (entry_bb); | ||||
4034 | set_immediate_dominator (CDI_DOMINATORS, entry_bb, | ||||
4035 | get_immediate_dominator (CDI_DOMINATORS, | ||||
4036 | zero_iter1_bb)); | ||||
4037 | } | ||||
4038 | if (zero_iter2_bb) | ||||
4039 | { | ||||
4040 | /* Some counts[i] vars might be uninitialized if | ||||
4041 | some loop has zero iterations. But the body shouldn't | ||||
4042 | be executed in that case, so just avoid uninit warnings. */ | ||||
4043 | for (i = first_zero_iter2; i < fd->ordered; i++) | ||||
4044 | 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)) | ||||
4045 | suppress_warning (counts[i], OPT_Wuninitialized); | ||||
4046 | if (zero_iter1_bb) | ||||
4047 | make_edge (zero_iter2_bb, entry_bb, EDGE_FALLTHRU); | ||||
4048 | else | ||||
4049 | { | ||||
4050 | gsi_prev (&gsi); | ||||
4051 | e = split_block (entry_bb, gsi_stmt (gsi)); | ||||
4052 | entry_bb = e->dest; | ||||
4053 | make_edge (zero_iter2_bb, entry_bb, EDGE_FALLTHRU); | ||||
4054 | gsi = gsi_last_nondebug_bb (entry_bb); | ||||
4055 | set_immediate_dominator (CDI_DOMINATORS, entry_bb, | ||||
4056 | get_immediate_dominator | ||||
4057 | (CDI_DOMINATORS, zero_iter2_bb)); | ||||
4058 | } | ||||
4059 | } | ||||
4060 | if (fd->collapse == 1) | ||||
4061 | { | ||||
4062 | counts[0] = fd->loop.n2; | ||||
4063 | fd->loop = fd->loops[0]; | ||||
4064 | } | ||||
4065 | } | ||||
4066 | |||||
4067 | type = TREE_TYPE (fd->loop.v)((contains_struct_check ((fd->loop.v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4067, __FUNCTION__))->typed.type); | ||||
4068 | istart0 = create_tmp_var (fd->iter_type, ".istart0"); | ||||
4069 | iend0 = create_tmp_var (fd->iter_type, ".iend0"); | ||||
4070 | TREE_ADDRESSABLE (istart0)((istart0)->base.addressable_flag) = 1; | ||||
4071 | TREE_ADDRESSABLE (iend0)((iend0)->base.addressable_flag) = 1; | ||||
4072 | |||||
4073 | /* See if we need to bias by LLONG_MIN. */ | ||||
4074 | if (fd->iter_type == long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long] | ||||
4075 | && TREE_CODE (type)((enum tree_code) (type)->base.code) == INTEGER_TYPE | ||||
4076 | && !TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4076, __FUNCTION__))->base.u.bits.unsigned_flag) | ||||
4077 | && fd->ordered == 0) | ||||
4078 | { | ||||
4079 | tree n1, n2; | ||||
4080 | |||||
4081 | if (fd->loop.cond_code == LT_EXPR) | ||||
4082 | { | ||||
4083 | n1 = fd->loop.n1; | ||||
4084 | 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 ); | ||||
4085 | } | ||||
4086 | else | ||||
4087 | { | ||||
4088 | 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 ); | ||||
4089 | n2 = fd->loop.n1; | ||||
4090 | } | ||||
4091 | if (TREE_CODE (n1)((enum tree_code) (n1)->base.code) != INTEGER_CST | ||||
4092 | || TREE_CODE (n2)((enum tree_code) (n2)->base.code) != INTEGER_CST | ||||
4093 | || ((tree_int_cst_sgn (n1) < 0) ^ (tree_int_cst_sgn (n2) < 0))) | ||||
4094 | bias = fold_convert (fd->iter_type, TYPE_MIN_VALUE (type))fold_convert_loc (((location_t) 0), fd->iter_type, ((tree_check5 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4094, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE ), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval )); | ||||
4095 | } | ||||
4096 | |||||
4097 | gimple_stmt_iterator gsif = gsi; | ||||
4098 | gsi_prev (&gsif); | ||||
4099 | |||||
4100 | tree arr = NULL_TREE(tree) nullptr; | ||||
4101 | if (in_combined_parallel) | ||||
4102 | { | ||||
4103 | gcc_assert (fd->ordered == 0)((void)(!(fd->ordered == 0) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4103, __FUNCTION__), 0 : 0)); | ||||
4104 | /* In a combined parallel loop, emit a call to | ||||
4105 | GOMP_loop_foo_next. */ | ||||
4106 | t = build_call_expr (builtin_decl_explicit (next_fn), 2, | ||||
4107 | build_fold_addr_expr (istart0)build_fold_addr_expr_loc (((location_t) 0), (istart0)), | ||||
4108 | build_fold_addr_expr (iend0)build_fold_addr_expr_loc (((location_t) 0), (iend0))); | ||||
4109 | } | ||||
4110 | else | ||||
4111 | { | ||||
4112 | tree t0, t1, t2, t3, t4; | ||||
4113 | /* If this is not a combined parallel loop, emit a call to | ||||
4114 | GOMP_loop_foo_start in ENTRY_BB. */ | ||||
4115 | t4 = build_fold_addr_expr (iend0)build_fold_addr_expr_loc (((location_t) 0), (iend0)); | ||||
4116 | t3 = build_fold_addr_expr (istart0)build_fold_addr_expr_loc (((location_t) 0), (istart0)); | ||||
4117 | if (fd->ordered) | ||||
4118 | { | ||||
4119 | t0 = build_int_cst (unsigned_type_nodeinteger_types[itk_unsigned_int], | ||||
4120 | fd->ordered - fd->collapse + 1); | ||||
4121 | arr = create_tmp_var (build_array_type_nelts (fd->iter_type, | ||||
4122 | fd->ordered | ||||
4123 | - fd->collapse + 1), | ||||
4124 | ".omp_counts"); | ||||
4125 | DECL_NAMELESS (arr)((contains_struct_check ((arr), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4125, __FUNCTION__))->base.u.bits.nameless_flag) = 1; | ||||
4126 | TREE_ADDRESSABLE (arr)((arr)->base.addressable_flag) = 1; | ||||
4127 | TREE_STATIC (arr)((arr)->base.static_flag) = 1; | ||||
4128 | vec<constructor_elt, va_gc> *v; | ||||
4129 | vec_alloc (v, fd->ordered - fd->collapse + 1); | ||||
4130 | int idx; | ||||
4131 | |||||
4132 | for (idx = 0; idx < fd->ordered - fd->collapse + 1; idx++) | ||||
4133 | { | ||||
4134 | tree c; | ||||
4135 | if (idx == 0 && fd->collapse > 1) | ||||
4136 | c = fd->loop.n2; | ||||
4137 | else | ||||
4138 | c = counts[idx + fd->collapse - 1]; | ||||
4139 | tree purpose = size_int (idx)size_int_kind (idx, stk_sizetype); | ||||
4140 | CONSTRUCTOR_APPEND_ELT (v, purpose, c)do { constructor_elt _ce___ = {purpose, c}; vec_safe_push ((v ), _ce___); } while (0); | ||||
4141 | if (TREE_CODE (c)((enum tree_code) (c)->base.code) != INTEGER_CST) | ||||
4142 | TREE_STATIC (arr)((arr)->base.static_flag) = 0; | ||||
4143 | } | ||||
4144 | |||||
4145 | DECL_INITIAL (arr)((contains_struct_check ((arr), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4145, __FUNCTION__))->decl_common.initial) = build_constructor (TREE_TYPE (arr)((contains_struct_check ((arr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4145, __FUNCTION__))->typed.type), v); | ||||
4146 | if (!TREE_STATIC (arr)((arr)->base.static_flag)) | ||||
4147 | force_gimple_operand_gsi (&gsi, build1 (DECL_EXPR, | ||||
4148 | void_type_nodeglobal_trees[TI_VOID_TYPE], arr), | ||||
4149 | true, NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); | ||||
4150 | t1 = build_fold_addr_expr (arr)build_fold_addr_expr_loc (((location_t) 0), (arr)); | ||||
4151 | t2 = NULL_TREE(tree) nullptr; | ||||
4152 | } | ||||
4153 | else | ||||
4154 | { | ||||
4155 | t2 = fold_convert (fd->iter_type, fd->loop.step)fold_convert_loc (((location_t) 0), fd->iter_type, fd-> loop.step); | ||||
4156 | t1 = fd->loop.n2; | ||||
4157 | t0 = fd->loop.n1; | ||||
4158 | if (gimple_omp_for_combined_into_p (fd->for_stmt)) | ||||
4159 | { | ||||
4160 | tree innerc | ||||
4161 | = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), | ||||
4162 | OMP_CLAUSE__LOOPTEMP_); | ||||
4163 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4163, __FUNCTION__), 0 : 0)); | ||||
4164 | t0 = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4164, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4164, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4164, __FUNCTION__))); | ||||
4165 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4165, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4165, __FUNCTION__))->common.chain), | ||||
4166 | OMP_CLAUSE__LOOPTEMP_); | ||||
4167 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4167, __FUNCTION__), 0 : 0)); | ||||
4168 | t1 = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4168, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4168, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4168, __FUNCTION__))); | ||||
4169 | } | ||||
4170 | if (POINTER_TYPE_P (TREE_TYPE (t0))(((enum tree_code) (((contains_struct_check ((t0), (TS_TYPED) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4170, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((t0), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4170, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE ) | ||||
4171 | && TYPE_PRECISION (TREE_TYPE (t0))((tree_class_check ((((contains_struct_check ((t0), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4171, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4171, __FUNCTION__))->type_common.precision) | ||||
4172 | != TYPE_PRECISION (fd->iter_type)((tree_class_check ((fd->iter_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4172, __FUNCTION__))->type_common.precision)) | ||||
4173 | { | ||||
4174 | /* Avoid casting pointers to integer of a different size. */ | ||||
4175 | tree itype = signed_type_for (type); | ||||
4176 | 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)); | ||||
4177 | 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)); | ||||
4178 | } | ||||
4179 | else | ||||
4180 | { | ||||
4181 | t1 = fold_convert (fd->iter_type, t1)fold_convert_loc (((location_t) 0), fd->iter_type, t1); | ||||
4182 | t0 = fold_convert (fd->iter_type, t0)fold_convert_loc (((location_t) 0), fd->iter_type, t0); | ||||
4183 | } | ||||
4184 | if (bias) | ||||
4185 | { | ||||
4186 | t1 = fold_build2 (PLUS_EXPR, fd->iter_type, t1, bias)fold_build2_loc (((location_t) 0), PLUS_EXPR, fd->iter_type , t1, bias ); | ||||
4187 | t0 = fold_build2 (PLUS_EXPR, fd->iter_type, t0, bias)fold_build2_loc (((location_t) 0), PLUS_EXPR, fd->iter_type , t0, bias ); | ||||
4188 | } | ||||
4189 | } | ||||
4190 | if (fd->iter_type == long_integer_type_nodeinteger_types[itk_long] || fd->ordered) | ||||
4191 | { | ||||
4192 | if (fd->chunk_size) | ||||
4193 | { | ||||
4194 | t = fold_convert (fd->iter_type, fd->chunk_size)fold_convert_loc (((location_t) 0), fd->iter_type, fd-> chunk_size); | ||||
4195 | t = omp_adjust_chunk_size (t, fd->simd_schedule); | ||||
4196 | if (sched_arg) | ||||
4197 | { | ||||
4198 | if (fd->ordered) | ||||
4199 | t = build_call_expr (builtin_decl_explicit (start_fn), | ||||
4200 | 8, t0, t1, sched_arg, t, t3, t4, | ||||
4201 | reductions, mem); | ||||
4202 | else | ||||
4203 | t = build_call_expr (builtin_decl_explicit (start_fn), | ||||
4204 | 9, t0, t1, t2, sched_arg, t, t3, t4, | ||||
4205 | reductions, mem); | ||||
4206 | } | ||||
4207 | else if (fd->ordered) | ||||
4208 | t = build_call_expr (builtin_decl_explicit (start_fn), | ||||
4209 | 5, t0, t1, t, t3, t4); | ||||
4210 | else | ||||
4211 | t = build_call_expr (builtin_decl_explicit (start_fn), | ||||
4212 | 6, t0, t1, t2, t, t3, t4); | ||||
4213 | } | ||||
4214 | else if (fd->ordered) | ||||
4215 | t = build_call_expr (builtin_decl_explicit (start_fn), | ||||
4216 | 4, t0, t1, t3, t4); | ||||
4217 | else | ||||
4218 | t = build_call_expr (builtin_decl_explicit (start_fn), | ||||
4219 | 5, t0, t1, t2, t3, t4); | ||||
4220 | } | ||||
4221 | else | ||||
4222 | { | ||||
4223 | tree t5; | ||||
4224 | tree c_bool_type; | ||||
4225 | tree bfn_decl; | ||||
4226 | |||||
4227 | /* The GOMP_loop_ull_*start functions have additional boolean | ||||
4228 | argument, true for < loops and false for > loops. | ||||
4229 | In Fortran, the C bool type can be different from | ||||
4230 | boolean_type_node. */ | ||||
4231 | bfn_decl = builtin_decl_explicit (start_fn); | ||||
4232 | c_bool_type = TREE_TYPE (TREE_TYPE (bfn_decl))((contains_struct_check ((((contains_struct_check ((bfn_decl) , (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4232, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4232, __FUNCTION__))->typed.type); | ||||
4233 | t5 = build_int_cst (c_bool_type, | ||||
4234 | fd->loop.cond_code == LT_EXPR ? 1 : 0); | ||||
4235 | if (fd->chunk_size) | ||||
4236 | { | ||||
4237 | tree bfn_decl = builtin_decl_explicit (start_fn); | ||||
4238 | t = fold_convert (fd->iter_type, fd->chunk_size)fold_convert_loc (((location_t) 0), fd->iter_type, fd-> chunk_size); | ||||
4239 | t = omp_adjust_chunk_size (t, fd->simd_schedule); | ||||
4240 | if (sched_arg) | ||||
4241 | t = build_call_expr (bfn_decl, 10, t5, t0, t1, t2, sched_arg, | ||||
4242 | t, t3, t4, reductions, mem); | ||||
4243 | else | ||||
4244 | t = build_call_expr (bfn_decl, 7, t5, t0, t1, t2, t, t3, t4); | ||||
4245 | } | ||||
4246 | else | ||||
4247 | t = build_call_expr (builtin_decl_explicit (start_fn), | ||||
4248 | 6, t5, t0, t1, t2, t3, t4); | ||||
4249 | } | ||||
4250 | } | ||||
4251 | if (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4251, __FUNCTION__))->typed.type) != boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE]) | ||||
4252 | 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) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4253, __FUNCTION__))->typed.type), 0) ) | ||||
4253 | 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) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4253, __FUNCTION__))->typed.type), 0) ); | ||||
4254 | t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, | ||||
4255 | true, GSI_SAME_STMT); | ||||
4256 | if (arr && !TREE_STATIC (arr)((arr)->base.static_flag)) | ||||
4257 | { | ||||
4258 | tree clobber = build_clobber (TREE_TYPE (arr)((contains_struct_check ((arr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4258, __FUNCTION__))->typed.type)); | ||||
4259 | gsi_insert_before (&gsi, gimple_build_assign (arr, clobber), | ||||
4260 | GSI_SAME_STMT); | ||||
4261 | } | ||||
4262 | if (fd->have_pointer_condtemp) | ||||
4263 | expand_omp_build_assign (&gsi, condtemp, memv, false); | ||||
4264 | if (fd->have_reductemp) | ||||
4265 | { | ||||
4266 | gimple *g = gsi_stmt (gsi); | ||||
4267 | gsi_remove (&gsi, true); | ||||
4268 | release_ssa_name (gimple_assign_lhs (g)); | ||||
4269 | |||||
4270 | entry_bb = region->entry; | ||||
4271 | gsi = gsi_last_nondebug_bb (entry_bb); | ||||
4272 | |||||
4273 | gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR)((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4273, __FUNCTION__), 0 : 0)); | ||||
4274 | } | ||||
4275 | gsi_insert_after (&gsi, gimple_build_cond_empty (t), GSI_SAME_STMT); | ||||
4276 | |||||
4277 | /* Remove the GIMPLE_OMP_FOR statement. */ | ||||
4278 | gsi_remove (&gsi, true); | ||||
4279 | |||||
4280 | if (gsi_end_p (gsif)) | ||||
4281 | gsif = gsi_after_labels (gsi_bb (gsif)); | ||||
4282 | gsi_next (&gsif); | ||||
4283 | |||||
4284 | /* Iteration setup for sequential loop goes in L0_BB. */ | ||||
4285 | tree startvar = fd->loop.v; | ||||
4286 | tree endvar = NULL_TREE(tree) nullptr; | ||||
4287 | |||||
4288 | if (gimple_omp_for_combined_p (fd->for_stmt)) | ||||
4289 | { | ||||
4290 | 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4292, __FUNCTION__), 0 : 0)) | ||||
4291 | && 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4292, __FUNCTION__), 0 : 0)) | ||||
4292 | == 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4292, __FUNCTION__), 0 : 0)); | ||||
4293 | tree innerc = omp_find_clause (gimple_omp_for_clauses (inner_stmt), | ||||
4294 | OMP_CLAUSE__LOOPTEMP_); | ||||
4295 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4295, __FUNCTION__), 0 : 0)); | ||||
4296 | startvar = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4296, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4296, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4296, __FUNCTION__))); | ||||
4297 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4297, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4297, __FUNCTION__))->common.chain), | ||||
4298 | OMP_CLAUSE__LOOPTEMP_); | ||||
4299 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4299, __FUNCTION__), 0 : 0)); | ||||
4300 | endvar = OMP_CLAUSE_DECL (innerc)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4300, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4300, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4300, __FUNCTION__))); | ||||
4301 | } | ||||
4302 | |||||
4303 | gsi = gsi_start_bb (l0_bb); | ||||
4304 | t = istart0; | ||||
4305 | if (fd->ordered && fd->collapse == 1) | ||||
4306 | 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) ) | ||||
4307 | 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) ); | ||||
4308 | else if (bias) | ||||
4309 | t = fold_build2 (MINUS_EXPR, fd->iter_type, t, bias)fold_build2_loc (((location_t) 0), MINUS_EXPR, fd->iter_type , t, bias ); | ||||
4310 | if (fd->ordered && fd->collapse == 1) | ||||
4311 | { | ||||
4312 | if (POINTER_TYPE_P (TREE_TYPE (startvar))(((enum tree_code) (((contains_struct_check ((startvar), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4312, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((startvar), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4312, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) | ||||
4313 | t = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (startvar),fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4313, __FUNCTION__))->typed.type), fd->loop.n1, fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype], t) ) | ||||
4314 | fd->loop.n1, fold_convert (sizetype, t))fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4313, __FUNCTION__))->typed.type), fd->loop.n1, fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype], t) ); | ||||
4315 | else | ||||
4316 | { | ||||
4317 | t = fold_convert (TREE_TYPE (startvar), t)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (startvar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4317, __FUNCTION__))->typed.type), t); | ||||
4318 | t = fold_build2 (PLUS_EXPR, TREE_TYPE (startvar),fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4318, __FUNCTION__))->typed.type), fd->loop.n1, t ) | ||||
4319 | fd->loop.n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4318, __FUNCTION__))->typed.type), fd->loop.n1, t ); | ||||
4320 | } | ||||
4321 | } | ||||
4322 | else | ||||
4323 | { | ||||
4324 | if (POINTER_TYPE_P (TREE_TYPE (startvar))(((enum tree_code) (((contains_struct_check ((startvar), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4324, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((startvar), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4324, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) | ||||
4325 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4325, __FUNCTION__))->typed.type)), t); | ||||
4326 | t = fold_convert (TREE_TYPE (startvar), t)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (startvar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4326, __FUNCTION__))->typed.type), t); | ||||
4327 | } | ||||
4328 | t = force_gimple_operand_gsi (&gsi, t, | ||||
4329 | DECL_P (startvar)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (startvar)->base.code))] == tcc_declaration) | ||||
4330 | && TREE_ADDRESSABLE (startvar)((startvar)->base.addressable_flag), | ||||
4331 | NULL_TREE(tree) nullptr, false, GSI_CONTINUE_LINKING); | ||||
4332 | assign_stmt = gimple_build_assign (startvar, t); | ||||
4333 | gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); | ||||
4334 | if (cond_var) | ||||
4335 | { | ||||
4336 | tree itype = TREE_TYPE (cond_var)((contains_struct_check ((cond_var), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4336, __FUNCTION__))->typed.type); | ||||
4337 | /* For lastprivate(conditional:) itervar, we need some iteration | ||||
4338 | counter that starts at unsigned non-zero and increases. | ||||
4339 | Prefer as few IVs as possible, so if we can use startvar | ||||
4340 | itself, use that, or startvar + constant (those would be | ||||
4341 | incremented with step), and as last resort use the s0 + 1 | ||||
4342 | incremented by 1. */ | ||||
4343 | if ((fd->ordered && fd->collapse == 1) | ||||
4344 | || bias | ||||
4345 | || POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE) | ||||
4346 | || TREE_CODE (fd->loop.n1)((enum tree_code) (fd->loop.n1)->base.code) != INTEGER_CST | ||||
4347 | || fd->loop.cond_code != LT_EXPR) | ||||
4348 | 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) ) | ||||
4349 | 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) ); | ||||
4350 | else if (tree_int_cst_sgn (fd->loop.n1) == 1) | ||||
4351 | t = fold_convert (itype, t)fold_convert_loc (((location_t) 0), itype, t); | ||||
4352 | else | ||||
4353 | { | ||||
4354 | tree c = fold_convert (itype, fd->loop.n1)fold_convert_loc (((location_t) 0), itype, fd->loop.n1); | ||||
4355 | 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 ); | ||||
4356 | 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 ); | ||||
4357 | } | ||||
4358 | t = force_gimple_operand_gsi (&gsi, t, false, | ||||
4359 | NULL_TREE(tree) nullptr, false, GSI_CONTINUE_LINKING); | ||||
4360 | assign_stmt = gimple_build_assign (cond_var, t); | ||||
4361 | gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); | ||||
4362 | } | ||||
4363 | |||||
4364 | t = iend0; | ||||
4365 | if (fd->ordered && fd->collapse == 1) | ||||
4366 | 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) ) | ||||
4367 | 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) ); | ||||
4368 | else if (bias) | ||||
4369 | t = fold_build2 (MINUS_EXPR, fd->iter_type, t, bias)fold_build2_loc (((location_t) 0), MINUS_EXPR, fd->iter_type , t, bias ); | ||||
4370 | if (fd->ordered && fd->collapse == 1) | ||||
4371 | { | ||||
4372 | if (POINTER_TYPE_P (TREE_TYPE (startvar))(((enum tree_code) (((contains_struct_check ((startvar), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4372, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((startvar), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4372, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) | ||||
4373 | t = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (startvar),fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4373, __FUNCTION__))->typed.type), fd->loop.n1, fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype], t) ) | ||||
4374 | fd->loop.n1, fold_convert (sizetype, t))fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4373, __FUNCTION__))->typed.type), fd->loop.n1, fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype], t) ); | ||||
4375 | else | ||||
4376 | { | ||||
4377 | t = fold_convert (TREE_TYPE (startvar), t)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (startvar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4377, __FUNCTION__))->typed.type), t); | ||||
4378 | t = fold_build2 (PLUS_EXPR, TREE_TYPE (startvar),fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4378, __FUNCTION__))->typed.type), fd->loop.n1, t ) | ||||
4379 | fd->loop.n1, t)fold_build2_loc (((location_t) 0), PLUS_EXPR, ((contains_struct_check ((startvar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4378, __FUNCTION__))->typed.type), fd->loop.n1, t ); | ||||
4380 | } | ||||
4381 | } | ||||
4382 | else | ||||
4383 | { | ||||
4384 | if (POINTER_TYPE_P (TREE_TYPE (startvar))(((enum tree_code) (((contains_struct_check ((startvar), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4384, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((startvar), ( TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4384, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) | ||||
4385 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4385, __FUNCTION__))->typed.type)), t); | ||||
4386 | t = fold_convert (TREE_TYPE (startvar), t)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (startvar), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4386, __FUNCTION__))->typed.type), t); | ||||
4387 | } | ||||
4388 | iend = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, | ||||
4389 | false, GSI_CONTINUE_LINKING); | ||||
4390 | if (endvar) | ||||
4391 | { | ||||
4392 | assign_stmt = gimple_build_assign (endvar, iend); | ||||
4393 | gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); | ||||
4394 | if (useless_type_conversion_p (TREE_TYPE (fd->loop.v)((contains_struct_check ((fd->loop.v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4394, __FUNCTION__))->typed.type), TREE_TYPE (iend)((contains_struct_check ((iend), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4394, __FUNCTION__))->typed.type))) | ||||
4395 | assign_stmt = gimple_build_assign (fd->loop.v, iend); | ||||
4396 | else | ||||
4397 | assign_stmt = gimple_build_assign (fd->loop.v, NOP_EXPR, iend); | ||||
4398 | gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); | ||||
4399 | } | ||||
4400 | /* Handle linear clause adjustments. */ | ||||
4401 | tree itercnt = NULL_TREE(tree) nullptr; | ||||
4402 | if (gimple_omp_for_kind (fd->for_stmt) == GF_OMP_FOR_KIND_FOR) | ||||
4403 | for (tree c = gimple_omp_for_clauses (fd->for_stmt); | ||||
4404 | c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4404, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4404, __FUNCTION__))->common.chain)) | ||||
4405 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4405, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE_LINEAR | ||||
4406 | && !OMP_CLAUSE_LINEAR_NO_COPYIN (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE_LINEAR), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4406, __FUNCTION__))->base.public_flag)) | ||||
4407 | { | ||||
4408 | tree d = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4408, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4408, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4408, __FUNCTION__))); | ||||
4409 | tree t = d, a, dest; | ||||
4410 | if (omp_privatize_by_reference (t)) | ||||
4411 | t = build_simple_mem_ref_loc (OMP_CLAUSE_LOCATION (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4411, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.locus, t); | ||||
4412 | tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4412, __FUNCTION__))->typed.type); | ||||
4413 | if (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE)) | ||||
4414 | type = sizetypesizetype_tab[(int) stk_sizetype]; | ||||
4415 | dest = unshare_expr (t); | ||||
4416 | tree v = create_tmp_var (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4416, __FUNCTION__))->typed.type), NULLnullptr); | ||||
4417 | expand_omp_build_assign (&gsif, v, t); | ||||
4418 | if (itercnt == NULL_TREE(tree) nullptr) | ||||
4419 | { | ||||
4420 | itercnt = startvar; | ||||
4421 | tree n1 = fd->loop.n1; | ||||
4422 | if (POINTER_TYPE_P (TREE_TYPE (itercnt))(((enum tree_code) (((contains_struct_check ((itercnt), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4422, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE || ((enum tree_code) (((contains_struct_check ((itercnt), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4422, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE )) | ||||
4423 | { | ||||
4424 | itercnt | ||||
4425 | = fold_convert (signed_type_for (TREE_TYPE (itercnt)),fold_convert_loc (((location_t) 0), signed_type_for (((contains_struct_check ((itercnt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4425, __FUNCTION__))->typed.type)), itercnt) | ||||
4426 | itercnt)fold_convert_loc (((location_t) 0), signed_type_for (((contains_struct_check ((itercnt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4425, __FUNCTION__))->typed.type)), itercnt); | ||||
4427 | n1 = fold_convert (TREE_TYPE (itercnt), n1)fold_convert_loc (((location_t) 0), ((contains_struct_check ( (itercnt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4427, __FUNCTION__))->typed.type), n1); | ||||
4428 | } | ||||
4429 | itercnt = fold_build2 (MINUS_EXPR, TREE_TYPE (itercnt),fold_build2_loc (((location_t) 0), MINUS_EXPR, ((contains_struct_check ((itercnt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4429, __FUNCTION__))->typed.type), itercnt, n1 ) | ||||
4430 | itercnt, n1)fold_build2_loc (((location_t) 0), MINUS_EXPR, ((contains_struct_check ((itercnt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4429, __FUNCTION__))->typed.type), itercnt, n1 ); | ||||
4431 | itercnt = fold_build2 (EXACT_DIV_EXPR, TREE_TYPE (itercnt),fold_build2_loc (((location_t) 0), EXACT_DIV_EXPR, ((contains_struct_check ((itercnt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4431, __FUNCTION__))->typed.type), itercnt, fd->loop. step ) | ||||
4432 | itercnt, fd->loop.step)fold_build2_loc (((location_t) 0), EXACT_DIV_EXPR, ((contains_struct_check ((itercnt), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4431, __FUNCTION__))->typed.type), itercnt, fd->loop. step ); | ||||
4433 | itercnt = force_gimple_operand_gsi (&gsi, itercnt, true, | ||||
4434 | NULL_TREE(tree) nullptr, false, | ||||
4435 | GSI_CONTINUE_LINKING); | ||||
4436 | } | ||||
4437 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4439, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4439, __FUNCTION__)))) ) | ||||
4438 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4439, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4439, __FUNCTION__)))) ) | ||||
4439 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4439, __FUNCTION__))), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4439, __FUNCTION__)))) ); | ||||
4440 | t = fold_build2 (type == TREE_TYPE (t) ? PLUS_EXPRfold_build2_loc (((location_t) 0), type == ((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4440, __FUNCTION__))->typed.type) ? PLUS_EXPR : POINTER_PLUS_EXPR , ((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4441, __FUNCTION__))->typed.type), v, a ) | ||||
4441 | : POINTER_PLUS_EXPR, TREE_TYPE (t), v, a)fold_build2_loc (((location_t) 0), type == ((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4440, __FUNCTION__))->typed.type) ? PLUS_EXPR : POINTER_PLUS_EXPR , ((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4441, __FUNCTION__))->typed.type), v, a ); | ||||
4442 | t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, | ||||
4443 | false, GSI_CONTINUE_LINKING); | ||||
4444 | expand_omp_build_assign (&gsi, dest, t, true); | ||||
4445 | } | ||||
4446 | if (fd->collapse > 1) | ||||
4447 | expand_omp_for_init_vars (fd, &gsi, counts, NULLnullptr, inner_stmt, startvar); | ||||
4448 | |||||
4449 | if (fd->ordered) | ||||
4450 | { | ||||
4451 | /* Until now, counts array contained number of iterations or | ||||
4452 | variable containing it for ith loop. From now on, we usually need | ||||
4453 | those counts only for collapsed loops, and only for the 2nd | ||||
4454 | till the last collapsed one. Move those one element earlier, | ||||
4455 | we'll use counts[fd->collapse - 1] for the first source/sink | ||||
4456 | iteration counter and so on and counts[fd->ordered] | ||||
4457 | as the array holding the current counter values for | ||||
4458 | depend(source). For doacross(sink:omp_cur_iteration - 1) we need | ||||
4459 | the counts from fd->collapse to fd->ordered - 1; make a copy of | ||||
4460 | those to counts[fd->ordered + 2] and onwards. | ||||
4461 | counts[fd->ordered + 1] can be a flag whether it is the first | ||||
4462 | iteration with a new collapsed counter (used only if | ||||
4463 | fd->ordered > fd->collapse). */ | ||||
4464 | if (fd->ordered > fd->collapse) | ||||
4465 | memcpy (counts + fd->ordered + 2, counts + fd->collapse, | ||||
4466 | (fd->ordered - fd->collapse) * sizeof (counts[0])); | ||||
4467 | if (fd->collapse > 1) | ||||
4468 | memmove (counts, counts + 1, (fd->collapse - 1) * sizeof (counts[0])); | ||||
4469 | if (broken_loop) | ||||
4470 | { | ||||
4471 | int i; | ||||
4472 | for (i = fd->collapse; i < fd->ordered; i++) | ||||
4473 | { | ||||
4474 | tree type = TREE_TYPE (fd->loops[i].v)((contains_struct_check ((fd->loops[i].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4474, __FUNCTION__))->typed.type); | ||||
4475 | tree this_cond | ||||
4476 | = 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) ) | ||||
4477 | 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) ) | ||||
4478 | 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) ); | ||||
4479 | if (!integer_onep (this_cond)) | ||||
4480 | break; | ||||
4481 | } | ||||
4482 | if (i < fd->ordered) | ||||
4483 | { | ||||
4484 | if (entry_bb->loop_father != l0_bb->loop_father) | ||||
4485 | { | ||||
4486 | remove_bb_from_loops (l0_bb); | ||||
4487 | add_bb_to_loop (l0_bb, entry_bb->loop_father); | ||||
4488 | gcc_assert (single_succ (l0_bb) == l1_bb)((void)(!(single_succ (l0_bb) == l1_bb) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4488, __FUNCTION__), 0 : 0)); | ||||
4489 | } | ||||
4490 | cont_bb | ||||
4491 | = create_empty_bb (EXIT_BLOCK_PTR_FOR_FN (cfun)(((cfun + 0))->cfg->x_exit_block_ptr)->prev_bb); | ||||
4492 | add_bb_to_loop (cont_bb, l0_bb->loop_father); | ||||
4493 | gimple_stmt_iterator gsi = gsi_after_labels (cont_bb); | ||||
4494 | gimple *g = gimple_build_omp_continue (fd->loop.v, fd->loop.v); | ||||
4495 | gsi_insert_before (&gsi, g, GSI_SAME_STMT); | ||||
4496 | make_edge (cont_bb, l3_bb, EDGE_FALLTHRU); | ||||
4497 | make_edge (cont_bb, l1_bb, 0); | ||||
4498 | l2_bb = create_empty_bb (cont_bb); | ||||
4499 | broken_loop = false; | ||||
4500 | } | ||||
4501 | } | ||||
4502 | expand_omp_ordered_source_sink (region, fd, counts, cont_bb); | ||||
4503 | cont_bb = expand_omp_for_ordered_loops (fd, counts, cont_bb, l1_bb, | ||||
4504 | l0_bb, ordered_lastprivate); | ||||
4505 | if (counts[fd->collapse - 1]) | ||||
4506 | { | ||||
4507 | gcc_assert (fd->collapse == 1)((void)(!(fd->collapse == 1) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4507, __FUNCTION__), 0 : 0)); | ||||
4508 | gsi = gsi_last_bb (l0_bb); | ||||
4509 | expand_omp_build_assign (&gsi, counts[fd->collapse - 1], | ||||
4510 | istart0, true); | ||||
4511 | if (cont_bb) | ||||
4512 | { | ||||
4513 | gsi = gsi_last_bb (cont_bb); | ||||
4514 | 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) ) | ||||
4515 | 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) ) | ||||
4516 | 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) ); | ||||
4517 | expand_omp_build_assign (&gsi, counts[fd->collapse - 1], t); | ||||
4518 | tree aref = build4 (ARRAY_REF, fd->iter_type, | ||||
4519 | counts[fd->ordered], size_zero_nodeglobal_trees[TI_SIZE_ZERO], | ||||
4520 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
4521 | expand_omp_build_assign (&gsi, aref, counts[fd->collapse - 1]); | ||||
4522 | } | ||||
4523 | t = counts[fd->collapse - 1]; | ||||
4524 | } | ||||
4525 | else if (fd->collapse > 1) | ||||
4526 | t = fd->loop.v; | ||||
4527 | else | ||||
4528 | { | ||||
4529 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4529, __FUNCTION__))->typed.type), fd->loops[0].v, fd ->loops[0].n1 ) | ||||
4530 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4529, __FUNCTION__))->typed.type), fd->loops[0].v, fd ->loops[0].n1 ); | ||||
4531 | t = fold_convert (fd->iter_type, t)fold_convert_loc (((location_t) 0), fd->iter_type, t); | ||||
4532 | } | ||||
4533 | gsi = gsi_last_bb (l0_bb); | ||||
4534 | tree aref = build4 (ARRAY_REF, fd->iter_type, counts[fd->ordered], | ||||
4535 | size_zero_nodeglobal_trees[TI_SIZE_ZERO], NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
4536 | t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, | ||||
4537 | false, GSI_CONTINUE_LINKING); | ||||
4538 | expand_omp_build_assign (&gsi, aref, t, true); | ||||
4539 | } | ||||
4540 | |||||
4541 | if (!broken_loop) | ||||
4542 | { | ||||
4543 | /* Code to control the increment and predicate for the sequential | ||||
4544 | loop goes in the CONT_BB. */ | ||||
4545 | gsi = gsi_last_nondebug_bb (cont_bb); | ||||
4546 | gomp_continue *cont_stmt = as_a <gomp_continue *> (gsi_stmt (gsi)); | ||||
4547 | gcc_assert (gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE)((void)(!(gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4547, __FUNCTION__), 0 : 0)); | ||||
4548 | vmain = gimple_omp_continue_control_use (cont_stmt); | ||||
4549 | vback = gimple_omp_continue_control_def (cont_stmt); | ||||
4550 | |||||
4551 | if (cond_var) | ||||
4552 | { | ||||
4553 | tree itype = TREE_TYPE (cond_var)((contains_struct_check ((cond_var), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4553, __FUNCTION__))->typed.type); | ||||
4554 | tree t2; | ||||
4555 | if ((fd->ordered && fd->collapse == 1) | ||||
4556 | || bias | ||||
4557 | || POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE) | ||||
4558 | || TREE_CODE (fd->loop.n1)((enum tree_code) (fd->loop.n1)->base.code) != INTEGER_CST | ||||
4559 | || fd->loop.cond_code != LT_EXPR) | ||||
4560 | t2 = build_int_cst (itype, 1); | ||||
4561 | else | ||||
4562 | t2 = fold_convert (itype, fd->loop.step)fold_convert_loc (((location_t) 0), itype, fd->loop.step); | ||||
4563 | t2 = fold_build2 (PLUS_EXPR, itype, cond_var, t2)fold_build2_loc (((location_t) 0), PLUS_EXPR, itype, cond_var , t2 ); | ||||
4564 | t2 = force_gimple_operand_gsi (&gsi, t2, false, | ||||
4565 | NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); | ||||
4566 | assign_stmt = gimple_build_assign (cond_var, t2); | ||||
4567 | gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); | ||||
4568 | } | ||||
4569 | |||||
4570 | if (!gimple_omp_for_combined_p (fd->for_stmt)) | ||||
4571 | { | ||||
4572 | if (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE)) | ||||
4573 | t = fold_build_pointer_plus (vmain, fd->loop.step)fold_build_pointer_plus_loc (((location_t) 0), vmain, fd-> loop.step); | ||||
4574 | else | ||||
4575 | t = fold_build2 (PLUS_EXPR, type, vmain, fd->loop.step)fold_build2_loc (((location_t) 0), PLUS_EXPR, type, vmain, fd ->loop.step ); | ||||
4576 | t = force_gimple_operand_gsi (&gsi, t, | ||||
4577 | DECL_P (vback)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (vback)->base.code))] == tcc_declaration) | ||||
4578 | && TREE_ADDRESSABLE (vback)((vback)->base.addressable_flag), | ||||
4579 | NULL_TREE(tree) nullptr, true, GSI_SAME_STMT); | ||||
4580 | assign_stmt = gimple_build_assign (vback, t); | ||||
4581 | gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT); | ||||
4582 | |||||
4583 | if (fd->ordered && counts[fd->collapse - 1] == NULL_TREE(tree) nullptr) | ||||
4584 | { | ||||
4585 | tree tem; | ||||
4586 | if (fd->collapse > 1) | ||||
4587 | tem = fd->loop.v; | ||||
4588 | else | ||||
4589 | { | ||||
4590 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4590, __FUNCTION__))->typed.type), fd->loops[0].v, fd ->loops[0].n1 ) | ||||
4591 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4590, __FUNCTION__))->typed.type), fd->loops[0].v, fd ->loops[0].n1 ); | ||||
4592 | tem = fold_convert (fd->iter_type, tem)fold_convert_loc (((location_t) 0), fd->iter_type, tem); | ||||
4593 | } | ||||
4594 | tree aref = build4 (ARRAY_REF, fd->iter_type, | ||||
4595 | counts[fd->ordered], size_zero_nodeglobal_trees[TI_SIZE_ZERO], | ||||
4596 | NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr); | ||||
4597 | tem = force_gimple_operand_gsi (&gsi, tem, true, NULL_TREE(tree) nullptr, | ||||
4598 | true, GSI_SAME_STMT); | ||||
4599 | expand_omp_build_assign (&gsi, aref, tem); | ||||
4600 | } | ||||
4601 | |||||
4602 | t = build2 (fd->loop.cond_code, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], | ||||
4603 | DECL_P (vback)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (vback)->base.code))] == tcc_declaration) && TREE_ADDRESSABLE (vback)((vback)->base.addressable_flag) ? t : vback, | ||||
4604 | iend); | ||||
4605 | gcond *cond_stmt = gimple_build_cond_empty (t); | ||||
4606 | gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT); | ||||
4607 | } | ||||
4608 | |||||
4609 | /* Remove GIMPLE_OMP_CONTINUE. */ | ||||
4610 | gsi_remove (&gsi, true); | ||||
4611 | |||||
4612 | if (fd->collapse > 1 && !gimple_omp_for_combined_p (fd->for_stmt)) | ||||
4613 | collapse_bb = extract_omp_for_update_vars (fd, NULLnullptr, cont_bb, l1_bb); | ||||
4614 | |||||
4615 | /* Emit code to get the next parallel iteration in L2_BB. */ | ||||
4616 | gsi = gsi_start_bb (l2_bb); | ||||
4617 | |||||
4618 | t = build_call_expr (builtin_decl_explicit (next_fn), 2, | ||||
4619 | build_fold_addr_expr (istart0)build_fold_addr_expr_loc (((location_t) 0), (istart0)), | ||||
4620 | build_fold_addr_expr (iend0)build_fold_addr_expr_loc (((location_t) 0), (iend0))); | ||||
4621 | t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE(tree) nullptr, | ||||
4622 | false, GSI_CONTINUE_LINKING); | ||||
4623 | if (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4623, __FUNCTION__))->typed.type) != boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE]) | ||||
4624 | 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) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4625, __FUNCTION__))->typed.type), 0) ) | ||||
4625 | 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) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4625, __FUNCTION__))->typed.type), 0) ); | ||||
4626 | gcond *cond_stmt = gimple_build_cond_empty (t); | ||||
4627 | gsi_insert_after (&gsi, cond_stmt, GSI_CONTINUE_LINKING); | ||||
4628 | } | ||||
4629 | |||||
4630 | /* Add the loop cleanup function. */ | ||||
4631 | gsi = gsi_last_nondebug_bb (exit_bb); | ||||
4632 | if (gimple_omp_return_nowait_p (gsi_stmt (gsi))) | ||||
4633 | t = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END_NOWAIT); | ||||
4634 | else if (gimple_omp_return_lhs (gsi_stmt (gsi))) | ||||
4635 | t = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END_CANCEL); | ||||
4636 | else | ||||
4637 | t = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END); | ||||
4638 | gcall *call_stmt = gimple_build_call (t, 0); | ||||
4639 | if (fd->ordered) | ||||
4640 | { | ||||
4641 | tree arr = counts[fd->ordered]; | ||||
4642 | tree clobber = build_clobber (TREE_TYPE (arr)((contains_struct_check ((arr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4642, __FUNCTION__))->typed.type)); | ||||
4643 | gsi_insert_after (&gsi, gimple_build_assign (arr, clobber), | ||||
4644 | GSI_SAME_STMT); | ||||
4645 | } | ||||
4646 | if (gimple_omp_return_lhs (gsi_stmt (gsi))) | ||||
4647 | { | ||||
4648 | gimple_call_set_lhs (call_stmt, gimple_omp_return_lhs (gsi_stmt (gsi))); | ||||
4649 | if (fd->have_reductemp) | ||||
4650 | { | ||||
4651 | gimple *g = gimple_build_assign (reductions, NOP_EXPR, | ||||
4652 | gimple_call_lhs (call_stmt)); | ||||
4653 | gsi_insert_after (&gsi, g, GSI_SAME_STMT); | ||||
4654 | } | ||||
4655 | } | ||||
4656 | gsi_insert_after (&gsi, call_stmt, GSI_SAME_STMT); | ||||
4657 | gsi_remove (&gsi, true); | ||||
4658 | |||||
4659 | /* Connect the new blocks. */ | ||||
4660 | find_edge (entry_bb, l0_bb)->flags = EDGE_TRUE_VALUE; | ||||
4661 | find_edge (entry_bb, l3_bb)->flags = EDGE_FALSE_VALUE; | ||||
4662 | |||||
4663 | if (!broken_loop) | ||||
4664 | { | ||||
4665 | gimple_seq phis; | ||||
4666 | |||||
4667 | e = find_edge (cont_bb, l3_bb); | ||||
4668 | ne = make_edge (l2_bb, l3_bb, EDGE_FALSE_VALUE); | ||||
4669 | |||||
4670 | phis = phi_nodes (l3_bb); | ||||
4671 | for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi)) | ||||
4672 | { | ||||
4673 | gimple *phi = gsi_stmt (gsi); | ||||
4674 | 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 ))) | ||||
4675 | 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 ))); | ||||
4676 | } | ||||
4677 | remove_edge (e); | ||||
4678 | |||||
4679 | make_edge (cont_bb, l2_bb, EDGE_FALSE_VALUE); | ||||
4680 | e = find_edge (cont_bb, l1_bb); | ||||
4681 | if (e == NULLnullptr) | ||||
4682 | { | ||||
4683 | e = BRANCH_EDGE (cont_bb)((*((cont_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))->succs)[(1)] : (*((cont_bb))->succs)[(0) ]); | ||||
4684 | gcc_assert (single_succ (e->dest) == l1_bb)((void)(!(single_succ (e->dest) == l1_bb) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4684, __FUNCTION__), 0 : 0)); | ||||
4685 | } | ||||
4686 | if (gimple_omp_for_combined_p (fd->for_stmt)) | ||||
4687 | { | ||||
4688 | remove_edge (e); | ||||
4689 | e = NULLnullptr; | ||||
4690 | } | ||||
4691 | else if (fd->collapse > 1) | ||||
4692 | { | ||||
4693 | remove_edge (e); | ||||
4694 | e = make_edge (cont_bb, collapse_bb, EDGE_TRUE_VALUE); | ||||
4695 | } | ||||
4696 | else | ||||
4697 | e->flags = EDGE_TRUE_VALUE; | ||||
4698 | if (e) | ||||
4699 | { | ||||
4700 | e->probability = profile_probability::guessed_always ().apply_scale (7, 8); | ||||
4701 | find_edge (cont_bb, l2_bb)->probability = e->probability.invert (); | ||||
4702 | } | ||||
4703 | else | ||||
4704 | { | ||||
4705 | e = find_edge (cont_bb, l2_bb); | ||||
4706 | e->flags = EDGE_FALLTHRU; | ||||
4707 | } | ||||
4708 | make_edge (l2_bb, l0_bb, EDGE_TRUE_VALUE); | ||||
4709 | |||||
4710 | if (gimple_in_ssa_p (cfun(cfun + 0))) | ||||
4711 | { | ||||
4712 | /* Add phis to the outer loop that connect to the phis in the inner, | ||||
4713 | original loop, and move the loop entry value of the inner phi to | ||||
4714 | the loop entry value of the outer phi. */ | ||||
4715 | gphi_iterator psi; | ||||
4716 | for (psi = gsi_start_phis (l3_bb); !gsi_end_p (psi); gsi_next (&psi)) | ||||
4717 | { | ||||
4718 | location_t locus; | ||||
4719 | gphi *nphi; | ||||
4720 | gphi *exit_phi = psi.phi (); | ||||
4721 | |||||
4722 | if (virtual_operand_p (gimple_phi_result (exit_phi))) | ||||
4723 | continue; | ||||
4724 | |||||
4725 | edge l2_to_l3 = find_edge (l2_bb, l3_bb); | ||||
4726 | tree exit_res = PHI_ARG_DEF_FROM_EDGE (exit_phi, l2_to_l3)gimple_phi_arg_def (((exit_phi)), ((l2_to_l3)->dest_idx)); | ||||
4727 | |||||
4728 | basic_block latch = BRANCH_EDGE (cont_bb)((*((cont_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((cont_bb))->succs)[(1)] : (*((cont_bb))->succs)[(0) ])->dest; | ||||
4729 | edge latch_to_l1 = find_edge (latch, l1_bb); | ||||
4730 | gphi *inner_phi | ||||
4731 | = find_phi_with_arg_on_edge (exit_res, latch_to_l1); | ||||
4732 | |||||
4733 | tree t = gimple_phi_result (exit_phi); | ||||
4734 | tree new_res = copy_ssa_name (t, NULLnullptr); | ||||
4735 | nphi = create_phi_node (new_res, l0_bb); | ||||
4736 | |||||
4737 | edge l0_to_l1 = find_edge (l0_bb, l1_bb); | ||||
4738 | t = PHI_ARG_DEF_FROM_EDGE (inner_phi, l0_to_l1)gimple_phi_arg_def (((inner_phi)), ((l0_to_l1)->dest_idx)); | ||||
4739 | locus = gimple_phi_arg_location_from_edge (inner_phi, l0_to_l1); | ||||
4740 | edge entry_to_l0 = find_edge (entry_bb, l0_bb); | ||||
4741 | add_phi_arg (nphi, t, entry_to_l0, locus); | ||||
4742 | |||||
4743 | edge l2_to_l0 = find_edge (l2_bb, l0_bb); | ||||
4744 | add_phi_arg (nphi, exit_res, l2_to_l0, UNKNOWN_LOCATION((location_t) 0)); | ||||
4745 | |||||
4746 | add_phi_arg (inner_phi, new_res, l0_to_l1, UNKNOWN_LOCATION((location_t) 0)); | ||||
4747 | } | ||||
4748 | } | ||||
4749 | |||||
4750 | set_immediate_dominator (CDI_DOMINATORS, l2_bb, | ||||
4751 | recompute_dominator (CDI_DOMINATORS, l2_bb)); | ||||
4752 | set_immediate_dominator (CDI_DOMINATORS, l3_bb, | ||||
4753 | recompute_dominator (CDI_DOMINATORS, l3_bb)); | ||||
4754 | set_immediate_dominator (CDI_DOMINATORS, l0_bb, | ||||
4755 | recompute_dominator (CDI_DOMINATORS, l0_bb)); | ||||
4756 | set_immediate_dominator (CDI_DOMINATORS, l1_bb, | ||||
4757 | recompute_dominator (CDI_DOMINATORS, l1_bb)); | ||||
4758 | |||||
4759 | /* We enter expand_omp_for_generic with a loop. This original loop may | ||||
4760 | have its own loop struct, or it may be part of an outer loop struct | ||||
4761 | (which may be the fake loop). */ | ||||
4762 | class loop *outer_loop = entry_bb->loop_father; | ||||
4763 | bool orig_loop_has_loop_struct = l1_bb->loop_father != outer_loop; | ||||
4764 | |||||
4765 | add_bb_to_loop (l2_bb, outer_loop); | ||||
4766 | |||||
4767 | /* We've added a new loop around the original loop. Allocate the | ||||
4768 | corresponding loop struct. */ | ||||
4769 | class loop *new_loop = alloc_loop (); | ||||
4770 | new_loop->header = l0_bb; | ||||
4771 | new_loop->latch = l2_bb; | ||||
4772 | add_loop (new_loop, outer_loop); | ||||
4773 | |||||
4774 | /* Allocate a loop structure for the original loop unless we already | ||||
4775 | had one. */ | ||||
4776 | if (!orig_loop_has_loop_struct | ||||
4777 | && !gimple_omp_for_combined_p (fd->for_stmt)) | ||||
4778 | { | ||||
4779 | class loop *orig_loop = alloc_loop (); | ||||
4780 | orig_loop->header = l1_bb; | ||||
4781 | /* The loop may have multiple latches. */ | ||||
4782 | add_loop (orig_loop, new_loop); | ||||
4783 | } | ||||
4784 | } | ||||
4785 | } | ||||
4786 | |||||
4787 | /* Helper function for expand_omp_for_static_nochunk. If PTR is NULL, | ||||
4788 | compute needed allocation size. If !ALLOC of team allocations, | ||||
4789 | if ALLOC of thread allocation. SZ is the initial needed size for | ||||
4790 | other purposes, ALLOC_ALIGN guaranteed alignment of allocation in bytes, | ||||
4791 | CNT number of elements of each array, for !ALLOC this is | ||||
4792 | omp_get_num_threads (), for ALLOC number of iterations handled by the | ||||
4793 | current thread. If PTR is non-NULL, it is the start of the allocation | ||||
4794 | and this routine shall assign to OMP_CLAUSE_DECL (c) of those _scantemp_ | ||||
4795 | clauses pointers to the corresponding arrays. */ | ||||
4796 | |||||
4797 | static tree | ||||
4798 | expand_omp_scantemp_alloc (tree clauses, tree ptr, unsigned HOST_WIDE_INTlong sz, | ||||
4799 | unsigned HOST_WIDE_INTlong alloc_align, tree cnt, | ||||
4800 | gimple_stmt_iterator *gsi, bool alloc) | ||||
4801 | { | ||||
4802 | tree eltsz = NULL_TREE(tree) nullptr; | ||||
4803 | unsigned HOST_WIDE_INTlong preval = 0; | ||||
4804 | if (ptr && sz) | ||||
4805 | ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr),fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((ptr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4805, __FUNCTION__))->typed.type), ptr, size_int_kind (sz , stk_sizetype) ) | ||||
4806 | ptr, size_int (sz))fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((ptr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4805, __FUNCTION__))->typed.type), ptr, size_int_kind (sz , stk_sizetype) ); | ||||
4807 | for (tree c = clauses; c; c = OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4807, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4807, __FUNCTION__))->common.chain)) | ||||
4808 | if (OMP_CLAUSE_CODE (c)((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4808, __FUNCTION__, (OMP_CLAUSE))))->omp_clause.code == OMP_CLAUSE__SCANTEMP_ | ||||
4809 | && !OMP_CLAUSE__SCANTEMP__CONTROL (c)(((omp_clause_subcode_check ((c), (OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4809, __FUNCTION__)))->base.private_flag) | ||||
4810 | && (!OMP_CLAUSE__SCANTEMP__ALLOC (c)((omp_clause_subcode_check ((c), (OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4810, __FUNCTION__))->base.public_flag)) != alloc) | ||||
4811 | { | ||||
4812 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4812, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4812, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4812, __FUNCTION__)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4812, __FUNCTION__))->typed.type)), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4812, __FUNCTION__))->typed.type); | ||||
4813 | unsigned HOST_WIDE_INTlong al = TYPE_ALIGN_UNIT (pointee_type)((((tree_class_check ((pointee_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4813, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((pointee_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4813, __FUNCTION__))->type_common.align) - 1) : 0) / (8) ); | ||||
4814 | if (tree_fits_uhwi_p (TYPE_SIZE_UNIT (pointee_type)((tree_class_check ((pointee_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4814, __FUNCTION__))->type_common.size_unit))) | ||||
4815 | { | ||||
4816 | unsigned HOST_WIDE_INTlong szl | ||||
4817 | = tree_to_uhwi (TYPE_SIZE_UNIT (pointee_type)((tree_class_check ((pointee_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4817, __FUNCTION__))->type_common.size_unit)); | ||||
4818 | szl = least_bit_hwi (szl); | ||||
4819 | if (szl) | ||||
4820 | al = MIN (al, szl)((al) < (szl) ? (al) : (szl)); | ||||
4821 | } | ||||
4822 | if (ptr == NULL_TREE(tree) nullptr) | ||||
4823 | { | ||||
4824 | if (eltsz == NULL_TREE(tree) nullptr) | ||||
4825 | eltsz = TYPE_SIZE_UNIT (pointee_type)((tree_class_check ((pointee_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4825, __FUNCTION__))->type_common.size_unit); | ||||
4826 | else | ||||
4827 | eltsz = size_binop (PLUS_EXPR, eltsz,size_binop_loc (((location_t) 0), PLUS_EXPR, eltsz, ((tree_class_check ((pointee_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4828, __FUNCTION__))->type_common.size_unit)) | ||||
4828 | TYPE_SIZE_UNIT (pointee_type))size_binop_loc (((location_t) 0), PLUS_EXPR, eltsz, ((tree_class_check ((pointee_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4828, __FUNCTION__))->type_common.size_unit)); | ||||
4829 | } | ||||
4830 | if (preval == 0 && al <= alloc_align) | ||||
4831 | { | ||||
4832 | unsigned HOST_WIDE_INTlong diff = ROUND_UP (sz, al)(((sz) + (al) - 1) & ~((al) - 1)) - sz; | ||||
4833 | sz += diff; | ||||
4834 | if (diff && ptr) | ||||
4835 | ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr),fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((ptr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4835, __FUNCTION__))->typed.type), ptr, size_int_kind (diff , stk_sizetype) ) | ||||
4836 | ptr, size_int (diff))fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((ptr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4835, __FUNCTION__))->typed.type), ptr, size_int_kind (diff , stk_sizetype) ); | ||||
4837 | } | ||||
4838 | else if (al > preval) | ||||
4839 | { | ||||
4840 | if (ptr) | ||||
4841 | { | ||||
4842 | ptr = fold_convert (pointer_sized_int_node, ptr)fold_convert_loc (((location_t) 0), global_trees[TI_POINTER_SIZED_TYPE ], ptr); | ||||
4843 | 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) ) | ||||
4844 | 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) ) | ||||
4845 | 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) ); | ||||
4846 | 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) ) | ||||
4847 | 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) ) | ||||
4848 | -(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) ); | ||||
4849 | ptr = fold_convert (ptr_type_node, ptr)fold_convert_loc (((location_t) 0), global_trees[TI_PTR_TYPE] , ptr); | ||||
4850 | } | ||||
4851 | else | ||||
4852 | sz += al - 1; | ||||
4853 | } | ||||
4854 | if (tree_fits_uhwi_p (TYPE_SIZE_UNIT (pointee_type)((tree_class_check ((pointee_type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4854, __FUNCTION__))->type_common.size_unit))) | ||||
4855 | preval = al; | ||||
4856 | else | ||||
4857 | preval = 1; | ||||
4858 | if (ptr) | ||||
4859 | { | ||||
4860 | expand_omp_build_assign (gsi, OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4860, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4860, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4860, __FUNCTION__))), ptr, false); | ||||
4861 | ptr = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4861, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4861, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4861, __FUNCTION__))); | ||||
4862 | 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), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4862, __FUNCTION__))->typed.type), ptr, size_binop_loc ( ((location_t) 0), MULT_EXPR, cnt, ((tree_class_check ((pointee_type ), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4864, __FUNCTION__))->type_common.size_unit)) ) | ||||
4863 | size_binop (MULT_EXPR, cnt,fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((ptr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4862, __FUNCTION__))->typed.type), ptr, size_binop_loc ( ((location_t) 0), MULT_EXPR, cnt, ((tree_class_check ((pointee_type ), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4864, __FUNCTION__))->type_common.size_unit)) ) | ||||
4864 | TYPE_SIZE_UNIT (pointee_type)))fold_build2_loc (((location_t) 0), POINTER_PLUS_EXPR, ((contains_struct_check ((ptr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4862, __FUNCTION__))->typed.type), ptr, size_binop_loc ( ((location_t) 0), MULT_EXPR, cnt, ((tree_class_check ((pointee_type ), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4864, __FUNCTION__))->type_common.size_unit)) ); | ||||
4865 | } | ||||
4866 | } | ||||
4867 | |||||
4868 | if (ptr == NULL_TREE(tree) nullptr) | ||||
4869 | { | ||||
4870 | eltsz = size_binop (MULT_EXPR, eltsz, cnt)size_binop_loc (((location_t) 0), MULT_EXPR, eltsz, cnt); | ||||
4871 | if (sz) | ||||
4872 | eltsz = size_binop (PLUS_EXPR, eltsz, size_int (sz))size_binop_loc (((location_t) 0), PLUS_EXPR, eltsz, size_int_kind (sz, stk_sizetype)); | ||||
4873 | return eltsz; | ||||
4874 | } | ||||
4875 | else | ||||
4876 | return ptr; | ||||
4877 | } | ||||
4878 | |||||
4879 | /* Return the last _looptemp_ clause if one has been created for | ||||
4880 | lastprivate on distribute parallel for{, simd} or taskloop. | ||||
4881 | FD is the loop data and INNERC should be the second _looptemp_ | ||||
4882 | clause (the one holding the end of the range). | ||||
4883 | This is followed by collapse - 1 _looptemp_ clauses for the | ||||
4884 | counts[1] and up, and for triangular loops followed by 4 | ||||
4885 | further _looptemp_ clauses (one for counts[0], one first_inner_iterations, | ||||
4886 | one factor and one adjn1). After this there is optionally one | ||||
4887 | _looptemp_ clause that this function returns. */ | ||||
4888 | |||||
4889 | static tree | ||||
4890 | find_lastprivate_looptemp (struct omp_for_data *fd, tree innerc) | ||||
4891 | { | ||||
4892 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4892, __FUNCTION__), 0 : 0)); | ||||
4893 | int count = fd->collapse - 1; | ||||
4894 | if (fd->non_rect | ||||
4895 | && fd->last_nonrect == fd->first_nonrect + 1 | ||||
4896 | && !TYPE_UNSIGNED (TREE_TYPE (fd->loops[fd->last_nonrect].v))((tree_class_check ((((contains_struct_check ((fd->loops[fd ->last_nonrect].v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4896, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4896, __FUNCTION__))->base.u.bits.unsigned_flag)) | ||||
4897 | count += 4; | ||||
4898 | for (int i = 0; i < count; i++) | ||||
4899 | { | ||||
4900 | innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4900, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4900, __FUNCTION__))->common.chain), | ||||
4901 | OMP_CLAUSE__LOOPTEMP_); | ||||
4902 | gcc_assert (innerc)((void)(!(innerc) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4902, __FUNCTION__), 0 : 0)); | ||||
4903 | } | ||||
4904 | return omp_find_clause (OMP_CLAUSE_CHAIN (innerc)((contains_struct_check (((tree_check ((innerc), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4904, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4904, __FUNCTION__))->common.chain), | ||||
4905 | OMP_CLAUSE__LOOPTEMP_); | ||||
4906 | } | ||||
4907 | |||||
4908 | /* A subroutine of expand_omp_for. Generate code for a parallel | ||||
4909 | loop with static schedule and no specified chunk size. Given | ||||
4910 | parameters: | ||||
4911 | |||||
4912 | for (V = N1; V cond N2; V += STEP) BODY; | ||||
4913 | |||||
4914 | where COND is "<" or ">", we generate pseudocode | ||||
4915 | |||||
4916 | if ((__typeof (V)) -1 > 0 && N2 cond N1) goto L2; | ||||
4917 | if (cond is <) | ||||
4918 | adj = STEP - 1; | ||||
4919 | else | ||||
4920 | adj = STEP + 1; | ||||
4921 | if ((__typeof (V)) -1 > 0 && cond is >) | ||||
4922 | n = -(adj + N2 - N1) / -STEP; | ||||
4923 | else | ||||
4924 | n = (adj + N2 - N1) / STEP; | ||||
4925 | q = n / nthreads; | ||||
4926 | tt = n % nthreads; | ||||
4927 | if (threadid < tt) goto L3; else goto L4; | ||||
4928 | L3: | ||||
4929 | tt = 0; | ||||
4930 | q = q + 1; | ||||
4931 | L4: | ||||
4932 | s0 = q * threadid + tt; | ||||
4933 | e0 = s0 + q; | ||||
4934 | V = s0 * STEP + N1; | ||||
4935 | if (s0 >= e0) goto L2; else goto L0; | ||||
4936 | L0: | ||||
4937 | e = e0 * STEP + N1; | ||||
4938 | L1: | ||||
4939 | BODY; | ||||
4940 | V += STEP; | ||||
4941 | if (V cond e) goto L1; | ||||
4942 | L2: | ||||
4943 | */ | ||||
4944 | |||||
4945 | static void | ||||
4946 | expand_omp_for_static_nochunk (struct omp_region *region, | ||||
4947 | struct omp_for_data *fd, | ||||
4948 | gimple *inner_stmt) | ||||
4949 | { | ||||
4950 | tree n, q, s0, e0, e, t, tt, nthreads = NULL_TREE(tree) nullptr, threadid; | ||||
4951 | tree type, itype, vmain, vback; | ||||
4952 | basic_block entry_bb, second_bb, third_bb, exit_bb, seq_start_bb; | ||||
4953 | basic_block body_bb, cont_bb, collapse_bb = NULLnullptr; | ||||
4954 | basic_block fin_bb, fourth_bb = NULLnullptr, fifth_bb = NULLnullptr, sixth_bb = NULLnullptr; | ||||
4955 | basic_block exit1_bb = NULLnullptr, exit2_bb = NULLnullptr, exit3_bb = NULLnullptr; | ||||
4956 | gimple_stmt_iterator gsi, gsip; | ||||
4957 | edge ep; | ||||
4958 | bool broken_loop = region->cont == NULLnullptr; | ||||
4959 | tree *counts = NULLnullptr; | ||||
4960 | tree n1, n2, step; | ||||
4961 | tree reductions = NULL_TREE(tree) nullptr; | ||||
4962 | tree cond_var = NULL_TREE(tree) nullptr, condtemp = NULL_TREE(tree) nullptr; | ||||
4963 | |||||
4964 | itype = type = TREE_TYPE (fd->loop.v)((contains_struct_check ((fd->loop.v), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4964, __FUNCTION__))->typed.type); | ||||
4965 | if (POINTER_TYPE_P (type)(((enum tree_code) (type)->base.code) == POINTER_TYPE || ( (enum tree_code) (type)->base.code) == REFERENCE_TYPE)) | ||||
4966 | itype = signed_type_for (type); | ||||
4967 | |||||
4968 | entry_bb = region->entry; | ||||
4969 | cont_bb = region->cont; | ||||
4970 | gcc_assert (EDGE_COUNT (entry_bb->succs) == 2)((void)(!(vec_safe_length (entry_bb->succs) == 2) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4970, __FUNCTION__), 0 : 0)); | ||||
4971 | fin_bb = BRANCH_EDGE (entry_bb)((*((entry_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(1)] : (*((entry_bb))->succs) [(0)])->dest; | ||||
4972 | 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4973, __FUNCTION__), 0 : 0)) | ||||
4973 | || (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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4973, __FUNCTION__), 0 : 0)); | ||||
4974 | seq_start_bb = split_edge (FALLTHRU_EDGE (entry_bb)((*((entry_bb))->succs)[(0)]->flags & EDGE_FALLTHRU ? (*((entry_bb))->succs)[(0)] : (*((entry_bb))->succs) [(1)])); | ||||
4975 | body_bb = single_succ (seq_start_bb); | ||||
4976 | if (!broken_loop) | ||||
4977 | { | ||||
4978 | 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4979, __FUNCTION__), 0 : 0)) | ||||
4979 | || 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 ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4979, __FUNCTION__), 0 : 0)); | ||||
4980 | gcc_assert (EDGE_COUNT (cont_bb->succs) == 2)((void)(!(vec_safe_length (cont_bb->succs) == 2) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4980, __FUNCTION__), 0 : 0)); | ||||
4981 | } | ||||
4982 | exit_bb = region->exit; | ||||
4983 | |||||
4984 | /* Iteration space partitioning goes in ENTRY_BB. */ | ||||
4985 | gsi = gsi_last_nondebug_bb (entry_bb); | ||||
4986 | gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR)((void)(!(gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 4986, __FUNCTION__), 0 : 0)); | ||||
4987 | gsip = gsi; | ||||
4988 | gsi_prev (&gsip); | ||||
4989 | |||||
4990 | if (fd->collapse > 1) | ||||
4991 | { | ||||
4992 | int first_zero_iter = -1, dummy = -1; | ||||
4993 | basic_block l2_dom_bb = NULLnullptr, dummy_bb = NULLnullptr; | ||||
4994 | |||||
4995 | counts = XALLOCAVEC (tree, fd->collapse)((tree *) __builtin_alloca(sizeof (tree) * (fd->collapse)) ); | ||||
4996 | expand_omp_for_init_counts (fd, &gsi, entry_bb, counts, | ||||
4997 | fin_bb, first_zero_iter, | ||||
4998 | dummy_bb, dummy, l2_dom_bb); | ||||
4999 | t = NULL_TREE(tree) nullptr; | ||||
5000 | } | ||||
5001 | else if (gimple_omp_for_combined_into_p (fd->for_stmt)) | ||||
5002 | t = integer_one_nodeglobal_trees[TI_INTEGER_ONE]; | ||||
5003 | else | ||||
5004 | 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)) | ||||
5005 | 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)) | ||||
5006 | 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)); | ||||
5007 | if (fd->collapse == 1 | ||||
5008 | && TYPE_UNSIGNED (type)((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5008, __FUNCTION__))->base.u.bits.unsigned_flag) | ||||
5009 | && (t == NULL_TREE(tree) nullptr || !integer_onep (t))) | ||||
5010 | { | ||||
5011 | n1 = fold_convert (type, unshare_expr (fd->loop.n1))fold_convert_loc (((location_t) 0), type, unshare_expr (fd-> loop.n1)); | ||||
5012 | n1 = force_gimple_operand_gsi (&gsi, n1, true, NULL_TREE(tree) nullptr, | ||||
5013 | true, GSI_SAME_STMT); | ||||
5014 | n2 = fold_convert (type, unshare_expr (fd->loop.n2))fold_convert_loc (((location_t) 0), type, unshare_expr (fd-> loop.n2)); | ||||
5015 | n2 = force_gimple_operand_gsi (&gsi, n2, true, NULL_TREE(tree) nullptr, | ||||
5016 | true, GSI_SAME_STMT); | ||||
5017 | gcond *cond_stmt = expand_omp_build_cond (&gsi, fd->loop.cond_code, | ||||
5018 | n1, n2); | ||||
5019 | ep = split_block (entry_bb, cond_stmt); | ||||
5020 | ep->flags = EDGE_TRUE_VALUE; | ||||
5021 | entry_bb = ep->dest; | ||||
5022 | ep->probability = profile_probability::very_likely (); | ||||
5023 | ep = make_edge (ep->src, fin_bb, EDGE_FALSE_VALUE); | ||||
5024 | ep->probability = profile_probability::very_unlikely (); | ||||
5025 | if (gimple_in_ssa_p (cfun(cfun + 0))) | ||||
5026 | { | ||||
5027 | int dest_idx = find_edge (entry_bb, fin_bb)->dest_idx; | ||||
5028 | for (gphi_iterator gpi = gsi_start_phis (fin_bb); | ||||
5029 | !gsi_end_p (gpi); gsi_next (&gpi)) | ||||
5030 | { | ||||
5031 | gphi *phi = gpi.phi (); | ||||
5032 | add_phi_arg (phi, gimple_phi_arg_def (phi, dest_idx), | ||||
5033 | ep, UNKNOWN_LOCATION((location_t) 0)); | ||||
5034 | } | ||||
5035 | } | ||||
5036 | gsi = gsi_last_bb (entry_bb); | ||||
5037 | } | ||||
5038 | |||||
5039 | if (fd->lastprivate_conditional) | ||||
5040 | { | ||||
5041 | tree clauses = gimple_omp_for_clauses (fd->for_stmt); | ||||
5042 | tree c = omp_find_clause (clauses, OMP_CLAUSE__CONDTEMP_); | ||||
5043 | if (fd->have_pointer_condtemp) | ||||
5044 | condtemp = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5044, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5044, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5044, __FUNCTION__))); | ||||
5045 | c = omp_find_clause (OMP_CLAUSE_CHAIN (c)((contains_struct_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5045, __FUNCTION__, (OMP_CLAUSE)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5045, __FUNCTION__))->common.chain), OMP_CLAUSE__CONDTEMP_); | ||||
5046 | cond_var = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5046, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5046, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5046, __FUNCTION__))); | ||||
5047 | } | ||||
5048 | if (fd->have_reductemp | ||||
5049 | /* For scan, we don't want to reinitialize condtemp before the | ||||
5050 | second loop. */ | ||||
5051 | || (fd->have_pointer_condtemp && !fd->have_scantemp) | ||||
5052 | || fd->have_nonctrl_scantemp) | ||||
5053 | { | ||||
5054 | tree t1 = build_int_cst (long_integer_type_nodeinteger_types[itk_long], 0); | ||||
5055 | tree t2 = build_int_cst (long_integer_type_nodeinteger_types[itk_long], 1); | ||||
5056 | tree t3 = build_int_cstu (long_integer_type_nodeinteger_types[itk_long], | ||||
5057 | (HOST_WIDE_INT_1U1UL << 31) + 1); | ||||
5058 | tree clauses = gimple_omp_for_clauses (fd->for_stmt); | ||||
5059 | gimple_stmt_iterator gsi2 = gsi_none (); | ||||
5060 | gimple *g = NULLnullptr; | ||||
5061 | tree mem = null_pointer_nodeglobal_trees[TI_NULL_POINTER], memv = NULL_TREE(tree) nullptr; | ||||
5062 | unsigned HOST_WIDE_INTlong condtemp_sz = 0; | ||||
5063 | unsigned HOST_WIDE_INTlong alloc_align = 0; | ||||
5064 | if (fd->have_reductemp) | ||||
5065 | { | ||||
5066 | gcc_assert (!fd->have_nonctrl_scantemp)((void)(!(!fd->have_nonctrl_scantemp) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5066, __FUNCTION__), 0 : 0)); | ||||
5067 | tree c = omp_find_clause (clauses, OMP_CLAUSE__REDUCTEMP_); | ||||
5068 | reductions = OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5068, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5068, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5068, __FUNCTION__))); | ||||
5069 | gcc_assert (TREE_CODE (reductions) == SSA_NAME)((void)(!(((enum tree_code) (reductions)->base.code) == SSA_NAME ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5069, __FUNCTION__), 0 : 0)); | ||||
5070 | g = SSA_NAME_DEF_STMT (reductions)(tree_check ((reductions), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5070, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt; | ||||
5071 | reductions = gimple_assign_rhs1 (g); | ||||
5072 | OMP_CLAUSE_DECL (c)(*(omp_clause_elt_check (((omp_clause_range_check (((tree_check ((c), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5072, __FUNCTION__, (OMP_CLAUSE)))), (OMP_CLAUSE_PRIVATE), ( OMP_CLAUSE__SCANTEMP_), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5072, __FUNCTION__))), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5072, __FUNCTION__))) = reductions; | ||||
5073 | gsi2 = gsi_for_stmt (g); | ||||
5074 | } | ||||
5075 | else | ||||
5076 | { | ||||
5077 | if (gsi_end_p (gsip)) | ||||
5078 | gsi2 = gsi_after_labels (region->entry); | ||||
5079 | else | ||||
5080 | gsi2 = gsip; | ||||
5081 | reductions = null_pointer_nodeglobal_trees[TI_NULL_POINTER]; | ||||
5082 | } | ||||
5083 | if (fd->have_pointer_condtemp || fd->have_nonctrl_scantemp) | ||||
5084 | { | ||||
5085 | tree type; | ||||
5086 | if (fd->have_pointer_condtemp) | ||||
5087 | type = TREE_TYPE (condtemp)((contains_struct_check ((condtemp), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5087, __FUNCTION__))->typed.type); | ||||
5088 | else | ||||
5089 | type = ptr_type_nodeglobal_trees[TI_PTR_TYPE]; | ||||
5090 | memv = create_tmp_var (type); | ||||
5091 | TREE_ADDRESSABLE (memv)((memv)->base.addressable_flag) = 1; | ||||
5092 | unsigned HOST_WIDE_INTlong sz = 0; | ||||
5093 | tree size = NULL_TREE(tree) nullptr; | ||||
5094 | if (fd->have_pointer_condtemp) | ||||
5095 | { | ||||
5096 | sz = tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (type))((tree_class_check ((((contains_struct_check ((type), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5096, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5096, __FUNCTION__))->type_common.size_unit)); | ||||
5097 | sz *= fd->lastprivate_conditional; | ||||
5098 | condtemp_sz = sz; | ||||
5099 | } | ||||
5100 | if (fd->have_nonctrl_scantemp) | ||||
5101 | { | ||||
5102 | nthreads = builtin_decl_explicit (BUILT_IN_OMP_GET_NUM_THREADS); | ||||
5103 | gimple *g = gimple_build_call (nthreads, 0); | ||||
5104 | nthreads = create_tmp_var (integer_type_nodeinteger_types[itk_int]); | ||||
5105 | gimple_call_set_lhs (g, nthreads); | ||||
5106 | gsi_insert_before (&gsi2, g, GSI_SAME_STMT); | ||||
5107 | nthreads = fold_convert (sizetype, nthreads)fold_convert_loc (((location_t) 0), sizetype_tab[(int) stk_sizetype ], nthreads); | ||||
5108 | alloc_align = TYPE_ALIGN_UNIT (long_long_integer_type_node)((((tree_class_check ((integer_types[itk_long_long]), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5108, __FUNCTION__))->type_common.align) ? ((unsigned)1) << (((tree_class_check ((integer_types[itk_long_long]) , (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/omp-expand.cc" , 5108, __FUNCTION__))->type_common.align) - 1) : 0) / (8) ); | ||||
5109 | size = expand_omp_scantemp_alloc (clauses, NULL_TREE(tree) nullptr, sz, | ||||
5110 | alloc_align, nthreads, NULLnullptr, | ||||
5111 | false); | ||||
5112 | size = fold_convert (type, size)fold_convert_loc (((location_t) 0), type, size); | ||||
5113 | } | ||||
5114 | else | ||||
5115 | size = build_int_cst (type, sz); | ||||
5116 | expand_omp_build_assign (&gsi2, memv, size, false); | ||||
5117 | mem = build_fold_addr_expr (memv)build_fold_addr_expr_loc (((location_t) 0), (memv)); | ||||
5118 | } | ||||
5119 | tree t | ||||
5120 | = build_call_expr (builtin_decl_explicit (BUILT_IN_GOMP_LOOP_START), | ||||
5121 | 9, t1, t2, t2, t3, t1, null_pointer_nodeglobal_trees[TI_NULL_POINTER], | ||||
5122 | null_pointer_nodeglobal_trees[TI_NULL_POINTER], reductions, mem); | ||||
5123 | force_gimple_operand_gsi |