Bug Summary

File:build/gcc/tree-ssa-forwprop.c
Warning:line 3375, column 8
Value stored to 'stmt' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name tree-ssa-forwprop.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model static -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/objdir/gcc -resource-dir /usr/lib64/clang/13.0.0 -D IN_GCC -D HAVE_CONFIG_H -I . -I . -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/. -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../include -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libcpp/include -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libcody -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libdecnumber -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libdecnumber/bid -I ../libdecnumber -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libbacktrace -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/11/../../../../include/c++/11 -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/11/../../../../include/c++/11/x86_64-suse-linux -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/11/../../../../include/c++/11/backward -internal-isystem /usr/lib64/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-narrowing -Wwrite-strings -Wno-error=format-diag -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fdeprecated-macro -fdebug-compilation-dir=/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/objdir/gcc -ferror-limit 19 -fno-rtti -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-output=plist-html -analyzer-config silence-checkers=core.NullDereference -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/objdir/clang-static-analyzer/2021-11-20-133755-20252-1/report-bnGMzv.plist -x c++ /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c
1/* Forward propagation of expressions for single use variables.
2 Copyright (C) 2004-2021 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 3, or (at your option)
9any later version.
10
11GCC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#include "config.h"
21#include "system.h"
22#include "coretypes.h"
23#include "backend.h"
24#include "rtl.h"
25#include "tree.h"
26#include "gimple.h"
27#include "cfghooks.h"
28#include "tree-pass.h"
29#include "ssa.h"
30#include "expmed.h"
31#include "optabs-query.h"
32#include "gimple-pretty-print.h"
33#include "fold-const.h"
34#include "stor-layout.h"
35#include "gimple-fold.h"
36#include "tree-eh.h"
37#include "gimplify.h"
38#include "gimple-iterator.h"
39#include "gimplify-me.h"
40#include "tree-cfg.h"
41#include "expr.h"
42#include "tree-dfa.h"
43#include "tree-ssa-propagate.h"
44#include "tree-ssa-dom.h"
45#include "builtins.h"
46#include "tree-cfgcleanup.h"
47#include "cfganal.h"
48#include "optabs-tree.h"
49#include "tree-vector-builder.h"
50#include "vec-perm-indices.h"
51#include "internal-fn.h"
52#include "cgraph.h"
53#include "tree-ssa.h"
54
55/* This pass propagates the RHS of assignment statements into use
56 sites of the LHS of the assignment. It's basically a specialized
57 form of tree combination. It is hoped all of this can disappear
58 when we have a generalized tree combiner.
59
60 One class of common cases we handle is forward propagating a single use
61 variable into a COND_EXPR.
62
63 bb0:
64 x = a COND b;
65 if (x) goto ... else goto ...
66
67 Will be transformed into:
68
69 bb0:
70 if (a COND b) goto ... else goto ...
71
72 Similarly for the tests (x == 0), (x != 0), (x == 1) and (x != 1).
73
74 Or (assuming c1 and c2 are constants):
75
76 bb0:
77 x = a + c1;
78 if (x EQ/NEQ c2) goto ... else goto ...
79
80 Will be transformed into:
81
82 bb0:
83 if (a EQ/NEQ (c2 - c1)) goto ... else goto ...
84
85 Similarly for x = a - c1.
86
87 Or
88
89 bb0:
90 x = !a
91 if (x) goto ... else goto ...
92
93 Will be transformed into:
94
95 bb0:
96 if (a == 0) goto ... else goto ...
97
98 Similarly for the tests (x == 0), (x != 0), (x == 1) and (x != 1).
99 For these cases, we propagate A into all, possibly more than one,
100 COND_EXPRs that use X.
101
102 Or
103
104 bb0:
105 x = (typecast) a
106 if (x) goto ... else goto ...
107
108 Will be transformed into:
109
110 bb0:
111 if (a != 0) goto ... else goto ...
112
113 (Assuming a is an integral type and x is a boolean or x is an
114 integral and a is a boolean.)
115
116 Similarly for the tests (x == 0), (x != 0), (x == 1) and (x != 1).
117 For these cases, we propagate A into all, possibly more than one,
118 COND_EXPRs that use X.
119
120 In addition to eliminating the variable and the statement which assigns
121 a value to the variable, we may be able to later thread the jump without
122 adding insane complexity in the dominator optimizer.
123
124 Also note these transformations can cascade. We handle this by having
125 a worklist of COND_EXPR statements to examine. As we make a change to
126 a statement, we put it back on the worklist to examine on the next
127 iteration of the main loop.
128
129 A second class of propagation opportunities arises for ADDR_EXPR
130 nodes.
131
132 ptr = &x->y->z;
133 res = *ptr;
134
135 Will get turned into
136
137 res = x->y->z;
138
139 Or
140 ptr = (type1*)&type2var;
141 res = *ptr
142
143 Will get turned into (if type1 and type2 are the same size
144 and neither have volatile on them):
145 res = VIEW_CONVERT_EXPR<type1>(type2var)
146
147 Or
148
149 ptr = &x[0];
150 ptr2 = ptr + <constant>;
151
152 Will get turned into
153
154 ptr2 = &x[constant/elementsize];
155
156 Or
157
158 ptr = &x[0];
159 offset = index * element_size;
160 offset_p = (pointer) offset;
161 ptr2 = ptr + offset_p
162
163 Will get turned into:
164
165 ptr2 = &x[index];
166
167 Or
168 ssa = (int) decl
169 res = ssa & 1
170
171 Provided that decl has known alignment >= 2, will get turned into
172
173 res = 0
174
175 We also propagate casts into SWITCH_EXPR and COND_EXPR conditions to
176 allow us to remove the cast and {NOT_EXPR,NEG_EXPR} into a subsequent
177 {NOT_EXPR,NEG_EXPR}.
178
179 This will (of course) be extended as other needs arise. */
180
181static bool forward_propagate_addr_expr (tree, tree, bool);
182
183/* Set to true if we delete dead edges during the optimization. */
184static bool cfg_changed;
185
186static tree rhs_to_tree (tree type, gimple *stmt);
187
188static bitmap to_purge;
189
190/* Const-and-copy lattice. */
191static vec<tree> lattice;
192
193/* Set the lattice entry for NAME to VAL. */
194static void
195fwprop_set_lattice_val (tree name, tree val)
196{
197 if (TREE_CODE (name)((enum tree_code) (name)->base.code) == SSA_NAME)
198 {
199 if (SSA_NAME_VERSION (name)(tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 199, __FUNCTION__, (SSA_NAME)))->base.u.version
>= lattice.length ())
200 {
201 lattice.reserve (num_ssa_names(vec_safe_length ((cfun + 0)->gimple_df->ssa_names)) - lattice.length ());
202 lattice.quick_grow_cleared (num_ssa_names(vec_safe_length ((cfun + 0)->gimple_df->ssa_names)));
203 }
204 lattice[SSA_NAME_VERSION (name)(tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 204, __FUNCTION__, (SSA_NAME)))->base.u.version
] = val;
205 }
206}
207
208/* Invalidate the lattice entry for NAME, done when releasing SSA names. */
209static void
210fwprop_invalidate_lattice (tree name)
211{
212 if (name
213 && TREE_CODE (name)((enum tree_code) (name)->base.code) == SSA_NAME
214 && SSA_NAME_VERSION (name)(tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 214, __FUNCTION__, (SSA_NAME)))->base.u.version
< lattice.length ())
215 lattice[SSA_NAME_VERSION (name)(tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 215, __FUNCTION__, (SSA_NAME)))->base.u.version
] = NULL_TREE(tree) nullptr;
216}
217
218
219/* Get the statement we can propagate from into NAME skipping
220 trivial copies. Returns the statement which defines the
221 propagation source or NULL_TREE if there is no such one.
222 If SINGLE_USE_ONLY is set considers only sources which have
223 a single use chain up to NAME. If SINGLE_USE_P is non-null,
224 it is set to whether the chain to NAME is a single use chain
225 or not. SINGLE_USE_P is not written to if SINGLE_USE_ONLY is set. */
226
227static gimple *
228get_prop_source_stmt (tree name, bool single_use_only, bool *single_use_p)
229{
230 bool single_use = true;
231
232 do {
233 gimple *def_stmt = SSA_NAME_DEF_STMT (name)(tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 233, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt
;
234
235 if (!has_single_use (name))
236 {
237 single_use = false;
238 if (single_use_only)
239 return NULLnullptr;
240 }
241
242 /* If name is defined by a PHI node or is the default def, bail out. */
243 if (!is_gimple_assign (def_stmt))
244 return NULLnullptr;
245
246 /* If def_stmt is a simple copy, continue looking. */
247 if (gimple_assign_rhs_code (def_stmt) == SSA_NAME)
248 name = gimple_assign_rhs1 (def_stmt);
249 else
250 {
251 if (!single_use_only && single_use_p)
252 *single_use_p = single_use;
253
254 return def_stmt;
255 }
256 } while (1);
257}
258
259/* Checks if the destination ssa name in DEF_STMT can be used as
260 propagation source. Returns true if so, otherwise false. */
261
262static bool
263can_propagate_from (gimple *def_stmt)
264{
265 gcc_assert (is_gimple_assign (def_stmt))((void)(!(is_gimple_assign (def_stmt)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 265, __FUNCTION__), 0 : 0))
;
266
267 /* If the rhs has side-effects we cannot propagate from it. */
268 if (gimple_has_volatile_ops (def_stmt))
269 return false;
270
271 /* If the rhs is a load we cannot propagate from it. */
272 if (TREE_CODE_CLASS (gimple_assign_rhs_code (def_stmt))tree_code_type[(int) (gimple_assign_rhs_code (def_stmt))] == tcc_reference
273 || TREE_CODE_CLASS (gimple_assign_rhs_code (def_stmt))tree_code_type[(int) (gimple_assign_rhs_code (def_stmt))] == tcc_declaration)
274 return false;
275
276 /* Constants can be always propagated. */
277 if (gimple_assign_single_p (def_stmt)
278 && is_gimple_min_invariant (gimple_assign_rhs1 (def_stmt)))
279 return true;
280
281 /* We cannot propagate ssa names that occur in abnormal phi nodes. */
282 if (stmt_references_abnormal_ssa_name (def_stmt))
283 return false;
284
285 /* If the definition is a conversion of a pointer to a function type,
286 then we cannot apply optimizations as some targets require
287 function pointers to be canonicalized and in this case this
288 optimization could eliminate a necessary canonicalization. */
289 if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt))((gimple_assign_rhs_code (def_stmt)) == NOP_EXPR || (gimple_assign_rhs_code
(def_stmt)) == CONVERT_EXPR)
)
290 {
291 tree rhs = gimple_assign_rhs1 (def_stmt);
292 if (POINTER_TYPE_P (TREE_TYPE (rhs))(((enum tree_code) (((contains_struct_check ((rhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 292, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
|| ((enum tree_code) (((contains_struct_check ((rhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 292, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
293 && TREE_CODE (TREE_TYPE (TREE_TYPE (rhs)))((enum tree_code) (((contains_struct_check ((((contains_struct_check
((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 293, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 293, __FUNCTION__))->typed.type))->base.code)
== FUNCTION_TYPE)
294 return false;
295 }
296
297 return true;
298}
299
300/* Remove a chain of dead statements starting at the definition of
301 NAME. The chain is linked via the first operand of the defining statements.
302 If NAME was replaced in its only use then this function can be used
303 to clean up dead stmts. The function handles already released SSA
304 names gracefully.
305 Returns true if cleanup-cfg has to run. */
306
307static bool
308remove_prop_source_from_use (tree name)
309{
310 gimple_stmt_iterator gsi;
311 gimple *stmt;
312 bool cfg_changed = false;
313
314 do {
315 basic_block bb;
316
317 if (SSA_NAME_IN_FREE_LIST (name)(tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 317, __FUNCTION__, (SSA_NAME)))->base.nothrow_flag
318 || SSA_NAME_IS_DEFAULT_DEF (name)(tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 318, __FUNCTION__, (SSA_NAME)))->base.default_def_flag
319 || !has_zero_uses (name))
320 return cfg_changed;
321
322 stmt = SSA_NAME_DEF_STMT (name)(tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 322, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt
;
323 if (gimple_code (stmt) == GIMPLE_PHI
324 || gimple_has_side_effects (stmt))
325 return cfg_changed;
326
327 bb = gimple_bb (stmt);
328 gsi = gsi_for_stmt (stmt);
329 unlink_stmt_vdef (stmt);
330 if (gsi_remove (&gsi, true))
331 bitmap_set_bit (to_purge, bb->index);
332 fwprop_invalidate_lattice (gimple_get_lhs (stmt));
333 release_defs (stmt);
334
335 name = is_gimple_assign (stmt) ? gimple_assign_rhs1 (stmt) : NULL_TREE(tree) nullptr;
336 } while (name && TREE_CODE (name)((enum tree_code) (name)->base.code) == SSA_NAME);
337
338 return cfg_changed;
339}
340
341/* Return the rhs of a gassign *STMT in a form of a single tree,
342 converted to type TYPE.
343
344 This should disappear, but is needed so we can combine expressions and use
345 the fold() interfaces. Long term, we need to develop folding and combine
346 routines that deal with gimple exclusively . */
347
348static tree
349rhs_to_tree (tree type, gimple *stmt)
350{
351 location_t loc = gimple_location (stmt);
352 enum tree_code code = gimple_assign_rhs_code (stmt);
353 switch (get_gimple_rhs_class (code))
354 {
355 case GIMPLE_TERNARY_RHS:
356 return fold_build3_loc (loc, code, type, gimple_assign_rhs1 (stmt),
357 gimple_assign_rhs2 (stmt),
358 gimple_assign_rhs3 (stmt));
359 case GIMPLE_BINARY_RHS:
360 return fold_build2_loc (loc, code, type, gimple_assign_rhs1 (stmt),
361 gimple_assign_rhs2 (stmt));
362 case GIMPLE_UNARY_RHS:
363 return build1 (code, type, gimple_assign_rhs1 (stmt));
364 case GIMPLE_SINGLE_RHS:
365 return gimple_assign_rhs1 (stmt);
366 default:
367 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 367, __FUNCTION__))
;
368 }
369}
370
371/* Combine OP0 CODE OP1 in the context of a COND_EXPR. Returns
372 the folded result in a form suitable for COND_EXPR_COND or
373 NULL_TREE, if there is no suitable simplified form. If
374 INVARIANT_ONLY is true only gimple_min_invariant results are
375 considered simplified. */
376
377static tree
378combine_cond_expr_cond (gimple *stmt, enum tree_code code, tree type,
379 tree op0, tree op1, bool invariant_only)
380{
381 tree t;
382
383 gcc_assert (TREE_CODE_CLASS (code) == tcc_comparison)((void)(!(tree_code_type[(int) (code)] == tcc_comparison) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 383, __FUNCTION__), 0 : 0))
;
384
385 fold_defer_overflow_warnings ();
386 t = fold_binary_loc (gimple_location (stmt), code, type, op0, op1);
387 if (!t)
388 {
389 fold_undefer_overflow_warnings (false, NULLnullptr, 0);
390 return NULL_TREE(tree) nullptr;
391 }
392
393 /* Require that we got a boolean type out if we put one in. */
394 gcc_assert (TREE_CODE (TREE_TYPE (t)) == TREE_CODE (type))((void)(!(((enum tree_code) (((contains_struct_check ((t), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 394, __FUNCTION__))->typed.type))->base.code) == ((enum
tree_code) (type)->base.code)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 394, __FUNCTION__), 0 : 0))
;
395
396 /* Canonicalize the combined condition for use in a COND_EXPR. */
397 t = canonicalize_cond_expr_cond (t);
398
399 /* Bail out if we required an invariant but didn't get one. */
400 if (!t || (invariant_only && !is_gimple_min_invariant (t)))
401 {
402 fold_undefer_overflow_warnings (false, NULLnullptr, 0);
403 return NULL_TREE(tree) nullptr;
404 }
405
406 bool nowarn = warning_suppressed_p (stmt, OPT_Wstrict_overflow);
407 fold_undefer_overflow_warnings (!nowarn, stmt, 0);
408
409 return t;
410}
411
412/* Combine the comparison OP0 CODE OP1 at LOC with the defining statements
413 of its operand. Return a new comparison tree or NULL_TREE if there
414 were no simplifying combines. */
415
416static tree
417forward_propagate_into_comparison_1 (gimple *stmt,
418 enum tree_code code, tree type,
419 tree op0, tree op1)
420{
421 tree tmp = NULL_TREE(tree) nullptr;
422 tree rhs0 = NULL_TREE(tree) nullptr, rhs1 = NULL_TREE(tree) nullptr;
423 bool single_use0_p = false, single_use1_p = false;
424
425 /* For comparisons use the first operand, that is likely to
426 simplify comparisons against constants. */
427 if (TREE_CODE (op0)((enum tree_code) (op0)->base.code) == SSA_NAME)
428 {
429 gimple *def_stmt = get_prop_source_stmt (op0, false, &single_use0_p);
430 if (def_stmt && can_propagate_from (def_stmt))
431 {
432 enum tree_code def_code = gimple_assign_rhs_code (def_stmt);
433 bool invariant_only_p = !single_use0_p;
434
435 rhs0 = rhs_to_tree (TREE_TYPE (op1)((contains_struct_check ((op1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 435, __FUNCTION__))->typed.type)
, def_stmt);
436
437 /* Always combine comparisons or conversions from booleans. */
438 if (TREE_CODE (op1)((enum tree_code) (op1)->base.code) == INTEGER_CST
439 && ((CONVERT_EXPR_CODE_P (def_code)((def_code) == NOP_EXPR || (def_code) == CONVERT_EXPR)
440 && TREE_CODE (TREE_TYPE (TREE_OPERAND (rhs0, 0)))((enum tree_code) (((contains_struct_check (((*((const_cast<
tree*> (tree_operand_check ((rhs0), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 440, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 440, __FUNCTION__))->typed.type))->base.code)
441 == BOOLEAN_TYPE)
442 || TREE_CODE_CLASS (def_code)tree_code_type[(int) (def_code)] == tcc_comparison))
443 invariant_only_p = false;
444
445 tmp = combine_cond_expr_cond (stmt, code, type,
446 rhs0, op1, invariant_only_p);
447 if (tmp)
448 return tmp;
449 }
450 }
451
452 /* If that wasn't successful, try the second operand. */
453 if (TREE_CODE (op1)((enum tree_code) (op1)->base.code) == SSA_NAME)
454 {
455 gimple *def_stmt = get_prop_source_stmt (op1, false, &single_use1_p);
456 if (def_stmt && can_propagate_from (def_stmt))
457 {
458 rhs1 = rhs_to_tree (TREE_TYPE (op0)((contains_struct_check ((op0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 458, __FUNCTION__))->typed.type)
, def_stmt);
459 tmp = combine_cond_expr_cond (stmt, code, type,
460 op0, rhs1, !single_use1_p);
461 if (tmp)
462 return tmp;
463 }
464 }
465
466 /* If that wasn't successful either, try both operands. */
467 if (rhs0 != NULL_TREE(tree) nullptr
468 && rhs1 != NULL_TREE(tree) nullptr)
469 tmp = combine_cond_expr_cond (stmt, code, type,
470 rhs0, rhs1,
471 !(single_use0_p && single_use1_p));
472
473 return tmp;
474}
475
476/* Propagate from the ssa name definition statements of the assignment
477 from a comparison at *GSI into the conditional if that simplifies it.
478 Returns 1 if the stmt was modified and 2 if the CFG needs cleanup,
479 otherwise returns 0. */
480
481static int
482forward_propagate_into_comparison (gimple_stmt_iterator *gsi)
483{
484 gimple *stmt = gsi_stmt (*gsi);
485 tree tmp;
486 bool cfg_changed = false;
487 tree type = TREE_TYPE (gimple_assign_lhs (stmt))((contains_struct_check ((gimple_assign_lhs (stmt)), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 487, __FUNCTION__))->typed.type)
;
488 tree rhs1 = gimple_assign_rhs1 (stmt);
489 tree rhs2 = gimple_assign_rhs2 (stmt);
490
491 /* Combine the comparison with defining statements. */
492 tmp = forward_propagate_into_comparison_1 (stmt,
493 gimple_assign_rhs_code (stmt),
494 type, rhs1, rhs2);
495 if (tmp && useless_type_conversion_p (type, TREE_TYPE (tmp)((contains_struct_check ((tmp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 495, __FUNCTION__))->typed.type)
))
496 {
497 gimple_assign_set_rhs_from_tree (gsi, tmp);
498 fold_stmt (gsi);
499 update_stmt (gsi_stmt (*gsi));
500
501 if (TREE_CODE (rhs1)((enum tree_code) (rhs1)->base.code) == SSA_NAME)
502 cfg_changed |= remove_prop_source_from_use (rhs1);
503 if (TREE_CODE (rhs2)((enum tree_code) (rhs2)->base.code) == SSA_NAME)
504 cfg_changed |= remove_prop_source_from_use (rhs2);
505 return cfg_changed ? 2 : 1;
506 }
507
508 return 0;
509}
510
511/* Propagate from the ssa name definition statements of COND_EXPR
512 in GIMPLE_COND statement STMT into the conditional if that simplifies it.
513 Returns zero if no statement was changed, one if there were
514 changes and two if cfg_cleanup needs to run.
515
516 This must be kept in sync with forward_propagate_into_cond. */
517
518static int
519forward_propagate_into_gimple_cond (gcond *stmt)
520{
521 tree tmp;
522 enum tree_code code = gimple_cond_code (stmt);
523 bool cfg_changed = false;
524 tree rhs1 = gimple_cond_lhs (stmt);
525 tree rhs2 = gimple_cond_rhs (stmt);
526
527 /* We can do tree combining on SSA_NAME and comparison expressions. */
528 if (TREE_CODE_CLASS (gimple_cond_code (stmt))tree_code_type[(int) (gimple_cond_code (stmt))] != tcc_comparison)
529 return 0;
530
531 tmp = forward_propagate_into_comparison_1 (stmt, code,
532 boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE],
533 rhs1, rhs2);
534 if (tmp
535 && is_gimple_condexpr_for_cond (tmp))
536 {
537 if (dump_file)
538 {
539 fprintf (dump_file, " Replaced '");
540 print_gimple_expr (dump_file, stmt, 0);
541 fprintf (dump_file, "' with '");
542 print_generic_expr (dump_file, tmp);
543 fprintf (dump_file, "'\n");
544 }
545
546 gimple_cond_set_condition_from_tree (stmt, unshare_expr (tmp));
547 update_stmt (stmt);
548
549 if (TREE_CODE (rhs1)((enum tree_code) (rhs1)->base.code) == SSA_NAME)
550 cfg_changed |= remove_prop_source_from_use (rhs1);
551 if (TREE_CODE (rhs2)((enum tree_code) (rhs2)->base.code) == SSA_NAME)
552 cfg_changed |= remove_prop_source_from_use (rhs2);
553 return (cfg_changed || is_gimple_min_invariant (tmp)) ? 2 : 1;
554 }
555
556 /* Canonicalize _Bool == 0 and _Bool != 1 to _Bool != 0 by swapping edges. */
557 if ((TREE_CODE (TREE_TYPE (rhs1))((enum tree_code) (((contains_struct_check ((rhs1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 557, __FUNCTION__))->typed.type))->base.code)
== BOOLEAN_TYPE
558 || (INTEGRAL_TYPE_P (TREE_TYPE (rhs1))(((enum tree_code) (((contains_struct_check ((rhs1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 558, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((rhs1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 558, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((rhs1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 558, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
559 && TYPE_PRECISION (TREE_TYPE (rhs1))((tree_class_check ((((contains_struct_check ((rhs1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 559, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 559, __FUNCTION__))->type_common.precision)
== 1))
560 && ((code == EQ_EXPR
561 && integer_zerop (rhs2))
562 || (code == NE_EXPR
563 && integer_onep (rhs2))))
564 {
565 basic_block bb = gimple_bb (stmt);
566 gimple_cond_set_code (stmt, NE_EXPR);
567 gimple_cond_set_rhs (stmt, build_zero_cst (TREE_TYPE (rhs1)((contains_struct_check ((rhs1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 567, __FUNCTION__))->typed.type)
));
568 EDGE_SUCC (bb, 0)(*(bb)->succs)[(0)]->flags ^= (EDGE_TRUE_VALUE|EDGE_FALSE_VALUE);
569 EDGE_SUCC (bb, 1)(*(bb)->succs)[(1)]->flags ^= (EDGE_TRUE_VALUE|EDGE_FALSE_VALUE);
570 return 1;
571 }
572
573 return 0;
574}
575
576
577/* Propagate from the ssa name definition statements of COND_EXPR
578 in the rhs of statement STMT into the conditional if that simplifies it.
579 Returns true zero if the stmt was changed. */
580
581static bool
582forward_propagate_into_cond (gimple_stmt_iterator *gsi_p)
583{
584 gimple *stmt = gsi_stmt (*gsi_p);
585 tree tmp = NULL_TREE(tree) nullptr;
586 tree cond = gimple_assign_rhs1 (stmt);
587 enum tree_code code = gimple_assign_rhs_code (stmt);
588
589 /* We can do tree combining on SSA_NAME and comparison expressions. */
590 if (COMPARISON_CLASS_P (cond)(tree_code_type[(int) (((enum tree_code) (cond)->base.code
))] == tcc_comparison)
)
591 tmp = forward_propagate_into_comparison_1 (stmt, TREE_CODE (cond)((enum tree_code) (cond)->base.code),
592 TREE_TYPE (cond)((contains_struct_check ((cond), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 592, __FUNCTION__))->typed.type)
,
593 TREE_OPERAND (cond, 0)(*((const_cast<tree*> (tree_operand_check ((cond), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 593, __FUNCTION__)))))
,
594 TREE_OPERAND (cond, 1)(*((const_cast<tree*> (tree_operand_check ((cond), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 594, __FUNCTION__)))))
);
595 else if (TREE_CODE (cond)((enum tree_code) (cond)->base.code) == SSA_NAME)
596 {
597 enum tree_code def_code;
598 tree name = cond;
599 gimple *def_stmt = get_prop_source_stmt (name, true, NULLnullptr);
600 if (!def_stmt || !can_propagate_from (def_stmt))
601 return 0;
602
603 def_code = gimple_assign_rhs_code (def_stmt);
604 if (TREE_CODE_CLASS (def_code)tree_code_type[(int) (def_code)] == tcc_comparison)
605 tmp = fold_build2_loc (gimple_location (def_stmt),
606 def_code,
607 TREE_TYPE (cond)((contains_struct_check ((cond), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 607, __FUNCTION__))->typed.type)
,
608 gimple_assign_rhs1 (def_stmt),
609 gimple_assign_rhs2 (def_stmt));
610 }
611
612 if (tmp
613 && is_gimple_condexpr (tmp))
614 {
615 if (dump_file)
616 {
617 fprintf (dump_file, " Replaced '");
618 print_generic_expr (dump_file, cond);
619 fprintf (dump_file, "' with '");
620 print_generic_expr (dump_file, tmp);
621 fprintf (dump_file, "'\n");
622 }
623
624 if ((code == VEC_COND_EXPR) ? integer_all_onesp (tmp)
625 : integer_onep (tmp))
626 gimple_assign_set_rhs_from_tree (gsi_p, gimple_assign_rhs2 (stmt));
627 else if (integer_zerop (tmp))
628 gimple_assign_set_rhs_from_tree (gsi_p, gimple_assign_rhs3 (stmt));
629 else
630 gimple_assign_set_rhs1 (stmt, unshare_expr (tmp));
631 stmt = gsi_stmt (*gsi_p);
632 update_stmt (stmt);
633
634 return true;
635 }
636
637 return 0;
638}
639
640/* We've just substituted an ADDR_EXPR into stmt. Update all the
641 relevant data structures to match. */
642
643static void
644tidy_after_forward_propagate_addr (gimple *stmt)
645{
646 /* We may have turned a trapping insn into a non-trapping insn. */
647 if (maybe_clean_or_replace_eh_stmt (stmt, stmt))
648 bitmap_set_bit (to_purge, gimple_bb (stmt)->index);
649
650 if (TREE_CODE (gimple_assign_rhs1 (stmt))((enum tree_code) (gimple_assign_rhs1 (stmt))->base.code) == ADDR_EXPR)
651 recompute_tree_invariant_for_addr_expr (gimple_assign_rhs1 (stmt));
652}
653
654/* NAME is a SSA_NAME representing DEF_RHS which is of the form
655 ADDR_EXPR <whatever>.
656
657 Try to forward propagate the ADDR_EXPR into the use USE_STMT.
658 Often this will allow for removal of an ADDR_EXPR and INDIRECT_REF
659 node or for recovery of array indexing from pointer arithmetic.
660
661 Return true if the propagation was successful (the propagation can
662 be not totally successful, yet things may have been changed). */
663
664static bool
665forward_propagate_addr_expr_1 (tree name, tree def_rhs,
666 gimple_stmt_iterator *use_stmt_gsi,
667 bool single_use_p)
668{
669 tree lhs, rhs, rhs2, array_ref;
670 gimple *use_stmt = gsi_stmt (*use_stmt_gsi);
671 enum tree_code rhs_code;
672 bool res = true;
673
674 gcc_assert (TREE_CODE (def_rhs) == ADDR_EXPR)((void)(!(((enum tree_code) (def_rhs)->base.code) == ADDR_EXPR
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 674, __FUNCTION__), 0 : 0))
;
675
676 lhs = gimple_assign_lhs (use_stmt);
677 rhs_code = gimple_assign_rhs_code (use_stmt);
678 rhs = gimple_assign_rhs1 (use_stmt);
679
680 /* Do not perform copy-propagation but recurse through copy chains. */
681 if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == SSA_NAME
682 && rhs_code == SSA_NAME)
683 return forward_propagate_addr_expr (lhs, def_rhs, single_use_p);
684
685 /* The use statement could be a conversion. Recurse to the uses of the
686 lhs as copyprop does not copy through pointer to integer to pointer
687 conversions and FRE does not catch all cases either.
688 Treat the case of a single-use name and
689 a conversion to def_rhs type separate, though. */
690 if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == SSA_NAME
691 && CONVERT_EXPR_CODE_P (rhs_code)((rhs_code) == NOP_EXPR || (rhs_code) == CONVERT_EXPR))
692 {
693 /* If there is a point in a conversion chain where the types match
694 so we can remove a conversion re-materialize the address here
695 and stop. */
696 if (single_use_p
697 && useless_type_conversion_p (TREE_TYPE (lhs)((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 697, __FUNCTION__))->typed.type)
, TREE_TYPE (def_rhs)((contains_struct_check ((def_rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 697, __FUNCTION__))->typed.type)
))
698 {
699 gimple_assign_set_rhs1 (use_stmt, unshare_expr (def_rhs));
700 gimple_assign_set_rhs_code (use_stmt, TREE_CODE (def_rhs)((enum tree_code) (def_rhs)->base.code));
701 return true;
702 }
703
704 /* Else recurse if the conversion preserves the address value. */
705 if ((INTEGRAL_TYPE_P (TREE_TYPE (lhs))(((enum tree_code) (((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 705, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 705, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 705, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
706 || POINTER_TYPE_P (TREE_TYPE (lhs))(((enum tree_code) (((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 706, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
|| ((enum tree_code) (((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 706, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
)
707 && (TYPE_PRECISION (TREE_TYPE (lhs))((tree_class_check ((((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 707, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 707, __FUNCTION__))->type_common.precision)
708 >= TYPE_PRECISION (TREE_TYPE (def_rhs))((tree_class_check ((((contains_struct_check ((def_rhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 708, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 708, __FUNCTION__))->type_common.precision)
))
709 return forward_propagate_addr_expr (lhs, def_rhs, single_use_p);
710
711 return false;
712 }
713
714 /* If this isn't a conversion chain from this on we only can propagate
715 into compatible pointer contexts. */
716 if (!types_compatible_p (TREE_TYPE (name)((contains_struct_check ((name), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 716, __FUNCTION__))->typed.type)
, TREE_TYPE (def_rhs)((contains_struct_check ((def_rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 716, __FUNCTION__))->typed.type)
))
717 return false;
718
719 /* Propagate through constant pointer adjustments. */
720 if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == SSA_NAME
721 && rhs_code == POINTER_PLUS_EXPR
722 && rhs == name
723 && TREE_CODE (gimple_assign_rhs2 (use_stmt))((enum tree_code) (gimple_assign_rhs2 (use_stmt))->base.code
)
== INTEGER_CST)
724 {
725 tree new_def_rhs;
726 /* As we come here with non-invariant addresses in def_rhs we need
727 to make sure we can build a valid constant offsetted address
728 for further propagation. Simply rely on fold building that
729 and check after the fact. */
730 new_def_rhs = fold_build2 (MEM_REF, TREE_TYPE (TREE_TYPE (rhs)),fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 730, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 730, __FUNCTION__))->typed.type), def_rhs, fold_convert_loc
(((location_t) 0), global_trees[TI_PTR_TYPE], gimple_assign_rhs2
(use_stmt)) )
731 def_rhs,fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 730, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 730, __FUNCTION__))->typed.type), def_rhs, fold_convert_loc
(((location_t) 0), global_trees[TI_PTR_TYPE], gimple_assign_rhs2
(use_stmt)) )
732 fold_convert (ptr_type_node,fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 730, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 730, __FUNCTION__))->typed.type), def_rhs, fold_convert_loc
(((location_t) 0), global_trees[TI_PTR_TYPE], gimple_assign_rhs2
(use_stmt)) )
733 gimple_assign_rhs2 (use_stmt)))fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 730, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 730, __FUNCTION__))->typed.type), def_rhs, fold_convert_loc
(((location_t) 0), global_trees[TI_PTR_TYPE], gimple_assign_rhs2
(use_stmt)) )
;
734 if (TREE_CODE (new_def_rhs)((enum tree_code) (new_def_rhs)->base.code) == MEM_REF
735 && !is_gimple_mem_ref_addr (TREE_OPERAND (new_def_rhs, 0)(*((const_cast<tree*> (tree_operand_check ((new_def_rhs
), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 735, __FUNCTION__)))))
))
736 return false;
737 new_def_rhs = build1 (ADDR_EXPR, TREE_TYPE (rhs)((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 737, __FUNCTION__))->typed.type)
, new_def_rhs);
738
739 /* Recurse. If we could propagate into all uses of lhs do not
740 bother to replace into the current use but just pretend we did. */
741 if (forward_propagate_addr_expr (lhs, new_def_rhs, single_use_p))
742 return true;
743
744 if (useless_type_conversion_p (TREE_TYPE (lhs)((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 744, __FUNCTION__))->typed.type)
,
745 TREE_TYPE (new_def_rhs)((contains_struct_check ((new_def_rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 745, __FUNCTION__))->typed.type)
))
746 gimple_assign_set_rhs_with_ops (use_stmt_gsi, TREE_CODE (new_def_rhs)((enum tree_code) (new_def_rhs)->base.code),
747 new_def_rhs);
748 else if (is_gimple_min_invariant (new_def_rhs))
749 gimple_assign_set_rhs_with_ops (use_stmt_gsi, NOP_EXPR, new_def_rhs);
750 else
751 return false;
752 gcc_assert (gsi_stmt (*use_stmt_gsi) == use_stmt)((void)(!(gsi_stmt (*use_stmt_gsi) == use_stmt) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 752, __FUNCTION__), 0 : 0))
;
753 update_stmt (use_stmt);
754 return true;
755 }
756
757 /* Now strip away any outer COMPONENT_REF/ARRAY_REF nodes from the LHS.
758 ADDR_EXPR will not appear on the LHS. */
759 tree *lhsp = gimple_assign_lhs_ptr (use_stmt);
760 while (handled_component_p (*lhsp))
761 lhsp = &TREE_OPERAND (*lhsp, 0)(*((const_cast<tree*> (tree_operand_check ((*lhsp), (0)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 761, __FUNCTION__)))))
;
762 lhs = *lhsp;
763
764 /* Now see if the LHS node is a MEM_REF using NAME. If so,
765 propagate the ADDR_EXPR into the use of NAME and fold the result. */
766 if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == MEM_REF
767 && TREE_OPERAND (lhs, 0)(*((const_cast<tree*> (tree_operand_check ((lhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 767, __FUNCTION__)))))
== name)
768 {
769 tree def_rhs_base;
770 poly_int64 def_rhs_offset;
771 /* If the address is invariant we can always fold it. */
772 if ((def_rhs_base = get_addr_base_and_unit_offset (TREE_OPERAND (def_rhs, 0)(*((const_cast<tree*> (tree_operand_check ((def_rhs), (
0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 772, __FUNCTION__)))))
,
773 &def_rhs_offset)))
774 {
775 poly_offset_int off = mem_ref_offset (lhs);
776 tree new_ptr;
777 off += def_rhs_offset;
778 if (TREE_CODE (def_rhs_base)((enum tree_code) (def_rhs_base)->base.code) == MEM_REF)
779 {
780 off += mem_ref_offset (def_rhs_base);
781 new_ptr = TREE_OPERAND (def_rhs_base, 0)(*((const_cast<tree*> (tree_operand_check ((def_rhs_base
), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 781, __FUNCTION__)))))
;
782 }
783 else
784 new_ptr = build_fold_addr_expr (def_rhs_base)build_fold_addr_expr_loc (((location_t) 0), (def_rhs_base));
785 TREE_OPERAND (lhs, 0)(*((const_cast<tree*> (tree_operand_check ((lhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 785, __FUNCTION__)))))
= new_ptr;
786 TREE_OPERAND (lhs, 1)(*((const_cast<tree*> (tree_operand_check ((lhs), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 786, __FUNCTION__)))))
787 = wide_int_to_tree (TREE_TYPE (TREE_OPERAND (lhs, 1))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((lhs), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 787, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 787, __FUNCTION__))->typed.type)
, off);
788 tidy_after_forward_propagate_addr (use_stmt);
789 /* Continue propagating into the RHS if this was not the only use. */
790 if (single_use_p)
791 return true;
792 }
793 /* If the LHS is a plain dereference and the value type is the same as
794 that of the pointed-to type of the address we can put the
795 dereferenced address on the LHS preserving the original alias-type. */
796 else if (integer_zerop (TREE_OPERAND (lhs, 1)(*((const_cast<tree*> (tree_operand_check ((lhs), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 796, __FUNCTION__)))))
)
797 && ((gimple_assign_lhs (use_stmt) == lhs
798 && useless_type_conversion_p
799 (TREE_TYPE (TREE_OPERAND (def_rhs, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((def_rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 799, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 799, __FUNCTION__))->typed.type)
,
800 TREE_TYPE (gimple_assign_rhs1 (use_stmt))((contains_struct_check ((gimple_assign_rhs1 (use_stmt)), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 800, __FUNCTION__))->typed.type)
))
801 || types_compatible_p (TREE_TYPE (lhs)((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 801, __FUNCTION__))->typed.type)
,
802 TREE_TYPE (TREE_OPERAND (def_rhs, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((def_rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 802, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 802, __FUNCTION__))->typed.type)
))
803 /* Don't forward anything into clobber stmts if it would result
804 in the lhs no longer being a MEM_REF. */
805 && (!gimple_clobber_p (use_stmt)
806 || TREE_CODE (TREE_OPERAND (def_rhs, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((def_rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 806, __FUNCTION__))))))->base.code)
== MEM_REF))
807 {
808 tree *def_rhs_basep = &TREE_OPERAND (def_rhs, 0)(*((const_cast<tree*> (tree_operand_check ((def_rhs), (
0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 808, __FUNCTION__)))))
;
809 tree new_offset, new_base, saved, new_lhs;
810 while (handled_component_p (*def_rhs_basep))
811 def_rhs_basep = &TREE_OPERAND (*def_rhs_basep, 0)(*((const_cast<tree*> (tree_operand_check ((*def_rhs_basep
), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 811, __FUNCTION__)))))
;
812 saved = *def_rhs_basep;
813 if (TREE_CODE (*def_rhs_basep)((enum tree_code) (*def_rhs_basep)->base.code) == MEM_REF)
814 {
815 new_base = TREE_OPERAND (*def_rhs_basep, 0)(*((const_cast<tree*> (tree_operand_check ((*def_rhs_basep
), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 815, __FUNCTION__)))))
;
816 new_offset = fold_convert (TREE_TYPE (TREE_OPERAND (lhs, 1)),fold_convert_loc (((location_t) 0), ((contains_struct_check (
((*((const_cast<tree*> (tree_operand_check ((lhs), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 816, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 816, __FUNCTION__))->typed.type), (*((const_cast<tree
*> (tree_operand_check ((*def_rhs_basep), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 817, __FUNCTION__))))))
817 TREE_OPERAND (*def_rhs_basep, 1))fold_convert_loc (((location_t) 0), ((contains_struct_check (
((*((const_cast<tree*> (tree_operand_check ((lhs), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 816, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 816, __FUNCTION__))->typed.type), (*((const_cast<tree
*> (tree_operand_check ((*def_rhs_basep), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 817, __FUNCTION__))))))
;
818 }
819 else
820 {
821 new_base = build_fold_addr_expr (*def_rhs_basep)build_fold_addr_expr_loc (((location_t) 0), (*def_rhs_basep));
822 new_offset = TREE_OPERAND (lhs, 1)(*((const_cast<tree*> (tree_operand_check ((lhs), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 822, __FUNCTION__)))))
;
823 }
824 *def_rhs_basep = build2 (MEM_REF, TREE_TYPE (*def_rhs_basep)((contains_struct_check ((*def_rhs_basep), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 824, __FUNCTION__))->typed.type)
,
825 new_base, new_offset);
826 TREE_THIS_VOLATILE (*def_rhs_basep)((*def_rhs_basep)->base.volatile_flag) = TREE_THIS_VOLATILE (lhs)((lhs)->base.volatile_flag);
827 TREE_SIDE_EFFECTS (*def_rhs_basep)((non_type_check ((*def_rhs_basep), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 827, __FUNCTION__))->base.side_effects_flag)
= TREE_SIDE_EFFECTS (lhs)((non_type_check ((lhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 827, __FUNCTION__))->base.side_effects_flag)
;
828 TREE_THIS_NOTRAP (*def_rhs_basep)((tree_check5 ((*def_rhs_basep), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 828, __FUNCTION__, (INDIRECT_REF), (MEM_REF), (TARGET_MEM_REF
), (ARRAY_REF), (ARRAY_RANGE_REF)))->base.nothrow_flag)
= TREE_THIS_NOTRAP (lhs)((tree_check5 ((lhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 828, __FUNCTION__, (INDIRECT_REF), (MEM_REF), (TARGET_MEM_REF
), (ARRAY_REF), (ARRAY_RANGE_REF)))->base.nothrow_flag)
;
829 new_lhs = unshare_expr (TREE_OPERAND (def_rhs, 0)(*((const_cast<tree*> (tree_operand_check ((def_rhs), (
0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 829, __FUNCTION__)))))
);
830 *lhsp = new_lhs;
831 TREE_THIS_VOLATILE (new_lhs)((new_lhs)->base.volatile_flag) = TREE_THIS_VOLATILE (lhs)((lhs)->base.volatile_flag);
832 TREE_SIDE_EFFECTS (new_lhs)((non_type_check ((new_lhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 832, __FUNCTION__))->base.side_effects_flag)
= TREE_SIDE_EFFECTS (lhs)((non_type_check ((lhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 832, __FUNCTION__))->base.side_effects_flag)
;
833 *def_rhs_basep = saved;
834 tidy_after_forward_propagate_addr (use_stmt);
835 /* Continue propagating into the RHS if this was not the
836 only use. */
837 if (single_use_p)
838 return true;
839 }
840 else
841 /* We can have a struct assignment dereferencing our name twice.
842 Note that we didn't propagate into the lhs to not falsely
843 claim we did when propagating into the rhs. */
844 res = false;
845 }
846
847 /* Strip away any outer COMPONENT_REF, ARRAY_REF or ADDR_EXPR
848 nodes from the RHS. */
849 tree *rhsp = gimple_assign_rhs1_ptr (use_stmt);
850 if (TREE_CODE (*rhsp)((enum tree_code) (*rhsp)->base.code) == ADDR_EXPR)
851 rhsp = &TREE_OPERAND (*rhsp, 0)(*((const_cast<tree*> (tree_operand_check ((*rhsp), (0)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 851, __FUNCTION__)))))
;
852 while (handled_component_p (*rhsp))
853 rhsp = &TREE_OPERAND (*rhsp, 0)(*((const_cast<tree*> (tree_operand_check ((*rhsp), (0)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 853, __FUNCTION__)))))
;
854 rhs = *rhsp;
855
856 /* Now see if the RHS node is a MEM_REF using NAME. If so,
857 propagate the ADDR_EXPR into the use of NAME and fold the result. */
858 if (TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == MEM_REF
859 && TREE_OPERAND (rhs, 0)(*((const_cast<tree*> (tree_operand_check ((rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 859, __FUNCTION__)))))
== name)
860 {
861 tree def_rhs_base;
862 poly_int64 def_rhs_offset;
863 if ((def_rhs_base = get_addr_base_and_unit_offset (TREE_OPERAND (def_rhs, 0)(*((const_cast<tree*> (tree_operand_check ((def_rhs), (
0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 863, __FUNCTION__)))))
,
864 &def_rhs_offset)))
865 {
866 poly_offset_int off = mem_ref_offset (rhs);
867 tree new_ptr;
868 off += def_rhs_offset;
869 if (TREE_CODE (def_rhs_base)((enum tree_code) (def_rhs_base)->base.code) == MEM_REF)
870 {
871 off += mem_ref_offset (def_rhs_base);
872 new_ptr = TREE_OPERAND (def_rhs_base, 0)(*((const_cast<tree*> (tree_operand_check ((def_rhs_base
), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 872, __FUNCTION__)))))
;
873 }
874 else
875 new_ptr = build_fold_addr_expr (def_rhs_base)build_fold_addr_expr_loc (((location_t) 0), (def_rhs_base));
876 TREE_OPERAND (rhs, 0)(*((const_cast<tree*> (tree_operand_check ((rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 876, __FUNCTION__)))))
= new_ptr;
877 TREE_OPERAND (rhs, 1)(*((const_cast<tree*> (tree_operand_check ((rhs), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 877, __FUNCTION__)))))
878 = wide_int_to_tree (TREE_TYPE (TREE_OPERAND (rhs, 1))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((rhs), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 878, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 878, __FUNCTION__))->typed.type)
, off);
879 fold_stmt_inplace (use_stmt_gsi);
880 tidy_after_forward_propagate_addr (use_stmt);
881 return res;
882 }
883 /* If the RHS is a plain dereference and the value type is the same as
884 that of the pointed-to type of the address we can put the
885 dereferenced address on the RHS preserving the original alias-type. */
886 else if (integer_zerop (TREE_OPERAND (rhs, 1)(*((const_cast<tree*> (tree_operand_check ((rhs), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 886, __FUNCTION__)))))
)
887 && ((gimple_assign_rhs1 (use_stmt) == rhs
888 && useless_type_conversion_p
889 (TREE_TYPE (gimple_assign_lhs (use_stmt))((contains_struct_check ((gimple_assign_lhs (use_stmt)), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 889, __FUNCTION__))->typed.type)
,
890 TREE_TYPE (TREE_OPERAND (def_rhs, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((def_rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 890, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 890, __FUNCTION__))->typed.type)
))
891 || types_compatible_p (TREE_TYPE (rhs)((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 891, __FUNCTION__))->typed.type)
,
892 TREE_TYPE (TREE_OPERAND (def_rhs, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((def_rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 892, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 892, __FUNCTION__))->typed.type)
)))
893 {
894 tree *def_rhs_basep = &TREE_OPERAND (def_rhs, 0)(*((const_cast<tree*> (tree_operand_check ((def_rhs), (
0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 894, __FUNCTION__)))))
;
895 tree new_offset, new_base, saved, new_rhs;
896 while (handled_component_p (*def_rhs_basep))
897 def_rhs_basep = &TREE_OPERAND (*def_rhs_basep, 0)(*((const_cast<tree*> (tree_operand_check ((*def_rhs_basep
), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 897, __FUNCTION__)))))
;
898 saved = *def_rhs_basep;
899 if (TREE_CODE (*def_rhs_basep)((enum tree_code) (*def_rhs_basep)->base.code) == MEM_REF)
900 {
901 new_base = TREE_OPERAND (*def_rhs_basep, 0)(*((const_cast<tree*> (tree_operand_check ((*def_rhs_basep
), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 901, __FUNCTION__)))))
;
902 new_offset = fold_convert (TREE_TYPE (TREE_OPERAND (rhs, 1)),fold_convert_loc (((location_t) 0), ((contains_struct_check (
((*((const_cast<tree*> (tree_operand_check ((rhs), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 902, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 902, __FUNCTION__))->typed.type), (*((const_cast<tree
*> (tree_operand_check ((*def_rhs_basep), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 903, __FUNCTION__))))))
903 TREE_OPERAND (*def_rhs_basep, 1))fold_convert_loc (((location_t) 0), ((contains_struct_check (
((*((const_cast<tree*> (tree_operand_check ((rhs), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 902, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 902, __FUNCTION__))->typed.type), (*((const_cast<tree
*> (tree_operand_check ((*def_rhs_basep), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 903, __FUNCTION__))))))
;
904 }
905 else
906 {
907 new_base = build_fold_addr_expr (*def_rhs_basep)build_fold_addr_expr_loc (((location_t) 0), (*def_rhs_basep));
908 new_offset = TREE_OPERAND (rhs, 1)(*((const_cast<tree*> (tree_operand_check ((rhs), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 908, __FUNCTION__)))))
;
909 }
910 *def_rhs_basep = build2 (MEM_REF, TREE_TYPE (*def_rhs_basep)((contains_struct_check ((*def_rhs_basep), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 910, __FUNCTION__))->typed.type)
,
911 new_base, new_offset);
912 TREE_THIS_VOLATILE (*def_rhs_basep)((*def_rhs_basep)->base.volatile_flag) = TREE_THIS_VOLATILE (rhs)((rhs)->base.volatile_flag);
913 TREE_SIDE_EFFECTS (*def_rhs_basep)((non_type_check ((*def_rhs_basep), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 913, __FUNCTION__))->base.side_effects_flag)
= TREE_SIDE_EFFECTS (rhs)((non_type_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 913, __FUNCTION__))->base.side_effects_flag)
;
914 TREE_THIS_NOTRAP (*def_rhs_basep)((tree_check5 ((*def_rhs_basep), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 914, __FUNCTION__, (INDIRECT_REF), (MEM_REF), (TARGET_MEM_REF
), (ARRAY_REF), (ARRAY_RANGE_REF)))->base.nothrow_flag)
= TREE_THIS_NOTRAP (rhs)((tree_check5 ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 914, __FUNCTION__, (INDIRECT_REF), (MEM_REF), (TARGET_MEM_REF
), (ARRAY_REF), (ARRAY_RANGE_REF)))->base.nothrow_flag)
;
915 new_rhs = unshare_expr (TREE_OPERAND (def_rhs, 0)(*((const_cast<tree*> (tree_operand_check ((def_rhs), (
0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 915, __FUNCTION__)))))
);
916 *rhsp = new_rhs;
917 TREE_THIS_VOLATILE (new_rhs)((new_rhs)->base.volatile_flag) = TREE_THIS_VOLATILE (rhs)((rhs)->base.volatile_flag);
918 TREE_SIDE_EFFECTS (new_rhs)((non_type_check ((new_rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 918, __FUNCTION__))->base.side_effects_flag)
= TREE_SIDE_EFFECTS (rhs)((non_type_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 918, __FUNCTION__))->base.side_effects_flag)
;
919 *def_rhs_basep = saved;
920 fold_stmt_inplace (use_stmt_gsi);
921 tidy_after_forward_propagate_addr (use_stmt);
922 return res;
923 }
924 }
925
926 /* If the use of the ADDR_EXPR is not a POINTER_PLUS_EXPR, there
927 is nothing to do. */
928 if (gimple_assign_rhs_code (use_stmt) != POINTER_PLUS_EXPR
929 || gimple_assign_rhs1 (use_stmt) != name)
930 return false;
931
932 /* The remaining cases are all for turning pointer arithmetic into
933 array indexing. They only apply when we have the address of
934 element zero in an array. If that is not the case then there
935 is nothing to do. */
936 array_ref = TREE_OPERAND (def_rhs, 0)(*((const_cast<tree*> (tree_operand_check ((def_rhs), (
0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 936, __FUNCTION__)))))
;
937 if ((TREE_CODE (array_ref)((enum tree_code) (array_ref)->base.code) != ARRAY_REF
938 || TREE_CODE (TREE_TYPE (TREE_OPERAND (array_ref, 0)))((enum tree_code) (((contains_struct_check (((*((const_cast<
tree*> (tree_operand_check ((array_ref), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 938, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 938, __FUNCTION__))->typed.type))->base.code)
!= ARRAY_TYPE
939 || TREE_CODE (TREE_OPERAND (array_ref, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((array_ref), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 939, __FUNCTION__))))))->base.code)
!= INTEGER_CST)
940 && TREE_CODE (TREE_TYPE (array_ref))((enum tree_code) (((contains_struct_check ((array_ref), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 940, __FUNCTION__))->typed.type))->base.code)
!= ARRAY_TYPE)
941 return false;
942
943 rhs2 = gimple_assign_rhs2 (use_stmt);
944 /* Optimize &x[C1] p+ C2 to &x p+ C3 with C3 = C1 * element_size + C2. */
945 if (TREE_CODE (rhs2)((enum tree_code) (rhs2)->base.code) == INTEGER_CST)
946 {
947 tree new_rhs = build1_loc (gimple_location (use_stmt),
948 ADDR_EXPR, TREE_TYPE (def_rhs)((contains_struct_check ((def_rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 948, __FUNCTION__))->typed.type)
,
949 fold_build2 (MEM_REF,fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((def_rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 950, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 950, __FUNCTION__))->typed.type), unshare_expr (def_rhs)
, fold_convert_loc (((location_t) 0), global_trees[TI_PTR_TYPE
], rhs2) )
950 TREE_TYPE (TREE_TYPE (def_rhs)),fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((def_rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 950, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 950, __FUNCTION__))->typed.type), unshare_expr (def_rhs)
, fold_convert_loc (((location_t) 0), global_trees[TI_PTR_TYPE
], rhs2) )
951 unshare_expr (def_rhs),fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((def_rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 950, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 950, __FUNCTION__))->typed.type), unshare_expr (def_rhs)
, fold_convert_loc (((location_t) 0), global_trees[TI_PTR_TYPE
], rhs2) )
952 fold_convert (ptr_type_node,fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((def_rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 950, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 950, __FUNCTION__))->typed.type), unshare_expr (def_rhs)
, fold_convert_loc (((location_t) 0), global_trees[TI_PTR_TYPE
], rhs2) )
953 rhs2))fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((def_rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 950, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 950, __FUNCTION__))->typed.type), unshare_expr (def_rhs)
, fold_convert_loc (((location_t) 0), global_trees[TI_PTR_TYPE
], rhs2) )
);
954 gimple_assign_set_rhs_from_tree (use_stmt_gsi, new_rhs);
955 use_stmt = gsi_stmt (*use_stmt_gsi);
956 update_stmt (use_stmt);
957 tidy_after_forward_propagate_addr (use_stmt);
958 return true;
959 }
960
961 return false;
962}
963
964/* STMT is a statement of the form SSA_NAME = ADDR_EXPR <whatever>.
965
966 Try to forward propagate the ADDR_EXPR into all uses of the SSA_NAME.
967 Often this will allow for removal of an ADDR_EXPR and INDIRECT_REF
968 node or for recovery of array indexing from pointer arithmetic.
969
970 PARENT_SINGLE_USE_P tells if, when in a recursive invocation, NAME was
971 the single use in the previous invocation. Pass true when calling
972 this as toplevel.
973
974 Returns true, if all uses have been propagated into. */
975
976static bool
977forward_propagate_addr_expr (tree name, tree rhs, bool parent_single_use_p)
978{
979 imm_use_iterator iter;
980 gimple *use_stmt;
981 bool all = true;
982 bool single_use_p = parent_single_use_p && has_single_use (name);
983
984 FOR_EACH_IMM_USE_STMT (use_stmt, iter, name)for (struct auto_end_imm_use_stmt_traverse auto_end_imm_use_stmt_traverse
((((use_stmt) = first_imm_use_stmt (&(iter), (name))), &
(iter))); !end_imm_use_stmt_p (&(iter)); (void) ((use_stmt
) = next_imm_use_stmt (&(iter))))
985 {
986 bool result;
987 tree use_rhs;
988
989 /* If the use is not in a simple assignment statement, then
990 there is nothing we can do. */
991 if (!is_gimple_assign (use_stmt))
992 {
993 if (!is_gimple_debug (use_stmt))
994 all = false;
995 continue;
996 }
997
998 gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
999 result = forward_propagate_addr_expr_1 (name, rhs, &gsi,
1000 single_use_p);
1001 /* If the use has moved to a different statement adjust
1002 the update machinery for the old statement too. */
1003 if (use_stmt != gsi_stmt (gsi))
1004 {
1005 update_stmt (use_stmt);
1006 use_stmt = gsi_stmt (gsi);
1007 }
1008 update_stmt (use_stmt);
1009 all &= result;
1010
1011 /* Remove intermediate now unused copy and conversion chains. */
1012 use_rhs = gimple_assign_rhs1 (use_stmt);
1013 if (result
1014 && TREE_CODE (gimple_assign_lhs (use_stmt))((enum tree_code) (gimple_assign_lhs (use_stmt))->base.code
)
== SSA_NAME
1015 && TREE_CODE (use_rhs)((enum tree_code) (use_rhs)->base.code) == SSA_NAME
1016 && has_zero_uses (gimple_assign_lhs (use_stmt)))
1017 {
1018 gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
1019 fwprop_invalidate_lattice (gimple_get_lhs (use_stmt));
1020 release_defs (use_stmt);
1021 gsi_remove (&gsi, true);
1022 }
1023 }
1024
1025 return all && has_zero_uses (name);
1026}
1027
1028
1029/* Helper function for simplify_gimple_switch. Remove case labels that
1030 have values outside the range of the new type. */
1031
1032static void
1033simplify_gimple_switch_label_vec (gswitch *stmt, tree index_type)
1034{
1035 unsigned int branch_num = gimple_switch_num_labels (stmt);
1036 auto_vec<tree> labels (branch_num);
1037 unsigned int i, len;
1038
1039 /* Collect the existing case labels in a VEC, and preprocess it as if
1040 we are gimplifying a GENERIC SWITCH_EXPR. */
1041 for (i = 1; i < branch_num; i++)
1042 labels.quick_push (gimple_switch_label (stmt, i));
1043 preprocess_case_label_vec_for_gimple (labels, index_type, NULLnullptr);
1044
1045 /* If any labels were removed, replace the existing case labels
1046 in the GIMPLE_SWITCH statement with the correct ones.
1047 Note that the type updates were done in-place on the case labels,
1048 so we only have to replace the case labels in the GIMPLE_SWITCH
1049 if the number of labels changed. */
1050 len = labels.length ();
1051 if (len < branch_num - 1)
1052 {
1053 bitmap target_blocks;
1054 edge_iterator ei;
1055 edge e;
1056
1057 /* Corner case: *all* case labels have been removed as being
1058 out-of-range for INDEX_TYPE. Push one label and let the
1059 CFG cleanups deal with this further. */
1060 if (len == 0)
1061 {
1062 tree label, elt;
1063
1064 label = CASE_LABEL (gimple_switch_default_label (stmt))(*((const_cast<tree*> (tree_operand_check (((tree_check
((gimple_switch_default_label (stmt)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1064, __FUNCTION__, (CASE_LABEL_EXPR)))), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1064, __FUNCTION__)))))
;
1065 elt = build_case_label (build_int_cst (index_type, 0), NULLnullptr, label);
1066 labels.quick_push (elt);
1067 len = 1;
1068 }
1069
1070 for (i = 0; i < labels.length (); i++)
1071 gimple_switch_set_label (stmt, i + 1, labels[i]);
1072 for (i++ ; i < branch_num; i++)
1073 gimple_switch_set_label (stmt, i, NULL_TREE(tree) nullptr);
1074 gimple_switch_set_num_labels (stmt, len + 1);
1075
1076 /* Cleanup any edges that are now dead. */
1077 target_blocks = BITMAP_ALLOCbitmap_alloc (NULLnullptr);
1078 for (i = 0; i < gimple_switch_num_labels (stmt); i++)
1079 {
1080 tree elt = gimple_switch_label (stmt, i);
1081 basic_block target = label_to_block (cfun(cfun + 0), CASE_LABEL (elt)(*((const_cast<tree*> (tree_operand_check (((tree_check
((elt), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1081, __FUNCTION__, (CASE_LABEL_EXPR)))), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1081, __FUNCTION__)))))
);
1082 bitmap_set_bit (target_blocks, target->index);
1083 }
1084 for (ei = ei_start (gimple_bb (stmt)->succs)ei_start_1 (&(gimple_bb (stmt)->succs)); (e = ei_safe_edge (ei)); )
1085 {
1086 if (! bitmap_bit_p (target_blocks, e->dest->index))
1087 {
1088 remove_edge (e);
1089 cfg_changed = true;
1090 free_dominance_info (CDI_DOMINATORS);
1091 }
1092 else
1093 ei_next (&ei);
1094 }
1095 BITMAP_FREE (target_blocks)((void) (bitmap_obstack_free ((bitmap) target_blocks), (target_blocks
) = (bitmap) nullptr))
;
1096 }
1097}
1098
1099/* STMT is a SWITCH_EXPR for which we attempt to find equivalent forms of
1100 the condition which we may be able to optimize better. */
1101
1102static bool
1103simplify_gimple_switch (gswitch *stmt)
1104{
1105 /* The optimization that we really care about is removing unnecessary
1106 casts. That will let us do much better in propagating the inferred
1107 constant at the switch target. */
1108 tree cond = gimple_switch_index (stmt);
1109 if (TREE_CODE (cond)((enum tree_code) (cond)->base.code) == SSA_NAME)
1110 {
1111 gimple *def_stmt = SSA_NAME_DEF_STMT (cond)(tree_check ((cond), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1111, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt
;
1112 if (gimple_assign_cast_p (def_stmt))
1113 {
1114 tree def = gimple_assign_rhs1 (def_stmt);
1115 if (TREE_CODE (def)((enum tree_code) (def)->base.code) != SSA_NAME)
1116 return false;
1117
1118 /* If we have an extension or sign-change that preserves the
1119 values we check against then we can copy the source value into
1120 the switch. */
1121 tree ti = TREE_TYPE (def)((contains_struct_check ((def), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1121, __FUNCTION__))->typed.type)
;
1122 if (INTEGRAL_TYPE_P (ti)(((enum tree_code) (ti)->base.code) == ENUMERAL_TYPE || ((
enum tree_code) (ti)->base.code) == BOOLEAN_TYPE || ((enum
tree_code) (ti)->base.code) == INTEGER_TYPE)
1123 && TYPE_PRECISION (ti)((tree_class_check ((ti), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1123, __FUNCTION__))->type_common.precision)
<= TYPE_PRECISION (TREE_TYPE (cond))((tree_class_check ((((contains_struct_check ((cond), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1123, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1123, __FUNCTION__))->type_common.precision)
)
1124 {
1125 size_t n = gimple_switch_num_labels (stmt);
1126 tree min = NULL_TREE(tree) nullptr, max = NULL_TREE(tree) nullptr;
1127 if (n > 1)
1128 {
1129 min = CASE_LOW (gimple_switch_label (stmt, 1))(*((const_cast<tree*> (tree_operand_check (((tree_check
((gimple_switch_label (stmt, 1)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1129, __FUNCTION__, (CASE_LABEL_EXPR)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1129, __FUNCTION__)))))
;
1130 if (CASE_HIGH (gimple_switch_label (stmt, n - 1))(*((const_cast<tree*> (tree_operand_check (((tree_check
((gimple_switch_label (stmt, n - 1)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1130, __FUNCTION__, (CASE_LABEL_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1130, __FUNCTION__)))))
)
1131 max = CASE_HIGH (gimple_switch_label (stmt, n - 1))(*((const_cast<tree*> (tree_operand_check (((tree_check
((gimple_switch_label (stmt, n - 1)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1131, __FUNCTION__, (CASE_LABEL_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1131, __FUNCTION__)))))
;
1132 else
1133 max = CASE_LOW (gimple_switch_label (stmt, n - 1))(*((const_cast<tree*> (tree_operand_check (((tree_check
((gimple_switch_label (stmt, n - 1)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1133, __FUNCTION__, (CASE_LABEL_EXPR)))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1133, __FUNCTION__)))))
;
1134 }
1135 if ((!min || int_fits_type_p (min, ti))
1136 && (!max || int_fits_type_p (max, ti)))
1137 {
1138 gimple_switch_set_index (stmt, def);
1139 simplify_gimple_switch_label_vec (stmt, ti);
1140 update_stmt (stmt);
1141 return true;
1142 }
1143 }
1144 }
1145 }
1146
1147 return false;
1148}
1149
1150/* For pointers p2 and p1 return p2 - p1 if the
1151 difference is known and constant, otherwise return NULL. */
1152
1153static tree
1154constant_pointer_difference (tree p1, tree p2)
1155{
1156 int i, j;
1157#define CPD_ITERATIONS5 5
1158 tree exps[2][CPD_ITERATIONS5];
1159 tree offs[2][CPD_ITERATIONS5];
1160 int cnt[2];
1161
1162 for (i = 0; i < 2; i++)
1163 {
1164 tree p = i ? p1 : p2;
1165 tree off = size_zero_nodeglobal_trees[TI_SIZE_ZERO];
1166 gimple *stmt;
1167 enum tree_code code;
1168
1169 /* For each of p1 and p2 we need to iterate at least
1170 twice, to handle ADDR_EXPR directly in p1/p2,
1171 SSA_NAME with ADDR_EXPR or POINTER_PLUS_EXPR etc.
1172 on definition's stmt RHS. Iterate a few extra times. */
1173 j = 0;
1174 do
1175 {
1176 if (!POINTER_TYPE_P (TREE_TYPE (p))(((enum tree_code) (((contains_struct_check ((p), (TS_TYPED),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1176, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
|| ((enum tree_code) (((contains_struct_check ((p), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1176, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
)
1177 break;
1178 if (TREE_CODE (p)((enum tree_code) (p)->base.code) == ADDR_EXPR)
1179 {
1180 tree q = TREE_OPERAND (p, 0)(*((const_cast<tree*> (tree_operand_check ((p), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1180, __FUNCTION__)))))
;
1181 poly_int64 offset;
1182 tree base = get_addr_base_and_unit_offset (q, &offset);
1183 if (base)
1184 {
1185 q = base;
1186 if (maybe_ne (offset, 0))
1187 off = size_binop (PLUS_EXPR, off, size_int (offset))size_binop_loc (((location_t) 0), PLUS_EXPR, off, size_int_kind
(offset, stk_sizetype))
;
1188 }
1189 if (TREE_CODE (q)((enum tree_code) (q)->base.code) == MEM_REF
1190 && TREE_CODE (TREE_OPERAND (q, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((q), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1190, __FUNCTION__))))))->base.code)
== SSA_NAME)
1191 {
1192 p = TREE_OPERAND (q, 0)(*((const_cast<tree*> (tree_operand_check ((q), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1192, __FUNCTION__)))))
;
1193 off = size_binop (PLUS_EXPR, off,size_binop_loc (((location_t) 0), PLUS_EXPR, off, wide_int_to_tree
(sizetype_tab[(int) stk_sizetype], mem_ref_offset (q)))
1194 wide_int_to_tree (sizetype,size_binop_loc (((location_t) 0), PLUS_EXPR, off, wide_int_to_tree
(sizetype_tab[(int) stk_sizetype], mem_ref_offset (q)))
1195 mem_ref_offset (q)))size_binop_loc (((location_t) 0), PLUS_EXPR, off, wide_int_to_tree
(sizetype_tab[(int) stk_sizetype], mem_ref_offset (q)))
;
1196 }
1197 else
1198 {
1199 exps[i][j] = q;
1200 offs[i][j++] = off;
1201 break;
1202 }
1203 }
1204 if (TREE_CODE (p)((enum tree_code) (p)->base.code) != SSA_NAME)
1205 break;
1206 exps[i][j] = p;
1207 offs[i][j++] = off;
1208 if (j == CPD_ITERATIONS5)
1209 break;
1210 stmt = SSA_NAME_DEF_STMT (p)(tree_check ((p), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1210, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt
;
1211 if (!is_gimple_assign (stmt) || gimple_assign_lhs (stmt) != p)
1212 break;
1213 code = gimple_assign_rhs_code (stmt);
1214 if (code == POINTER_PLUS_EXPR)
1215 {
1216 if (TREE_CODE (gimple_assign_rhs2 (stmt))((enum tree_code) (gimple_assign_rhs2 (stmt))->base.code) != INTEGER_CST)
1217 break;
1218 off = size_binop (PLUS_EXPR, off, gimple_assign_rhs2 (stmt))size_binop_loc (((location_t) 0), PLUS_EXPR, off, gimple_assign_rhs2
(stmt))
;
1219 p = gimple_assign_rhs1 (stmt);
1220 }
1221 else if (code == ADDR_EXPR || CONVERT_EXPR_CODE_P (code)((code) == NOP_EXPR || (code) == CONVERT_EXPR))
1222 p = gimple_assign_rhs1 (stmt);
1223 else
1224 break;
1225 }
1226 while (1);
1227 cnt[i] = j;
1228 }
1229
1230 for (i = 0; i < cnt[0]; i++)
1231 for (j = 0; j < cnt[1]; j++)
1232 if (exps[0][i] == exps[1][j])
1233 return size_binop (MINUS_EXPR, offs[0][i], offs[1][j])size_binop_loc (((location_t) 0), MINUS_EXPR, offs[0][i], offs
[1][j])
;
1234
1235 return NULL_TREE(tree) nullptr;
1236}
1237
1238/* *GSI_P is a GIMPLE_CALL to a builtin function.
1239 Optimize
1240 memcpy (p, "abcd", 4);
1241 memset (p + 4, ' ', 3);
1242 into
1243 memcpy (p, "abcd ", 7);
1244 call if the latter can be stored by pieces during expansion. */
1245
1246static bool
1247simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2)
1248{
1249 gimple *stmt1, *stmt2 = gsi_stmt (*gsi_p);
1250 tree vuse = gimple_vuse (stmt2);
1251 if (vuse == NULLnullptr)
1252 return false;
1253 stmt1 = SSA_NAME_DEF_STMT (vuse)(tree_check ((vuse), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1253, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt
;
1254
1255 switch (DECL_FUNCTION_CODE (callee2))
1256 {
1257 case BUILT_IN_MEMSET:
1258 if (gimple_call_num_args (stmt2) != 3
1259 || gimple_call_lhs (stmt2)
1260 || CHAR_BIT8 != 8
1261 || BITS_PER_UNIT(8) != 8)
1262 break;
1263 else
1264 {
1265 tree callee1;
1266 tree ptr1, src1, str1, off1, len1, lhs1;
1267 tree ptr2 = gimple_call_arg (stmt2, 0);
1268 tree val2 = gimple_call_arg (stmt2, 1);
1269 tree len2 = gimple_call_arg (stmt2, 2);
1270 tree diff, vdef, new_str_cst;
1271 gimple *use_stmt;
1272 unsigned int ptr1_align;
1273 unsigned HOST_WIDE_INTlong src_len;
1274 char *src_buf;
1275 use_operand_p use_p;
1276
1277 if (!tree_fits_shwi_p (val2)
1278 || !tree_fits_uhwi_p (len2)
1279 || compare_tree_int (len2, 1024) == 1)
1280 break;
1281 if (is_gimple_call (stmt1))
1282 {
1283 /* If first stmt is a call, it needs to be memcpy
1284 or mempcpy, with string literal as second argument and
1285 constant length. */
1286 callee1 = gimple_call_fndecl (stmt1);
1287 if (callee1 == NULL_TREE(tree) nullptr
1288 || !fndecl_built_in_p (callee1, BUILT_IN_NORMAL)
1289 || gimple_call_num_args (stmt1) != 3)
1290 break;
1291 if (DECL_FUNCTION_CODE (callee1) != BUILT_IN_MEMCPY
1292 && DECL_FUNCTION_CODE (callee1) != BUILT_IN_MEMPCPY)
1293 break;
1294 ptr1 = gimple_call_arg (stmt1, 0);
1295 src1 = gimple_call_arg (stmt1, 1);
1296 len1 = gimple_call_arg (stmt1, 2);
1297 lhs1 = gimple_call_lhs (stmt1);
1298 if (!tree_fits_uhwi_p (len1))
1299 break;
1300 str1 = string_constant (src1, &off1, NULLnullptr, NULLnullptr);
1301 if (str1 == NULL_TREE(tree) nullptr)
1302 break;
1303 if (!tree_fits_uhwi_p (off1)
1304 || compare_tree_int (off1, TREE_STRING_LENGTH (str1)((tree_check ((str1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1304, __FUNCTION__, (STRING_CST)))->string.length)
- 1) > 0
1305 || compare_tree_int (len1, TREE_STRING_LENGTH (str1)((tree_check ((str1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1305, __FUNCTION__, (STRING_CST)))->string.length)
1306 - tree_to_uhwi (off1)) > 0
1307 || TREE_CODE (TREE_TYPE (str1))((enum tree_code) (((contains_struct_check ((str1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1307, __FUNCTION__))->typed.type))->base.code)
!= ARRAY_TYPE
1308 || TYPE_MODE (TREE_TYPE (TREE_TYPE (str1)))((((enum tree_code) ((tree_class_check ((((contains_struct_check
((((contains_struct_check ((str1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1308, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1308, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1308, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(((contains_struct_check ((((contains_struct_check ((str1), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1308, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1308, __FUNCTION__))->typed.type)) : (((contains_struct_check
((((contains_struct_check ((str1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1308, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1308, __FUNCTION__))->typed.type))->type_common.mode)
1309 != TYPE_MODE (char_type_node)((((enum tree_code) ((tree_class_check ((integer_types[itk_char
]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1309, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(integer_types[itk_char]) : (integer_types[itk_char])->type_common
.mode)
)
1310 break;
1311 }
1312 else if (gimple_assign_single_p (stmt1))
1313 {
1314 /* Otherwise look for length 1 memcpy optimized into
1315 assignment. */
1316 ptr1 = gimple_assign_lhs (stmt1);
1317 src1 = gimple_assign_rhs1 (stmt1);
1318 if (TREE_CODE (ptr1)((enum tree_code) (ptr1)->base.code) != MEM_REF
1319 || TYPE_MODE (TREE_TYPE (ptr1))((((enum tree_code) ((tree_class_check ((((contains_struct_check
((ptr1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1319, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1319, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(((contains_struct_check ((ptr1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1319, __FUNCTION__))->typed.type)) : (((contains_struct_check
((ptr1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1319, __FUNCTION__))->typed.type))->type_common.mode)
!= TYPE_MODE (char_type_node)((((enum tree_code) ((tree_class_check ((integer_types[itk_char
]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1319, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(integer_types[itk_char]) : (integer_types[itk_char])->type_common
.mode)
1320 || !tree_fits_shwi_p (src1))
1321 break;
1322 ptr1 = build_fold_addr_expr (ptr1)build_fold_addr_expr_loc (((location_t) 0), (ptr1));
1323 STRIP_USELESS_TYPE_CONVERSION (ptr1)(ptr1) = tree_ssa_strip_useless_type_conversions (ptr1);
1324 callee1 = NULL_TREE(tree) nullptr;
1325 len1 = size_one_nodeglobal_trees[TI_SIZE_ONE];
1326 lhs1 = NULL_TREE(tree) nullptr;
1327 off1 = size_zero_nodeglobal_trees[TI_SIZE_ZERO];
1328 str1 = NULL_TREE(tree) nullptr;
1329 }
1330 else
1331 break;
1332
1333 diff = constant_pointer_difference (ptr1, ptr2);
1334 if (diff == NULLnullptr && lhs1 != NULLnullptr)
1335 {
1336 diff = constant_pointer_difference (lhs1, ptr2);
1337 if (DECL_FUNCTION_CODE (callee1) == BUILT_IN_MEMPCPY
1338 && diff != NULLnullptr)
1339 diff = size_binop (PLUS_EXPR, diff,size_binop_loc (((location_t) 0), PLUS_EXPR, diff, fold_convert_loc
(((location_t) 0), sizetype_tab[(int) stk_sizetype], len1))
1340 fold_convert (sizetype, len1))size_binop_loc (((location_t) 0), PLUS_EXPR, diff, fold_convert_loc
(((location_t) 0), sizetype_tab[(int) stk_sizetype], len1))
;
1341 }
1342 /* If the difference between the second and first destination pointer
1343 is not constant, or is bigger than memcpy length, bail out. */
1344 if (diff == NULLnullptr
1345 || !tree_fits_uhwi_p (diff)
1346 || tree_int_cst_lt (len1, diff)
1347 || compare_tree_int (diff, 1024) == 1)
1348 break;
1349
1350 /* Use maximum of difference plus memset length and memcpy length
1351 as the new memcpy length, if it is too big, bail out. */
1352 src_len = tree_to_uhwi (diff);
1353 src_len += tree_to_uhwi (len2);
1354 if (src_len < tree_to_uhwi (len1))
1355 src_len = tree_to_uhwi (len1);
1356 if (src_len > 1024)
1357 break;
1358
1359 /* If mempcpy value is used elsewhere, bail out, as mempcpy
1360 with bigger length will return different result. */
1361 if (lhs1 != NULL_TREE(tree) nullptr
1362 && DECL_FUNCTION_CODE (callee1) == BUILT_IN_MEMPCPY
1363 && (TREE_CODE (lhs1)((enum tree_code) (lhs1)->base.code) != SSA_NAME
1364 || !single_imm_use (lhs1, &use_p, &use_stmt)
1365 || use_stmt != stmt2))
1366 break;
1367
1368 /* If anything reads memory in between memcpy and memset
1369 call, the modified memcpy call might change it. */
1370 vdef = gimple_vdef (stmt1);
1371 if (vdef != NULLnullptr
1372 && (!single_imm_use (vdef, &use_p, &use_stmt)
1373 || use_stmt != stmt2))
1374 break;
1375
1376 ptr1_align = get_pointer_alignment (ptr1);
1377 /* Construct the new source string literal. */
1378 src_buf = XALLOCAVEC (char, src_len + 1)((char *) __builtin_alloca(sizeof (char) * (src_len + 1)));
1379 if (callee1)
1380 memcpy (src_buf,
1381 TREE_STRING_POINTER (str1)((const char *)((tree_check ((str1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1381, __FUNCTION__, (STRING_CST)))->string.str))
+ tree_to_uhwi (off1),
1382 tree_to_uhwi (len1));
1383 else
1384 src_buf[0] = tree_to_shwi (src1);
1385 memset (src_buf + tree_to_uhwi (diff),
1386 tree_to_shwi (val2), tree_to_uhwi (len2));
1387 src_buf[src_len] = '\0';
1388 /* Neither builtin_strncpy_read_str nor builtin_memcpy_read_str
1389 handle embedded '\0's. */
1390 if (strlen (src_buf) != src_len)
1391 break;
1392 rtl_profile_for_bb (gimple_bb (stmt2));
1393 /* If the new memcpy wouldn't be emitted by storing the literal
1394 by pieces, this optimization might enlarge .rodata too much,
1395 as commonly used string literals couldn't be shared any
1396 longer. */
1397 if (!can_store_by_pieces (src_len,
1398 builtin_strncpy_read_str,
1399 src_buf, ptr1_align, false))
1400 break;
1401
1402 new_str_cst = build_string_literal (src_len, src_buf);
1403 if (callee1)
1404 {
1405 /* If STMT1 is a mem{,p}cpy call, adjust it and remove
1406 memset call. */
1407 if (lhs1 && DECL_FUNCTION_CODE (callee1) == BUILT_IN_MEMPCPY)
1408 gimple_call_set_lhs (stmt1, NULL_TREE(tree) nullptr);
1409 gimple_call_set_arg (stmt1, 1, new_str_cst);
1410 gimple_call_set_arg (stmt1, 2,
1411 build_int_cst (TREE_TYPE (len1)((contains_struct_check ((len1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1411, __FUNCTION__))->typed.type)
, src_len));
1412 update_stmt (stmt1);
1413 unlink_stmt_vdef (stmt2);
1414 gsi_replace (gsi_p, gimple_build_nop (), false);
1415 fwprop_invalidate_lattice (gimple_get_lhs (stmt2));
1416 release_defs (stmt2);
1417 if (lhs1 && DECL_FUNCTION_CODE (callee1) == BUILT_IN_MEMPCPY)
1418 {
1419 fwprop_invalidate_lattice (lhs1);
1420 release_ssa_name (lhs1);
1421 }
1422 return true;
1423 }
1424 else
1425 {
1426 /* Otherwise, if STMT1 is length 1 memcpy optimized into
1427 assignment, remove STMT1 and change memset call into
1428 memcpy call. */
1429 gimple_stmt_iterator gsi = gsi_for_stmt (stmt1);
1430
1431 if (!is_gimple_val (ptr1))
1432 ptr1 = force_gimple_operand_gsi (gsi_p, ptr1, true, NULL_TREE(tree) nullptr,
1433 true, GSI_SAME_STMT);
1434 tree fndecl = builtin_decl_explicit (BUILT_IN_MEMCPY);
1435 gimple_call_set_fndecl (stmt2, fndecl);
1436 gimple_call_set_fntype (as_a <gcall *> (stmt2),
1437 TREE_TYPE (fndecl)((contains_struct_check ((fndecl), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1437, __FUNCTION__))->typed.type)
);
1438 gimple_call_set_arg (stmt2, 0, ptr1);
1439 gimple_call_set_arg (stmt2, 1, new_str_cst);
1440 gimple_call_set_arg (stmt2, 2,
1441 build_int_cst (TREE_TYPE (len2)((contains_struct_check ((len2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1441, __FUNCTION__))->typed.type)
, src_len));
1442 unlink_stmt_vdef (stmt1);
1443 gsi_remove (&gsi, true);
1444 fwprop_invalidate_lattice (gimple_get_lhs (stmt1));
1445 release_defs (stmt1);
1446 update_stmt (stmt2);
1447 return false;
1448 }
1449 }
1450 break;
1451 default:
1452 break;
1453 }
1454 return false;
1455}
1456
1457/* Given a ssa_name in NAME see if it was defined by an assignment and
1458 set CODE to be the code and ARG1 to the first operand on the rhs and ARG2
1459 to the second operand on the rhs. */
1460
1461static inline void
1462defcodefor_name (tree name, enum tree_code *code, tree *arg1, tree *arg2)
1463{
1464 gimple *def;
1465 enum tree_code code1;
1466 tree arg11;
1467 tree arg21;
1468 tree arg31;
1469 enum gimple_rhs_class grhs_class;
1470
1471 code1 = TREE_CODE (name)((enum tree_code) (name)->base.code);
1472 arg11 = name;
1473 arg21 = NULL_TREE(tree) nullptr;
1474 arg31 = NULL_TREE(tree) nullptr;
1475 grhs_class = get_gimple_rhs_class (code1);
1476
1477 if (code1 == SSA_NAME)
1478 {
1479 def = SSA_NAME_DEF_STMT (name)(tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1479, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt
;
1480
1481 if (def && is_gimple_assign (def)
1482 && can_propagate_from (def))
1483 {
1484 code1 = gimple_assign_rhs_code (def);
1485 arg11 = gimple_assign_rhs1 (def);
1486 arg21 = gimple_assign_rhs2 (def);
1487 arg31 = gimple_assign_rhs3 (def);
1488 }
1489 }
1490 else if (grhs_class != GIMPLE_SINGLE_RHS)
1491 code1 = ERROR_MARK;
1492
1493 *code = code1;
1494 *arg1 = arg11;
1495 if (arg2)
1496 *arg2 = arg21;
1497 if (arg31)
1498 *code = ERROR_MARK;
1499}
1500
1501
1502/* Recognize rotation patterns. Return true if a transformation
1503 applied, otherwise return false.
1504
1505 We are looking for X with unsigned type T with bitsize B, OP being
1506 +, | or ^, some type T2 wider than T. For:
1507 (X << CNT1) OP (X >> CNT2) iff CNT1 + CNT2 == B
1508 ((T) ((T2) X << CNT1)) OP ((T) ((T2) X >> CNT2)) iff CNT1 + CNT2 == B
1509
1510 transform these into:
1511 X r<< CNT1
1512
1513 Or for:
1514 (X << Y) OP (X >> (B - Y))
1515 (X << (int) Y) OP (X >> (int) (B - Y))
1516 ((T) ((T2) X << Y)) OP ((T) ((T2) X >> (B - Y)))
1517 ((T) ((T2) X << (int) Y)) OP ((T) ((T2) X >> (int) (B - Y)))
1518 (X << Y) | (X >> ((-Y) & (B - 1)))
1519 (X << (int) Y) | (X >> (int) ((-Y) & (B - 1)))
1520 ((T) ((T2) X << Y)) | ((T) ((T2) X >> ((-Y) & (B - 1))))
1521 ((T) ((T2) X << (int) Y)) | ((T) ((T2) X >> (int) ((-Y) & (B - 1))))
1522
1523 transform these into:
1524 X r<< Y
1525
1526 Or for:
1527 (X << (Y & (B - 1))) | (X >> ((-Y) & (B - 1)))
1528 (X << (int) (Y & (B - 1))) | (X >> (int) ((-Y) & (B - 1)))
1529 ((T) ((T2) X << (Y & (B - 1)))) | ((T) ((T2) X >> ((-Y) & (B - 1))))
1530 ((T) ((T2) X << (int) (Y & (B - 1)))) \
1531 | ((T) ((T2) X >> (int) ((-Y) & (B - 1))))
1532
1533 transform these into:
1534 X r<< (Y & (B - 1))
1535
1536 Note, in the patterns with T2 type, the type of OP operands
1537 might be even a signed type, but should have precision B.
1538 Expressions with & (B - 1) should be recognized only if B is
1539 a power of 2. */
1540
1541static bool
1542simplify_rotate (gimple_stmt_iterator *gsi)
1543{
1544 gimple *stmt = gsi_stmt (*gsi);
1545 tree arg[2], rtype, rotcnt = NULL_TREE(tree) nullptr;
1546 tree def_arg1[2], def_arg2[2];
1547 enum tree_code def_code[2];
1548 tree lhs;
1549 int i;
1550 bool swapped_p = false;
1551 gimple *g;
1552
1553 arg[0] = gimple_assign_rhs1 (stmt);
1554 arg[1] = gimple_assign_rhs2 (stmt);
1555 rtype = TREE_TYPE (arg[0])((contains_struct_check ((arg[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1555, __FUNCTION__))->typed.type)
;
1556
1557 /* Only create rotates in complete modes. Other cases are not
1558 expanded properly. */
1559 if (!INTEGRAL_TYPE_P (rtype)(((enum tree_code) (rtype)->base.code) == ENUMERAL_TYPE ||
((enum tree_code) (rtype)->base.code) == BOOLEAN_TYPE || (
(enum tree_code) (rtype)->base.code) == INTEGER_TYPE)
1560 || !type_has_mode_precision_p (rtype))
1561 return false;
1562
1563 for (i = 0; i < 2; i++)
1564 defcodefor_name (arg[i], &def_code[i], &def_arg1[i], &def_arg2[i]);
1565
1566 /* Look through narrowing (or same precision) conversions. */
1567 if (CONVERT_EXPR_CODE_P (def_code[0])((def_code[0]) == NOP_EXPR || (def_code[0]) == CONVERT_EXPR)
1568 && CONVERT_EXPR_CODE_P (def_code[1])((def_code[1]) == NOP_EXPR || (def_code[1]) == CONVERT_EXPR)
1569 && INTEGRAL_TYPE_P (TREE_TYPE (def_arg1[0]))(((enum tree_code) (((contains_struct_check ((def_arg1[0]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1569, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((def_arg1[0])
, (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1569, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((def_arg1[0])
, (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1569, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
1570 && INTEGRAL_TYPE_P (TREE_TYPE (def_arg1[1]))(((enum tree_code) (((contains_struct_check ((def_arg1[1]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1570, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((def_arg1[1])
, (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1570, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((def_arg1[1])
, (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1570, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
1571 && TYPE_PRECISION (TREE_TYPE (def_arg1[0]))((tree_class_check ((((contains_struct_check ((def_arg1[0]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1571, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1571, __FUNCTION__))->type_common.precision)
1572 == TYPE_PRECISION (TREE_TYPE (def_arg1[1]))((tree_class_check ((((contains_struct_check ((def_arg1[1]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1572, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1572, __FUNCTION__))->type_common.precision)
1573 && TYPE_PRECISION (TREE_TYPE (def_arg1[0]))((tree_class_check ((((contains_struct_check ((def_arg1[0]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1573, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1573, __FUNCTION__))->type_common.precision)
>= TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1573, __FUNCTION__))->type_common.precision)
1574 && has_single_use (arg[0])
1575 && has_single_use (arg[1]))
1576 {
1577 for (i = 0; i < 2; i++)
1578 {
1579 arg[i] = def_arg1[i];
1580 defcodefor_name (arg[i], &def_code[i], &def_arg1[i], &def_arg2[i]);
1581 }
1582 }
1583 else
1584 {
1585 /* Handle signed rotate; the RSHIFT_EXPR has to be done
1586 in unsigned type but LSHIFT_EXPR could be signed. */
1587 i = (def_code[0] == LSHIFT_EXPR || def_code[0] == RSHIFT_EXPR);
1588 if (CONVERT_EXPR_CODE_P (def_code[i])((def_code[i]) == NOP_EXPR || (def_code[i]) == CONVERT_EXPR)
1589 && (def_code[1 - i] == LSHIFT_EXPR || def_code[1 - i] == RSHIFT_EXPR)
1590 && INTEGRAL_TYPE_P (TREE_TYPE (def_arg1[i]))(((enum tree_code) (((contains_struct_check ((def_arg1[i]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1590, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((def_arg1[i])
, (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1590, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((def_arg1[i])
, (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1590, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
1591 && TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1591, __FUNCTION__))->type_common.precision)
== TYPE_PRECISION (TREE_TYPE (def_arg1[i]))((tree_class_check ((((contains_struct_check ((def_arg1[i]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1591, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1591, __FUNCTION__))->type_common.precision)
1592 && has_single_use (arg[i]))
1593 {
1594 arg[i] = def_arg1[i];
1595 defcodefor_name (arg[i], &def_code[i], &def_arg1[i], &def_arg2[i]);
1596 }
1597 }
1598
1599 /* One operand has to be LSHIFT_EXPR and one RSHIFT_EXPR. */
1600 for (i = 0; i < 2; i++)
1601 if (def_code[i] != LSHIFT_EXPR && def_code[i] != RSHIFT_EXPR)
1602 return false;
1603 else if (!has_single_use (arg[i]))
1604 return false;
1605 if (def_code[0] == def_code[1])
1606 return false;
1607
1608 /* If we've looked through narrowing conversions before, look through
1609 widening conversions from unsigned type with the same precision
1610 as rtype here. */
1611 if (TYPE_PRECISION (TREE_TYPE (def_arg1[0]))((tree_class_check ((((contains_struct_check ((def_arg1[0]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1611, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1611, __FUNCTION__))->type_common.precision)
!= TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1611, __FUNCTION__))->type_common.precision)
)
1612 for (i = 0; i < 2; i++)
1613 {
1614 tree tem;
1615 enum tree_code code;
1616 defcodefor_name (def_arg1[i], &code, &tem, NULLnullptr);
1617 if (!CONVERT_EXPR_CODE_P (code)((code) == NOP_EXPR || (code) == CONVERT_EXPR)
1618 || !INTEGRAL_TYPE_P (TREE_TYPE (tem))(((enum tree_code) (((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1618, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1618, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1618, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
1619 || TYPE_PRECISION (TREE_TYPE (tem))((tree_class_check ((((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1619, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1619, __FUNCTION__))->type_common.precision)
!= TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1619, __FUNCTION__))->type_common.precision)
)
1620 return false;
1621 def_arg1[i] = tem;
1622 }
1623 /* Both shifts have to use the same first operand. */
1624 if (!operand_equal_for_phi_arg_p (def_arg1[0], def_arg1[1])
1625 || !types_compatible_p (TREE_TYPE (def_arg1[0])((contains_struct_check ((def_arg1[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1625, __FUNCTION__))->typed.type)
,
1626 TREE_TYPE (def_arg1[1])((contains_struct_check ((def_arg1[1]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1626, __FUNCTION__))->typed.type)
))
1627 {
1628 if ((TYPE_PRECISION (TREE_TYPE (def_arg1[0]))((tree_class_check ((((contains_struct_check ((def_arg1[0]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1628, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1628, __FUNCTION__))->type_common.precision)
1629 != TYPE_PRECISION (TREE_TYPE (def_arg1[1]))((tree_class_check ((((contains_struct_check ((def_arg1[1]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1629, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1629, __FUNCTION__))->type_common.precision)
)
1630 || (TYPE_UNSIGNED (TREE_TYPE (def_arg1[0]))((tree_class_check ((((contains_struct_check ((def_arg1[0]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1630, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1630, __FUNCTION__))->base.u.bits.unsigned_flag)
1631 == TYPE_UNSIGNED (TREE_TYPE (def_arg1[1]))((tree_class_check ((((contains_struct_check ((def_arg1[1]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1631, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1631, __FUNCTION__))->base.u.bits.unsigned_flag)
))
1632 return false;
1633
1634 /* Handle signed rotate; the RSHIFT_EXPR has to be done
1635 in unsigned type but LSHIFT_EXPR could be signed. */
1636 i = def_code[0] != RSHIFT_EXPR;
1637 if (!TYPE_UNSIGNED (TREE_TYPE (def_arg1[i]))((tree_class_check ((((contains_struct_check ((def_arg1[i]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1637, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1637, __FUNCTION__))->base.u.bits.unsigned_flag)
)
1638 return false;
1639
1640 tree tem;
1641 enum tree_code code;
1642 defcodefor_name (def_arg1[i], &code, &tem, NULLnullptr);
1643 if (!CONVERT_EXPR_CODE_P (code)((code) == NOP_EXPR || (code) == CONVERT_EXPR)
1644 || !INTEGRAL_TYPE_P (TREE_TYPE (tem))(((enum tree_code) (((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1644, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1644, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1644, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
1645 || TYPE_PRECISION (TREE_TYPE (tem))((tree_class_check ((((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1645, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1645, __FUNCTION__))->type_common.precision)
!= TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1645, __FUNCTION__))->type_common.precision)
)
1646 return false;
1647 def_arg1[i] = tem;
1648 if (!operand_equal_for_phi_arg_p (def_arg1[0], def_arg1[1])
1649 || !types_compatible_p (TREE_TYPE (def_arg1[0])((contains_struct_check ((def_arg1[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1649, __FUNCTION__))->typed.type)
,
1650 TREE_TYPE (def_arg1[1])((contains_struct_check ((def_arg1[1]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1650, __FUNCTION__))->typed.type)
))
1651 return false;
1652 }
1653 else if (!TYPE_UNSIGNED (TREE_TYPE (def_arg1[0]))((tree_class_check ((((contains_struct_check ((def_arg1[0]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1653, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1653, __FUNCTION__))->base.u.bits.unsigned_flag)
)
1654 return false;
1655
1656 /* CNT1 + CNT2 == B case above. */
1657 if (tree_fits_uhwi_p (def_arg2[0])
1658 && tree_fits_uhwi_p (def_arg2[1])
1659 && tree_to_uhwi (def_arg2[0])
1660 + tree_to_uhwi (def_arg2[1]) == TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1660, __FUNCTION__))->type_common.precision)
)
1661 rotcnt = def_arg2[0];
1662 else if (TREE_CODE (def_arg2[0])((enum tree_code) (def_arg2[0])->base.code) != SSA_NAME
1663 || TREE_CODE (def_arg2[1])((enum tree_code) (def_arg2[1])->base.code) != SSA_NAME)
1664 return false;
1665 else
1666 {
1667 tree cdef_arg1[2], cdef_arg2[2], def_arg2_alt[2];
1668 enum tree_code cdef_code[2];
1669 /* Look through conversion of the shift count argument.
1670 The C/C++ FE cast any shift count argument to integer_type_node.
1671 The only problem might be if the shift count type maximum value
1672 is equal or smaller than number of bits in rtype. */
1673 for (i = 0; i < 2; i++)
1674 {
1675 def_arg2_alt[i] = def_arg2[i];
1676 defcodefor_name (def_arg2[i], &cdef_code[i],
1677 &cdef_arg1[i], &cdef_arg2[i]);
1678 if (CONVERT_EXPR_CODE_P (cdef_code[i])((cdef_code[i]) == NOP_EXPR || (cdef_code[i]) == CONVERT_EXPR
)
1679 && INTEGRAL_TYPE_P (TREE_TYPE (cdef_arg1[i]))(((enum tree_code) (((contains_struct_check ((cdef_arg1[i]), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1679, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((cdef_arg1[i]
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1679, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((cdef_arg1[i]
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1679, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
1680 && TYPE_PRECISION (TREE_TYPE (cdef_arg1[i]))((tree_class_check ((((contains_struct_check ((cdef_arg1[i]),
(TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1680, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1680, __FUNCTION__))->type_common.precision)
1681 > floor_log2 (TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1681, __FUNCTION__))->type_common.precision)
)
1682 && type_has_mode_precision_p (TREE_TYPE (cdef_arg1[i])((contains_struct_check ((cdef_arg1[i]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1682, __FUNCTION__))->typed.type)
))
1683 {
1684 def_arg2_alt[i] = cdef_arg1[i];
1685 defcodefor_name (def_arg2_alt[i], &cdef_code[i],
1686 &cdef_arg1[i], &cdef_arg2[i]);
1687 }
1688 }
1689 for (i = 0; i < 2; i++)
1690 /* Check for one shift count being Y and the other B - Y,
1691 with optional casts. */
1692 if (cdef_code[i] == MINUS_EXPR
1693 && tree_fits_shwi_p (cdef_arg1[i])
1694 && tree_to_shwi (cdef_arg1[i]) == TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1694, __FUNCTION__))->type_common.precision)
1695 && TREE_CODE (cdef_arg2[i])((enum tree_code) (cdef_arg2[i])->base.code) == SSA_NAME)
1696 {
1697 tree tem;
1698 enum tree_code code;
1699
1700 if (cdef_arg2[i] == def_arg2[1 - i]
1701 || cdef_arg2[i] == def_arg2_alt[1 - i])
1702 {
1703 rotcnt = cdef_arg2[i];
1704 break;
1705 }
1706 defcodefor_name (cdef_arg2[i], &code, &tem, NULLnullptr);
1707 if (CONVERT_EXPR_CODE_P (code)((code) == NOP_EXPR || (code) == CONVERT_EXPR)
1708 && INTEGRAL_TYPE_P (TREE_TYPE (tem))(((enum tree_code) (((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1708, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1708, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1708, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
1709 && TYPE_PRECISION (TREE_TYPE (tem))((tree_class_check ((((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1709, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1709, __FUNCTION__))->type_common.precision)
1710 > floor_log2 (TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1710, __FUNCTION__))->type_common.precision)
)
1711 && type_has_mode_precision_p (TREE_TYPE (tem)((contains_struct_check ((tem), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1711, __FUNCTION__))->typed.type)
)
1712 && (tem == def_arg2[1 - i]
1713 || tem == def_arg2_alt[1 - i]))
1714 {
1715 rotcnt = tem;
1716 break;
1717 }
1718 }
1719 /* The above sequence isn't safe for Y being 0,
1720 because then one of the shifts triggers undefined behavior.
1721 This alternative is safe even for rotation count of 0.
1722 One shift count is Y and the other (-Y) & (B - 1).
1723 Or one shift count is Y & (B - 1) and the other (-Y) & (B - 1). */
1724 else if (cdef_code[i] == BIT_AND_EXPR
1725 && pow2p_hwi (TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1725, __FUNCTION__))->type_common.precision)
)
1726 && tree_fits_shwi_p (cdef_arg2[i])
1727 && tree_to_shwi (cdef_arg2[i])
1728 == TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1728, __FUNCTION__))->type_common.precision)
- 1
1729 && TREE_CODE (cdef_arg1[i])((enum tree_code) (cdef_arg1[i])->base.code) == SSA_NAME
1730 && gimple_assign_rhs_code (stmt) == BIT_IOR_EXPR)
1731 {
1732 tree tem;
1733 enum tree_code code;
1734
1735 defcodefor_name (cdef_arg1[i], &code, &tem, NULLnullptr);
1736 if (CONVERT_EXPR_CODE_P (code)((code) == NOP_EXPR || (code) == CONVERT_EXPR)
1737 && INTEGRAL_TYPE_P (TREE_TYPE (tem))(((enum tree_code) (((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1737, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1737, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1737, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
1738 && TYPE_PRECISION (TREE_TYPE (tem))((tree_class_check ((((contains_struct_check ((tem), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1738, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1738, __FUNCTION__))->type_common.precision)
1739 > floor_log2 (TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1739, __FUNCTION__))->type_common.precision)
)
1740 && type_has_mode_precision_p (TREE_TYPE (tem)((contains_struct_check ((tem), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1740, __FUNCTION__))->typed.type)
))
1741 defcodefor_name (tem, &code, &tem, NULLnullptr);
1742
1743 if (code == NEGATE_EXPR)
1744 {
1745 if (tem == def_arg2[1 - i] || tem == def_arg2_alt[1 - i])
1746 {
1747 rotcnt = tem;
1748 break;
1749 }
1750 tree tem2;
1751 defcodefor_name (tem, &code, &tem2, NULLnullptr);
1752 if (CONVERT_EXPR_CODE_P (code)((code) == NOP_EXPR || (code) == CONVERT_EXPR)
1753 && INTEGRAL_TYPE_P (TREE_TYPE (tem2))(((enum tree_code) (((contains_struct_check ((tem2), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1753, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((tem2), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1753, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((tem2), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1753, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
1754 && TYPE_PRECISION (TREE_TYPE (tem2))((tree_class_check ((((contains_struct_check ((tem2), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1754, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1754, __FUNCTION__))->type_common.precision)
1755 > floor_log2 (TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1755, __FUNCTION__))->type_common.precision)
)
1756 && type_has_mode_precision_p (TREE_TYPE (tem2)((contains_struct_check ((tem2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1756, __FUNCTION__))->typed.type)
))
1757 {
1758 if (tem2 == def_arg2[1 - i]
1759 || tem2 == def_arg2_alt[1 - i])
1760 {
1761 rotcnt = tem2;
1762 break;
1763 }
1764 }
1765 else
1766 tem2 = NULL_TREE(tree) nullptr;
1767
1768 if (cdef_code[1 - i] == BIT_AND_EXPR
1769 && tree_fits_shwi_p (cdef_arg2[1 - i])
1770 && tree_to_shwi (cdef_arg2[1 - i])
1771 == TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1771, __FUNCTION__))->type_common.precision)
- 1
1772 && TREE_CODE (cdef_arg1[1 - i])((enum tree_code) (cdef_arg1[1 - i])->base.code) == SSA_NAME)
1773 {
1774 if (tem == cdef_arg1[1 - i]
1775 || tem2 == cdef_arg1[1 - i])
1776 {
1777 rotcnt = def_arg2[1 - i];
1778 break;
1779 }
1780 tree tem3;
1781 defcodefor_name (cdef_arg1[1 - i], &code, &tem3, NULLnullptr);
1782 if (CONVERT_EXPR_CODE_P (code)((code) == NOP_EXPR || (code) == CONVERT_EXPR)
1783 && INTEGRAL_TYPE_P (TREE_TYPE (tem3))(((enum tree_code) (((contains_struct_check ((tem3), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1783, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (((contains_struct_check ((tem3), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1783, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((tem3), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1783, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
1784 && TYPE_PRECISION (TREE_TYPE (tem3))((tree_class_check ((((contains_struct_check ((tem3), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1784, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1784, __FUNCTION__))->type_common.precision)
1785 > floor_log2 (TYPE_PRECISION (rtype)((tree_class_check ((rtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1785, __FUNCTION__))->type_common.precision)
)
1786 && type_has_mode_precision_p (TREE_TYPE (tem3)((contains_struct_check ((tem3), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1786, __FUNCTION__))->typed.type)
))
1787 {
1788 if (tem == tem3 || tem2 == tem3)
1789 {
1790 rotcnt = def_arg2[1 - i];
1791 break;
1792 }
1793 }
1794 }
1795 }
1796 }
1797 if (rotcnt == NULL_TREE(tree) nullptr)
1798 return false;
1799 swapped_p = i != 1;
1800 }
1801
1802 if (!useless_type_conversion_p (TREE_TYPE (def_arg2[0])((contains_struct_check ((def_arg2[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1802, __FUNCTION__))->typed.type)
,
1803 TREE_TYPE (rotcnt)((contains_struct_check ((rotcnt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1803, __FUNCTION__))->typed.type)
))
1804 {
1805 g = gimple_build_assign (make_ssa_name (TREE_TYPE (def_arg2[0])((contains_struct_check ((def_arg2[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1805, __FUNCTION__))->typed.type)
),
1806 NOP_EXPR, rotcnt);
1807 gsi_insert_before (gsi, g, GSI_SAME_STMT);
1808 rotcnt = gimple_assign_lhs (g);
1809 }
1810 lhs = gimple_assign_lhs (stmt);
1811 if (!useless_type_conversion_p (rtype, TREE_TYPE (def_arg1[0])((contains_struct_check ((def_arg1[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1811, __FUNCTION__))->typed.type)
))
1812 lhs = make_ssa_name (TREE_TYPE (def_arg1[0])((contains_struct_check ((def_arg1[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1812, __FUNCTION__))->typed.type)
);
1813 g = gimple_build_assign (lhs,
1814 ((def_code[0] == LSHIFT_EXPR) ^ swapped_p)
1815 ? LROTATE_EXPR : RROTATE_EXPR, def_arg1[0], rotcnt);
1816 if (!useless_type_conversion_p (rtype, TREE_TYPE (def_arg1[0])((contains_struct_check ((def_arg1[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1816, __FUNCTION__))->typed.type)
))
1817 {
1818 gsi_insert_before (gsi, g, GSI_SAME_STMT);
1819 g = gimple_build_assign (gimple_assign_lhs (stmt), NOP_EXPR, lhs);
1820 }
1821 gsi_replace (gsi, g, false);
1822 return true;
1823}
1824
1825
1826/* Check whether an array contains a valid ctz table. */
1827static bool
1828check_ctz_array (tree ctor, unsigned HOST_WIDE_INTlong mulc,
1829 HOST_WIDE_INTlong &zero_val, unsigned shift, unsigned bits)
1830{
1831 tree elt, idx;
1832 unsigned HOST_WIDE_INTlong i, mask;
1833 unsigned matched = 0;
1834
1835 mask = ((HOST_WIDE_INT_1U1UL << (bits - shift)) - 1) << shift;
1836
1837 zero_val = 0;
1838
1839 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), i, idx, elt)for (i = 0; (i >= vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1839, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
? false : (((void) (elt = (*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1839, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
i].value)), (idx = (*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1839, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
i].index), true); (i)++)
1840 {
1841 if (TREE_CODE (idx)((enum tree_code) (idx)->base.code) != INTEGER_CST || TREE_CODE (elt)((enum tree_code) (elt)->base.code) != INTEGER_CST)
1842 return false;
1843 if (i > bits * 2)
1844 return false;
1845
1846 unsigned HOST_WIDE_INTlong index = tree_to_shwi (idx);
1847 HOST_WIDE_INTlong val = tree_to_shwi (elt);
1848
1849 if (index == 0)
1850 {
1851 zero_val = val;
1852 matched++;
1853 }
1854
1855 if (val >= 0 && val < bits && (((mulc << val) & mask) >> shift) == index)
1856 matched++;
1857
1858 if (matched > bits)
1859 return true;
1860 }
1861
1862 return false;
1863}
1864
1865/* Check whether a string contains a valid ctz table. */
1866static bool
1867check_ctz_string (tree string, unsigned HOST_WIDE_INTlong mulc,
1868 HOST_WIDE_INTlong &zero_val, unsigned shift, unsigned bits)
1869{
1870 unsigned HOST_WIDE_INTlong len = TREE_STRING_LENGTH (string)((tree_check ((string), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1870, __FUNCTION__, (STRING_CST)))->string.length)
;
1871 unsigned HOST_WIDE_INTlong mask;
1872 unsigned matched = 0;
1873 const unsigned char *p = (const unsigned char *) TREE_STRING_POINTER (string)((const char *)((tree_check ((string), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1873, __FUNCTION__, (STRING_CST)))->string.str))
;
1874
1875 if (len < bits || len > bits * 2)
1876 return false;
1877
1878 mask = ((HOST_WIDE_INT_1U1UL << (bits - shift)) - 1) << shift;
1879
1880 zero_val = p[0];
1881
1882 for (unsigned i = 0; i < len; i++)
1883 if (p[i] < bits && (((mulc << p[i]) & mask) >> shift) == i)
1884 matched++;
1885
1886 return matched == bits;
1887}
1888
1889/* Recognize count trailing zeroes idiom.
1890 The canonical form is array[((x & -x) * C) >> SHIFT] where C is a magic
1891 constant which when multiplied by a power of 2 creates a unique value
1892 in the top 5 or 6 bits. This is then indexed into a table which maps it
1893 to the number of trailing zeroes. Array[0] is returned so the caller can
1894 emit an appropriate sequence depending on whether ctz (0) is defined on
1895 the target. */
1896static bool
1897optimize_count_trailing_zeroes (tree array_ref, tree x, tree mulc,
1898 tree tshift, HOST_WIDE_INTlong &zero_val)
1899{
1900 tree type = TREE_TYPE (array_ref)((contains_struct_check ((array_ref), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1900, __FUNCTION__))->typed.type)
;
1901 tree array = TREE_OPERAND (array_ref, 0)(*((const_cast<tree*> (tree_operand_check ((array_ref),
(0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1901, __FUNCTION__)))))
;
1902
1903 gcc_assert (TREE_CODE (mulc) == INTEGER_CST)((void)(!(((enum tree_code) (mulc)->base.code) == INTEGER_CST
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1903, __FUNCTION__), 0 : 0))
;
1904 gcc_assert (TREE_CODE (tshift) == INTEGER_CST)((void)(!(((enum tree_code) (tshift)->base.code) == INTEGER_CST
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1904, __FUNCTION__), 0 : 0))
;
1905
1906 tree input_type = TREE_TYPE (x)((contains_struct_check ((x), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1906, __FUNCTION__))->typed.type)
;
1907 unsigned input_bits = tree_to_shwi (TYPE_SIZE (input_type)((tree_class_check ((input_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1907, __FUNCTION__))->type_common.size)
);
1908
1909 /* Check the array element type is not wider than 32 bits and the input is
1910 an unsigned 32-bit or 64-bit type. */
1911 if (TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1911, __FUNCTION__))->type_common.precision)
> 32 || !TYPE_UNSIGNED (input_type)((tree_class_check ((input_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1911, __FUNCTION__))->base.u.bits.unsigned_flag)
)
1912 return false;
1913 if (input_bits != 32 && input_bits != 64)
1914 return false;
1915
1916 if (!direct_internal_fn_supported_p (IFN_CTZ, input_type, OPTIMIZE_FOR_BOTH))
1917 return false;
1918
1919 /* Check the lower bound of the array is zero. */
1920 tree low = array_ref_low_bound (array_ref);
1921 if (!low || !integer_zerop (low))
1922 return false;
1923
1924 unsigned shiftval = tree_to_shwi (tshift);
1925
1926 /* Check the shift extracts the top 5..7 bits. */
1927 if (shiftval < input_bits - 7 || shiftval > input_bits - 5)
1928 return false;
1929
1930 tree ctor = ctor_for_folding (array);
1931 if (!ctor)
1932 return false;
1933
1934 unsigned HOST_WIDE_INTlong val = tree_to_uhwi (mulc);
1935
1936 if (TREE_CODE (ctor)((enum tree_code) (ctor)->base.code) == CONSTRUCTOR)
1937 return check_ctz_array (ctor, val, zero_val, shiftval, input_bits);
1938
1939 if (TREE_CODE (ctor)((enum tree_code) (ctor)->base.code) == STRING_CST
1940 && TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1940, __FUNCTION__))->type_common.precision)
== CHAR_TYPE_SIZE(8))
1941 return check_ctz_string (ctor, val, zero_val, shiftval, input_bits);
1942
1943 return false;
1944}
1945
1946/* Match.pd function to match the ctz expression. */
1947extern bool gimple_ctz_table_index (tree, tree *, tree (*)(tree));
1948
1949static bool
1950simplify_count_trailing_zeroes (gimple_stmt_iterator *gsi)
1951{
1952 gimple *stmt = gsi_stmt (*gsi);
1953 tree array_ref = gimple_assign_rhs1 (stmt);
1954 tree res_ops[3];
1955 HOST_WIDE_INTlong zero_val;
1956
1957 gcc_checking_assert (TREE_CODE (array_ref) == ARRAY_REF)((void)(!(((enum tree_code) (array_ref)->base.code) == ARRAY_REF
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1957, __FUNCTION__), 0 : 0))
;
1958
1959 if (!gimple_ctz_table_index (TREE_OPERAND (array_ref, 1)(*((const_cast<tree*> (tree_operand_check ((array_ref),
(1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1959, __FUNCTION__)))))
, &res_ops[0], NULLnullptr))
1960 return false;
1961
1962 if (optimize_count_trailing_zeroes (array_ref, res_ops[0],
1963 res_ops[1], res_ops[2], zero_val))
1964 {
1965 tree type = TREE_TYPE (res_ops[0])((contains_struct_check ((res_ops[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1965, __FUNCTION__))->typed.type)
;
1966 HOST_WIDE_INTlong ctz_val = 0;
1967 HOST_WIDE_INTlong type_size = tree_to_shwi (TYPE_SIZE (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1967, __FUNCTION__))->type_common.size)
);
1968 bool zero_ok
1969 = CTZ_DEFINED_VALUE_AT_ZERO (SCALAR_INT_TYPE_MODE (type), ctz_val)((ctz_val) = GET_MODE_BITSIZE ((as_a <scalar_int_mode> (
(tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 1969, __FUNCTION__))->type_common.mode))), ((global_options
.x_ix86_isa_flags & (1UL << 23)) != 0) ? 2 : 0)
== 2;
1970
1971 /* If the input value can't be zero, don't special case ctz (0). */
1972 if (tree_expr_nonzero_p (res_ops[0]))
1973 {
1974 zero_ok = true;
1975 zero_val = 0;
1976 ctz_val = 0;
1977 }
1978
1979 /* Skip if there is no value defined at zero, or if we can't easily
1980 return the correct value for zero. */
1981 if (!zero_ok)
1982 return false;
1983 if (zero_val != ctz_val && !(zero_val == 0 && ctz_val == type_size))
1984 return false;
1985
1986 gimple_seq seq = NULLnullptr;
1987 gimple *g;
1988 gcall *call = gimple_build_call_internal (IFN_CTZ, 1, res_ops[0]);
1989 gimple_set_location (call, gimple_location (stmt));
1990 gimple_set_lhs (call, make_ssa_name (integer_type_nodeinteger_types[itk_int]));
1991 gimple_seq_add_stmt (&seq, call);
1992
1993 tree prev_lhs = gimple_call_lhs (call);
1994
1995 /* Emit ctz (x) & 31 if ctz (0) is 32 but we need to return 0. */
1996 if (zero_val == 0 && ctz_val == type_size)
1997 {
1998 g = gimple_build_assign (make_ssa_name (integer_type_nodeinteger_types[itk_int]),
1999 BIT_AND_EXPR, prev_lhs,
2000 build_int_cst (integer_type_nodeinteger_types[itk_int],
2001 type_size - 1));
2002 gimple_set_location (g, gimple_location (stmt));
2003 gimple_seq_add_stmt (&seq, g);
2004 prev_lhs = gimple_assign_lhs (g);
2005 }
2006
2007 g = gimple_build_assign (gimple_assign_lhs (stmt), NOP_EXPR, prev_lhs);
2008 gimple_seq_add_stmt (&seq, g);
2009 gsi_replace_with_seq (gsi, seq, true);
2010 return true;
2011 }
2012
2013 return false;
2014}
2015
2016
2017/* Combine an element access with a shuffle. Returns true if there were
2018 any changes made, else it returns false. */
2019
2020static bool
2021simplify_bitfield_ref (gimple_stmt_iterator *gsi)
2022{
2023 gimple *stmt = gsi_stmt (*gsi);
2024 gimple *def_stmt;
2025 tree op, op0, op1;
2026 tree elem_type;
2027 unsigned idx, size;
2028 enum tree_code code;
2029
2030 op = gimple_assign_rhs1 (stmt);
2031 gcc_checking_assert (TREE_CODE (op) == BIT_FIELD_REF)((void)(!(((enum tree_code) (op)->base.code) == BIT_FIELD_REF
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2031, __FUNCTION__), 0 : 0))
;
2032
2033 op0 = TREE_OPERAND (op, 0)(*((const_cast<tree*> (tree_operand_check ((op), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2033, __FUNCTION__)))))
;
2034 if (TREE_CODE (op0)((enum tree_code) (op0)->base.code) != SSA_NAME
2035 || TREE_CODE (TREE_TYPE (op0))((enum tree_code) (((contains_struct_check ((op0), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2035, __FUNCTION__))->typed.type))->base.code)
!= VECTOR_TYPE)
2036 return false;
2037
2038 def_stmt = get_prop_source_stmt (op0, false, NULLnullptr);
2039 if (!def_stmt || !can_propagate_from (def_stmt))
2040 return false;
2041
2042 op1 = TREE_OPERAND (op, 1)(*((const_cast<tree*> (tree_operand_check ((op), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2042, __FUNCTION__)))))
;
2043 code = gimple_assign_rhs_code (def_stmt);
2044 elem_type = TREE_TYPE (TREE_TYPE (op0))((contains_struct_check ((((contains_struct_check ((op0), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2044, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2044, __FUNCTION__))->typed.type)
;
2045 if (TREE_TYPE (op)((contains_struct_check ((op), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2045, __FUNCTION__))->typed.type)
!= elem_type)
2046 return false;
2047
2048 size = TREE_INT_CST_LOW (TYPE_SIZE (elem_type))((unsigned long) (*tree_int_cst_elt_check ((((tree_class_check
((elem_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2048, __FUNCTION__))->type_common.size)), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2048, __FUNCTION__)))
;
2049 if (maybe_ne (bit_field_size (op), size))
2050 return false;
2051
2052 if (code == VEC_PERM_EXPR
2053 && constant_multiple_p (bit_field_offset (op), size, &idx))
2054 {
2055 tree p, m, tem;
2056 unsigned HOST_WIDE_INTlong nelts;
2057 m = gimple_assign_rhs3 (def_stmt);
2058 if (TREE_CODE (m)((enum tree_code) (m)->base.code) != VECTOR_CST
2059 || !VECTOR_CST_NELTS (m)(TYPE_VECTOR_SUBPARTS (((contains_struct_check ((m), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2059, __FUNCTION__))->typed.type)))
.is_constant (&nelts))
2060 return false;
2061 idx = TREE_INT_CST_LOW (VECTOR_CST_ELT (m, idx))((unsigned long) (*tree_int_cst_elt_check ((vector_cst_elt (m
, idx)), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2061, __FUNCTION__)))
;
2062 idx %= 2 * nelts;
2063 if (idx < nelts)
2064 {
2065 p = gimple_assign_rhs1 (def_stmt);
2066 }
2067 else
2068 {
2069 p = gimple_assign_rhs2 (def_stmt);
2070 idx -= nelts;
2071 }
2072 tem = build3 (BIT_FIELD_REF, TREE_TYPE (op)((contains_struct_check ((op), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2072, __FUNCTION__))->typed.type)
,
2073 unshare_expr (p), op1, bitsize_int (idx * size)size_int_kind (idx * size, stk_bitsizetype));
2074 gimple_assign_set_rhs1 (stmt, tem);
2075 fold_stmt (gsi);
2076 update_stmt (gsi_stmt (*gsi));
2077 return true;
2078 }
2079
2080 return false;
2081}
2082
2083/* Determine whether applying the 2 permutations (mask1 then mask2)
2084 gives back one of the input. */
2085
2086static int
2087is_combined_permutation_identity (tree mask1, tree mask2)
2088{
2089 tree mask;
2090 unsigned HOST_WIDE_INTlong nelts, i, j;
2091 bool maybe_identity1 = true;
2092 bool maybe_identity2 = true;
2093
2094 gcc_checking_assert (TREE_CODE (mask1) == VECTOR_CST((void)(!(((enum tree_code) (mask1)->base.code) == VECTOR_CST
&& ((enum tree_code) (mask2)->base.code) == VECTOR_CST
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2095, __FUNCTION__), 0 : 0))
2095 && TREE_CODE (mask2) == VECTOR_CST)((void)(!(((enum tree_code) (mask1)->base.code) == VECTOR_CST
&& ((enum tree_code) (mask2)->base.code) == VECTOR_CST
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2095, __FUNCTION__), 0 : 0))
;
2096 mask = fold_ternary (VEC_PERM_EXPR, TREE_TYPE (mask1), mask1, mask1, mask2)fold_ternary_loc (((location_t) 0), VEC_PERM_EXPR, ((contains_struct_check
((mask1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2096, __FUNCTION__))->typed.type), mask1, mask1, mask2)
;
2097 if (mask == NULL_TREE(tree) nullptr || TREE_CODE (mask)((enum tree_code) (mask)->base.code) != VECTOR_CST)
2098 return 0;
2099
2100 if (!VECTOR_CST_NELTS (mask)(TYPE_VECTOR_SUBPARTS (((contains_struct_check ((mask), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2100, __FUNCTION__))->typed.type)))
.is_constant (&nelts))
2101 return 0;
2102 for (i = 0; i < nelts; i++)
2103 {
2104 tree val = VECTOR_CST_ELT (mask, i)vector_cst_elt (mask, i);
2105 gcc_assert (TREE_CODE (val) == INTEGER_CST)((void)(!(((enum tree_code) (val)->base.code) == INTEGER_CST
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2105, __FUNCTION__), 0 : 0))
;
2106 j = TREE_INT_CST_LOW (val)((unsigned long) (*tree_int_cst_elt_check ((val), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2106, __FUNCTION__)))
& (2 * nelts - 1);
2107 if (j == i)
2108 maybe_identity2 = false;
2109 else if (j == i + nelts)
2110 maybe_identity1 = false;
2111 else
2112 return 0;
2113 }
2114 return maybe_identity1 ? 1 : maybe_identity2 ? 2 : 0;
2115}
2116
2117/* Combine a shuffle with its arguments. Returns 1 if there were any
2118 changes made, 2 if cfg-cleanup needs to run. Else it returns 0. */
2119
2120static int
2121simplify_permutation (gimple_stmt_iterator *gsi)
2122{
2123 gimple *stmt = gsi_stmt (*gsi);
2124 gimple *def_stmt = NULLnullptr;
2125 tree op0, op1, op2, op3, arg0, arg1;
2126 enum tree_code code, code2 = ERROR_MARK;
2127 bool single_use_op0 = false;
2128
2129 gcc_checking_assert (gimple_assign_rhs_code (stmt) == VEC_PERM_EXPR)((void)(!(gimple_assign_rhs_code (stmt) == VEC_PERM_EXPR) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2129, __FUNCTION__), 0 : 0))
;
2130
2131 op0 = gimple_assign_rhs1 (stmt);
2132 op1 = gimple_assign_rhs2 (stmt);
2133 op2 = gimple_assign_rhs3 (stmt);
2134
2135 if (TREE_CODE (op2)((enum tree_code) (op2)->base.code) != VECTOR_CST)
2136 return 0;
2137
2138 if (TREE_CODE (op0)((enum tree_code) (op0)->base.code) == VECTOR_CST)
2139 {
2140 code = VECTOR_CST;
2141 arg0 = op0;
2142 }
2143 else if (TREE_CODE (op0)((enum tree_code) (op0)->base.code) == SSA_NAME)
2144 {
2145 def_stmt = get_prop_source_stmt (op0, false, &single_use_op0);
2146 if (!def_stmt)
2147 return 0;
2148 code = gimple_assign_rhs_code (def_stmt);
2149 if (code == VIEW_CONVERT_EXPR)
2150 {
2151 tree rhs = gimple_assign_rhs1 (def_stmt);
2152 tree name = TREE_OPERAND (rhs, 0)(*((const_cast<tree*> (tree_operand_check ((rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2152, __FUNCTION__)))))
;
2153 if (TREE_CODE (name)((enum tree_code) (name)->base.code) != SSA_NAME)
2154 return 0;
2155 if (!has_single_use (name))
2156 single_use_op0 = false;
2157 /* Here we update the def_stmt through this VIEW_CONVERT_EXPR,
2158 but still keep the code to indicate it comes from
2159 VIEW_CONVERT_EXPR. */
2160 def_stmt = SSA_NAME_DEF_STMT (name)(tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2160, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt
;
2161 if (!def_stmt || !is_gimple_assign (def_stmt))
2162 return 0;
2163 if (gimple_assign_rhs_code (def_stmt) != CONSTRUCTOR)
2164 return 0;
2165 }
2166 if (!can_propagate_from (def_stmt))
2167 return 0;
2168 arg0 = gimple_assign_rhs1 (def_stmt);
2169 }
2170 else
2171 return 0;
2172
2173 /* Two consecutive shuffles. */
2174 if (code == VEC_PERM_EXPR)
2175 {
2176 tree orig;
2177 int ident;
2178
2179 if (op0 != op1)
2180 return 0;
2181 op3 = gimple_assign_rhs3 (def_stmt);
2182 if (TREE_CODE (op3)((enum tree_code) (op3)->base.code) != VECTOR_CST)
2183 return 0;
2184 ident = is_combined_permutation_identity (op3, op2);
2185 if (!ident)
2186 return 0;
2187 orig = (ident == 1) ? gimple_assign_rhs1 (def_stmt)
2188 : gimple_assign_rhs2 (def_stmt);
2189 gimple_assign_set_rhs1 (stmt, unshare_expr (orig));
2190 gimple_assign_set_rhs_code (stmt, TREE_CODE (orig)((enum tree_code) (orig)->base.code));
2191 gimple_set_num_ops (stmt, 2);
2192 update_stmt (stmt);
2193 return remove_prop_source_from_use (op0) ? 2 : 1;
2194 }
2195 else if (code == CONSTRUCTOR
2196 || code == VECTOR_CST
2197 || code == VIEW_CONVERT_EXPR)
2198 {
2199 if (op0 != op1)
2200 {
2201 if (TREE_CODE (op0)((enum tree_code) (op0)->base.code) == SSA_NAME && !single_use_op0)
2202 return 0;
2203
2204 if (TREE_CODE (op1)((enum tree_code) (op1)->base.code) == VECTOR_CST)
2205 arg1 = op1;
2206 else if (TREE_CODE (op1)((enum tree_code) (op1)->base.code) == SSA_NAME)
2207 {
2208 gimple *def_stmt2 = get_prop_source_stmt (op1, true, NULLnullptr);
2209 if (!def_stmt2)
2210 return 0;
2211 code2 = gimple_assign_rhs_code (def_stmt2);
2212 if (code2 == VIEW_CONVERT_EXPR)
2213 {
2214 tree rhs = gimple_assign_rhs1 (def_stmt2);
2215 tree name = TREE_OPERAND (rhs, 0)(*((const_cast<tree*> (tree_operand_check ((rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2215, __FUNCTION__)))))
;
2216 if (TREE_CODE (name)((enum tree_code) (name)->base.code) != SSA_NAME)
2217 return 0;
2218 if (!has_single_use (name))
2219 return 0;
2220 def_stmt2 = SSA_NAME_DEF_STMT (name)(tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2220, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt
;
2221 if (!def_stmt2 || !is_gimple_assign (def_stmt2))
2222 return 0;
2223 if (gimple_assign_rhs_code (def_stmt2) != CONSTRUCTOR)
2224 return 0;
2225 }
2226 else if (code2 != CONSTRUCTOR && code2 != VECTOR_CST)
2227 return 0;
2228 if (!can_propagate_from (def_stmt2))
2229 return 0;
2230 arg1 = gimple_assign_rhs1 (def_stmt2);
2231 }
2232 else
2233 return 0;
2234 }
2235 else
2236 {
2237 /* Already used twice in this statement. */
2238 if (TREE_CODE (op0)((enum tree_code) (op0)->base.code) == SSA_NAME && num_imm_uses (op0) > 2)
2239 return 0;
2240 arg1 = arg0;
2241 }
2242
2243 /* If there are any VIEW_CONVERT_EXPRs found when finding permutation
2244 operands source, check whether it's valid to transform and prepare
2245 the required new operands. */
2246 if (code == VIEW_CONVERT_EXPR || code2 == VIEW_CONVERT_EXPR)
2247 {
2248 /* Figure out the target vector type to which operands should be
2249 converted. If both are CONSTRUCTOR, the types should be the
2250 same, otherwise, use the one of CONSTRUCTOR. */
2251 tree tgt_type = NULL_TREE(tree) nullptr;
2252 if (code == VIEW_CONVERT_EXPR)
2253 {
2254 gcc_assert (gimple_assign_rhs_code (def_stmt) == CONSTRUCTOR)((void)(!(gimple_assign_rhs_code (def_stmt) == CONSTRUCTOR) ?
fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2254, __FUNCTION__), 0 : 0))
;
2255 code = CONSTRUCTOR;
2256 tgt_type = TREE_TYPE (arg0)((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2256, __FUNCTION__))->typed.type)
;
2257 }
2258 if (code2 == VIEW_CONVERT_EXPR)
2259 {
2260 tree arg1_type = TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2260, __FUNCTION__))->typed.type)
;
2261 if (tgt_type == NULL_TREE(tree) nullptr)
2262 tgt_type = arg1_type;
2263 else if (tgt_type != arg1_type)
2264 return 0;
2265 }
2266
2267 if (!VECTOR_TYPE_P (tgt_type)(((enum tree_code) (tgt_type)->base.code) == VECTOR_TYPE))
2268 return 0;
2269 tree op2_type = TREE_TYPE (op2)((contains_struct_check ((op2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2269, __FUNCTION__))->typed.type)
;
2270
2271 /* Figure out the shrunk factor. */
2272 poly_uint64 tgt_units = TYPE_VECTOR_SUBPARTS (tgt_type);
2273 poly_uint64 op2_units = TYPE_VECTOR_SUBPARTS (op2_type);
2274 if (maybe_gt (tgt_units, op2_units)maybe_lt (op2_units, tgt_units))
2275 return 0;
2276 unsigned int factor;
2277 if (!constant_multiple_p (op2_units, tgt_units, &factor))
2278 return 0;
2279
2280 /* Build the new permutation control vector as target vector. */
2281 vec_perm_builder builder;
2282 if (!tree_to_vec_perm_builder (&builder, op2))
2283 return 0;
2284 vec_perm_indices indices (builder, 2, op2_units);
2285 vec_perm_indices new_indices;
2286 if (new_indices.new_shrunk_vector (indices, factor))
2287 {
2288 tree mask_type = tgt_type;
2289 if (!VECTOR_INTEGER_TYPE_P (mask_type)((((enum tree_code) (mask_type)->base.code) == VECTOR_TYPE
) && ((enum tree_code) (((contains_struct_check ((mask_type
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2289, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
)
)
2290 {
2291 tree elem_type = TREE_TYPE (mask_type)((contains_struct_check ((mask_type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2291, __FUNCTION__))->typed.type)
;
2292 unsigned elem_size = TREE_INT_CST_LOW (TYPE_SIZE (elem_type))((unsigned long) (*tree_int_cst_elt_check ((((tree_class_check
((elem_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2292, __FUNCTION__))->type_common.size)), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2292, __FUNCTION__)))
;
2293 tree int_type = build_nonstandard_integer_type (elem_size, 0);
2294 mask_type = build_vector_type (int_type, tgt_units);
2295 }
2296 op2 = vec_perm_indices_to_tree (mask_type, new_indices);
2297 }
2298 else
2299 return 0;
2300
2301 /* Convert the VECTOR_CST to the appropriate vector type. */
2302 if (tgt_type != TREE_TYPE (arg0)((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2302, __FUNCTION__))->typed.type)
)
2303 arg0 = fold_build1 (VIEW_CONVERT_EXPR, tgt_type, arg0)fold_build1_loc (((location_t) 0), VIEW_CONVERT_EXPR, tgt_type
, arg0 )
;
2304 else if (tgt_type != TREE_TYPE (arg1)((contains_struct_check ((arg1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2304, __FUNCTION__))->typed.type)
)
2305 arg1 = fold_build1 (VIEW_CONVERT_EXPR, tgt_type, arg1)fold_build1_loc (((location_t) 0), VIEW_CONVERT_EXPR, tgt_type
, arg1 )
;
2306 }
2307
2308 /* VIEW_CONVERT_EXPR should be updated to CONSTRUCTOR before. */
2309 gcc_assert (code == CONSTRUCTOR || code == VECTOR_CST)((void)(!(code == CONSTRUCTOR || code == VECTOR_CST) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2309, __FUNCTION__), 0 : 0))
;
2310
2311 /* Shuffle of a constructor. */
2312 bool ret = false;
2313 tree res_type = TREE_TYPE (arg0)((contains_struct_check ((arg0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2313, __FUNCTION__))->typed.type)
;
2314 tree opt = fold_ternary (VEC_PERM_EXPR, res_type, arg0, arg1, op2)fold_ternary_loc (((location_t) 0), VEC_PERM_EXPR, res_type, arg0
, arg1, op2)
;
2315 if (!opt
2316 || (TREE_CODE (opt)((enum tree_code) (opt)->base.code) != CONSTRUCTOR && TREE_CODE (opt)((enum tree_code) (opt)->base.code) != VECTOR_CST))
2317 return 0;
2318 /* Found VIEW_CONVERT_EXPR before, need one explicit conversion. */
2319 if (res_type != TREE_TYPE (op0)((contains_struct_check ((op0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2319, __FUNCTION__))->typed.type)
)
2320 {
2321 tree name = make_ssa_name (TREE_TYPE (opt)((contains_struct_check ((opt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2321, __FUNCTION__))->typed.type)
);
2322 gimple *ass_stmt = gimple_build_assign (name, opt);
2323 gsi_insert_before (gsi, ass_stmt, GSI_SAME_STMT);
2324 opt = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (op0)((contains_struct_check ((op0), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2324, __FUNCTION__))->typed.type)
, name);
2325 }
2326 gimple_assign_set_rhs_from_tree (gsi, opt);
2327 update_stmt (gsi_stmt (*gsi));
2328 if (TREE_CODE (op0)((enum tree_code) (op0)->base.code) == SSA_NAME)
2329 ret = remove_prop_source_from_use (op0);
2330 if (op0 != op1 && TREE_CODE (op1)((enum tree_code) (op1)->base.code) == SSA_NAME)
2331 ret |= remove_prop_source_from_use (op1);
2332 return ret ? 2 : 1;
2333 }
2334
2335 return 0;
2336}
2337
2338/* Get the BIT_FIELD_REF definition of VAL, if any, looking through
2339 conversions with code CONV_CODE or update it if still ERROR_MARK.
2340 Return NULL_TREE if no such matching def was found. */
2341
2342static tree
2343get_bit_field_ref_def (tree val, enum tree_code &conv_code)
2344{
2345 if (TREE_CODE (val)((enum tree_code) (val)->base.code) != SSA_NAME)
2346 return NULL_TREE(tree) nullptr ;
2347 gimple *def_stmt = get_prop_source_stmt (val, false, NULLnullptr);
2348 if (!def_stmt)
2349 return NULL_TREE(tree) nullptr;
2350 enum tree_code code = gimple_assign_rhs_code (def_stmt);
2351 if (code == FLOAT_EXPR
2352 || code == FIX_TRUNC_EXPR
2353 || CONVERT_EXPR_CODE_P (code)((code) == NOP_EXPR || (code) == CONVERT_EXPR))
2354 {
2355 tree op1 = gimple_assign_rhs1 (def_stmt);
2356 if (conv_code == ERROR_MARK)
2357 conv_code = code;
2358 else if (conv_code != code)
2359 return NULL_TREE(tree) nullptr;
2360 if (TREE_CODE (op1)((enum tree_code) (op1)->base.code) != SSA_NAME)
2361 return NULL_TREE(tree) nullptr;
2362 def_stmt = SSA_NAME_DEF_STMT (op1)(tree_check ((op1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2362, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt
;
2363 if (! is_gimple_assign (def_stmt))
2364 return NULL_TREE(tree) nullptr;
2365 code = gimple_assign_rhs_code (def_stmt);
2366 }
2367 if (code != BIT_FIELD_REF)
2368 return NULL_TREE(tree) nullptr;
2369 return gimple_assign_rhs1 (def_stmt);
2370}
2371
2372/* Recognize a VEC_PERM_EXPR. Returns true if there were any changes. */
2373
2374static bool
2375simplify_vector_constructor (gimple_stmt_iterator *gsi)
2376{
2377 gimple *stmt = gsi_stmt (*gsi);
2378 tree op, orig[2], type, elem_type;
2379 unsigned elem_size, i;
2380 unsigned HOST_WIDE_INTlong nelts;
2381 unsigned HOST_WIDE_INTlong refnelts;
2382 enum tree_code conv_code;
2383 constructor_elt *elt;
2384
2385 op = gimple_assign_rhs1 (stmt);
2386 type = TREE_TYPE (op)((contains_struct_check ((op), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2386, __FUNCTION__))->typed.type)
;
2387 gcc_checking_assert (TREE_CODE (op) == CONSTRUCTOR((void)(!(((enum tree_code) (op)->base.code) == CONSTRUCTOR
&& ((enum tree_code) (type)->base.code) == VECTOR_TYPE
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2388, __FUNCTION__), 0 : 0))
2388 && TREE_CODE (type) == VECTOR_TYPE)((void)(!(((enum tree_code) (op)->base.code) == CONSTRUCTOR
&& ((enum tree_code) (type)->base.code) == VECTOR_TYPE
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2388, __FUNCTION__), 0 : 0))
;
2389
2390 if (!TYPE_VECTOR_SUBPARTS (type).is_constant (&nelts))
2391 return false;
2392 elem_type = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2392, __FUNCTION__))->typed.type)
;
2393 elem_size = TREE_INT_CST_LOW (TYPE_SIZE (elem_type))((unsigned long) (*tree_int_cst_elt_check ((((tree_class_check
((elem_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2393, __FUNCTION__))->type_common.size)), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2393, __FUNCTION__)))
;
2394
2395 orig[0] = NULLnullptr;
2396 orig[1] = NULLnullptr;
2397 conv_code = ERROR_MARK;
2398 bool maybe_ident = true;
2399 bool maybe_blend[2] = { true, true };
2400 tree one_constant = NULL_TREE(tree) nullptr;
2401 tree one_nonconstant = NULL_TREE(tree) nullptr;
2402 auto_vec<tree> constants;
2403 constants.safe_grow_cleared (nelts, true);
2404 auto_vec<std::pair<unsigned, unsigned>, 64> elts;
2405 FOR_EACH_VEC_SAFE_ELT (CONSTRUCTOR_ELTS (op), i, elt)for (i = 0; vec_safe_iterate ((((tree_check ((op), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2405, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)),
(i), &(elt)); ++(i))
2406 {
2407 tree ref, op1;
2408 unsigned int elem;
2409
2410 if (i >= nelts)
2411 return false;
2412
2413 /* Look for elements extracted and possibly converted from
2414 another vector. */
2415 op1 = get_bit_field_ref_def (elt->value, conv_code);
2416 if (op1
2417 && TREE_CODE ((ref = TREE_OPERAND (op1, 0)))((enum tree_code) ((ref = (*((const_cast<tree*> (tree_operand_check
((op1), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2417, __FUNCTION__)))))))->base.code)
== SSA_NAME
2418 && VECTOR_TYPE_P (TREE_TYPE (ref))(((enum tree_code) (((contains_struct_check ((ref), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2418, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE
)
2419 && useless_type_conversion_p (TREE_TYPE (op1)((contains_struct_check ((op1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2419, __FUNCTION__))->typed.type)
,
2420 TREE_TYPE (TREE_TYPE (ref))((contains_struct_check ((((contains_struct_check ((ref), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2420, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2420, __FUNCTION__))->typed.type)
)
2421 && constant_multiple_p (bit_field_offset (op1),
2422 bit_field_size (op1), &elem)
2423 && TYPE_VECTOR_SUBPARTS (TREE_TYPE (ref)((contains_struct_check ((ref), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2423, __FUNCTION__))->typed.type)
).is_constant (&refnelts))
2424 {
2425 unsigned int j;
2426 for (j = 0; j < 2; ++j)
2427 {
2428 if (!orig[j])
2429 {
2430 if (j == 0
2431 || useless_type_conversion_p (TREE_TYPE (orig[0])((contains_struct_check ((orig[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2431, __FUNCTION__))->typed.type)
,
2432 TREE_TYPE (ref)((contains_struct_check ((ref), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2432, __FUNCTION__))->typed.type)
))
2433 break;
2434 }
2435 else if (ref == orig[j])
2436 break;
2437 }
2438 /* Found a suitable vector element. */
2439 if (j < 2)
2440 {
2441 orig[j] = ref;
2442 if (elem != i || j != 0)
2443 maybe_ident = false;
2444 if (elem != i)
2445 maybe_blend[j] = false;
2446 elts.safe_push (std::make_pair (j, elem));
2447 continue;
2448 }
2449 /* Else fallthru. */
2450 }
2451 /* Handle elements not extracted from a vector.
2452 1. constants by permuting with constant vector
2453 2. a unique non-constant element by permuting with a splat vector */
2454 if (orig[1]
2455 && orig[1] != error_mark_nodeglobal_trees[TI_ERROR_MARK])
2456 return false;
2457 orig[1] = error_mark_nodeglobal_trees[TI_ERROR_MARK];
2458 if (CONSTANT_CLASS_P (elt->value)(tree_code_type[(int) (((enum tree_code) (elt->value)->
base.code))] == tcc_constant)
)
2459 {
2460 if (one_nonconstant)
2461 return false;
2462 if (!one_constant)
2463 one_constant = elt->value;
2464 constants[i] = elt->value;
2465 }
2466 else
2467 {
2468 if (one_constant)
2469 return false;
2470 if (!one_nonconstant)
2471 one_nonconstant = elt->value;
2472 else if (!operand_equal_p (one_nonconstant, elt->value, 0))
2473 return false;
2474 }
2475 elts.safe_push (std::make_pair (1, i));
2476 maybe_ident = false;
2477 }
2478 if (i < nelts)
2479 return false;
2480
2481 if (! orig[0]
2482 || ! VECTOR_TYPE_P (TREE_TYPE (orig[0]))(((enum tree_code) (((contains_struct_check ((orig[0]), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2482, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE
)
)
2483 return false;
2484 refnelts = TYPE_VECTOR_SUBPARTS (TREE_TYPE (orig[0])((contains_struct_check ((orig[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2484, __FUNCTION__))->typed.type)
).to_constant ();
2485 /* We currently do not handle larger destination vectors. */
2486 if (refnelts < nelts)
2487 return false;
2488
2489 if (maybe_ident)
2490 {
2491 tree conv_src_type
2492 = (nelts != refnelts
2493 ? (conv_code != ERROR_MARK
2494 ? build_vector_type (TREE_TYPE (TREE_TYPE (orig[0]))((contains_struct_check ((((contains_struct_check ((orig[0]),
(TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2494, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2494, __FUNCTION__))->typed.type)
, nelts)
2495 : type)
2496 : TREE_TYPE (orig[0])((contains_struct_check ((orig[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2496, __FUNCTION__))->typed.type)
);
2497 if (conv_code != ERROR_MARK
2498 && !supportable_convert_operation (conv_code, type, conv_src_type,
2499 &conv_code))
2500 {
2501 /* Only few targets implement direct conversion patterns so try
2502 some simple special cases via VEC_[UN]PACK[_FLOAT]_LO_EXPR. */
2503 optab optab;
2504 tree halfvectype, dblvectype;
2505 enum tree_code unpack_op;
2506
2507 if (!BYTES_BIG_ENDIAN0)
2508 unpack_op = (FLOAT_TYPE_P (TREE_TYPE (type))((((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2508, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE
) || ((((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2508, __FUNCTION__))->typed.type))->base.code) == COMPLEX_TYPE
|| (((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2508, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE
)) && (((enum tree_code) (((contains_struct_check (((
(contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2508, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2508, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE
)))
2509 ? VEC_UNPACK_FLOAT_LO_EXPR
2510 : VEC_UNPACK_LO_EXPR);
2511 else
2512 unpack_op = (FLOAT_TYPE_P (TREE_TYPE (type))((((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2512, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE
) || ((((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2512, __FUNCTION__))->typed.type))->base.code) == COMPLEX_TYPE
|| (((enum tree_code) (((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2512, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE
)) && (((enum tree_code) (((contains_struct_check (((
(contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2512, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2512, __FUNCTION__))->typed.type))->base.code) == REAL_TYPE
)))
2513 ? VEC_UNPACK_FLOAT_HI_EXPR
2514 : VEC_UNPACK_HI_EXPR);
2515
2516 if (CONVERT_EXPR_CODE_P (conv_code)((conv_code) == NOP_EXPR || (conv_code) == CONVERT_EXPR)
2517 && (2 * TYPE_PRECISION (TREE_TYPE (TREE_TYPE (orig[0])))((tree_class_check ((((contains_struct_check ((((contains_struct_check
((orig[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2517, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2517, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2517, __FUNCTION__))->type_common.precision)
2518 == TYPE_PRECISION (TREE_TYPE (type))((tree_class_check ((((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2518, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2518, __FUNCTION__))->type_common.precision)
)
2519 && mode_for_vector (as_a <scalar_mode>
2520 (TYPE_MODE (TREE_TYPE (TREE_TYPE (orig[0])))((((enum tree_code) ((tree_class_check ((((contains_struct_check
((((contains_struct_check ((orig[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2520, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2520, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2520, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(((contains_struct_check ((((contains_struct_check ((orig[0]
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2520, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2520, __FUNCTION__))->typed.type)) : (((contains_struct_check
((((contains_struct_check ((orig[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2520, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2520, __FUNCTION__))->typed.type))->type_common.mode)
),
2521 nelts * 2).exists ()
2522 && (dblvectype
2523 = build_vector_type (TREE_TYPE (TREE_TYPE (orig[0]))((contains_struct_check ((((contains_struct_check ((orig[0]),
(TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2523, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2523, __FUNCTION__))->typed.type)
,
2524 nelts * 2))
2525 /* Only use it for vector modes or for vector booleans
2526 represented as scalar bitmasks. See PR95528. */
2527 && (VECTOR_MODE_P (TYPE_MODE (dblvectype))(((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((dblvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2527, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(dblvectype) : (dblvectype)->type_common.mode)]) == MODE_VECTOR_BOOL
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((dblvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2527, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(dblvectype) : (dblvectype)->type_common.mode)]) == MODE_VECTOR_INT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((dblvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2527, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(dblvectype) : (dblvectype)->type_common.mode)]) == MODE_VECTOR_FLOAT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((dblvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2527, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(dblvectype) : (dblvectype)->type_common.mode)]) == MODE_VECTOR_FRACT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((dblvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2527, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(dblvectype) : (dblvectype)->type_common.mode)]) == MODE_VECTOR_UFRACT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((dblvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2527, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(dblvectype) : (dblvectype)->type_common.mode)]) == MODE_VECTOR_ACCUM
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((dblvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2527, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(dblvectype) : (dblvectype)->type_common.mode)]) == MODE_VECTOR_UACCUM
)
2528 || VECTOR_BOOLEAN_TYPE_P (dblvectype)(((enum tree_code) (dblvectype)->base.code) == VECTOR_TYPE
&& ((enum tree_code) (((contains_struct_check ((dblvectype
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2528, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
)
)
2529 && (optab = optab_for_tree_code (unpack_op,
2530 dblvectype,
2531 optab_default))
2532 && (optab_handler (optab, TYPE_MODE (dblvectype)((((enum tree_code) ((tree_class_check ((dblvectype), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2532, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(dblvectype) : (dblvectype)->type_common.mode)
)
2533 != CODE_FOR_nothing))
2534 {
2535 gimple_seq stmts = NULLnullptr;
2536 tree dbl;
2537 if (refnelts == nelts)
2538 {
2539 /* ??? Paradoxical subregs don't exist, so insert into
2540 the lower half of a wider zero vector. */
2541 dbl = gimple_build (&stmts, BIT_INSERT_EXPR, dblvectype,
2542 build_zero_cst (dblvectype), orig[0],
2543 bitsize_zero_nodeglobal_trees[TI_BITSIZE_ZERO]);
2544 }
2545 else if (refnelts == 2 * nelts)
2546 dbl = orig[0];
2547 else
2548 dbl = gimple_build (&stmts, BIT_FIELD_REF, dblvectype,
2549 orig[0], TYPE_SIZE (dblvectype)((tree_class_check ((dblvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2549, __FUNCTION__))->type_common.size)
,
2550 bitsize_zero_nodeglobal_trees[TI_BITSIZE_ZERO]);
2551 gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT);
2552 gimple_assign_set_rhs_with_ops (gsi, unpack_op, dbl);
2553 }
2554 else if (CONVERT_EXPR_CODE_P (conv_code)((conv_code) == NOP_EXPR || (conv_code) == CONVERT_EXPR)
2555 && (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (orig[0])))((tree_class_check ((((contains_struct_check ((((contains_struct_check
((orig[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2555, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2555, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2555, __FUNCTION__))->type_common.precision)
2556 == 2 * TYPE_PRECISION (TREE_TYPE (type))((tree_class_check ((((contains_struct_check ((type), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2556, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2556, __FUNCTION__))->type_common.precision)
)
2557 && mode_for_vector (as_a <scalar_mode>
2558 (TYPE_MODE((((enum tree_code) ((tree_class_check ((((contains_struct_check
((((contains_struct_check ((orig[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(((contains_struct_check ((((contains_struct_check ((orig[0]
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__))->typed.type)) : (((contains_struct_check
((((contains_struct_check ((orig[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__))->typed.type))->type_common.mode)
2559 (TREE_TYPE (TREE_TYPE (orig[0])))((((enum tree_code) ((tree_class_check ((((contains_struct_check
((((contains_struct_check ((orig[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(((contains_struct_check ((((contains_struct_check ((orig[0]
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__))->typed.type)) : (((contains_struct_check
((((contains_struct_check ((orig[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2559, __FUNCTION__))->typed.type))->type_common.mode)
),
2560 nelts / 2).exists ()
2561 && (halfvectype
2562 = build_vector_type (TREE_TYPE (TREE_TYPE (orig[0]))((contains_struct_check ((((contains_struct_check ((orig[0]),
(TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2562, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2562, __FUNCTION__))->typed.type)
,
2563 nelts / 2))
2564 /* Only use it for vector modes or for vector booleans
2565 represented as scalar bitmasks. See PR95528. */
2566 && (VECTOR_MODE_P (TYPE_MODE (halfvectype))(((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((halfvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2566, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(halfvectype) : (halfvectype)->type_common.mode)]) == MODE_VECTOR_BOOL
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((halfvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2566, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(halfvectype) : (halfvectype)->type_common.mode)]) == MODE_VECTOR_INT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((halfvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2566, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(halfvectype) : (halfvectype)->type_common.mode)]) == MODE_VECTOR_FLOAT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((halfvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2566, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(halfvectype) : (halfvectype)->type_common.mode)]) == MODE_VECTOR_FRACT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((halfvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2566, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(halfvectype) : (halfvectype)->type_common.mode)]) == MODE_VECTOR_UFRACT
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((halfvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2566, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(halfvectype) : (halfvectype)->type_common.mode)]) == MODE_VECTOR_ACCUM
|| ((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((halfvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2566, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(halfvectype) : (halfvectype)->type_common.mode)]) == MODE_VECTOR_UACCUM
)
2567 || VECTOR_BOOLEAN_TYPE_P (halfvectype)(((enum tree_code) (halfvectype)->base.code) == VECTOR_TYPE
&& ((enum tree_code) (((contains_struct_check ((halfvectype
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2567, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
)
)
2568 && (optab = optab_for_tree_code (VEC_PACK_TRUNC_EXPR,
2569 halfvectype,
2570 optab_default))
2571 && (optab_handler (optab, TYPE_MODE (halfvectype)((((enum tree_code) ((tree_class_check ((halfvectype), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2571, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(halfvectype) : (halfvectype)->type_common.mode)
)
2572 != CODE_FOR_nothing))
2573 {
2574 gimple_seq stmts = NULLnullptr;
2575 tree low = gimple_build (&stmts, BIT_FIELD_REF, halfvectype,
2576 orig[0], TYPE_SIZE (halfvectype)((tree_class_check ((halfvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2576, __FUNCTION__))->type_common.size)
,
2577 bitsize_zero_nodeglobal_trees[TI_BITSIZE_ZERO]);
2578 tree hig = gimple_build (&stmts, BIT_FIELD_REF, halfvectype,
2579 orig[0], TYPE_SIZE (halfvectype)((tree_class_check ((halfvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2579, __FUNCTION__))->type_common.size)
,
2580 TYPE_SIZE (halfvectype)((tree_class_check ((halfvectype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2580, __FUNCTION__))->type_common.size)
);
2581 gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT);
2582 gimple_assign_set_rhs_with_ops (gsi, VEC_PACK_TRUNC_EXPR,
2583 low, hig);
2584 }
2585 else
2586 return false;
2587 update_stmt (gsi_stmt (*gsi));
2588 return true;
2589 }
2590 if (nelts != refnelts)
2591 {
2592 gassign *lowpart
2593 = gimple_build_assign (make_ssa_name (conv_src_type),
2594 build3 (BIT_FIELD_REF, conv_src_type,
2595 orig[0], TYPE_SIZE (conv_src_type)((tree_class_check ((conv_src_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2595, __FUNCTION__))->type_common.size)
,
2596 bitsize_zero_nodeglobal_trees[TI_BITSIZE_ZERO]));
2597 gsi_insert_before (gsi, lowpart, GSI_SAME_STMT);
2598 orig[0] = gimple_assign_lhs (lowpart);
2599 }
2600 if (conv_code == ERROR_MARK)
2601 {
2602 tree src_type = TREE_TYPE (orig[0])((contains_struct_check ((orig[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2602, __FUNCTION__))->typed.type)
;
2603 if (!useless_type_conversion_p (type, src_type))
2604 {
2605 gcc_assert (known_eq (TYPE_VECTOR_SUBPARTS (type),((void)(!((!maybe_ne (TYPE_VECTOR_SUBPARTS (type), TYPE_VECTOR_SUBPARTS
(src_type))) && useless_type_conversion_p (((contains_struct_check
((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2607, __FUNCTION__))->typed.type), ((contains_struct_check
((src_type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2608, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2608, __FUNCTION__), 0 : 0))
2606 TYPE_VECTOR_SUBPARTS (src_type))((void)(!((!maybe_ne (TYPE_VECTOR_SUBPARTS (type), TYPE_VECTOR_SUBPARTS
(src_type))) && useless_type_conversion_p (((contains_struct_check
((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2607, __FUNCTION__))->typed.type), ((contains_struct_check
((src_type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2608, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2608, __FUNCTION__), 0 : 0))
2607 && useless_type_conversion_p (TREE_TYPE (type),((void)(!((!maybe_ne (TYPE_VECTOR_SUBPARTS (type), TYPE_VECTOR_SUBPARTS
(src_type))) && useless_type_conversion_p (((contains_struct_check
((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2607, __FUNCTION__))->typed.type), ((contains_struct_check
((src_type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2608, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2608, __FUNCTION__), 0 : 0))
2608 TREE_TYPE (src_type)))((void)(!((!maybe_ne (TYPE_VECTOR_SUBPARTS (type), TYPE_VECTOR_SUBPARTS
(src_type))) && useless_type_conversion_p (((contains_struct_check
((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2607, __FUNCTION__))->typed.type), ((contains_struct_check
((src_type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2608, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2608, __FUNCTION__), 0 : 0))
;
2609 tree rhs = build1 (VIEW_CONVERT_EXPR, type, orig[0]);
2610 orig[0] = make_ssa_name (type);
2611 gassign *assign = gimple_build_assign (orig[0], rhs);
2612 gsi_insert_before (gsi, assign, GSI_SAME_STMT);
2613 }
2614 gimple_assign_set_rhs_from_tree (gsi, orig[0]);
2615 }
2616 else
2617 gimple_assign_set_rhs_with_ops (gsi, conv_code, orig[0],
2618 NULL_TREE(tree) nullptr, NULL_TREE(tree) nullptr);
2619 }
2620 else
2621 {
2622 /* If we combine a vector with a non-vector avoid cases where
2623 we'll obviously end up with more GIMPLE stmts which is when
2624 we'll later not fold this to a single insert into the vector
2625 and we had a single extract originally. See PR92819. */
2626 if (nelts == 2
2627 && refnelts > 2
2628 && orig[1] == error_mark_nodeglobal_trees[TI_ERROR_MARK]
2629 && !maybe_blend[0])
2630 return false;
2631 tree mask_type, perm_type, conv_src_type;
2632 perm_type = TREE_TYPE (orig[0])((contains_struct_check ((orig[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2632, __FUNCTION__))->typed.type)
;
2633 conv_src_type = (nelts == refnelts
2634 ? perm_type
2635 : build_vector_type (TREE_TYPE (perm_type)((contains_struct_check ((perm_type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2635, __FUNCTION__))->typed.type)
, nelts));
2636 if (conv_code != ERROR_MARK
2637 && !supportable_convert_operation (conv_code, type, conv_src_type,
2638 &conv_code))
2639 return false;
2640
2641 /* Now that we know the number of elements of the source build the
2642 permute vector.
2643 ??? When the second vector has constant values we can shuffle
2644 it and its source indexes to make the permutation supported.
2645 For now it mimics a blend. */
2646 vec_perm_builder sel (refnelts, refnelts, 1);
2647 bool all_same_p = true;
2648 for (i = 0; i < elts.length (); ++i)
2649 {
2650 sel.quick_push (elts[i].second + elts[i].first * refnelts);
2651 all_same_p &= known_eq (sel[i], sel[0])(!maybe_ne (sel[i], sel[0]));
2652 }
2653 /* And fill the tail with "something". It's really don't care,
2654 and ideally we'd allow VEC_PERM to have a smaller destination
2655 vector. As a heuristic:
2656
2657 (a) if what we have so far duplicates a single element, make the
2658 tail do the same
2659
2660 (b) otherwise preserve a uniform orig[0]. This facilitates
2661 later pattern-matching of VEC_PERM_EXPR to a BIT_INSERT_EXPR. */
2662 for (; i < refnelts; ++i)
2663 sel.quick_push (all_same_p
2664 ? sel[0]
2665 : (elts[0].second == 0 && elts[0].first == 0
2666 ? 0 : refnelts) + i);
2667 vec_perm_indices indices (sel, orig[1] ? 2 : 1, refnelts);
2668 if (!can_vec_perm_const_p (TYPE_MODE (perm_type)((((enum tree_code) ((tree_class_check ((perm_type), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2668, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(perm_type) : (perm_type)->type_common.mode)
, indices))
2669 return false;
2670 mask_type
2671 = build_vector_type (build_nonstandard_integer_type (elem_size, 1),
2672 refnelts);
2673 if (GET_MODE_CLASS (TYPE_MODE (mask_type))((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((mask_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2673, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(mask_type) : (mask_type)->type_common.mode)])
!= MODE_VECTOR_INT
2674 || maybe_ne (GET_MODE_SIZE (TYPE_MODE (mask_type)((((enum tree_code) ((tree_class_check ((mask_type), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2674, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(mask_type) : (mask_type)->type_common.mode)
),
2675 GET_MODE_SIZE (TYPE_MODE (perm_type)((((enum tree_code) ((tree_class_check ((perm_type), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2675, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(perm_type) : (perm_type)->type_common.mode)
)))
2676 return false;
2677 tree op2 = vec_perm_indices_to_tree (mask_type, indices);
2678 bool converted_orig1 = false;
2679 gimple_seq stmts = NULLnullptr;
2680 if (!orig[1])
2681 orig[1] = orig[0];
2682 else if (orig[1] == error_mark_nodeglobal_trees[TI_ERROR_MARK]
2683 && one_nonconstant)
2684 {
2685 /* ??? We can see if we can safely convert to the original
2686 element type. */
2687 converted_orig1 = conv_code != ERROR_MARK;
2688 orig[1] = gimple_build_vector_from_val (&stmts, UNKNOWN_LOCATION((location_t) 0),
2689 converted_orig1
2690 ? type : perm_type,
2691 one_nonconstant);
2692 }
2693 else if (orig[1] == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2694 {
2695 /* ??? See if we can convert the vector to the original type. */
2696 converted_orig1 = conv_code != ERROR_MARK;
2697 unsigned n = converted_orig1 ? nelts : refnelts;
2698 tree_vector_builder vec (converted_orig1
2699 ? type : perm_type, n, 1);
2700 for (unsigned i = 0; i < n; ++i)
2701 if (i < nelts && constants[i])
2702 vec.quick_push (constants[i]);
2703 else
2704 /* ??? Push a don't-care value. */
2705 vec.quick_push (one_constant);
2706 orig[1] = vec.build ();
2707 }
2708 tree blend_op2 = NULL_TREE(tree) nullptr;
2709 if (converted_orig1)
2710 {
2711 /* Make sure we can do a blend in the target type. */
2712 vec_perm_builder sel (nelts, nelts, 1);
2713 for (i = 0; i < elts.length (); ++i)
2714 sel.quick_push (elts[i].first
2715 ? elts[i].second + nelts : i);
2716 vec_perm_indices indices (sel, 2, nelts);
2717 if (!can_vec_perm_const_p (TYPE_MODE (type)((((enum tree_code) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2717, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)
, indices))
2718 return false;
2719 mask_type
2720 = build_vector_type (build_nonstandard_integer_type (elem_size, 1),
2721 nelts);
2722 if (GET_MODE_CLASS (TYPE_MODE (mask_type))((enum mode_class) mode_class[((((enum tree_code) ((tree_class_check
((mask_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2722, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(mask_type) : (mask_type)->type_common.mode)])
!= MODE_VECTOR_INT
2723 || maybe_ne (GET_MODE_SIZE (TYPE_MODE (mask_type)((((enum tree_code) ((tree_class_check ((mask_type), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2723, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(mask_type) : (mask_type)->type_common.mode)
),
2724 GET_MODE_SIZE (TYPE_MODE (type)((((enum tree_code) ((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2724, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(type) : (type)->type_common.mode)
)))
2725 return false;
2726 blend_op2 = vec_perm_indices_to_tree (mask_type, indices);
2727 }
2728 tree orig1_for_perm
2729 = converted_orig1 ? build_zero_cst (perm_type) : orig[1];
2730 tree res = gimple_build (&stmts, VEC_PERM_EXPR, perm_type,
2731 orig[0], orig1_for_perm, op2);
2732 if (nelts != refnelts)
2733 res = gimple_build (&stmts, BIT_FIELD_REF,
2734 conv_code != ERROR_MARK ? conv_src_type : type,
2735 res, TYPE_SIZE (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2735, __FUNCTION__))->type_common.size)
, bitsize_zero_nodeglobal_trees[TI_BITSIZE_ZERO]);
2736 if (conv_code != ERROR_MARK)
2737 res = gimple_build (&stmts, conv_code, type, res);
2738 else if (!useless_type_conversion_p (type, TREE_TYPE (res)((contains_struct_check ((res), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2738, __FUNCTION__))->typed.type)
))
2739 {
2740 gcc_assert (known_eq (TYPE_VECTOR_SUBPARTS (type),((void)(!((!maybe_ne (TYPE_VECTOR_SUBPARTS (type), TYPE_VECTOR_SUBPARTS
(perm_type))) && useless_type_conversion_p (((contains_struct_check
((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2742, __FUNCTION__))->typed.type), ((contains_struct_check
((perm_type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2743, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2743, __FUNCTION__), 0 : 0))
2741 TYPE_VECTOR_SUBPARTS (perm_type))((void)(!((!maybe_ne (TYPE_VECTOR_SUBPARTS (type), TYPE_VECTOR_SUBPARTS
(perm_type))) && useless_type_conversion_p (((contains_struct_check
((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2742, __FUNCTION__))->typed.type), ((contains_struct_check
((perm_type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2743, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2743, __FUNCTION__), 0 : 0))
2742 && useless_type_conversion_p (TREE_TYPE (type),((void)(!((!maybe_ne (TYPE_VECTOR_SUBPARTS (type), TYPE_VECTOR_SUBPARTS
(perm_type))) && useless_type_conversion_p (((contains_struct_check
((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2742, __FUNCTION__))->typed.type), ((contains_struct_check
((perm_type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2743, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2743, __FUNCTION__), 0 : 0))
2743 TREE_TYPE (perm_type)))((void)(!((!maybe_ne (TYPE_VECTOR_SUBPARTS (type), TYPE_VECTOR_SUBPARTS
(perm_type))) && useless_type_conversion_p (((contains_struct_check
((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2742, __FUNCTION__))->typed.type), ((contains_struct_check
((perm_type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2743, __FUNCTION__))->typed.type))) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2743, __FUNCTION__), 0 : 0))
;
2744 res = gimple_build (&stmts, VIEW_CONVERT_EXPR, type, res);
2745 }
2746 /* Blend in the actual constant. */
2747 if (converted_orig1)
2748 res = gimple_build (&stmts, VEC_PERM_EXPR, type,
2749 res, orig[1], blend_op2);
2750 gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT);
2751 gimple_assign_set_rhs_with_ops (gsi, SSA_NAME, res);
2752 }
2753 update_stmt (gsi_stmt (*gsi));
2754 return true;
2755}
2756
2757
2758/* Rewrite the vector load at *GSI to component-wise loads if the load
2759 is only used in BIT_FIELD_REF extractions with eventual intermediate
2760 widening. */
2761
2762static void
2763optimize_vector_load (gimple_stmt_iterator *gsi)
2764{
2765 gimple *stmt = gsi_stmt (*gsi);
2766 tree lhs = gimple_assign_lhs (stmt);
2767 tree rhs = gimple_assign_rhs1 (stmt);
2768
2769 /* Gather BIT_FIELD_REFs to rewrite, looking through
2770 VEC_UNPACK_{LO,HI}_EXPR. */
2771 use_operand_p use_p;
2772 imm_use_iterator iter;
2773 bool rewrite = true;
2774 auto_vec<gimple *, 8> bf_stmts;
2775 auto_vec<tree, 8> worklist;
2776 worklist.quick_push (lhs);
2777 do
2778 {
2779 tree def = worklist.pop ();
2780 unsigned HOST_WIDE_INTlong def_eltsize
2781 = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (TREE_TYPE (def))))((unsigned long) (*tree_int_cst_elt_check ((((tree_class_check
((((contains_struct_check ((((contains_struct_check ((def), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2781, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2781, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2781, __FUNCTION__))->type_common.size)), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2781, __FUNCTION__)))
;
2782 FOR_EACH_IMM_USE_FAST (use_p, iter, def)for ((use_p) = first_readonly_imm_use (&(iter), (def)); !
end_readonly_imm_use_p (&(iter)); (void) ((use_p) = next_readonly_imm_use
(&(iter))))
2783 {
2784 gimple *use_stmt = USE_STMT (use_p)(use_p)->loc.stmt;
2785 if (is_gimple_debug (use_stmt))
2786 continue;
2787 if (!is_gimple_assign (use_stmt))
2788 {
2789 rewrite = false;
2790 break;
2791 }
2792 enum tree_code use_code = gimple_assign_rhs_code (use_stmt);
2793 tree use_rhs = gimple_assign_rhs1 (use_stmt);
2794 if (use_code == BIT_FIELD_REF
2795 && TREE_OPERAND (use_rhs, 0)(*((const_cast<tree*> (tree_operand_check ((use_rhs), (
0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2795, __FUNCTION__)))))
== def
2796 /* If its on the VEC_UNPACK_{HI,LO}_EXPR
2797 def need to verify it is element aligned. */
2798 && (def == lhs
2799 || (known_eq (bit_field_size (use_rhs), def_eltsize)(!maybe_ne (bit_field_size (use_rhs), def_eltsize))
2800 && constant_multiple_p (bit_field_offset (use_rhs),
2801 def_eltsize))))
2802 {
2803 bf_stmts.safe_push (use_stmt);
2804 continue;
2805 }
2806 /* Walk through one level of VEC_UNPACK_{LO,HI}_EXPR. */
2807 if (def == lhs
2808 && (use_code == VEC_UNPACK_HI_EXPR
2809 || use_code == VEC_UNPACK_LO_EXPR)
2810 && use_rhs == lhs)
2811 {
2812 worklist.safe_push (gimple_assign_lhs (use_stmt));
2813 continue;
2814 }
2815 rewrite = false;
2816 break;
2817 }
2818 if (!rewrite)
2819 break;
2820 }
2821 while (!worklist.is_empty ());
2822
2823 if (!rewrite)
2824 {
2825 gsi_next (gsi);
2826 return;
2827 }
2828 /* We now have all ultimate uses of the load to rewrite in bf_stmts. */
2829
2830 /* Prepare the original ref to be wrapped in adjusted BIT_FIELD_REFs.
2831 For TARGET_MEM_REFs we have to separate the LEA from the reference. */
2832 tree load_rhs = rhs;
2833 if (TREE_CODE (load_rhs)((enum tree_code) (load_rhs)->base.code) == TARGET_MEM_REF)
2834 {
2835 if (TREE_CODE (TREE_OPERAND (load_rhs, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((load_rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2835, __FUNCTION__))))))->base.code)
== ADDR_EXPR)
2836 mark_addressable (TREE_OPERAND (TREE_OPERAND (load_rhs, 0), 0)(*((const_cast<tree*> (tree_operand_check (((*((const_cast
<tree*> (tree_operand_check ((load_rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2836, __FUNCTION__)))))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2836, __FUNCTION__)))))
);
2837 tree tem = make_ssa_name (TREE_TYPE (TREE_OPERAND (load_rhs, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((load_rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2837, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2837, __FUNCTION__))->typed.type)
);
2838 gimple *new_stmt
2839 = gimple_build_assign (tem, build1 (ADDR_EXPR, TREE_TYPE (tem)((contains_struct_check ((tem), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2839, __FUNCTION__))->typed.type)
,
2840 unshare_expr (load_rhs)));
2841 gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT);
2842 load_rhs = build2_loc (EXPR_LOCATION (load_rhs)((((load_rhs)) && ((tree_code_type[(int) (((enum tree_code
) ((load_rhs))->base.code))]) >= tcc_reference &&
(tree_code_type[(int) (((enum tree_code) ((load_rhs))->base
.code))]) <= tcc_expression)) ? (load_rhs)->exp.locus :
((location_t) 0))
,
2843 MEM_REF, TREE_TYPE (load_rhs)((contains_struct_check ((load_rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2843, __FUNCTION__))->typed.type)
, tem,
2844 build_int_cst
2845 (TREE_TYPE (TREE_OPERAND (load_rhs, 1))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((load_rhs), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2845, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2845, __FUNCTION__))->typed.type)
, 0));
2846 }
2847
2848 /* Rewrite the BIT_FIELD_REFs to be actual loads, re-emitting them at
2849 the place of the original load. */
2850 for (gimple *use_stmt : bf_stmts)
2851 {
2852 tree bfr = gimple_assign_rhs1 (use_stmt);
2853 tree new_rhs = unshare_expr (load_rhs);
2854 if (TREE_OPERAND (bfr, 0)(*((const_cast<tree*> (tree_operand_check ((bfr), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2854, __FUNCTION__)))))
!= lhs)
2855 {
2856 /* When the BIT_FIELD_REF is on the promoted vector we have to
2857 adjust it and emit a conversion afterwards. */
2858 gimple *def_stmt
2859 = SSA_NAME_DEF_STMT (TREE_OPERAND (bfr, 0))(tree_check (((*((const_cast<tree*> (tree_operand_check
((bfr), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2859, __FUNCTION__)))))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2859, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt
;
2860 enum tree_code def_code
2861 = gimple_assign_rhs_code (def_stmt);
2862
2863 /* The adjusted BIT_FIELD_REF is of the promotion source
2864 vector size and at half of the offset... */
2865 new_rhs = fold_build3 (BIT_FIELD_REF,fold_build3_loc (((location_t) 0), BIT_FIELD_REF, ((contains_struct_check
((((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type), new_rhs, ((tree_class_check
((((contains_struct_check ((((contains_struct_check ((lhs), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->type_common.size), size_binop_loc (
((location_t) 0), EXACT_DIV_EXPR, (*((const_cast<tree*>
(tree_operand_check ((bfr), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2870, __FUNCTION__))))), size_int_kind (2, stk_bitsizetype)
) )
2866 TREE_TYPE (TREE_TYPE (lhs)),fold_build3_loc (((location_t) 0), BIT_FIELD_REF, ((contains_struct_check
((((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type), new_rhs, ((tree_class_check
((((contains_struct_check ((((contains_struct_check ((lhs), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->type_common.size), size_binop_loc (
((location_t) 0), EXACT_DIV_EXPR, (*((const_cast<tree*>
(tree_operand_check ((bfr), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2870, __FUNCTION__))))), size_int_kind (2, stk_bitsizetype)
) )
2867 new_rhs,fold_build3_loc (((location_t) 0), BIT_FIELD_REF, ((contains_struct_check
((((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type), new_rhs, ((tree_class_check
((((contains_struct_check ((((contains_struct_check ((lhs), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->type_common.size), size_binop_loc (
((location_t) 0), EXACT_DIV_EXPR, (*((const_cast<tree*>
(tree_operand_check ((bfr), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2870, __FUNCTION__))))), size_int_kind (2, stk_bitsizetype)
) )
2868 TYPE_SIZE (TREE_TYPE (TREE_TYPE (lhs))),fold_build3_loc (((location_t) 0), BIT_FIELD_REF, ((contains_struct_check
((((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type), new_rhs, ((tree_class_check
((((contains_struct_check ((((contains_struct_check ((lhs), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->type_common.size), size_binop_loc (
((location_t) 0), EXACT_DIV_EXPR, (*((const_cast<tree*>
(tree_operand_check ((bfr), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2870, __FUNCTION__))))), size_int_kind (2, stk_bitsizetype)
) )
2869 size_binop (EXACT_DIV_EXPR,fold_build3_loc (((location_t) 0), BIT_FIELD_REF, ((contains_struct_check
((((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type), new_rhs, ((tree_class_check
((((contains_struct_check ((((contains_struct_check ((lhs), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->type_common.size), size_binop_loc (
((location_t) 0), EXACT_DIV_EXPR, (*((const_cast<tree*>
(tree_operand_check ((bfr), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2870, __FUNCTION__))))), size_int_kind (2, stk_bitsizetype)
) )
2870 TREE_OPERAND (bfr, 2),fold_build3_loc (((location_t) 0), BIT_FIELD_REF, ((contains_struct_check
((((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type), new_rhs, ((tree_class_check
((((contains_struct_check ((((contains_struct_check ((lhs), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->type_common.size), size_binop_loc (
((location_t) 0), EXACT_DIV_EXPR, (*((const_cast<tree*>
(tree_operand_check ((bfr), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2870, __FUNCTION__))))), size_int_kind (2, stk_bitsizetype)
) )
2871 bitsize_int (2)))fold_build3_loc (((location_t) 0), BIT_FIELD_REF, ((contains_struct_check
((((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2866, __FUNCTION__))->typed.type), new_rhs, ((tree_class_check
((((contains_struct_check ((((contains_struct_check ((lhs), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2868, __FUNCTION__))->type_common.size), size_binop_loc (
((location_t) 0), EXACT_DIV_EXPR, (*((const_cast<tree*>
(tree_operand_check ((bfr), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2870, __FUNCTION__))))), size_int_kind (2, stk_bitsizetype)
) )
;
2872 /* ... and offsetted by half of the vector if VEC_UNPACK_HI_EXPR. */
2873 if (def_code == (!BYTES_BIG_ENDIAN0
2874 ? VEC_UNPACK_HI_EXPR : VEC_UNPACK_LO_EXPR))
2875 TREE_OPERAND (new_rhs, 2)(*((const_cast<tree*> (tree_operand_check ((new_rhs), (
2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2875, __FUNCTION__)))))
2876 = size_binop (PLUS_EXPR, TREE_OPERAND (new_rhs, 2),size_binop_loc (((location_t) 0), PLUS_EXPR, (*((const_cast<
tree*> (tree_operand_check ((new_rhs), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2876, __FUNCTION__))))), size_binop_loc (((location_t) 0), EXACT_DIV_EXPR
, ((tree_class_check ((((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2878, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2878, __FUNCTION__))->type_common.size), size_int_kind (
2, stk_bitsizetype)))
2877 size_binop (EXACT_DIV_EXPR,size_binop_loc (((location_t) 0), PLUS_EXPR, (*((const_cast<
tree*> (tree_operand_check ((new_rhs), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2876, __FUNCTION__))))), size_binop_loc (((location_t) 0), EXACT_DIV_EXPR
, ((tree_class_check ((((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2878, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2878, __FUNCTION__))->type_common.size), size_int_kind (
2, stk_bitsizetype)))
2878 TYPE_SIZE (TREE_TYPE (lhs)),size_binop_loc (((location_t) 0), PLUS_EXPR, (*((const_cast<
tree*> (tree_operand_check ((new_rhs), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2876, __FUNCTION__))))), size_binop_loc (((location_t) 0), EXACT_DIV_EXPR
, ((tree_class_check ((((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2878, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2878, __FUNCTION__))->type_common.size), size_int_kind (
2, stk_bitsizetype)))
2879 bitsize_int (2)))size_binop_loc (((location_t) 0), PLUS_EXPR, (*((const_cast<
tree*> (tree_operand_check ((new_rhs), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2876, __FUNCTION__))))), size_binop_loc (((location_t) 0), EXACT_DIV_EXPR
, ((tree_class_check ((((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2878, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2878, __FUNCTION__))->type_common.size), size_int_kind (
2, stk_bitsizetype)))
;
2880 tree tem = make_ssa_name (TREE_TYPE (TREE_TYPE (lhs))((contains_struct_check ((((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2880, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2880, __FUNCTION__))->typed.type)
);
2881 gimple *new_stmt = gimple_build_assign (tem, new_rhs);
2882 location_t loc = gimple_location (use_stmt);
2883 gimple_set_location (new_stmt, loc);
2884 gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT);
2885 /* Perform scalar promotion. */
2886 new_stmt = gimple_build_assign (gimple_assign_lhs (use_stmt),
2887 NOP_EXPR, tem);
2888 gimple_set_location (new_stmt, loc);
2889 gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT);
2890 }
2891 else
2892 {
2893 /* When the BIT_FIELD_REF is on the original load result
2894 we can just wrap that. */
2895 tree new_rhs = fold_build3 (BIT_FIELD_REF, TREE_TYPE (bfr),fold_build3_loc (((location_t) 0), BIT_FIELD_REF, ((contains_struct_check
((bfr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2895, __FUNCTION__))->typed.type), unshare_expr (load_rhs
), (*((const_cast<tree*> (tree_operand_check ((bfr), (1
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2897, __FUNCTION__))))), (*((const_cast<tree*> (tree_operand_check
((bfr), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2898, __FUNCTION__))))) )
2896 unshare_expr (load_rhs),fold_build3_loc (((location_t) 0), BIT_FIELD_REF, ((contains_struct_check
((bfr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2895, __FUNCTION__))->typed.type), unshare_expr (load_rhs
), (*((const_cast<tree*> (tree_operand_check ((bfr), (1
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2897, __FUNCTION__))))), (*((const_cast<tree*> (tree_operand_check
((bfr), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2898, __FUNCTION__))))) )
2897 TREE_OPERAND (bfr, 1),fold_build3_loc (((location_t) 0), BIT_FIELD_REF, ((contains_struct_check
((bfr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2895, __FUNCTION__))->typed.type), unshare_expr (load_rhs
), (*((const_cast<tree*> (tree_operand_check ((bfr), (1
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2897, __FUNCTION__))))), (*((const_cast<tree*> (tree_operand_check
((bfr), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2898, __FUNCTION__))))) )
2898 TREE_OPERAND (bfr, 2))fold_build3_loc (((location_t) 0), BIT_FIELD_REF, ((contains_struct_check
((bfr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2895, __FUNCTION__))->typed.type), unshare_expr (load_rhs
), (*((const_cast<tree*> (tree_operand_check ((bfr), (1
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2897, __FUNCTION__))))), (*((const_cast<tree*> (tree_operand_check
((bfr), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2898, __FUNCTION__))))) )
;
2899 gimple *new_stmt = gimple_build_assign (gimple_assign_lhs (use_stmt),
2900 new_rhs);
2901 location_t loc = gimple_location (use_stmt);
2902 gimple_set_location (new_stmt, loc);
2903 gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT);
2904 }
2905 gimple_stmt_iterator gsi2 = gsi_for_stmt (use_stmt);
2906 unlink_stmt_vdef (use_stmt);
2907 gsi_remove (&gsi2, true);
2908 }
2909
2910 /* Finally get rid of the intermediate stmts. */
2911 gimple *use_stmt;
2912 FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs)for (struct auto_end_imm_use_stmt_traverse auto_end_imm_use_stmt_traverse
((((use_stmt) = first_imm_use_stmt (&(iter), (lhs))), &
(iter))); !end_imm_use_stmt_p (&(iter)); (void) ((use_stmt
) = next_imm_use_stmt (&(iter))))
2913 {
2914 if (is_gimple_debug (use_stmt))
2915 {
2916 if (gimple_debug_bind_p (use_stmt))
2917 {
2918 gimple_debug_bind_reset_value (use_stmt);
2919 update_stmt (use_stmt);
2920 }
2921 continue;
2922 }
2923 gimple_stmt_iterator gsi2 = gsi_for_stmt (use_stmt);
2924 unlink_stmt_vdef (use_stmt);
2925 release_defs (use_stmt);
2926 gsi_remove (&gsi2, true);
2927 }
2928 /* And the original load. */
2929 release_defs (stmt);
2930 gsi_remove (gsi, true);
2931}
2932
2933
2934/* Primitive "lattice" function for gimple_simplify. */
2935
2936static tree
2937fwprop_ssa_val (tree name)
2938{
2939 /* First valueize NAME. */
2940 if (TREE_CODE (name)((enum tree_code) (name)->base.code) == SSA_NAME
2941 && SSA_NAME_VERSION (name)(tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2941, __FUNCTION__, (SSA_NAME)))->base.u.version
< lattice.length ())
2942 {
2943 tree val = lattice[SSA_NAME_VERSION (name)(tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 2943, __FUNCTION__, (SSA_NAME)))->base.u.version
];
2944 if (val)
2945 name = val;
2946 }
2947 /* We continue matching along SSA use-def edges for SSA names
2948 that are not single-use. Currently there are no patterns
2949 that would cause any issues with that. */
2950 return name;
2951}
2952
2953/* Main entry point for the forward propagation and statement combine
2954 optimizer. */
2955
2956namespace {
2957
2958const pass_data pass_data_forwprop =
2959{
2960 GIMPLE_PASS, /* type */
2961 "forwprop", /* name */
2962 OPTGROUP_NONE, /* optinfo_flags */
2963 TV_TREE_FORWPROP, /* tv_id */
2964 ( PROP_cfg(1 << 3) | PROP_ssa(1 << 5) ), /* properties_required */
2965 0, /* properties_provided */
2966 0, /* properties_destroyed */
2967 0, /* todo_flags_start */
2968 TODO_update_ssa(1 << 11), /* todo_flags_finish */
2969};
2970
2971class pass_forwprop : public gimple_opt_pass
2972{
2973public:
2974 pass_forwprop (gcc::context *ctxt)
2975 : gimple_opt_pass (pass_data_forwprop, ctxt)
2976 {}
2977
2978 /* opt_pass methods: */
2979 opt_pass * clone () { return new pass_forwprop (m_ctxt); }
2980 virtual bool gate (function *) { return flag_tree_forwpropglobal_options.x_flag_tree_forwprop; }
2981 virtual unsigned int execute (function *);
2982
2983}; // class pass_forwprop
2984
2985unsigned int
2986pass_forwprop::execute (function *fun)
2987{
2988 unsigned int todoflags = 0;
2989
2990 cfg_changed = false;
2991
2992 /* Combine stmts with the stmts defining their operands. Do that
2993 in an order that guarantees visiting SSA defs before SSA uses. */
2994 lattice.create (num_ssa_names(vec_safe_length ((cfun + 0)->gimple_df->ssa_names)));
2995 lattice.quick_grow_cleared (num_ssa_names(vec_safe_length ((cfun + 0)->gimple_df->ssa_names)));
2996 int *postorder = XNEWVEC (int, n_basic_blocks_for_fn (fun))((int *) xmalloc (sizeof (int) * (((fun)->cfg->x_n_basic_blocks
))))
;
2997 int postorder_num = pre_and_rev_post_order_compute_fn (cfun(cfun + 0), NULLnullptr,
2998 postorder, false);
2999 auto_vec<gimple *, 4> to_fixup;
3000 auto_vec<gimple *, 32> to_remove;
3001 to_purge = BITMAP_ALLOCbitmap_alloc (NULLnullptr);
3002 for (int i = 0; i < postorder_num; ++i)
3003 {
3004 gimple_stmt_iterator gsi;
3005 basic_block bb = BASIC_BLOCK_FOR_FN (fun, postorder[i])((*((fun)->cfg->x_basic_block_info))[(postorder[i])]);
3006
3007 /* Record degenerate PHIs in the lattice. */
3008 for (gphi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
3009 gsi_next (&si))
3010 {
3011 gphi *phi = si.phi ();
3012 tree res = gimple_phi_result (phi);
3013 if (virtual_operand_p (res))
3014 continue;
3015
3016 use_operand_p use_p;
3017 ssa_op_iter it;
3018 tree first = NULL_TREE(tree) nullptr;
3019 bool all_same = true;
3020 FOR_EACH_PHI_ARG (use_p, phi, it, SSA_OP_USE)for ((use_p) = op_iter_init_phiuse (&(it), phi, 0x01); !op_iter_done
(&(it)); (use_p) = op_iter_next_use (&(it)))
3021 {
3022 tree use = USE_FROM_PTR (use_p)get_use_from_ptr (use_p);
3023 if (! first)
3024 first = use;
3025 else if (! operand_equal_p (first, use, 0))
3026 {
3027 all_same = false;
3028 break;
3029 }
3030 }
3031 if (all_same)
3032 {
3033 if (may_propagate_copy (res, first))
3034 to_remove.safe_push (phi);
3035 fwprop_set_lattice_val (res, first);
3036 }
3037 }
3038
3039 /* Apply forward propagation to all stmts in the basic-block.
3040 Note we update GSI within the loop as necessary. */
3041 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
3042 {
3043 gimple *stmt = gsi_stmt (gsi);
3044 tree lhs, rhs;
3045 enum tree_code code;
3046
3047 if (!is_gimple_assign (stmt))
3048 {
3049 gsi_next (&gsi);
3050 continue;
3051 }
3052
3053 lhs = gimple_assign_lhs (stmt);
3054 rhs = gimple_assign_rhs1 (stmt);
3055 code = gimple_assign_rhs_code (stmt);
3056 if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) != SSA_NAME
3057 || has_zero_uses (lhs))
3058 {
3059 gsi_next (&gsi);
3060 continue;
3061 }
3062
3063 /* If this statement sets an SSA_NAME to an address,
3064 try to propagate the address into the uses of the SSA_NAME. */
3065 if ((code == ADDR_EXPR
3066 /* Handle pointer conversions on invariant addresses
3067 as well, as this is valid gimple. */
3068 || (CONVERT_EXPR_CODE_P (code)((code) == NOP_EXPR || (code) == CONVERT_EXPR)
3069 && TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == ADDR_EXPR
3070 && POINTER_TYPE_P (TREE_TYPE (lhs))(((enum tree_code) (((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3070, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
|| ((enum tree_code) (((contains_struct_check ((lhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3070, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
))
3071 && TREE_CODE (TREE_OPERAND (rhs, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3071, __FUNCTION__))))))->base.code)
!= TARGET_MEM_REF)
3072 {
3073 tree base = get_base_address (TREE_OPERAND (rhs, 0)(*((const_cast<tree*> (tree_operand_check ((rhs), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3073, __FUNCTION__)))))
);
3074 if ((!base
3075 || !DECL_P (base)(tree_code_type[(int) (((enum tree_code) (base)->base.code
))] == tcc_declaration)
3076 || decl_address_invariant_p (base))
3077 && !stmt_references_abnormal_ssa_name (stmt)
3078 && forward_propagate_addr_expr (lhs, rhs, true))
3079 {
3080 fwprop_invalidate_lattice (gimple_get_lhs (stmt));
3081 release_defs (stmt);
3082 gsi_remove (&gsi, true);
3083 }
3084 else
3085 gsi_next (&gsi);
3086 }
3087 else if (code == POINTER_PLUS_EXPR)
3088 {
3089 tree off = gimple_assign_rhs2 (stmt);
3090 if (TREE_CODE (off)((enum tree_code) (off)->base.code) == INTEGER_CST
3091 && can_propagate_from (stmt)
3092 && !simple_iv_increment_p (stmt)
3093 /* ??? Better adjust the interface to that function
3094 instead of building new trees here. */
3095 && forward_propagate_addr_expr
3096 (lhs,
3097 build1_loc (gimple_location (stmt),
3098 ADDR_EXPR, TREE_TYPE (rhs)((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3098, __FUNCTION__))->typed.type)
,
3099 fold_build2 (MEM_REF,fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3100, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3100, __FUNCTION__))->typed.type), rhs, fold_convert_loc
(((location_t) 0), global_trees[TI_PTR_TYPE], off) )
3100 TREE_TYPE (TREE_TYPE (rhs)),fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3100, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3100, __FUNCTION__))->typed.type), rhs, fold_convert_loc
(((location_t) 0), global_trees[TI_PTR_TYPE], off) )
3101 rhs,fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3100, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3100, __FUNCTION__))->typed.type), rhs, fold_convert_loc
(((location_t) 0), global_trees[TI_PTR_TYPE], off) )
3102 fold_convert (ptr_type_node,fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3100, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3100, __FUNCTION__))->typed.type), rhs, fold_convert_loc
(((location_t) 0), global_trees[TI_PTR_TYPE], off) )
3103 off))fold_build2_loc (((location_t) 0), MEM_REF, ((contains_struct_check
((((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3100, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3100, __FUNCTION__))->typed.type), rhs, fold_convert_loc
(((location_t) 0), global_trees[TI_PTR_TYPE], off) )
), true))
3104 {
3105 fwprop_invalidate_lattice (gimple_get_lhs (stmt));
3106 release_defs (stmt);
3107 gsi_remove (&gsi, true);
3108 }
3109 else if (is_gimple_min_invariant (rhs))
3110 {
3111 /* Make sure to fold &a[0] + off_1 here. */
3112 fold_stmt_inplace (&gsi);
3113 update_stmt (stmt);
3114 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
3115 gsi_next (&gsi);
3116 }
3117 else
3118 gsi_next (&gsi);
3119 }
3120 else if (TREE_CODE (TREE_TYPE (lhs))((enum tree_code) (((contains_struct_check ((lhs), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3120, __FUNCTION__))->typed.type))->base.code)
== COMPLEX_TYPE
3121 && gimple_assign_load_p (stmt)
3122 && !gimple_has_volatile_ops (stmt)
3123 && (TREE_CODE (gimple_assign_rhs1 (stmt))((enum tree_code) (gimple_assign_rhs1 (stmt))->base.code)
3124 != TARGET_MEM_REF)
3125 && !stmt_can_throw_internal (cfun(cfun + 0), stmt))
3126 {
3127 /* Rewrite loads used only in real/imagpart extractions to
3128 component-wise loads. */
3129 use_operand_p use_p;
3130 imm_use_iterator iter;
3131 bool rewrite = true;
3132 FOR_EACH_IMM_USE_FAST (use_p, iter, lhs)for ((use_p) = first_readonly_imm_use (&(iter), (lhs)); !
end_readonly_imm_use_p (&(iter)); (void) ((use_p) = next_readonly_imm_use
(&(iter))))
3133 {
3134 gimple *use_stmt = USE_STMT (use_p)(use_p)->loc.stmt;
3135 if (is_gimple_debug (use_stmt))
3136 continue;
3137 if (!is_gimple_assign (use_stmt)
3138 || (gimple_assign_rhs_code (use_stmt) != REALPART_EXPR
3139 && gimple_assign_rhs_code (use_stmt) != IMAGPART_EXPR)
3140 || TREE_OPERAND (gimple_assign_rhs1 (use_stmt), 0)(*((const_cast<tree*> (tree_operand_check ((gimple_assign_rhs1
(use_stmt)), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3140, __FUNCTION__)))))
!= lhs)
3141 {
3142 rewrite = false;
3143 break;
3144 }
3145 }
3146 if (rewrite)
3147 {
3148 gimple *use_stmt;
3149 FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs)for (struct auto_end_imm_use_stmt_traverse auto_end_imm_use_stmt_traverse
((((use_stmt) = first_imm_use_stmt (&(iter), (lhs))), &
(iter))); !end_imm_use_stmt_p (&(iter)); (void) ((use_stmt
) = next_imm_use_stmt (&(iter))))
3150 {
3151 if (is_gimple_debug (use_stmt))
3152 {
3153 if (gimple_debug_bind_p (use_stmt))
3154 {
3155 gimple_debug_bind_reset_value (use_stmt);
3156 update_stmt (use_stmt);
3157 }
3158 continue;
3159 }
3160
3161 tree new_rhs = build1 (gimple_assign_rhs_code (use_stmt),
3162 TREE_TYPE (TREE_TYPE (rhs))((contains_struct_check ((((contains_struct_check ((rhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3162, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3162, __FUNCTION__))->typed.type)
,
3163 unshare_expr (rhs));
3164 gimple *new_stmt
3165 = gimple_build_assign (gimple_assign_lhs (use_stmt),
3166 new_rhs);
3167
3168 location_t loc = gimple_location (use_stmt);
3169 gimple_set_location (new_stmt, loc);
3170 gimple_stmt_iterator gsi2 = gsi_for_stmt (use_stmt);
3171 unlink_stmt_vdef (use_stmt);
3172 gsi_remove (&gsi2, true);
3173
3174 gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT);
3175 }
3176
3177 release_defs (stmt);
3178 gsi_remove (&gsi, true);
3179 }
3180 else
3181 gsi_next (&gsi);
3182 }
3183 else if (TREE_CODE (TREE_TYPE (lhs))((enum tree_code) (((contains_struct_check ((lhs), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3183, __FUNCTION__))->typed.type))->base.code)
== VECTOR_TYPE
3184 && (TYPE_MODE (TREE_TYPE (lhs))((((enum tree_code) ((tree_class_check ((((contains_struct_check
((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3184, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3184, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(((contains_struct_check ((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3184, __FUNCTION__))->typed.type)) : (((contains_struct_check
((lhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3184, __FUNCTION__))->typed.type))->type_common.mode)
== BLKmode((void) 0, E_BLKmode)
3185 /* After vector lowering rewrite all loads, but
3186 initially do not since this conflicts with
3187 vector CONSTRUCTOR to shuffle optimization. */
3188 || (fun->curr_properties & PROP_gimple_lvec(1 << 12)))
3189 && gimple_assign_load_p (stmt)
3190 && !gimple_has_volatile_ops (stmt)
3191 && !stmt_can_throw_internal (cfun(cfun + 0), stmt)
3192 && (!VAR_P (rhs)(((enum tree_code) (rhs)->base.code) == VAR_DECL) || !DECL_HARD_REGISTER (rhs)((tree_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3192, __FUNCTION__, (VAR_DECL)))->decl_with_vis.hard_register
)
))
3193 optimize_vector_load (&gsi);
3194
3195 else if (code == COMPLEX_EXPR)
3196 {
3197 /* Rewrite stores of a single-use complex build expression
3198 to component-wise stores. */
3199 use_operand_p use_p;
3200 gimple *use_stmt;
3201 if (single_imm_use (lhs, &use_p, &use_stmt)
3202 && gimple_store_p (use_stmt)
3203 && !gimple_has_volatile_ops (use_stmt)
3204 && is_gimple_assign (use_stmt)
3205 && (TREE_CODE (gimple_assign_lhs (use_stmt))((enum tree_code) (gimple_assign_lhs (use_stmt))->base.code
)
3206 != TARGET_MEM_REF))
3207 {
3208 tree use_lhs = gimple_assign_lhs (use_stmt);
3209 if (auto_var_p (use_lhs))
3210 DECL_NOT_GIMPLE_REG_P (use_lhs)(contains_struct_check ((use_lhs), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3210, __FUNCTION__))->decl_common.not_gimple_reg_flag
= 1;
3211 tree new_lhs = build1 (REALPART_EXPR,
3212 TREE_TYPE (TREE_TYPE (use_lhs))((contains_struct_check ((((contains_struct_check ((use_lhs),
(TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3212, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3212, __FUNCTION__))->typed.type)
,
3213 unshare_expr (use_lhs));
3214 gimple *new_stmt = gimple_build_assign (new_lhs, rhs);
3215 location_t loc = gimple_location (use_stmt);
3216 gimple_set_location (new_stmt, loc);
3217 gimple_set_vuse (new_stmt, gimple_vuse (use_stmt));
3218 gimple_set_vdef (new_stmt, make_ssa_name (gimple_vop (cfun(cfun + 0))));
3219 SSA_NAME_DEF_STMT (gimple_vdef (new_stmt))(tree_check ((gimple_vdef (new_stmt)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3219, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt
= new_stmt;
3220 gimple_set_vuse (use_stmt, gimple_vdef (new_stmt));
3221 gimple_stmt_iterator gsi2 = gsi_for_stmt (use_stmt);
3222 gsi_insert_before (&gsi2, new_stmt, GSI_SAME_STMT);
3223
3224 new_lhs = build1 (IMAGPART_EXPR,
3225 TREE_TYPE (TREE_TYPE (use_lhs))((contains_struct_check ((((contains_struct_check ((use_lhs),
(TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3225, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3225, __FUNCTION__))->typed.type)
,
3226 unshare_expr (use_lhs));
3227 gimple_assign_set_lhs (use_stmt, new_lhs);
3228 gimple_assign_set_rhs1 (use_stmt, gimple_assign_rhs2 (stmt));
3229 update_stmt (use_stmt);
3230
3231 release_defs (stmt);
3232 gsi_remove (&gsi, true);
3233 }
3234 else
3235 gsi_next (&gsi);
3236 }
3237 else if (code == CONSTRUCTOR
3238 && VECTOR_TYPE_P (TREE_TYPE (rhs))(((enum tree_code) (((contains_struct_check ((rhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3238, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE
)
3239 && TYPE_MODE (TREE_TYPE (rhs))((((enum tree_code) ((tree_class_check ((((contains_struct_check
((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3239, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3239, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(((contains_struct_check ((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3239, __FUNCTION__))->typed.type)) : (((contains_struct_check
((rhs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3239, __FUNCTION__))->typed.type))->type_common.mode)
== BLKmode((void) 0, E_BLKmode)
3240 && CONSTRUCTOR_NELTS (rhs)(vec_safe_length (((tree_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3240, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
> 0
3241 && (!VECTOR_TYPE_P (TREE_TYPE (CONSTRUCTOR_ELT (rhs, 0)->value))(((enum tree_code) (((contains_struct_check (((&(*((tree_check
((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3241, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])->value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3241, __FUNCTION__))->typed.type))->base.code) == VECTOR_TYPE
)
3242 || (TYPE_MODE (TREE_TYPE (CONSTRUCTOR_ELT (rhs, 0)->value))((((enum tree_code) ((tree_class_check ((((contains_struct_check
(((&(*((tree_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3242, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])->value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3242, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3242, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(((contains_struct_check (((&(*((tree_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3242, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])->value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3242, __FUNCTION__))->typed.type)) : (((contains_struct_check
(((&(*((tree_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3242, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])->value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3242, __FUNCTION__))->typed.type))->type_common.mode)
3243 != BLKmode((void) 0, E_BLKmode))))
3244 {
3245 /* Rewrite stores of a single-use vector constructors
3246 to component-wise stores if the mode isn't supported. */
3247 use_operand_p use_p;
3248 gimple *use_stmt;
3249 if (single_imm_use (lhs, &use_p, &use_stmt)
3250 && gimple_store_p (use_stmt)
3251 && !gimple_has_volatile_ops (use_stmt)
3252 && !stmt_can_throw_internal (cfun(cfun + 0), use_stmt)
3253 && is_gimple_assign (use_stmt)
3254 && (TREE_CODE (gimple_assign_lhs (use_stmt))((enum tree_code) (gimple_assign_lhs (use_stmt))->base.code
)
3255 != TARGET_MEM_REF))
3256 {
3257 tree elt_t = TREE_TYPE (CONSTRUCTOR_ELT (rhs, 0)->value)((contains_struct_check (((&(*((tree_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3257, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])->value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3257, __FUNCTION__))->typed.type)
;
3258 unsigned HOST_WIDE_INTlong elt_w
3259 = tree_to_uhwi (TYPE_SIZE (elt_t)((tree_class_check ((elt_t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3259, __FUNCTION__))->type_common.size)
);
3260 unsigned HOST_WIDE_INTlong n
3261 = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (rhs))((tree_class_check ((((contains_struct_check ((rhs), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3261, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3261, __FUNCTION__))->type_common.size)
);
3262 tree use_lhs = gimple_assign_lhs (use_stmt);
3263 if (auto_var_p (use_lhs))
3264 DECL_NOT_GIMPLE_REG_P (use_lhs)(contains_struct_check ((use_lhs), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3264, __FUNCTION__))->decl_common.not_gimple_reg_flag
= 1;
3265 for (unsigned HOST_WIDE_INTlong bi = 0; bi < n; bi += elt_w)
3266 {
3267 unsigned HOST_WIDE_INTlong ci = bi / elt_w;
3268 tree new_rhs;
3269 if (ci < CONSTRUCTOR_NELTS (rhs)(vec_safe_length (((tree_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3269, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
)
3270 new_rhs = CONSTRUCTOR_ELT (rhs, ci)(&(*((tree_check ((rhs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3270, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
ci])
->value;
3271 else
3272 new_rhs = build_zero_cst (elt_t);
3273 tree new_lhs = build3 (BIT_FIELD_REF,
3274 elt_t,
3275 unshare_expr (use_lhs),
3276 bitsize_int (elt_w)size_int_kind (elt_w, stk_bitsizetype),
3277 bitsize_int (bi)size_int_kind (bi, stk_bitsizetype));
3278 gimple *new_stmt = gimple_build_assign (new_lhs, new_rhs);
3279 location_t loc = gimple_location (use_stmt);
3280 gimple_set_location (new_stmt, loc);
3281 gimple_set_vuse (new_stmt, gimple_vuse (use_stmt));
3282 gimple_set_vdef (new_stmt,
3283 make_ssa_name (gimple_vop (cfun(cfun + 0))));
3284 SSA_NAME_DEF_STMT (gimple_vdef (new_stmt))(tree_check ((gimple_vdef (new_stmt)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3284, __FUNCTION__, (SSA_NAME)))->ssa_name.def_stmt
= new_stmt;
3285 gimple_set_vuse (use_stmt, gimple_vdef (new_stmt));
3286 gimple_stmt_iterator gsi2 = gsi_for_stmt (use_stmt);
3287 gsi_insert_before (&gsi2, new_stmt, GSI_SAME_STMT);
3288 }
3289 gimple_stmt_iterator gsi2 = gsi_for_stmt (use_stmt);
3290 unlink_stmt_vdef (use_stmt);
3291 release_defs (use_stmt);
3292 gsi_remove (&gsi2, true);
3293 release_defs (stmt);
3294 gsi_remove (&gsi, true);
3295 }
3296 else
3297 gsi_next (&gsi);
3298 }
3299 else
3300 gsi_next (&gsi);
3301 }
3302
3303 /* Combine stmts with the stmts defining their operands.
3304 Note we update GSI within the loop as necessary. */
3305 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
3306 {
3307 gimple *stmt = gsi_stmt (gsi);
3308
3309 /* Mark stmt as potentially needing revisiting. */
3310 gimple_set_plf (stmt, GF_PLF_1, false);
3311
3312 /* Substitute from our lattice. We need to do so only once. */
3313 bool substituted_p = false;
3314 use_operand_p usep;
3315 ssa_op_iter iter;
3316 FOR_EACH_SSA_USE_OPERAND (usep, stmt, iter, SSA_OP_USE)for (usep = op_iter_init_use (&(iter), stmt, 0x01); !op_iter_done
(&(iter)); usep = op_iter_next_use (&(iter)))
3317 {
3318 tree use = USE_FROM_PTR (usep)get_use_from_ptr (usep);
3319 tree val = fwprop_ssa_val (use);
3320 if (val && val != use && may_propagate_copy (use, val))
3321 {
3322 propagate_value (usep, val);
3323 substituted_p = true;
3324 }
3325 }
3326 if (substituted_p
3327 && is_gimple_assign (stmt)
3328 && gimple_assign_rhs_code (stmt) == ADDR_EXPR)
3329 recompute_tree_invariant_for_addr_expr (gimple_assign_rhs1 (stmt));
3330
3331 bool changed;
3332 do
3333 {
3334 gimple *orig_stmt = stmt = gsi_stmt (gsi);
3335 bool was_noreturn = (is_gimple_call (stmt)
3336 && gimple_call_noreturn_p (stmt));
3337 changed = false;
3338
3339 if (fold_stmt (&gsi, fwprop_ssa_val))
3340 {
3341 changed = true;
3342 stmt = gsi_stmt (gsi);
3343 /* Cleanup the CFG if we simplified a condition to
3344 true or false. */
3345 if (gcond *cond = dyn_cast <gcond *> (stmt))
3346 if (gimple_cond_true_p (cond)
3347 || gimple_cond_false_p (cond))
3348 cfg_changed = true;
3349 }
3350
3351 if (changed || substituted_p)
3352 {
3353 if (maybe_clean_or_replace_eh_stmt (orig_stmt, stmt))
3354 bitmap_set_bit (to_purge, bb->index);
3355 if (!was_noreturn
3356 && is_gimple_call (stmt) && gimple_call_noreturn_p (stmt))
3357 to_fixup.safe_push (stmt);
3358 update_stmt (stmt);
3359 substituted_p = false;
3360 }
3361
3362 switch (gimple_code (stmt))
3363 {
3364 case GIMPLE_ASSIGN:
3365 {
3366 tree rhs1 = gimple_assign_rhs1 (stmt);
3367 enum tree_code code = gimple_assign_rhs_code (stmt);
3368
3369 if (code == COND_EXPR)
3370 {
3371 /* In this case the entire COND_EXPR is in rhs1. */
3372 if (forward_propagate_into_cond (&gsi))
3373 {
3374 changed = true;
3375 stmt = gsi_stmt (gsi);
Value stored to 'stmt' is never read
3376 }
3377 }
3378 else if (TREE_CODE_CLASS (code)tree_code_type[(int) (code)] == tcc_comparison)
3379 {
3380 int did_something;
3381 did_something = forward_propagate_into_comparison (&gsi);
3382 if (maybe_clean_or_replace_eh_stmt (stmt, gsi_stmt (gsi)))
3383 bitmap_set_bit (to_purge, bb->index);
3384 if (did_something == 2)
3385 cfg_changed = true;
3386 changed = did_something != 0;
3387 }
3388 else if ((code == PLUS_EXPR
3389 || code == BIT_IOR_EXPR
3390 || code == BIT_XOR_EXPR)
3391 && simplify_rotate (&gsi))
3392 changed = true;
3393 else if (code == VEC_PERM_EXPR)
3394 {
3395 int did_something = simplify_permutation (&gsi);
3396 if (did_something == 2)
3397 cfg_changed = true;
3398 changed = did_something != 0;
3399 }
3400 else if (code == BIT_FIELD_REF)
3401 changed = simplify_bitfield_ref (&gsi);
3402 else if (code == CONSTRUCTOR
3403 && TREE_CODE (TREE_TYPE (rhs1))((enum tree_code) (((contains_struct_check ((rhs1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3403, __FUNCTION__))->typed.type))->base.code)
== VECTOR_TYPE)
3404 changed = simplify_vector_constructor (&gsi);
3405 else if (code == ARRAY_REF)
3406 changed = simplify_count_trailing_zeroes (&gsi);
3407 break;
3408 }
3409
3410 case GIMPLE_SWITCH:
3411 changed = simplify_gimple_switch (as_a <gswitch *> (stmt));
3412 break;
3413
3414 case GIMPLE_COND:
3415 {
3416 int did_something = forward_propagate_into_gimple_cond
3417 (as_a <gcond *> (stmt));
3418 if (did_something == 2)
3419 cfg_changed = true;
3420 changed = did_something != 0;
3421 break;
3422 }
3423
3424 case GIMPLE_CALL:
3425 {
3426 tree callee = gimple_call_fndecl (stmt);
3427 if (callee != NULL_TREE(tree) nullptr
3428 && fndecl_built_in_p (callee, BUILT_IN_NORMAL))
3429 changed = simplify_builtin_call (&gsi, callee);
3430 break;
3431 }
3432
3433 default:;
3434 }
3435
3436 if (changed)
3437 {
3438 /* If the stmt changed then re-visit it and the statements
3439 inserted before it. */
3440 for (; !gsi_end_p (gsi); gsi_prev (&gsi))
3441 if (gimple_plf (gsi_stmt (gsi), GF_PLF_1))
3442 break;
3443 if (gsi_end_p (gsi))
3444 gsi = gsi_start_bb (bb);
3445 else
3446 gsi_next (&gsi);
3447 }
3448 }
3449 while (changed);
3450
3451 /* Stmt no longer needs to be revisited. */
3452 stmt = gsi_stmt (gsi);
3453 gcc_checking_assert (!gimple_plf (stmt, GF_PLF_1))((void)(!(!gimple_plf (stmt, GF_PLF_1)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/tree-ssa-forwprop.c"
, 3453, __FUNCTION__), 0 : 0))
;
3454 gimple_set_plf (stmt, GF_PLF_1, true);
3455
3456 /* Fill up the lattice. */
3457 if (gimple_assign_single_p (stmt))
3458 {
3459 tree lhs = gimple_assign_lhs (stmt);
3460 tree rhs = gimple_assign_rhs1 (stmt);
3461 if (TREE_CODE (lhs)((enum tree_code) (lhs)->base.code) == SSA_NAME)
3462 {
3463 tree val = lhs;
3464 if (TREE_CODE (rhs)((enum tree_code) (rhs)->base.code) == SSA_NAME)
3465 val = fwprop_ssa_val (rhs);
3466 else if (is_gimple_min_invariant (rhs))
3467 val = rhs;
3468 /* If we can propagate the lattice-value mark the
3469 stmt for removal. */
3470 if (val != lhs
3471 && may_propagate_copy (lhs, val))
3472 to_remove.safe_push (stmt);
3473 fwprop_set_lattice_val (lhs, val);
3474 }
3475 }
3476 else if (gimple_nop_p (stmt))
3477 to_remove.safe_push (stmt);
3478 }
3479
3480 /* Substitute in destination PHI arguments. */
3481 edge_iterator ei;
3482 edge e;
3483 FOR_EACH_EDGE (e, ei, bb->succs)for ((ei) = ei_start_1 (&((bb->succs))); ei_cond ((ei)
, &(e)); ei_next (&(ei)))
3484 for (gphi_iterator gsi = gsi_start_phis (e->dest);
3485 !gsi_end_p (gsi); gsi_next (&gsi))
3486 {
3487 gphi *phi = gsi.phi ();
3488 use_operand_p use_p = PHI_ARG_DEF_PTR_FROM_EDGE (phi, e)gimple_phi_arg_imm_use_ptr (((phi)), ((e)->dest_idx));
3489 tree arg = USE_FROM_PTR (use_p)get_use_from_ptr (use_p);
3490 if (TREE_CODE (arg)((enum tree_code) (arg)->base.code) != SSA_NAME
3491 || virtual_operand_p (arg))
3492 continue;
3493 tree val = fwprop_ssa_val (arg);
3494 if (val != arg
3495 && may_propagate_copy (arg, val))
3496 propagate_value (use_p, val);
3497 }
3498 }
3499 free (postorder);
3500 lattice.release ();
3501
3502 /* Remove stmts in reverse order to make debug stmt creation possible. */
3503 while (!to_remove.is_empty())
3504 {
3505 gimple *stmt = to_remove.pop ();
3506 if (dump_file && (dump_flags & TDF_DETAILS))
3507 {
3508 fprintf (dump_file, "Removing dead stmt ");
3509 print_gimple_stmt (dump_file, stmt, 0);
3510 fprintf (dump_file, "\n");
3511 }
3512 gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
3513 if (gimple_code (stmt) == GIMPLE_PHI)
3514 remove_phi_node (&gsi, true);
3515 else
3516 {
3517 unlink_stmt_vdef (stmt);
3518 gsi_remove (&gsi, true);
3519 release_defs (stmt);
3520 }
3521 }
3522
3523 /* Fixup stmts that became noreturn calls. This may require splitting
3524 blocks and thus isn't possible during the walk. Do this
3525 in reverse order so we don't inadvertedly remove a stmt we want to
3526 fixup by visiting a dominating now noreturn call first. */
3527 while (!to_fixup.is_empty ())
3528 {
3529 gimple *stmt = to_fixup.pop ();
3530 if (dump_file && dump_flags & TDF_DETAILS)
3531 {
3532 fprintf (dump_file, "Fixing up noreturn call ");
3533 print_gimple_stmt (dump_file, stmt, 0);
3534 fprintf (dump_file, "\n");
3535 }
3536 cfg_changed |= fixup_noreturn_call (stmt);
3537 }
3538
3539 cfg_changed |= gimple_purge_all_dead_eh_edges (to_purge);
3540 BITMAP_FREE (to_purge)((void) (bitmap_obstack_free ((bitmap) to_purge), (to_purge) =
(bitmap) nullptr))
;
3541
3542 if (cfg_changed)
3543 todoflags |= TODO_cleanup_cfg(1 << 5);
3544
3545 return todoflags;
3546}
3547
3548} // anon namespace
3549
3550gimple_opt_pass *
3551make_pass_forwprop (gcc::context *ctxt)
3552{
3553 return new pass_forwprop (ctxt);
3554}