public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/2806] if's are not combined together
       [not found] <20010511150601.2806.eric-gcc@omnifarious.org>
@ 2003-06-15 19:01 ` pinskia@physics.uc.edu
  2003-06-16 16:37 ` eric-gcc@omnifarious.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia@physics.uc.edu @ 2003-06-15 19:01 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia@physics.uc.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|0000-00-00 00:00:00         |2003-06-15 19:01:53
               date|                            |
            Summary|inadequate optimization in  |if's are not combined
                   |static and global           |together
                   |initializers                |


------- Additional Comments From pinskia@physics.uc.edu  2003-06-15 19:01 -------
Still happens on the mainline (20030615) and changing the symmary to really what this 
bug is about, the initializers are just that simplified which is caused by this.


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

* [Bug optimization/2806] if's are not combined together
       [not found] <20010511150601.2806.eric-gcc@omnifarious.org>
  2003-06-15 19:01 ` [Bug optimization/2806] if's are not combined together pinskia@physics.uc.edu
@ 2003-06-16 16:37 ` eric-gcc@omnifarious.org
  2003-07-21  2:56 ` pinskia at physics dot uc dot edu
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: eric-gcc@omnifarious.org @ 2003-06-16 16:37 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From eric-gcc@omnifarious.org  2003-06-16 16:34 -------
Well, actually, the bug is two issues.

The first is that trivial static initializers of const objects like this should
be analyzed at compile time, and put in the .rodata segment, provided, of
course, there are equally trivial destructors.

If it's non-const or there are trivial constructors, but not trivial
destructors, then it should be put into the .data segment.  There is no reason
those things need to have any run time code at all.

The second issue is the "if statements are not combined together" issue.


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

* [Bug optimization/2806] if's are not combined together
       [not found] <20010511150601.2806.eric-gcc@omnifarious.org>
  2003-06-15 19:01 ` [Bug optimization/2806] if's are not combined together pinskia@physics.uc.edu
  2003-06-16 16:37 ` eric-gcc@omnifarious.org
@ 2003-07-21  2:56 ` pinskia at physics dot uc dot edu
  2003-08-18  3:11 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-21  2:56 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-21 02:56 -------
In fact if the if are combined together before emitting to rtl some of the problems in bug 
10060 	would fixed as the number of rtl's would be greatly reduced.


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

* [Bug optimization/2806] if's are not combined together
       [not found] <20010511150601.2806.eric-gcc@omnifarious.org>
                   ` (2 preceding siblings ...)
  2003-07-21  2:56 ` pinskia at physics dot uc dot edu
@ 2003-08-18  3:11 ` pinskia at gcc dot gnu dot org
  2003-11-17 15:41 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-18  3:11 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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

* [Bug optimization/2806] if's are not combined together
       [not found] <20010511150601.2806.eric-gcc@omnifarious.org>
                   ` (3 preceding siblings ...)
  2003-08-18  3:11 ` pinskia at gcc dot gnu dot org
@ 2003-11-17 15:41 ` pinskia at gcc dot gnu dot org
  2003-12-17  0:54 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-17 15:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-17 15:41 -------
Suspending as the combining of the if is fixed on the tree-ssa branch.
On PPC the code now looks like:
_foo:
        li r2,0
        cmpwi cr6,r3,1
        ori r0,r2,65535
        cmpw cr7,r4,r0
        bnelr+ cr7
        bnelr+ cr6
        lis r7,ha16(L_abarney$non_lazy_ptr)
        lis r5,ha16(L_afred$non_lazy_ptr)
        lwz r9,lo16(L_abarney$non_lazy_ptr)(r7)
        li r6,6
        li r11,2
        lwz r4,lo16(L_afred$non_lazy_ptr)(r5)
        li r3,5
        stw r6,4(r9)
        stw r11,0(r4)
        stw r3,0(r9)
        blr

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |SUSPENDED
   Target Milestone|---                         |tree-ssa


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


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

