On Wed, 2 May 2012, Jakub Jelinek wrote:

> Hi!
> 
> single_nonlooparound_use ignores debug uses (otherwise we end up with
> -fcompare-debug failures), but when removing stmts we need to reset
> the debug uses, otherwise e.g. the testcase below ICEs.  Alex, if you have
> better ideas how to reconstruct the debug stmts instead, feel free to
> follow-up, but it won't be easy IMHO.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok.

Thanks,
Richard.

> 2012-05-02  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR debug/53174
>       * tree-predcom.c (remove_stmt): Call reset_debug_uses on stmts being
>       removed.
> 
>       * gcc.dg/pr53174.c: New test.
> 
> --- gcc/tree-predcom.c.jj     2012-03-28 19:39:21.000000000 +0200
> +++ gcc/tree-predcom.c        2012-05-02 13:14:14.765575987 +0200
> @@ -1707,6 +1707,7 @@ remove_stmt (gimple stmt)
>      {
>        name = PHI_RESULT (stmt);
>        next = single_nonlooparound_use (name);
> +      reset_debug_uses (stmt);
>        psi = gsi_for_stmt (stmt);
>        remove_phi_node (&psi, true);
>  
> @@ -1728,6 +1729,7 @@ remove_stmt (gimple stmt)
>        gcc_assert (TREE_CODE (name) == SSA_NAME);
>  
>        next = single_nonlooparound_use (name);
> +      reset_debug_uses (stmt);
>  
>        mark_virtual_ops_for_renaming (stmt);
>        gsi_remove (&bsi, true);
> --- gcc/testsuite/gcc.dg/pr53174.c.jj 2012-05-02 13:36:29.466948569 +0200
> +++ gcc/testsuite/gcc.dg/pr53174.c    2012-05-02 13:35:59.000000000 +0200
> @@ -0,0 +1,67 @@
> +/* PR debug/53174 */
> +/* { dg-do compile } */
> +/* { dg-options "-Ofast -g" } */
> +
> +int w, h;
> +
> +void
> +bar (float (*x)[4], int y, int z)
> +{
> +  int a, b, c, d, e, f, g;
> +
> +  a = 2;
> +  b = 2;
> +  c = 274;
> +  d = 274;
> +  if (!z)
> +    a = 12;
> +  if (!y)
> +    b = 12;
> +  if (z + 266 >= h - 2)
> +    c = 8 + h - z;
> +  if (y + 266 >= w - 2)
> +    d = 8 + w - y;
> +  for (e = a; e < c; e++)
> +    for (f = b, g = e * 276 + f; f < d; f++, g++)
> +      {
> +     float (*h)[4] = x + (g - 277);
> +     float k = (*h)[0];
> +     float l = (*h)[1];
> +     float m = (*h)[2];
> +     h++;
> +     k += (*h)[0];
> +     l += (*h)[1];
> +     m += (*h)[2];
> +     h++;
> +     k += (*h)[0];
> +     l += (*h)[1];
> +     m += (*h)[2];
> +     h += 274;
> +     k += (*h)[0];
> +     l += (*h)[1];
> +     m += (*h)[2];
> +     h += 2;
> +     k += (*h)[0];
> +     l += (*h)[1];
> +     m += (*h)[2];
> +     h += 274;
> +     k += (*h)[0];
> +     l += (*h)[1];
> +     m += (*h)[2];
> +     h++;
> +     k += (*h)[0];
> +     l += (*h)[1];
> +     m += (*h)[2];
> +     h++;
> +     k += (*h)[0];
> +     l += (*h)[1];
> +     m += (*h)[2];
> +     k *= 0.125f;
> +     l *= 0.125f;
> +     m *= 0.125f;
> +     k = k + (x[g][1] - l);
> +     m = m + (x[g][1] - l);
> +     x[g][0] = k;
> +     x[g][2] = m;
> +      }
> +}
> 
>       Jakub
> 
> 

-- 
Richard Guenther <rguent...@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

Reply via email to