public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/14847] [tree-ssa] combine "if (a & 1) goto there" and "if (a & 4) goto there"
       [not found] <bug-14847-5009@http.gcc.gnu.org/bugzilla/>
@ 2008-04-29 10:02 ` rguenth at gcc dot gnu dot org
  2008-04-30 15:07 ` rguenth at gcc dot gnu dot org
  2008-04-30 15:07 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-29 10:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2008-04-29 10:01 -------
The ifcombine pass would do this since 4.3.0 if there were not an extra
conversion
for a bittest of bit zero:

<bb 2>:
  a.0_2 = (int) a_1(D);
  D.1556_3 = a.0_2 & 1;
  if (D.1556_3 != 0)
    goto <bb 4> (heaven);
  else
    goto <bb 3>;

<bb 3>:
  D.1558_5 = a_1(D) & 4;
  if (D.1558_5 != 0)
    goto <bb 4> (heaven);
  else
    goto <bb 5>;

this is probably due to fold.  I will have a look.

For

void
foo (unsigned int a)
{
  if (a & 2)
    goto heaven;
  if (a & 4)
    goto heaven;
  return;

 heaven:
  bar ();
}

this is optimized to

optimizing bits or bits test to a_1(D) & T != 0
with temporary T = 4 | 2
Merging blocks 2 and 3
foo (unsigned int a)
{
  unsigned int D.1583;
  unsigned int D.1556;
  unsigned int D.1555;

<bb 2>:
  D.1555_2 = a_1(D) & 2;
  D.1556_3 = a_1(D) & 4;
  D.1583_5 = a_1(D) & 6;
  if (D.1583_5 != 0)
    goto <bb 3> (heaven);
  else
    goto <bb 4>;

Invalid sum of incoming frequencies 6100, should be 7231
heaven:;
  bar ();

<bb 4>:
Invalid sum of incoming frequencies 11131, should be 10000
  return;

}


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-02-05 21:36:17         |2008-04-29 10:01:23
               date|                            |


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


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

* [Bug tree-optimization/14847] [tree-ssa] combine "if (a & 1) goto there" and "if (a & 4) goto there"
       [not found] <bug-14847-5009@http.gcc.gnu.org/bugzilla/>
  2008-04-29 10:02 ` [Bug tree-optimization/14847] [tree-ssa] combine "if (a & 1) goto there" and "if (a & 4) goto there" rguenth at gcc dot gnu dot org
@ 2008-04-30 15:07 ` rguenth at gcc dot gnu dot org
  2008-04-30 15:07 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-30 15:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2008-04-30 15:07 -------
Subject: Bug 14847

Author: rguenth
Date: Wed Apr 30 15:06:16 2008
New Revision: 134825

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134825
Log:
2008-04-30  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/14847
        * tree-ssa-ifcombine.c (get_name_for_bit_test): New helper function.
        (recognize_bits_test): Use it.
        (recognize_single_bit_test): Likewise.

        * gcc.dg/tree-ssa/ssa-ifcombine-6.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-6.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-ifcombine.c


-- 


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


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

* [Bug tree-optimization/14847] [tree-ssa] combine "if (a & 1) goto there" and "if (a & 4) goto there"
       [not found] <bug-14847-5009@http.gcc.gnu.org/bugzilla/>
  2008-04-29 10:02 ` [Bug tree-optimization/14847] [tree-ssa] combine "if (a & 1) goto there" and "if (a & 4) goto there" rguenth at gcc dot gnu dot org
  2008-04-30 15:07 ` rguenth at gcc dot gnu dot org
@ 2008-04-30 15:07 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-30 15:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2008-04-30 15:06 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |4.4.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0


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


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

* [Bug tree-optimization/14847] [tree-ssa] combine "if (a & 1) goto there" and "if (a & 4) goto there"
       [not found] <bug-14847-4@http.gcc.gnu.org/bugzilla/>
@ 2014-10-31  4:02 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-10-31  4:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14847
Bug 14847 depends on bug 15459, which changed state.

Bug 15459 Summary: [meta-bug] there should be a tree combiner like the rtl one
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15459

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


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

* [Bug tree-optimization/14847] [tree-ssa] combine "if (a & 1) goto there" and "if (a & 4) goto there"
       [not found] <20040404164820.14847.kazu@gcc.gnu.org>
@ 2005-09-30 22:09 ` steven at gcc dot gnu dot org
  0 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-09-30 22:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-09-30 22:09 -------
In fact, combine also doesn't catch this for me on AMD64. 
 

-- 


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


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

* [Bug tree-optimization/14847] [tree-ssa] combine "if (a & 1) goto there" and "if (a & 4) goto there"
  2004-04-04 16:48 [Bug optimization/14847] New: [tree-ssa kazu at cs dot umass dot edu
  2004-05-24 19:57 ` [Bug tree-optimization/14847] [tree-ssa] combine "if (a & 1) goto there" and "if (a & 4) goto there" pinskia at gcc dot gnu dot org
@ 2005-04-21  0:40 ` kazu at cs dot umass dot edu
  1 sibling, 0 replies; 7+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-21  0:40 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 14847 depends on bug 14846, which changed state.

Bug 14846 Summary: [tree-ssa] don't use a shift in A & CST_POWER_OF_2 == 0 until very late in tree-ssa optimizations
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14846

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

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


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

* [Bug tree-optimization/14847] [tree-ssa] combine "if (a & 1) goto there" and "if (a & 4) goto there"
  2004-04-04 16:48 [Bug optimization/14847] New: [tree-ssa kazu at cs dot umass dot edu
@ 2004-05-24 19:57 ` pinskia at gcc dot gnu dot org
  2005-04-21  0:40 ` kazu at cs dot umass dot edu
  1 sibling, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 19:57 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.5.0                       |---


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


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

end of thread, other threads:[~2014-10-31  4:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-14847-5009@http.gcc.gnu.org/bugzilla/>
2008-04-29 10:02 ` [Bug tree-optimization/14847] [tree-ssa] combine "if (a & 1) goto there" and "if (a & 4) goto there" rguenth at gcc dot gnu dot org
2008-04-30 15:07 ` rguenth at gcc dot gnu dot org
2008-04-30 15:07 ` rguenth at gcc dot gnu dot org
     [not found] <bug-14847-4@http.gcc.gnu.org/bugzilla/>
2014-10-31  4:02 ` pinskia at gcc dot gnu.org
     [not found] <20040404164820.14847.kazu@gcc.gnu.org>
2005-09-30 22:09 ` steven at gcc dot gnu dot org
2004-04-04 16:48 [Bug optimization/14847] New: [tree-ssa kazu at cs dot umass dot edu
2004-05-24 19:57 ` [Bug tree-optimization/14847] [tree-ssa] combine "if (a & 1) goto there" and "if (a & 4) goto there" pinskia at gcc dot gnu dot org
2005-04-21  0:40 ` kazu at cs dot umass dot edu

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).