* [Bug optimization/2806] if's are not combined together
       [not found] <20010511150601.2806.eric-gcc@omnifarious.org>
                   ` (4 preceding siblings ...)
  2003-11-17 15:41 ` pinskia at gcc dot gnu dot org
@ 2003-12-17  0:54 ` pinskia at gcc dot gnu dot org
  2003-12-17 17:17 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-17  0:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-17 00:53 -------
Closing as fixed for the tree-ssa.

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


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


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

* [Bug optimization/2806] if's are not combined together
       [not found] <20010511150601.2806.eric-gcc@omnifarious.org>
                   ` (5 preceding siblings ...)
  2003-12-17  0:54 ` pinskia at gcc dot gnu dot org
@ 2003-12-17 17:17 ` pinskia at gcc dot gnu dot org
  2003-12-17 17:23 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-17 17:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-17 17:05 -------
Reopening the bugs that are fixed on the tree-ssa (but not reported against the branch).

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


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


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

* [Bug optimization/2806] if's are not combined together
       [not found] <20010511150601.2806.eric-gcc@omnifarious.org>
                   ` (6 preceding siblings ...)
  2003-12-17 17:17 ` pinskia at gcc dot gnu dot org
@ 2003-12-17 17:23 ` pinskia at gcc dot gnu dot org
  2004-03-04  3:06 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-17 17:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-17 17:10 -------
Suspending based on this is fixed on the tree-ssa.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |SUSPENDED


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


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

* [Bug optimization/2806] if's are not combined together
       [not found] <20010511150601.2806.eric-gcc@omnifarious.org>
                   ` (7 preceding siblings ...)
  2003-12-17 17:23 ` pinskia at gcc dot gnu dot org
@ 2004-03-04  3:06 ` pinskia at gcc dot gnu dot org
  2004-03-04  5:00 ` law at redhat dot com
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-04  3:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-04 03:06 -------
We are now missing one jump threading for some reason:
(From .DOM3):
{
<bb 0>:
  if (eax_1 == 65535) goto <L0>; else goto <L6>;

<L0>:;
  if (edx_2 == 1) goto <L1>; else goto <L4>;

<L1>:;
  abarney[0] = 5;
  abarney[1] = 6;

<L4>:;
  edx_3 = edx_2 - 1;
  if (edx_3 == 0) goto <L5>; else goto <L6>;

<L5>:;
  afred[0] = 2;

<L6>:;
  return;

}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu dot org
             Status|SUSPENDED                   |NEW
   Last reconfirmed|2003-12-04 09:14:27         |2004-03-04 03:06:04
               date|                            |


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


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

* [Bug optimization/2806] if's are not combined together
       [not found] <20010511150601.2806.eric-gcc@omnifarious.org>
                   ` (8 preceding siblings ...)
  2004-03-04  3:06 ` pinskia at gcc dot gnu dot org
@ 2004-03-04  5:00 ` law at redhat dot com
  2004-03-05  3:53 ` law at redhat dot com
  2004-03-05 20:54 ` law at gcc dot gnu dot org
  11 siblings, 0 replies; 12+ messages in thread
From: law at redhat dot com @ 2004-03-04  5:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From law at redhat dot com  2004-03-04 05:00 -------
Subject: Re:  if's are not combined together 

