public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/23346] New: [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads
@ 2005-08-12  0:50 pinskia at gcc dot gnu dot org
  2005-08-12  0:50 ` [Bug tree-optimization/23346] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 22+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-12  0:50 UTC (permalink / raw)
  To: gcc-bugs

Take the following code:
int a, b;

int f(int bool1)
{
  int c;
  int c1 = a/b;
  if(bool1)
    c = 0;
  else
    c = a/b;
  return c;
}

On the mainline, we produce (at -O2 -fomit-frame-pointer):
f:
        subl    $8, %esp
        xorl    %ecx, %ecx
        movl    12(%esp), %eax
        movl    %ebx, (%esp)
        movl    b, %edx
        movl    %esi, 4(%esp)
        movl    a, %ebx
        testl   %eax, %eax
        jne     .L4
        movl    %ebx, %eax
        movl    %edx, %esi
        cltd
        idivl   %esi
        movl    %eax, %ecx
.L4:
        movl    (%esp), %ebx
        movl    %ecx, %eax
        movl    4(%esp), %esi
        addl    $8, %esp
        ret

Which is just a mess.
in 4.0.0, we produced:
f:
        movl    4(%esp), %edx
        xorl    %eax, %eax
        testl   %edx, %edx
        jne     .L4
        movl    a, %eax
        cltd
        idivl   b
.L4:
        ret

There are two ways of fixing this, one way is to sink loads; the other simple way (most likely for 4.1) is 
to call dce before fre.  I think the reason why the testcase which Steven committed did not catch this is 
because sink will sink the divide which is what is only in Steven's testcase.

-- 
           Summary: [4.1 Regression] FRE before DCE makes a mess of loads or
                    need to sink loads
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2009-03-30 15:46 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-23346-6528@http.gcc.gnu.org/bugzilla/>
2005-10-12  0:53 ` [Bug tree-optimization/23346] [4.1 Regression] FRE before DCE makes a mess of loads or need to sink loads pinskia at gcc dot gnu dot org
2005-10-17  9:35 ` steven at gcc dot gnu dot org
2005-10-29  1:21 ` pinskia at gcc dot gnu dot org
2005-10-31  4:58 ` mmitchel at gcc dot gnu dot org
2005-10-31  4:59 ` pinskia at physics dot uc dot edu
2006-02-24  0:26 ` [Bug tree-optimization/23346] [4.1/4.2 " mmitchel at gcc dot gnu dot org
2006-04-19  9:02 ` rguenth at gcc dot gnu dot org
2006-04-21 12:34 ` rguenth at gcc dot gnu dot org
2006-05-25  2:35 ` mmitchel at gcc dot gnu dot org
2006-10-10 11:58 ` rguenth at gcc dot gnu dot org
2006-10-10 14:03 ` amacleod at redhat dot com
2007-01-15 20:15 ` [Bug tree-optimization/23346] [4.1/4.2/4.3 " pinskia at gcc dot gnu dot org
2007-02-14  9:07 ` mmitchel at gcc dot gnu dot org
2007-07-01  1:07 ` [Bug tree-optimization/23346] [4.1/4.2 " pinskia at gcc dot gnu dot org
2008-07-04 20:02 ` [Bug tree-optimization/23346] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 15:46 ` jsm28 at gcc dot gnu dot org
2005-08-12  0:50 [Bug tree-optimization/23346] New: [4.1 " pinskia at gcc dot gnu dot org
2005-08-12  0:50 ` [Bug tree-optimization/23346] " pinskia at gcc dot gnu dot org
2005-08-23 16:34 ` pinskia at gcc dot gnu dot org
2005-08-23 16:54 ` dberlin at gcc dot gnu dot org
2005-08-23 17:02 ` pinskia at gcc dot gnu dot org
2005-08-23 19:54 ` dberlin at gcc dot gnu dot org
2005-08-26 15:53 ` 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).