]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR rtl-optimization/69891 (wrong code with -mstringop-strategy=libcall...
authorJakub Jelinek <jakub@redhat.com>
Thu, 7 Jul 2016 21:47:40 +0000 (23:47 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 7 Jul 2016 21:47:40 +0000 (23:47 +0200)
Backported from mainline
2016-02-26  Jakub Jelinek  <jakub@redhat.com>
    Eric Botcazou  <ebotcazou@adacore.com>

PR rtl-optimization/69891
* dse.c (scan_insn): If we can't figure out memset arguments
or they are non-constant, call clear_rhs_from_active_local_stores.

* gcc.target/i386/pr69891.c: New test.

From-SVN: r238137

gcc/ChangeLog
gcc/dse.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr69891.c [new file with mode: 0644]

index 5cb436212f0e85e605f886d9e1b208d49dd93581..77a3af91ddd2867c8cd0f4169f89b8617c241a2e 100644 (file)
@@ -1,6 +1,13 @@
 2016-07-07  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-02-26  Jakub Jelinek  <jakub@redhat.com>
+                   Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR rtl-optimization/69891
+       * dse.c (scan_insn): If we can't figure out memset arguments
+       or they are non-constant, call clear_rhs_from_active_local_stores.
+
        2016-02-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/69802
index 9392f6bccc1b16f5b36806f479441e97aac669dd..2aa5af0d5ca8dd63f55470c9664a7f7b7e51cd1a 100644 (file)
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -2582,6 +2582,8 @@ scan_insn (bb_info_t bb_info, rtx insn)
                      active_local_stores = insn_info;
                    }
                }
+             else
+               clear_rhs_from_active_local_stores ();
            }
        }
 
index 7fc70834ed63fdff27bac7ce73be54112ffec468..96a3b621674dfe57f5cba254bbf3d3865fe4070d 100644 (file)
@@ -1,6 +1,12 @@
 2016-07-07  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-02-26  Jakub Jelinek  <jakub@redhat.com>
+                   Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR rtl-optimization/69891
+       * gcc.target/i386/pr69891.c: New test.
+
        2016-02-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/67767
diff --git a/gcc/testsuite/gcc.target/i386/pr69891.c b/gcc/testsuite/gcc.target/i386/pr69891.c
new file mode 100644 (file)
index 0000000..2c5e863
--- /dev/null
@@ -0,0 +1,30 @@
+/* PR rtl-optimization/69891 */
+/* { dg-do run } */
+/* { dg-options "-O -fno-tree-fre -mstringop-strategy=libcall -Wno-psabi" } */
+/* { dg-additional-options "-mno-sse" { target ia32 } } */
+
+typedef unsigned short A;
+typedef unsigned short B __attribute__ ((vector_size (32)));
+typedef unsigned int C;
+typedef unsigned int D __attribute__ ((vector_size (32)));
+typedef unsigned long long E;
+typedef unsigned long long F __attribute__ ((vector_size (32)));
+
+__attribute__((noinline, noclone)) unsigned
+foo(D a, B b, D c, F d)
+{
+  b /= (B) {1, -c[0]} | 1;
+  c[0] |= 7;
+  a %= c | 1;
+  c ^= c;
+  return a[0] + b[15] + c[0] + d[3];
+}
+
+int
+main ()
+{
+  unsigned x = foo ((D) {}, (B) {}, (D) {}, (F) {});
+  if (x != 0)
+    __builtin_abort ();
+  return 0;
+}