public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14046] New: [tree-ssa regression] address calculation not moved out of innermost loop
@ 2004-02-06 12:40 rguenth at tat dot physik dot uni-tuebingen dot de
  2004-02-06 13:39 ` [Bug optimization/14046] " martin at mpa-garching dot mpg dot de
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: rguenth at tat dot physik dot uni-tuebingen dot de @ 2004-02-06 12:40 UTC (permalink / raw)
  To: gcc-bugs

For the simple testcase

void foo(double *a, int o, int f0, int e0, int f1, int e1, int s0, int s1)
{
  for (int i1=f1; i1<=e1; ++i1)
    for (int i0=f0; i0<=e0; ++i0)
      a[o + i0*s0 + i1*s1] = 0.0;
}

tree-ssa is not able to move the address calculation partly out of the innermost
loop, while 3.4 is able to do this:

g++-3.4 (GCC) 3.4.0 20040127 (prerelease)
g++-3.4 -O2 -S -fverbose-asm loop2.c:
.LCFI5:
        movl    24(%ebp), %ebx  # f1, i1
        cmpl    28(%ebp), %ebx  # e1, i1
        movl    20(%ebp), %edi  # e0, e0
        jg      .L11    #,
        movl    16(%ebp), %eax  # f0,
        movl    32(%ebp), %edx  # s0,
        movl    36(%ebp), %esi  # s1, tmp101
        imull   %edx, %eax      #,
        imull   %ebx, %esi      # i1, tmp101
        movl    %eax, -16(%ebp) #,
        .p2align 4,,15
.L9:
        movl    16(%ebp), %edx  # f0, i0
        cmpl    %edi, %edx      # e0, i0
        jg      .L13    #,
        movl    12(%ebp), %eax  # o, tmp86
        movl    -16(%ebp), %ecx #,
        addl    %esi, %eax      # tmp101, tmp86
        addl    %ecx, %eax      #, tmp88
        movl    8(%ebp), %ecx   # a,    
        leal    (%ecx,%eax,8), %eax     #, tmp83
        movl    32(%ebp), %ecx  # s0, tmp85
        sall    $3, %ecx        #, tmp85
        .p2align 4,,15
.L8:
        movl    $0, (%eax)      #,
        incl    %edx    # i0    
        movl    $0, 4(%eax)     #,
        addl    %ecx, %eax      # tmp85, tmp83
        cmpl    %edi, %edx      # e0, i0
        jle     .L8     #,
.L13:
        movl    36(%ebp), %edx  # s1,
        incl    %ebx    # i1
        addl    %edx, %esi      #, tmp101
        cmpl    28(%ebp), %ebx  # e1, i1
        jle     .L9     #,
.L11:
        popl    %eax    #
        popl    %ebx    #
        popl    %esi    #
        popl    %edi    #
        popl    %ebp    #
        ret

g++-ssa (GCC) 3.5-tree-ssa 20040205 (merged 20040126)
g++-ssa -O2 -S -fverbose-asm loop2.c:
.LCFI4:
        movl    24(%ebp), %ebx  # f1, i1
        cmpl    28(%ebp), %ebx  # e1, i1
        jg      .L1     #,
.L11:
        movl    16(%ebp), %ecx  # f0, i0
        jmp     .L4     # 
        .p2align 4,,7   
.L3:
        movl    %ecx, %eax      # i0, tmp68
        movl    %ebx, %edx      # i1, tmp69
        imull   %edi, %eax      # s0, tmp68
        imull   %esi, %edx      # s1, tmp69
        incl    %ecx    # i0
        fldz
        addl    12(%ebp), %eax  # o, tmp70
        addl    %edx, %eax      # tmp69, tmp71
        movl    8(%ebp), %edx   # a,
        fstpl   (%edx,%eax,8)   #
.L4:
        cmpl    20(%ebp), %ecx  # e0, i0
        jle     .L3     #,
        incl    %ebx    # i1
        cmpl    28(%ebp), %ebx  # e1, i1
        jle     .L11    #,
.L1:
        popl    %ebx    #
        popl    %esi    #
        popl    %edi    #
        popl    %ebp    #
        ret

-- 
           Summary: [tree-ssa regression] address calculation not moved out
                    of innermost loop
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at tat dot physik dot uni-tuebingen dot de
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14046


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug optimization/14046] [tree-ssa regression] address calculation not moved out of innermost loop
  2004-02-06 12:40 [Bug optimization/14046] New: [tree-ssa regression] address calculation not moved out of innermost loop rguenth at tat dot physik dot uni-tuebingen dot de
@ 2004-02-06 13:39 ` martin at mpa-garching dot mpg dot de
  2004-02-06 14:49 ` rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: martin at mpa-garching dot mpg dot de @ 2004-02-06 13:39 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |martin at mpa-garching dot
                   |                            |mpg dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14046


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug optimization/14046] [tree-ssa regression] address calculation not moved out of innermost loop
  2004-02-06 12:40 [Bug optimization/14046] New: [tree-ssa regression] address calculation not moved out of innermost loop rguenth at tat dot physik dot uni-tuebingen dot de
  2004-02-06 13:39 ` [Bug optimization/14046] " martin at mpa-garching dot mpg dot de
