diff options
author | Richard Biener <rguenther@suse.de> | 2019-01-23 14:02:13 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-01-23 14:02:13 +0000 |
commit | ef192ae1b63da0d71d0fb881d26b27db35fa2920 (patch) | |
tree | 3643242b0fff4001d35b5fc6491cf50dbb305d65 | |
parent | 4d0c18c601bafe272e9c5093cfbb15a875710440 (diff) | |
download | gcc-ef192ae1b63da0d71d0fb881d26b27db35fa2920.zip gcc-ef192ae1b63da0d71d0fb881d26b27db35fa2920.tar.gz gcc-ef192ae1b63da0d71d0fb881d26b27db35fa2920.tar.bz2 |
re PR middle-end/89008 (O2 and O1 results differ for simple test)
2019-01-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/89008
* tree-ssa-reassoc.c (eliminate_using_constants): For * 0 do
not leave another stray operand.
* gcc.dg/torture/pr89008.c: New testcase.
From-SVN: r268186
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr89008.c | 27 | ||||
-rw-r--r-- | gcc/tree-ssa-reassoc.c | 2 |
4 files changed, 39 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 47bb681..bbbaceb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-01-23 Richard Biener <rguenther@suse.de> + + PR tree-optimization/89008 + * tree-ssa-reassoc.c (eliminate_using_constants): For * 0 do + not leave another stray operand. + 2019-01-23 Jakub Jelinek <jakub@redhat.com> * BASE-VER: Bump to 9.0.1. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b1ad372..d91be29 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-23 Richard Biener <rguenther@suse.de> + + PR tree-optimization/89008 + * gcc.dg/torture/pr89008.c: New testcase. + 2019-01-23 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/specs/opt4.ads: New test. diff --git a/gcc/testsuite/gcc.dg/torture/pr89008.c b/gcc/testsuite/gcc.dg/torture/pr89008.c new file mode 100644 index 0000000..aa13f94 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr89008.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ + +unsigned long a, c; +unsigned b; +int d, e; +long f() +{ + unsigned long g = 0; + for (d = 0; d < 5; d += 2) + for (e = 0; e < 5; e += 3) + { + c = 4 + b; + g = -b - b; + b = 5 * (b << 24); + } + a = g; + return 0; +} + +int main() +{ + f(); + if (a) + __builtin_abort(); + return 0; +} diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 07ff42e..e1c4dfe 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1015,7 +1015,7 @@ eliminate_using_constants (enum tree_code opcode, fprintf (dump_file, "Found * 0, removing all other ops\n"); reassociate_stats.ops_eliminated += ops->length () - 1; - ops->truncate (1); + ops->truncate (0); ops->quick_push (oelast); return; } |