public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/18136] New: arguments being gimple registers cause redundant memory loads
@ 2004-10-25  0:49 hubicka at gcc dot gnu dot org
  2004-10-25  0:50 ` [Bug tree-optimization/18136] " hubicka at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2004-10-25  0:49 UTC (permalink / raw)
  To: gcc-bugs

Since the arguments are gimple registers, gimple optimizers are happy to create many references to it.
While lowering them to RTL these however compile to memory loads causing number of redundant loads.
The attached quicksort loop on when compiled with -O2 -fno-loop-optimize (the other being needed only for clarity of the testcase) produces such a funny sequence:
        movl    8(%ebp), %eax   # 143   *movsi_1/1      [length = 3]
        movl    8(%ebp), %edx   # 171   *movsi_1/1      [length = 3]
        movl    8(%ebp), %ebx   # 145   *movsi_1/1      [length = 3]
These are comming from:
  median = data[start];
  pos.22 = start + 1;
  if (end - start <= 1) goto <L6>; else goto <L25>;
where each of these compiles into RTL expression that looks different to CSE:
(insn 16 15 18 1 (set (reg/v:SI 66 [ median ])
        (mem/s:SI (plus:SI (mult:SI (reg/v:SI 68 [ start ])
                    (const_int 4 [0x4]))
                (reg/f:SI 70)) [3 data S4 A32])) -1 (nil)
    (nil))

(insn 18 16 20 1 (parallel [
            (set (reg/v:SI 60 [ pos.22 ])
                (plus:SI (reg/v:SI 68 [ start ])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) -1 (nil)
    (nil))

(insn 20 18 21 1 (parallel [
            (set (reg:SI 71)
                (minus:SI (reg/v:SI 69 [ end ])
                    (reg/v:SI 68 [ start ])))
            (clobber (reg:CC 17 flags))
        ]) -1 (nil)
    (nil))

(insn 21 20 22 1 (set (reg:CCGC 17 flags)
        (compare:CCGC (reg:SI 71)
            (const_int 1 [0x1]))) -1 (nil)
    (nil))
Similarly we get redudnant loads inside the loop itself.

Not sure about sollution - making arguments nongimple registers does not lead optimizers to deal with them very nicely, forcing
expander to load memory operands to register in prologue would lead to unnecesarly long lifetimes...
forcing memory operands to registers in RTL generation is something we want to avoid ;)
Ideas?

-- 
           Summary: arguments being gimple registers cause redundant memory
                    loads
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hubicka at gcc dot gnu dot org
                CC: dnovillo at redhat dot com,gcc-bugs at gcc dot gnu dot
                    org,rth at redhat dot com,stevenb at suse dot de
GCC target triplet: i686-linux


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


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

* [Bug tree-optimization/18136] arguments being gimple registers cause redundant memory loads
  2004-10-25  0:49 [Bug tree-optimization/18136] New: arguments being gimple registers cause redundant memory loads hubicka at gcc dot gnu dot org
@ 2004-10-25  0:50 ` hubicka at gcc dot gnu dot org
  2004-10-25  1:03 ` pinskia at gcc dot gnu dot org
  2004-10-25  1:09 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2004-10-25  0:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hubicka at gcc dot gnu dot org  2004-10-25 00:50 -------
Created an attachment (id=7406)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7406&action=view)
the quicksort loop


-- 


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


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

* [Bug tree-optimization/18136] arguments being gimple registers cause redundant memory loads
  2004-10-25  0:49 [Bug tree-optimization/18136] New: arguments being gimple registers cause redundant memory loads hubicka at gcc dot gnu dot org
  2004-10-25  0:50 ` [Bug tree-optimization/18136] " hubicka at gcc dot gnu dot org
@ 2004-10-25  1:03 ` pinskia at gcc dot gnu dot org
  2004-10-25  1:09 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-25  1:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-25 01:03 -------
*** Bug 18137 has been marked as a duplicate of this bug. ***

-- 


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


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

* [Bug tree-optimization/18136] arguments being gimple registers cause redundant memory loads
  2004-10-25  0:49 [Bug tree-optimization/18136] New: arguments being gimple registers cause redundant memory loads hubicka at gcc dot gnu dot org
  2004-10-25  0:50 ` [Bug tree-optimization/18136] " hubicka at gcc dot gnu dot org
  2004-10-25  1:03 ` pinskia at gcc dot gnu dot org
@ 2004-10-25  1:09 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-25  1:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-25 01:09 -------


*** This bug has been marked as a duplicate of 18137 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2004-10-25  1:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-25  0:49 [Bug tree-optimization/18136] New: arguments being gimple registers cause redundant memory loads hubicka at gcc dot gnu dot org
2004-10-25  0:50 ` [Bug tree-optimization/18136] " hubicka at gcc dot gnu dot org
2004-10-25  1:03 ` pinskia at gcc dot gnu dot org
2004-10-25  1:09 ` 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).