public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bonzini at gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/37242] missed FRE opportunity because of signedness of addition Date: Wed, 27 Aug 2008 19:55:00 -0000 [thread overview] Message-ID: <20080827195358.17063.qmail@sourceware.org> (raw) In-Reply-To: <bug-37242-7849@http.gcc.gnu.org/bugzilla/> ------- Comment #10 from bonzini at gnu dot org 2008-08-27 19:53 ------- Yet another piece of the puzzle: Index: tree-ssa-sccvn.c =================================================================== --- tree-ssa-sccvn.c (revision 139423) +++ tree-ssa-sccvn.c (working copy) @@ -2052,6 +2052,40 @@ valueize_expr (tree expr) return expr; } +static tree +make_expression_gimple (tree t) +{ + enum gimple_rhs_class grc = get_gimple_rhs_class (TREE_CODE (t)); + tree op0 = NULL, op1 = NULL; + + switch (grc) + { + case GIMPLE_UNARY_RHS: + op0 = TREE_OPERAND (t, 0); + if (!is_gimple_val (op0)) + op0 = vn_nary_op_lookup (op0, NULL); + if (op0) + return build1 (TREE_CODE (t), TREE_TYPE (t), op0); + break; + + case GIMPLE_BINARY_RHS: + op0 = TREE_OPERAND (t, 0); + op1 = TREE_OPERAND (t, 1); + if (!is_gimple_val (op0)) + op0 = vn_nary_op_lookup (op0, NULL); + if (!is_gimple_val (op1)) + op1 = vn_nary_op_lookup (op1, NULL); + if (op0 && op1) + return build2 (TREE_CODE (t), TREE_TYPE (t), op0, op1); + break; + + default: + break; + } + + return NULL; +} + /* Simplify the binary expression RHS, and return the result if simplified. */ @@ -2100,10 +2134,14 @@ simplify_binary_expression (gimple stmt) of operators of operators (IE (a + b) + (a + c)) Otherwise, we will end up with unbounded expressions if fold does anything at all. */ - if (result && valid_gimple_rhs_p (result)) - return result; + if (result) + { + STRIP_USELESS_TYPE_CONVERSION (result); + if (!valid_gimple_rhs_p (result)) + result = make_expression_gimple (result); + } - return NULL_TREE; + return result; } /* Simplify the unary expression RHS, and return the result if @@ -2153,11 +2191,11 @@ simplify_unary_expression (gimple stmt) if (result) { STRIP_USELESS_TYPE_CONVERSION (result); - if (valid_gimple_rhs_p (result)) - return result; + if (!valid_gimple_rhs_p (result)) + result = make_expression_gimple (result); } - return NULL_TREE; + return result; } /* Try to simplify RHS using equivalences and constant folding. */ However it still does not work because the two "unsigned" types do not match. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37242
next prev parent reply other threads:[~2008-08-27 19:55 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-08-26 11:55 [Bug tree-optimization/37242] New: missed load PRE-like opportunity bonzini at gnu dot org 2008-08-26 11:57 ` [Bug tree-optimization/37242] " bonzini at gnu dot org 2008-08-26 12:03 ` [Bug tree-optimization/37242] missed FRE opportunity bonzini at gnu dot org 2008-08-26 21:17 ` [Bug tree-optimization/37242] missed FRE opportunity because of signedness of addition pinskia at gcc dot gnu dot org 2008-08-27 6:42 ` bonzini at gnu dot org 2008-08-27 7:16 ` bonzini at gnu dot org 2008-08-27 7:16 ` bonzini at gnu dot org 2008-08-27 9:42 ` rguenther at suse dot de 2008-08-27 17:51 ` bonzini at gnu dot org 2008-08-27 19:13 ` rguenther at suse dot de 2008-08-27 19:55 ` bonzini at gnu dot org [this message] 2008-08-27 20:18 ` rguenther at suse dot de 2008-08-28 6:10 ` bonzini at gnu dot org 2008-08-28 6:18 ` bonzini at gnu dot org 2008-08-28 8:03 ` rguenther at suse dot de 2008-08-28 8:43 ` bonzini at gnu dot org 2008-08-28 8:47 ` rguenther at suse dot de 2008-08-28 8:58 ` bonzini at gnu dot org 2008-08-28 8:59 ` bonzini at gnu dot org 2008-08-29 4:39 ` pinskia at gcc dot gnu dot org [not found] <bug-37242-4@http.gcc.gnu.org/bugzilla/> 2011-04-27 17:57 ` matt at use dot net 2011-04-28 9:53 ` rguenth at gcc dot gnu.org 2012-04-18 22:51 ` pinskia at gcc dot gnu.org 2012-06-29 0:20 ` matt at use dot net
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=20080827195358.17063.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).