Yet another expand_debug_expr BLKmode fix (PR debug/83666)

Message ID 20180104083633.GR1833@tucnak
State New
Headers show
Series
  • Yet another expand_debug_expr BLKmode fix (PR debug/83666)
Related show

Commit Message

Jakub Jelinek Jan. 4, 2018, 8:36 a.m.
Hi!

Another spot where we need to punt on BLKmode, otherwise we try to create
a subreg with BLKmode, or ZERO/SIGN_EXTEND with BLKmode.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Eventually, we should try to handle both hw and generic vectors in the debug
info better, but we'd need to discuss that with the GDB folks.  E.g.
we could lower debuginfo for the generic vectors during the vector lowering
pass into DEBUG_EXPRs representing individual elements kind like how SRA
splits arrays.

2018-01-04  Jakub Jelinek  <jakub@redhat.com>

	PR debug/83666
	* cfgexpand.c (expand_dbeug_expr) <case BIT_FIELD_REF>: Punt if mode
	is BLKmode and bitpos not zero or mode change is needed.

	* gcc.dg/pr83666.c: New test.


	Jakub

Comments

Richard Biener Jan. 4, 2018, 10:47 a.m. | #1
On January 4, 2018 9:36:33 AM GMT+01:00, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!

>

>Another spot where we need to punt on BLKmode, otherwise we try to

>create

>a subreg with BLKmode, or ZERO/SIGN_EXTEND with BLKmode.

>

>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?


OK. 

Richard. 

>Eventually, we should try to handle both hw and generic vectors in the

>debug

>info better, but we'd need to discuss that with the GDB folks.  E.g.

>we could lower debuginfo for the generic vectors during the vector

>lowering

>pass into DEBUG_EXPRs representing individual elements kind like how

>SRA

>splits arrays.

>

>2018-01-04  Jakub Jelinek  <jakub@redhat.com>

>

>	PR debug/83666

>	* cfgexpand.c (expand_dbeug_expr) <case BIT_FIELD_REF>: Punt if mode

>	is BLKmode and bitpos not zero or mode change is needed.

>

>	* gcc.dg/pr83666.c: New test.

>

>--- gcc/cfgexpand.c.jj	2018-01-03 16:56:28.375179714 +0100

>+++ gcc/cfgexpand.c	2018-01-03 19:45:43.807687499 +0100

>@@ -4560,7 +4560,7 @@ expand_debug_expr (tree exp)

> 	if (maybe_lt (bitpos, 0))

>           return NULL;

> 

>-	if (GET_MODE (op0) == BLKmode)

>+	if (GET_MODE (op0) == BLKmode || mode == BLKmode)

> 	  return NULL;

> 

> 	poly_int64 bytepos;

>--- gcc/testsuite/gcc.dg/pr83666.c.jj	2018-01-03 19:47:46.370733409

>+0100

>+++ gcc/testsuite/gcc.dg/pr83666.c	2018-01-03 19:47:26.106725818 +0100

>@@ -0,0 +1,28 @@

>+/* PR debug/83666 */

>+/* { dg-do compile } */

>+/* { dg-options "-O2 -g --param=sccvn-max-scc-size=10 -Wno-psabi" } */

>+

>+typedef int __attribute__ ((vector_size (64))) V;

>+

>+int c, d;

>+short e;

>+V g;

>+

>+V

>+bar (void)

>+{

>+  g[1] = d;

>+  do

>+    {

>+      e += c;

>+      g = g > 0;

>+    }

>+  while (g[1]);

>+  return g;

>+}

>+

>+void

>+foo (void)

>+{

>+  int x = bar ()[3];

>+}

>

>	Jakub

Patch

--- gcc/cfgexpand.c.jj	2018-01-03 16:56:28.375179714 +0100
+++ gcc/cfgexpand.c	2018-01-03 19:45:43.807687499 +0100
@@ -4560,7 +4560,7 @@  expand_debug_expr (tree exp)
 	if (maybe_lt (bitpos, 0))
           return NULL;
 
-	if (GET_MODE (op0) == BLKmode)
+	if (GET_MODE (op0) == BLKmode || mode == BLKmode)
 	  return NULL;
 
 	poly_int64 bytepos;
--- gcc/testsuite/gcc.dg/pr83666.c.jj	2018-01-03 19:47:46.370733409 +0100
+++ gcc/testsuite/gcc.dg/pr83666.c	2018-01-03 19:47:26.106725818 +0100
@@ -0,0 +1,28 @@ 
+/* PR debug/83666 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g --param=sccvn-max-scc-size=10 -Wno-psabi" } */
+
+typedef int __attribute__ ((vector_size (64))) V;
+
+int c, d;
+short e;
+V g;
+
+V
+bar (void)
+{
+  g[1] = d;
+  do
+    {
+      e += c;
+      g = g > 0;
+    }
+  while (g[1]);
+  return g;
+}
+
+void
+foo (void)
+{
+  int x = bar ()[3];
+}