diff options
author | Kugan Vivekanandarajah <kuganv@linaro.org> | 2016-06-06 23:46:11 +0000 |
---|---|---|
committer | Kugan Vivekanandarajah <kugan@gcc.gnu.org> | 2016-06-06 23:46:11 +0000 |
commit | ec963f2ae5a167060de578b72413ed4d870fe091 (patch) | |
tree | fb896e6b17b2b1900b966f416a4390a5dde1521f /gcc | |
parent | 46ab5b6edea83d9eb67a83572171493a8e2283b5 (diff) | |
download | gcc-ec963f2ae5a167060de578b72413ed4d870fe091.zip gcc-ec963f2ae5a167060de578b72413ed4d870fe091.tar.gz gcc-ec963f2ae5a167060de578b72413ed4d870fe091.tar.bz2 |
re PR tree-optimization/71408 (wrong code at -Os and above on x86_64-linux-gnu)
gcc/ChangeLog:
2016-06-07 Kugan Vivekanandarajah <kuganv@linaro.org>
PR middle-end/71408
* tree-ssa-reassoc.c (zero_one_operation): Fix NEGATE_EXPR operand for
propagate_op_to_single_use.
gcc/testsuite/ChangeLog:
2016-06-07 Kugan Vivekanandarajah <kuganv@linaro.org>
PR middle-end/71408
* gcc.dg/tree-ssa/pr71408.c: New test.
From-SVN: r237158
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr71408.c | 30 | ||||
-rw-r--r-- | gcc/tree-ssa-reassoc.c | 6 |
4 files changed, 45 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d586f9b..5e9ce57 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2016-06-07 Kugan Vivekanandarajah <kuganv@linaro.org> + PR middle-end/71408 + * tree-ssa-reassoc.c (zero_one_operation): Fix NEGATE_EXPR operand for + propagate_op_to_single_use. + +2016-06-07 Kugan Vivekanandarajah <kuganv@linaro.org> + PR middle-end/71281 * tree-ssa-reassoc.c (reassociate_bb): Set uid for negate stmt. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 81d2fd5..a1a7f19 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2016-06-07 Kugan Vivekanandarajah <kuganv@linaro.org> + PR middle-end/71408 + * gcc.dg/tree-ssa/pr71408.c: New test. + +2016-06-07 Kugan Vivekanandarajah <kuganv@linaro.org> + PR middle-end/71281 * g++.dg/torture/pr71281.C: New test. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr71408.c b/gcc/testsuite/gcc.dg/tree-ssa/pr71408.c new file mode 100644 index 0000000..896a428 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr71408.c @@ -0,0 +1,30 @@ +/* PR middle-end/71408 */ +/* { dg-do run } */ +/* { dg-options "-Os" } */ +unsigned a, b; + +struct S0 +{ + int f1:18; + unsigned f3:4; +}; + +void fn1 () +{ + struct S0 c = { 7, 0 }; + if (c.f1) + c.f3 = 3; + a = -~c.f3; + c.f3 = ~(c.f1 && c.f1); + c.f1 = c.f3 * (c.f1 - (c.f1 - a % c.f1)) + ~c.f3 * -a; + b = ~(c.f1 & a); + if (b >= 4294967295) + __builtin_abort (); +} + +int +main () +{ + fn1 (); + return 0; +} diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 096b24d..36b34d3 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1203,7 +1203,8 @@ zero_one_operation (tree *def, enum tree_code opcode, tree op) { if (gimple_assign_rhs1 (stmt) == op) { - propagate_op_to_single_use (op, stmt, def); + tree cst = build_minus_one_cst (TREE_TYPE (op)); + propagate_op_to_single_use (cst, stmt, def); return; } else if (integer_minus_onep (op) @@ -1251,7 +1252,8 @@ zero_one_operation (tree *def, enum tree_code opcode, tree op) { if (gimple_assign_rhs1 (stmt2) == op) { - propagate_op_to_single_use (op, stmt2, def); + tree cst = build_minus_one_cst (TREE_TYPE (op)); + propagate_op_to_single_use (cst, stmt2, def); return; } else if (integer_minus_onep (op) |