Bug 39297 - [4.4/4.5 Regression] gcc.dg/tree-ssa/loop-31.c
Summary: [4.4/4.5 Regression] gcc.dg/tree-ssa/loop-31.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: testsuite (show other bugs)
Version: 4.4.0
: P2 normal
Target Milestone: 4.4.2
Assignee: Zdenek Dvorak
URL:
Keywords:
Depends on: 39233
Blocks: 32283
  Show dependency treegraph
 
Reported: 2009-02-25 02:59 UTC by H.J. Lu
Modified: 2009-08-26 23:10 UTC (History)
2 users (show)

See Also:
Host:
Target: ia64-unknown-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-02-25 18:34:04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2009-02-25 02:59:31 UTC
On Linux/ia64, revision 144413 gave

FAIL: gcc.dg/tree-ssa/loop-31.c scan-tree-dump-times optimized " \+ 2" 1

Revision 144404 is OK. Revision 144405:

http://gcc.gnu.org/ml/gcc-cvs/2009-02/msg00572.html

may be the cause.
Comment 1 Richard Biener 2009-02-25 08:52:10 UTC
Sooo - what is the content of the .optimized dump?
Comment 2 H.J. Lu 2009-02-25 14:37:56 UTC
(In reply to comment #1)
> Sooo - what is the content of the .optimized dump?
> 

;; Function foo (foo)

Analyzing Edge Insertions.
foo (int len, int v)
{
  long unsigned int D.1255;
  long unsigned int ivtmp.14;

<bb 2>:
  if (len > 0)
    goto <bb 3>;
  else
    goto <bb 5>;

<bb 3>:
  ivtmp.14 = (long unsigned int) &a[0];
  D.1255 = ((long unsigned int) &a + 2) + (long unsigned int) ((unsigned int) le
n + 4294967295) * 2;

<bb 4>:
  MEM[index: ivtmp.14] = (short int) (short int) v;
  ivtmp.14 = ivtmp.14 + 2;
  if (ivtmp.14 != D.1255)
    goto <bb 4>;
  else
    goto <bb 5>;

<bb 5>:
  return a[0];

}
Comment 3 Andrew Pinski 2009-02-25 14:41:40 UTC
Note index: again, booooo. I thought I got rid of all those.
Comment 4 rguenther@suse.de 2009-02-25 14:48:40 UTC
Subject: Re:  [4.4 Regression]
 gcc.dg/tree-ssa/loop-31.c

On Wed, 25 Feb 2009, hjl dot tools at gmail dot com wrote:

> ------- Comment #2 from hjl dot tools at gmail dot com  2009-02-25 14:37 -------
> (In reply to comment #1)
> > Sooo - what is the content of the .optimized dump?
> > 
> 
> ;; Function foo (foo)
> 
> Analyzing Edge Insertions.
> foo (int len, int v)
> {
>   long unsigned int D.1255;
>   long unsigned int ivtmp.14;
> 
> <bb 2>:
>   if (len > 0)
>     goto <bb 3>;
>   else
>     goto <bb 5>;
> 
> <bb 3>:
>   ivtmp.14 = (long unsigned int) &a[0];
>   D.1255 = ((long unsigned int) &a + 2) + (long unsigned int) ((unsigned int)
> le
> n + 4294967295) * 2;

This likely used to be folded to &a[len], but the addressing-mode
is still what it is supposed to be.  Can you attach the dump with
the patch reverted as well?

> <bb 4>:
>   MEM[index: ivtmp.14] = (short int) (short int) v;
>   ivtmp.14 = ivtmp.14 + 2;
>   if (ivtmp.14 != D.1255)
>     goto <bb 4>;
>   else
>     goto <bb 5>;
> 
> <bb 5>:
>   return a[0];
> 
> }
> 
> 
> 

Comment 5 H.J. Lu 2009-02-25 14:53:22 UTC
Revision 144404 gave:

;; Function foo (foo)

Analyzing Edge Insertions.
foo (int len, int v)
{
  short int * D.1254;
  short int * ivtmp.14;

<bb 2>:
  if (len > 0)
    goto <bb 3>;
  else
    goto <bb 5>;

<bb 3>:
  D.1254 = &a[0] + ((long unsigned int) ((unsigned int) len + 4294967295) + 1) * 2;
  ivtmp.14 = &a[0];

<bb 4>:
  MEM[base: ivtmp.14] = (short int) (short int) v;
  ivtmp.14 = ivtmp.14 + 2;
  if (ivtmp.14 != D.1254)
    goto <bb 4>;
  else
    goto <bb 5>;

<bb 5>:
  return a[0];

}
Comment 6 rguenther@suse.de 2009-02-25 15:01:11 UTC
Subject: Re:  [4.4 Regression]
 gcc.dg/tree-ssa/loop-31.c

On Wed, 25 Feb 2009, hjl dot tools at gmail dot com wrote:

> ------- Comment #5 from hjl dot tools at gmail dot com  2009-02-25 14:53 -------
> Revision 144404 gave:

Is the assembly different?
Comment 7 H.J. Lu 2009-02-25 15:09:35 UTC
Revision 144405 gave:

        .text
        .align 16
        .global foo#
        .type   foo#, @function
        .proc foo#
foo:
        .prologue
        .body
        cmp4.ge p6, p7 = 0, r32
        (p6) br.cond.spnt .L2
        addl r14 = @ltoffx(a#), r1
        ;;
        ld8.mov r14 = [r14], a#
        adds r16 = -1, r32
        ;;
        addp4 r16 = r16, r0
        addl r15 = @gprel(.LC0), gp
        ;;
        ld8 r15 = [r15]
        ;;
        shladd r15 = r16, 1, r15
.L3:
        st2 [r14] = r33, 2
        ;;
        cmp.ne p6, p7 = r15, r14
        (p6) br.cond.sptk .L3
.L2:
        addl r14 = @ltoffx(a#), r1
        ;;
        ld8.mov r14 = [r14], a#
        ;;
        ld2 r8 = [r14]
        br.ret.sptk.many b0
        ;;
        .endp foo#

Revision 144404 gave:

        .proc foo#
foo:
        .prologue
        .save ar.lc, r2
        mov r2 = ar.lc
        .body
        cmp4.ge p6, p7 = 0, r32
        (p6) br.cond.spnt .L2
        adds r15 = -1, r32
        ;;
        addp4 r15 = r15, r0
        ;;
        adds r15 = 1, r15
        addl r14 = @ltoffx(a#), r1
        ;;
        ld8.mov r14 = [r14], a#
        ;;
        shladd r15 = r15, 1, r14
        ;;
        sub r15 = r15, r14
        ;;
        adds r15 = -2, r15
        ;;
        shr.u r15 = r15, 1
        ;;
        mov ar.lc = r15
.L3:
        st2 [r14] = r33, 2
        ;;
        br.cloop.sptk.few .L3
.L2:
        addl r14 = @ltoffx(a#), r1
        ;;
        ld8.mov r14 = [r14], a#
        ;;
        ld2 r8 = [r14]
        mov ar.lc = r2
        br.ret.sptk.many b0
        ;;
        .endp foo#
Comment 8 H.J. Lu 2009-02-25 17:00:58 UTC
gcc.dg/tree-ssa/loop-31.c comes from PR 32283. This testcase only
runs on arms and ia64.
Comment 9 H.J. Lu 2009-02-25 18:24:40 UTC
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2009-02/msg01185.html
Comment 10 Zdenek Dvorak 2009-02-25 19:09:46 UTC
The difference between

>   D.1254 = &a[0] + ((long unsigned int) ((unsigned int) len + 4294967295) + 1)
> * 2;

(original) and

>   D.1255 = ((long unsigned int) &a + 2) + (long unsigned int) ((unsigned int)
>            len + 4294967295) * 2;

(current) is mostly cosmetical; the test in the testcase should be made more robust, but other than that, there is no regression here.
Comment 11 H.J. Lu 2009-02-25 19:18:06 UTC
(In reply to comment #10)
> The difference between
> 
> >   D.1254 = &a[0] + ((long unsigned int) ((unsigned int) len + 4294967295) + 1)
> > * 2;
> 
> (original) and
> 
> >   D.1255 = ((long unsigned int) &a + 2) + (long unsigned int) ((unsigned int)
> >            len + 4294967295) * 2;
> 
> (current) is mostly cosmetical; the test in the testcase should be made more
> robust, but other than that, there is no regression here.
> 

The new loop is

.L3:
        st2 [r14] = r33, 2
        ;;
        cmp.ne p6, p7 = r15, r14
        (p6) br.cond.sptk .L3

The old loop is

       mov ar.lc = r15
.L3:
        st2 [r14] = r33, 2
        ;;
        br.cloop.sptk.few .L3

They are quite different.
Comment 12 rakdver@kam.mff.cuni.cz 2009-02-25 22:41:06 UTC
Subject: Re:  [4.4 Regression] gcc.dg/tree-ssa/loop-31.c

> ------- Comment #11 from hjl dot tools at gmail dot com  2009-02-25 19:18 -------
> (In reply to comment #10)
> > The difference between
> > 
> > >   D.1254 = &a[0] + ((long unsigned int) ((unsigned int) len + 4294967295) + 1)
> > > * 2;
> > 
> > (original) and
> > 
> > >   D.1255 = ((long unsigned int) &a + 2) + (long unsigned int) ((unsigned int)
> > >            len + 4294967295) * 2;
> > 
> > (current) is mostly cosmetical; the test in the testcase should be made more
> > robust, but other than that, there is no regression here.
> > 
> 
> The new loop is
> 
> .L3:
>         st2 [r14] = r33, 2
>         ;;
>         cmp.ne p6, p7 = r15, r14
>         (p6) br.cond.sptk .L3
> 
> The old loop is
> 
>        mov ar.lc = r15
> .L3:
>         st2 [r14] = r33, 2
>         ;;
>         br.cloop.sptk.few .L3
> 
> They are quite different.

nevertheless, loop-31.c test is not supposed to test this; it just
checks whether strength reduction is performed correctly.  I think we
already have another PR regarding the problem that strength reduction
and iv elimination on tree level may cause rtl level # of iterations
analysis to fail (which leads to the code difference).
Comment 13 Richard Biener 2009-03-04 12:10:03 UTC
Thus this is a testsuite issue.
Comment 14 Steve Ellcey 2009-06-23 18:28:42 UTC
Subject: Bug 39297

Author: sje
Date: Tue Jun 23 18:28:26 2009
New Revision: 148862

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148862
Log:
2009-06-23  Steve Ellcey  <sje@cup.hp.com>

	PR testsuite/39297
	* gcc.dg/ssa/loop-31.c: Change scan rules.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/tree-ssa/loop-31.c

Comment 15 Steve Ellcey 2009-08-26 23:10:23 UTC
Test no longer fails due to checkin that fixes the scan for IA64.

See http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01600.html