In message <20040304030605.4965.qmail@sources.redhat.com>, "pinskia at gcc dot 
gnu dot org" writes:
 >
 >------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-04 0
 >3:06 -------
 >We are now missing one jump threading for some reason:
 >(From .DOM3):
 >{
 ><bb 0>:
 >  if (eax_1 == 65535) goto <L0>; else goto <L6>;
 >
 ><L0>:;
 >  if (edx_2 == 1) goto <L1>; else goto <L4>;
 >
 ><L1>:;
 >  abarney[0] = 5;
 >  abarney[1] = 6;
 >
 ><L4>:;
 >  edx_3 = edx_2 - 1;
 >  if (edx_3 == 0) goto <L5>; else goto <L6>;
 >
 ><L5>:;
 >  afred[0] = 2;
 >
 ><L6>:;
 >  return;
What jump do you think should be threaded?   I don't see any jump threading
opportunities here -- at least not without knowing that edx_3 is only used
once.

jeff



-- 


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


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

* [Bug optimization/2806] if's are not combined together
       [not found] <20010511150601.2806.eric-gcc@omnifarious.org>
                   ` (9 preceding siblings ...)
  2004-03-04  5:00 ` law at redhat dot com
@ 2004-03-05  3:53 ` law at redhat dot com
  2004-03-05 20:54 ` law at gcc dot gnu dot org
  11 siblings, 0 replies; 12+ messages in thread
From: law at redhat dot com @ 2004-03-05  3:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From law at redhat dot com  2004-03-05 03:53 -------
Subject: Re:  if's are not combined together 

In message <20040304030605.4965.qmail@sources.redhat.com>, "pinskia at gcc dot 
gnu dot org" writes:
 >
 >------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-04 0
 >3:06 -------
 >We are now missing one jump threading for some reason:
 >(From .DOM3):
 >{
 ><bb 0>:
 >  if (eax_1 == 65535) goto <L0>; else goto <L6>;
 >
 ><L0>:;
 >  if (edx_2 == 1) goto <L1>; else goto <L4>;
 >
 ><L1>:;
 >  abarney[0] = 5;
 >  abarney[1] = 6;
 >
 ><L4>:;
 >  edx_3 = edx_2 - 1;
 >  if (edx_3 == 0) goto <L5>; else goto <L6>;
 >
 ><L5>:;
 >  afred[0] = 2;
 >
 ><L6>:;
 >  return;
OK.  edx_3 is a single use variable and we can (in theory) propagate it into
the conditional and adjust the conditional.  ie

if (edx_3 == 0)

can be turned into

  if (edx_2 == 1)

Once that's done, then the jump threader can thread through that block.

I've got a patch which does that as a straightforward extension to
tree-ssa-forwprop.  I'm still evaluating whether or not I want to risk
introducing it now or wait until after we merge.

On a positive note, with that improvement to tree-ssa-forwprop tree-ssa
generates noticeably better code than the mainline GCC sources.


jeff



-- 


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


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

* [Bug optimization/2806] if's are not combined together
       [not found] <20010511150601.2806.eric-gcc@omnifarious.org>
                   ` (10 preceding siblings ...)
  2004-03-05  3:53 ` law at redhat dot com
@ 2004-03-05 20:54 ` law at gcc dot gnu dot org
  11 siblings, 0 replies; 12+ messages in thread
From: law at gcc dot gnu dot org @ 2004-03-05 20:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From law at gcc dot gnu dot org  2004-03-05 20:54 -------
We now fully thread the IF conditionals in both examples.



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


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


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

end of thread, other threads:[~2004-03-05 20:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20010511150601.2806.eric-gcc@omnifarious.org>
2003-06-15 19:01 ` [Bug optimization/2806] if's are not combined together pinskia@physics.uc.edu
2003-06-16 16:37 ` eric-gcc@omnifarious.org
2003-07-21  2:56 ` pinskia at physics dot uc dot edu
2003-08-18  3:11 ` pinskia at gcc dot gnu dot org
2003-11-17 15:41 ` pinskia at gcc dot gnu dot org
2003-12-17  0:54 ` pinskia at gcc dot gnu dot org
2003-12-17 17:17 ` pinskia at gcc dot gnu dot org
2003-12-17 17:23 ` pinskia at gcc dot gnu dot org
2004-03-04  3:06 ` pinskia at gcc dot gnu dot org
2004-03-04  5:00 ` law at redhat dot com
2004-03-05  3:53 ` law at redhat dot com
2004-03-05 20:54 ` law 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).