@ 2004-02-06 14:49 ` rguenth at tat dot physik dot uni-tuebingen dot de
  2004-02-06 15:12 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at tat dot physik dot uni-tuebingen dot de @ 2004-02-06 14:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de  2004-02-06 14:49 -------
looking at the loop optimizer dump and comparing to 3.4, I see that for tree-ssa:

Loop at 71 ignored due to multiple entry points.

so the tree optimizers obfuscate the loop too much it seems (in fact, the
optimized tree dump looks very obfuscated - to me ;) ).

I remember a patch floating around to avoid the obfuscation, but don't remember
if it was applied. Jeff?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14046


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug optimization/14046] [tree-ssa regression] address calculation not moved out of innermost loop
  2004-02-06 12:40 [Bug optimization/14046] New: [tree-ssa regression] address calculation not moved out of innermost loop rguenth at tat dot physik dot uni-tuebingen dot de
  2004-02-06 13:39 ` [Bug optimization/14046] " martin at mpa-garching dot mpg dot de
  2004-02-06 14:49 ` rguenth at tat dot physik dot uni-tuebingen dot de
@ 2004-02-06 15:12 ` pinskia at gcc dot gnu dot org
  2004-02-06 15:40 ` dberlin at dberlin dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-06 15:12 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pessimizes-code
   Target Milestone|---                         |tree-ssa


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14046


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug optimization/14046] [tree-ssa regression] address calculation not moved out of innermost loop
  2004-02-06 12:40 [Bug optimization/14046] New: [tree-ssa regression] address calculation not moved out of innermost loop rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (2 preceding siblings ...)
  2004-02-06 15:12 ` pinskia at gcc dot gnu dot org
@ 2004-02-06 15:40 ` dberlin at dberlin dot org
  2004-02-06 15:44 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dberlin at dberlin dot org @ 2004-02-06 15:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dberlin at dberlin dot org  2004-02-06 15:40 -------
Subject: Re:  New: [tree-ssa regression] address calculation not moved out of innermost loop


On Feb 6, 2004, at 7:40 AM, rguenth at tat dot physik dot uni-tuebingen 
dot de wrote:

> For the simple testcase
>
> void foo(double *a, int o, int f0, int e0, int f1, int e1, int s0, int 
> s1)
> {
>   for (int i1=f1; i1<=e1; ++i1)
>     for (int i0=f0; i0<=e0; ++i0)
>       a[o + i0*s0 + i1*s1] = 0.0;
> }
>
> tree-ssa is not able to move the address calculation partly out of the 
> innermost
> loop, while 3.4 is able to do this:
On the normal tree-ssa branch, Load PRE would have been able to move 
this, but it doesn't because it's too expensive to run load PRE on 
calculations that only occur once right now.
Zdenek posted a LICM patch (which should also move it out of the loop), 
and committed it to the lno-branch.
--Dan



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14046


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug optimization/14046] [tree-ssa regression] address calculation not moved out of innermost loop
  2004-02-06 12:40 [Bug optimization/14046] New: [tree-ssa regression] address calculation not moved out of innermost loop rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (3 preceding siblings ...)
  2004-02-06 15:40 ` dberlin at dberlin dot org
@ 2004-02-06 15:44 ` pinskia at gcc dot gnu dot org
  2004-02-16  4:31 ` pinskia at gcc dot gnu dot org
  2004-02-27 18:43 ` dberlin at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-06 15:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-06 15:44 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |tree-ssa
      Known to work|                            |3.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-02-06 15:44:38
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14046


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug optimization/14046] [tree-ssa regression] address calculation not moved out of innermost loop
  2004-02-06 12:40 [Bug optimization/14046] New: [tree-ssa regression] address calculation not moved out of innermost loop rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (4 preceding siblings ...)
  2004-02-06 15:44 ` pinskia at gcc dot gnu dot org
@ 2004-02-16  4:31 ` pinskia at gcc dot gnu dot org
  2004-02-27 18:43 ` dberlin at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-16  4:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-16 04:31 -------
"Loop at 71 ignored due to multiple entry points." is because the loop header is not 
copied at all, this might change soon.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14046


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug optimization/14046] [tree-ssa regression] address calculation not moved out of innermost loop
  2004-02-06 12:40 [Bug optimization/14046] New: [tree-ssa regression] address calculation not moved out of innermost loop rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (5 preceding siblings ...)
  2004-02-16  4:31 ` pinskia at gcc dot gnu dot org
@ 2004-02-27 18:43 ` dberlin at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dberlin at gcc dot gnu dot org @ 2004-02-27 18:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dberlin at gcc dot gnu dot org  2004-02-27 18:43 -------
This is fixed now (or at least, appears to be). The calculation is no longer in the inner loop, and the loop 
is no longer "ignored due to multiple entry points".


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14046


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-02-27 18:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-06 12:40 [Bug optimization/14046] New: [tree-ssa regression] address calculation not moved out of innermost loop rguenth at tat dot physik dot uni-tuebingen dot de
2004-02-06 13:39 ` [Bug optimization/14046] " martin at mpa-garching dot mpg dot de
2004-02-06 14:49 ` rguenth at tat dot physik dot uni-tuebingen dot de
2004-02-06 15:12 ` pinskia at gcc dot gnu dot org
2004-02-06 15:40 ` dberlin at dberlin dot org
2004-02-06 15:44 ` pinskia at gcc dot gnu dot org
2004-02-16  4:31 ` pinskia at gcc dot gnu dot org
2004-02-27 18:43 ` dberlin at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).