https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385

--- Comment #23 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Instead of #c11 I meant:
-       else if ((is_gimple_assign (stmt) && !gimple_has_volatile_ops (stmt))
-                || gimple_code (stmt) == GIMPLE_PHI)
+       else if (flag_tree_dce
+                && ((is_gimple_assign (stmt) && !gimple_has_volatile_ops
(stmt))
+                    || gimple_code (stmt) == GIMPLE_PHI))
because the res = -1 handling is in the else after this already.

For what Richi is proposing, I guess one needs to run the analysis somewhere
(early tree_function_versioning or elsewhere?, note in a hash_set stmts that
shouldn't be copied, add pointer to that hash_set to copy_body_data and perhaps
in remap_gimple_stmt if the hash_set pointer is non-NULL, check early if stmt
is in it and in that case return NULL (like we already return NULL for debug
stmts if we want to drop them).
Most likely the lhs of such to be removed statements need to be also added to
id.killed_new_ssa_names (and verify if it works properly).

Reply via email to