public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/32940]  New: ivopts fails to set REG_POINTER attribute on pseudo
@ 2007-07-30 22:48 bergner at gcc dot gnu dot org
  2007-07-30 23:54 ` [Bug middle-end/32940] REG_POINTER attribute on DECL_ARTIFICIAL pointers pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: bergner at gcc dot gnu dot org @ 2007-07-30 22:48 UTC (permalink / raw)
  To: gcc-bugs

The ivopts pass fails to set the REG_POINTER attribute on a pseudo that is
equal to two pseudos, one of which has teh REG_POINTER attribute and the other
is just a n offset from it.  This leads us to not sort the operands on an
indexed load/store instruction causing performance problems on POWER6.

The test case used to recreate the problem is:

linux> cat > bug.c <<EOF
unsigned int *quadrant;
unsigned int
fullGtU (int i1, int n)
{
  unsigned int s1 = 0;
  for (; n >= 0; n--)
    {
      s1 = quadrant[i1];
      i1 += n;
    }
  return s1;
}
EOF

linux> /path/to/gcc -O1 -S -da bug.c

Resulting assembly:
fullGtU:
        li 0,0
        cmpwi 0,4,0
        blt 0,.L3
        lis 9,quadrant@ha
        lwz 11,quadrant@l(9)
        addi 0,4,1
        mtctr 0
        addi 0,4,-1
        cmpwi 7,0,-1
        bge+ 7,.L4
        li 0,1
        mtctr 0
.L4:
        slwi 9,3,2
        lwzx 0,9,11  <- bad operand ordering
        add 3,3,4
        addi 4,4,-1
        bdnz .L4
.L3:
        mr 3,0
        blr

Bad RTL in bug.c.127r.expand:

(insn 21 20 22 bug.c:8 (set (reg/f:SI 129)
        (plus:SI (reg:SI 128)
            (reg:SI 121 [ quadrant.0 ]))) -1 (nil))

(insn 22 21 0 bug.c:8 (set (reg/v:SI 120 [ s1 ])
        (mem:SI (reg/f:SI 129) [0 S4 A32])) -1 (nil))

Eventually, pseudo 129 )which has the REG_POINTER attribute) gets exchanged
with the (plus:SI (reg:SI 128) (reg:SI 121 [ quadrant.0 ])) and pseudo 121
doesn't have the attribute, so we end up failing to swap them.


-- 
           Summary: ivopts fails to set REG_POINTER attribute on pseudo
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bergner at gcc dot gnu dot org
 GCC build triplet: powerpc64-linux
  GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux


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


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

* [Bug middle-end/32940] REG_POINTER attribute on DECL_ARTIFICIAL pointers
  2007-07-30 22:48 [Bug middle-end/32940] New: ivopts fails to set REG_POINTER attribute on pseudo bergner at gcc dot gnu dot org
@ 2007-07-30 23:54 ` pinskia at gcc dot gnu dot org
  2007-08-02  0:32 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-07-30 23:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-07-30 23:54 -------
;; quadrant.0 = quadrant
(insn 16 15 17 t.c:8 (set (reg:SI 127)
        (high:SI (symbol_ref:SI ("quadrant") [flags 0x84] <var_decl 0xf7d9f070
quadrant>))) -1 (nil))

(insn 17 16 18 t.c:8 (set (reg/f:SI 126)
        (lo_sum:SI (reg:SI 127)
            (symbol_ref:SI ("quadrant") [flags 0x84] <var_decl 0xf7d9f070
quadrant>))) -1 (expr_list:REG_EQUAL (symbol_ref:SI ("quadrant") [flags 0x84]
<var_decl 0xf7d9f070 quadrant>)
        (nil)))

(insn 18 17 0 t.c:8 (set (reg:SI 121 [ quadrant.0 ])
        (mem/f/c/i:SI (reg/f:SI 126) [2 quadrant+0 S4 A32])) -1 (nil))


The problem here is that DECL_ARTIFICIAL causes REG_POINTER not to be set.
See: http://gcc.gnu.org/ml/gcc-patches/2004-06/msg00020.html

Reverting that patch was the next step on my pointer plus work (after fixing up
the regressions that still need fixing).


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-07-30 23:54:41
               date|                            |
            Summary|ivopts fails to set         |REG_POINTER attribute on
                   |REG_POINTER attribute on    |DECL_ARTIFICIAL pointers
                   |pseudo                      |


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


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

* [Bug middle-end/32940] REG_POINTER attribute on DECL_ARTIFICIAL pointers
  2007-07-30 22:48 [Bug middle-end/32940] New: ivopts fails to set REG_POINTER attribute on pseudo bergner at gcc dot gnu dot org
  2007-07-30 23:54 ` [Bug middle-end/32940] REG_POINTER attribute on DECL_ARTIFICIAL pointers pinskia at gcc dot gnu dot org
@ 2007-08-02  0:32 ` pinskia at gcc dot gnu dot org
  2007-08-02  0:37 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-02  0:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-08-02 00:31 -------
.L4:
        slwi 0,3,2
        lwzx 0,9,0
        add 3,3,4
        addi 4,4,-1
        bdnz .L4

Much better correct?


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization


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


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

* [Bug middle-end/32940] REG_POINTER attribute on DECL_ARTIFICIAL pointers
  2007-07-30 22:48 [Bug middle-end/32940] New: ivopts fails to set REG_POINTER attribute on pseudo bergner at gcc dot gnu dot org
  2007-07-30 23:54 ` [Bug middle-end/32940] REG_POINTER attribute on DECL_ARTIFICIAL pointers pinskia at gcc dot gnu dot org
  2007-08-02  0:32 ` pinskia at gcc dot gnu dot org
