public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-709] Remove forward_propagate_into_cond Date: Mon, 23 May 2022 10:55:32 +0000 (GMT) [thread overview] Message-ID: <20220523105532.14DB83836E5C@sourceware.org> (raw) https://gcc.gnu.org/g:0236ea984c0d08f282ad03b1c36acad014e5ba4d commit r13-709-g0236ea984c0d08f282ad03b1c36acad014e5ba4d Author: Richard Biener <rguenther@suse.de> Date: Tue May 17 09:05:00 2022 +0200 Remove forward_propagate_into_cond This is a first cleanup opportunity from the COND_EXPR gimplification which allows us to remove now redundant forward_propagate_into_cond. 2022-05-23 Richard Biener <rguenther@suse.de> * tree-ssa-forwprop.cc (forward_propagate_into_cond): Remove. (pass_forwprop::execute): Do not propagate into COND_EXPR conditions. Diff: --- gcc/tree-ssa-forwprop.cc | 79 ++---------------------------------------------- 1 file changed, 2 insertions(+), 77 deletions(-) diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index b582529c404..d698a483ff1 100644 --- a/gcc/tree-ssa-forwprop.cc +++ b/gcc/tree-ssa-forwprop.cc @@ -511,9 +511,7 @@ forward_propagate_into_comparison (gimple_stmt_iterator *gsi) /* Propagate from the ssa name definition statements of COND_EXPR in GIMPLE_COND statement STMT into the conditional if that simplifies it. Returns zero if no statement was changed, one if there were - changes and two if cfg_cleanup needs to run. - - This must be kept in sync with forward_propagate_into_cond. */ + changes and two if cfg_cleanup needs to run. */ static int forward_propagate_into_gimple_cond (gcond *stmt) @@ -573,70 +571,6 @@ forward_propagate_into_gimple_cond (gcond *stmt) return 0; } - -/* Propagate from the ssa name definition statements of COND_EXPR - in the rhs of statement STMT into the conditional if that simplifies it. - Returns true zero if the stmt was changed. */ - -static bool -forward_propagate_into_cond (gimple_stmt_iterator *gsi_p) -{ - gimple *stmt = gsi_stmt (*gsi_p); - tree tmp = NULL_TREE; - tree cond = gimple_assign_rhs1 (stmt); - enum tree_code code = gimple_assign_rhs_code (stmt); - - /* We can do tree combining on SSA_NAME and comparison expressions. */ - if (COMPARISON_CLASS_P (cond)) - tmp = forward_propagate_into_comparison_1 (stmt, TREE_CODE (cond), - TREE_TYPE (cond), - TREE_OPERAND (cond, 0), - TREE_OPERAND (cond, 1)); - else if (TREE_CODE (cond) == SSA_NAME) - { - enum tree_code def_code; - tree name = cond; - gimple *def_stmt = get_prop_source_stmt (name, true, NULL); - if (!def_stmt || !can_propagate_from (def_stmt)) - return 0; - - def_code = gimple_assign_rhs_code (def_stmt); - if (TREE_CODE_CLASS (def_code) == tcc_comparison) - tmp = fold_build2_loc (gimple_location (def_stmt), - def_code, - TREE_TYPE (cond), - gimple_assign_rhs1 (def_stmt), - gimple_assign_rhs2 (def_stmt)); - } - - if (tmp - && is_gimple_val (tmp)) - { - if (dump_file) - { - fprintf (dump_file, " Replaced '"); - print_generic_expr (dump_file, cond); - fprintf (dump_file, "' with '"); - print_generic_expr (dump_file, tmp); - fprintf (dump_file, "'\n"); - } - - if ((code == VEC_COND_EXPR) ? integer_all_onesp (tmp) - : integer_onep (tmp)) - gimple_assign_set_rhs_from_tree (gsi_p, gimple_assign_rhs2 (stmt)); - else if (integer_zerop (tmp)) - gimple_assign_set_rhs_from_tree (gsi_p, gimple_assign_rhs3 (stmt)); - else - gimple_assign_set_rhs1 (stmt, unshare_expr (tmp)); - stmt = gsi_stmt (*gsi_p); - update_stmt (stmt); - - return true; - } - - return 0; -} - /* We've just substituted an ADDR_EXPR into stmt. Update all the relevant data structures to match. */ @@ -3720,16 +3654,7 @@ pass_forwprop::execute (function *fun) tree rhs1 = gimple_assign_rhs1 (stmt); enum tree_code code = gimple_assign_rhs_code (stmt); - if (code == COND_EXPR) - { - /* In this case the entire COND_EXPR is in rhs1. */ - if (forward_propagate_into_cond (&gsi)) - { - changed = true; - stmt = gsi_stmt (gsi); - } - } - else if (TREE_CODE_CLASS (code) == tcc_comparison) + if (TREE_CODE_CLASS (code) == tcc_comparison) { int did_something; did_something = forward_propagate_into_comparison (&gsi);
reply other threads:[~2022-05-23 10:55 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220523105532.14DB83836E5C@sourceware.org \ --to=rguenth@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).