From: Richard Biener Date: Tue, 31 May 2016 12:18:15 +0000 (+0000) Subject: re PR tree-optimization/71352 (ICE at -O1 and above on x86_64-linux-gnu: in zero_one_... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0d99f8a0705e47ca7fcee70f25cab0098ec64e48;p=gcc.git re PR tree-optimization/71352 (ICE at -O1 and above on x86_64-linux-gnu: in zero_one_operation, at tree-ssa-reassoc.c:1251) 2016-05-31 Richard Biener PR tree-optimization/71352 * tree-ssa-reassoc.c (zero_one_operation): Handle op equal to minus one and a negate. * gcc.dg/tree-ssa/reassoc-45.c: New testcase. From-SVN: r236920 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ae81bbfb1a9..41bb494ec55 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-05-31 Richard Biener + + PR tree-optimization/71352 + * tree-ssa-reassoc.c (zero_one_operation): Handle op equal to + minus one and a negate. + 2016-05-31 Kyrylo Tkachov * config/aarch64/aarch64.c (aarch64_simd_attr_length_move): Delete. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 563d5e5885c..8c5def43270 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-05-31 Richard Biener + + PR tree-optimization/71352 + * gcc.dg/tree-ssa/reassoc-45.c: New testcase. + 2016-05-31 Thomas Preud'homme * gcc.target/arm/armv5_thumb_isa.c: New test. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-45.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-45.c new file mode 100644 index 00000000000..48f6b74e39f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-45.c @@ -0,0 +1,15 @@ +/* PR/71352 */ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-reassoc1" } */ + +unsigned a, b, c, d, e; + +void +fn1 () +{ + unsigned f; + e = f = d * -b + a * -c; +} + +/* Check that we factor -1 and create -(d * b + a * c). */ +/* { dg-final { scan-tree-dump-times " = -" 1 "reassoc1" } } */ diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 430bcc8eb40..1973077db7c 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1199,11 +1199,20 @@ zero_one_operation (tree *def, enum tree_code opcode, tree op) propagate_op_to_single_use (op, stmt, def); return; } - else if (gimple_assign_rhs_code (stmt) == NEGATE_EXPR - && gimple_assign_rhs1 (stmt) == op) + else if (gimple_assign_rhs_code (stmt) == NEGATE_EXPR) { - propagate_op_to_single_use (op, stmt, def); - return; + if (gimple_assign_rhs1 (stmt) == op) + { + propagate_op_to_single_use (op, stmt, def); + return; + } + else if (integer_minus_onep (op) + || real_minus_onep (op)) + { + gimple_assign_set_rhs_code + (stmt, TREE_CODE (gimple_assign_rhs1 (stmt))); + return; + } } } @@ -1238,11 +1247,20 @@ zero_one_operation (tree *def, enum tree_code opcode, tree op) return; } else if (is_gimple_assign (stmt2) - && gimple_assign_rhs_code (stmt2) == NEGATE_EXPR - && gimple_assign_rhs1 (stmt2) == op) + && gimple_assign_rhs_code (stmt2) == NEGATE_EXPR) { - propagate_op_to_single_use (op, stmt2, def); - return; + if (gimple_assign_rhs1 (stmt2) == op) + { + propagate_op_to_single_use (op, stmt2, def); + return; + } + else if (integer_minus_onep (op) + || real_minus_onep (op)) + { + gimple_assign_set_rhs_code + (stmt2, TREE_CODE (gimple_assign_rhs1 (stmt2))); + return; + } } }