This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix num_imm_uses (PR tree-optimization/70405)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 29 Mar 2016 19:23:18 +0200
- Subject: [PATCH] Fix num_imm_uses (PR tree-optimization/70405)
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
The recent change to num_imm_uses (to add support for NULL USE_STMT)
broke it totally, fortunately we have just one user of this function
right now. I've filed a PR for GCC 7 so that we get a warning on this.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
2016-03-29 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/70405
* ssa-iterators.h (num_imm_uses): Add missing braces.
* gcc.dg/pr70405.c: New test.
--- gcc/ssa-iterators.h.jj 2016-01-04 14:55:53.000000000 +0100
+++ gcc/ssa-iterators.h 2016-03-29 14:31:16.773551024 +0200
@@ -448,9 +448,11 @@ num_imm_uses (const_tree var)
unsigned int num = 0;
if (!MAY_HAVE_DEBUG_STMTS)
- for (ptr = start->next; ptr != start; ptr = ptr->next)
- if (USE_STMT (ptr))
- num++;
+ {
+ for (ptr = start->next; ptr != start; ptr = ptr->next)
+ if (USE_STMT (ptr))
+ num++;
+ }
else
for (ptr = start->next; ptr != start; ptr = ptr->next)
if (USE_STMT (ptr) && !is_gimple_debug (USE_STMT (ptr)))
--- gcc/testsuite/gcc.dg/pr70405.c.jj 2016-03-29 14:49:18.252808104 +0200
+++ gcc/testsuite/gcc.dg/pr70405.c 2016-03-29 14:33:41.000000000 +0200
@@ -0,0 +1,15 @@
+/* PR tree-optimization/70405 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+/* { dg-additional-options "-mavx512f" { target i?86-*-* x86_64-*-* } } */
+
+typedef short V __attribute__ ((vector_size (32)));
+
+int
+foo (V *p)
+{
+ V v = *p;
+ v >>= v;
+ v -= v[0];
+ return v[3];
+}
Jakub