aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-reassoc.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-11-11 16:07:54 +0000
committerRichard Biener <rguenther@suse.de>2019-11-11 16:07:54 +0000
commit455ea308e16e9681595b59521b18f466757f54fc (patch)
treecb786dce6b9a80998dcc16a9c4561e7d58ba1541 /gcc/tree-ssa-reassoc.c
parentf417c3356799147b4f4f8439b1da3526d9c880e7 (diff)
2019-11-11 Richard Biener <rguenther@suse.de>
Backport from mainline 2019-06-25 Richard Biener <rguenther@suse.de> PR tree-optimization/90930 * tree-ssa-reassoc.c (reassociate_bb): Only rewrite expression into parallel form in the last pass instance. * gcc.dg/tree-ssa/reassoc-24.c: Adjust. * gcc.dg/tree-ssa/reassoc-25.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@278059 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-reassoc.c')
-rw-r--r--gcc/tree-ssa-reassoc.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 7161c4c36c3..6794fbde29e 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -6013,12 +6013,7 @@ reassociate_bb (basic_block bb)
{
machine_mode mode = TYPE_MODE (TREE_TYPE (lhs));
int ops_num = ops.length ();
- int width = get_reassociation_width (ops_num, rhs_code, mode);
-
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file,
- "Width = %d was chosen for reassociation\n", width);
-
+ int width;
/* For binary bit operations, if there are at least 3
operands and the last last operand in OPS is a constant,
@@ -6032,10 +6027,21 @@ reassociate_bb (basic_block bb)
&& TREE_CODE (ops.last ()->op) == INTEGER_CST)
std::swap (*ops[0], *ops[ops_num - 1]);
- if (width > 1
- && ops.length () > 3)
- rewrite_expr_tree_parallel (as_a <gassign *> (stmt),
- width, ops);
+ /* Only rewrite the expression tree to parallel in the
+ last reassoc pass to avoid useless work back-and-forth
+ with initial linearization. */
+ if (!reassoc_insert_powi_p
+ && ops.length () > 3
+ && (width = get_reassociation_width (ops_num, rhs_code,
+ mode)) > 1)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "Width = %d was chosen for reassociation\n",
+ width);
+ rewrite_expr_tree_parallel (as_a <gassign *> (stmt),
+ width, ops);
+ }
else
{
/* When there are three operands left, we want