@ 2007-08-02  0:37 ` pinskia at gcc dot gnu dot org
  2007-08-03 14:44 ` bergner at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-02  0:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-08-02 00:37 -------
Created an attachment (id=14008)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14008&action=view)
Patch which needs full testing still

Hi, this reverts Jeff's patch in both stmt.c and cfgexpand.c (I don't know how
much code of stmt.c's function is still used though).

This patch has not been bootstrapped and tested yet and after it gets done, it
still needs an extra test on hppa-hpux as that is what Jeff's patch was trying
to fix.


-- 


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


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

* [Bug middle-end/32940] REG_POINTER attribute on DECL_ARTIFICIAL pointers
  2007-07-30 22:48 [Bug middle-end/32940] New: ivopts fails to set REG_POINTER attribute on pseudo bergner at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-08-02  0:37 ` pinskia at gcc dot gnu dot org
@ 2007-08-03 14:44 ` bergner at gcc dot gnu dot org
  2007-08-03 15:30 ` pthaugen at us dot ibm dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bergner at gcc dot gnu dot org @ 2007-08-03 14:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from bergner at gcc dot gnu dot org  2007-08-03 14:43 -------
Andrew's patch from Comment #3 bootstrapped and regtested with no regressions
on powerpc64-linux running the testsuite in both 32-bit and 64-bit modes.
I can also confirm that it fixes the test case I posted above.
Pat is running SPEC2000 with the patch now.


-- 


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


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

* [Bug middle-end/32940] REG_POINTER attribute on DECL_ARTIFICIAL pointers
  2007-07-30 22:48 [Bug middle-end/32940] New: ivopts fails to set REG_POINTER attribute on pseudo bergner at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-08-03 14:44 ` bergner at gcc dot gnu dot org
@ 2007-08-03 15:30 ` pthaugen at us dot ibm dot com
  2007-08-06 19:22 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pthaugen at us dot ibm dot com @ 2007-08-03 15:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pthaugen at us dot ibm dot com  2007-08-03 15:30 -------
This patch gives us an additional 2-3% overall on CPU2000, running on Power6.
Facerec was the big winner with about 40% improvement, there were a few
improvements in the 5-10% range and a few degradations in the 1-2% range that
could be attributed to other issues like loop alignment or possibly an issue
with r0 getting assigned to the base reg by renaming which I'm currently
testing a patch for.


-- 


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


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

* [Bug middle-end/32940] REG_POINTER attribute on DECL_ARTIFICIAL pointers
  2007-07-30 22:48 [Bug middle-end/32940] New: ivopts fails to set REG_POINTER attribute on pseudo bergner at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-08-03 15:30 ` pthaugen at us dot ibm dot com
@ 2007-08-06 19:22 ` pinskia at gcc dot gnu dot org
  2007-08-20  0:48 ` pinskia at gcc dot gnu dot org
  2007-08-20  0:48 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-06 19:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2007-08-06 19:22 -------
This patch helps more than just PR 28690 as we now have the ablity to use r0
more for the index which causes us to use one less callee saved register in
some cases and reduces the stack size.   I saw that result while compiling
tramp3d.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org


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


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

* [Bug middle-end/32940] REG_POINTER attribute on DECL_ARTIFICIAL pointers
  2007-07-30 22:48 [Bug middle-end/32940] New: ivopts fails to set REG_POINTER attribute on pseudo bergner at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-08-20  0:48 ` pinskia at gcc dot gnu dot org
@ 2007-08-20  0:48 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-20  0:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2007-08-20 00:48 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

* [Bug middle-end/32940] REG_POINTER attribute on DECL_ARTIFICIAL pointers
  2007-07-30 22:48 [Bug middle-end/32940] New: ivopts fails to set REG_POINTER attribute on pseudo bergner at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-08-06 19:22 ` pinskia at gcc dot gnu dot org
@ 2007-08-20  0:48 ` pinskia at gcc dot gnu dot org
  2007-08-20  0:48 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-20  0:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2007-08-20 00:48 -------
Subject: Bug 32940

Author: pinskia
Date: Mon Aug 20 00:48:09 2007
New Revision: 127634

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127634
Log:
2007-08-19  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR middle-end/32940
        * cfgexpand.c  (expand_one_register_var): Mark pointer
        DECL_ARTIFICIAL as REG_POINTER also.
        * stmt.c (expand_decl): Likewise.



Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgexpand.c
    trunk/gcc/stmt.c


-- 


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


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

end of thread, other threads:[~2007-08-20  0:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-30 22:48 [Bug middle-end/32940] New: ivopts fails to set REG_POINTER attribute on pseudo bergner at gcc dot gnu dot org
2007-07-30 23:54 ` [Bug middle-end/32940] REG_POINTER attribute on DECL_ARTIFICIAL pointers pinskia at gcc dot gnu dot org
2007-08-02  0:32 ` pinskia at gcc dot gnu dot org
2007-08-02  0:37 ` pinskia at gcc dot gnu dot org
2007-08-03 14:44 ` bergner at gcc dot gnu dot org
2007-08-03 15:30 ` pthaugen at us dot ibm dot com
2007-08-06 19:22 ` pinskia at gcc dot gnu dot org
2007-08-20  0:48 ` pinskia at gcc dot gnu dot org
2007-08-20  0:48 ` pinskia 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).