public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/18892] New: missed SRA of a block copy
@ 2004-12-08 20:15 pinskia at gcc dot gnu dot org
  2004-12-08 20:16 ` [Bug tree-optimization/18892] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-08 20:15 UTC (permalink / raw)
  To: gcc-bugs

The following function:
int f(int a)
{
  int i = a & -129;
  return i == 144;
}
Should be compiled to:
int f1(int a)
{
  return (a & -129) == 144; // aka return 0;
}

Yes this shows up in real code (gcc), found while testing out my tree combiner.

-- 
           Summary: missed SRA of a block copy
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          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
 BugsThisDependsOn: 15459


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


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

* [Bug tree-optimization/18892] missed SRA of a block copy
  2004-12-08 20:15 [Bug tree-optimization/18892] New: missed SRA of a block copy pinskia at gcc dot gnu dot org
@ 2004-12-08 20:16 ` pinskia at gcc dot gnu dot org
  2004-12-08 20:28 ` [Bug tree-optimization/18892] New: " Diego Novillo
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-08 20:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-08 20:15 -------
Mine.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-12-08 20:15:52
               date|                            |


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


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

* Re: [Bug tree-optimization/18892] New: missed SRA of a block copy
  2004-12-08 20:15 [Bug tree-optimization/18892] New: missed SRA of a block copy pinskia at gcc dot gnu dot org
  2004-12-08 20:16 ` [Bug tree-optimization/18892] " pinskia at gcc dot gnu dot org
@ 2004-12-08 20:28 ` Diego Novillo
  2004-12-08 20:28 ` [Bug tree-optimization/18892] missed optimization with & and == dnovillo at redhat dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Diego Novillo @ 2004-12-08 20:28 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

pinskia at gcc dot gnu dot org wrote:
> The following function:
> int f(int a)
> {
>   int i = a & -129;
>   return i == 144;
> }
> Should be compiled to:
> int f1(int a)
> {
>   return (a & -129) == 144; // aka return 0;
> }
> 
> Yes this shows up in real code (gcc), found while testing out my tree combiner.
> 
Hmm?  What does SRA have to do with anything here?


Diego.


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

* [Bug tree-optimization/18892] missed optimization with & and ==
  2004-12-08 20:15 [Bug tree-optimization/18892] New: missed SRA of a block copy pinskia at gcc dot gnu dot org
  2004-12-08 20:16 ` [Bug tree-optimization/18892] " pinskia at gcc dot gnu dot org
  2004-12-08 20:28 ` [Bug tree-optimization/18892] New: " Diego Novillo
@ 2004-12-08 20:28 ` dnovillo at redhat dot com
  2004-12-08 20:31 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: dnovillo at redhat dot com @ 2004-12-08 20:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dnovillo at redhat dot com  2004-12-08 20:28 -------
Subject: Re:  New: missed SRA of a block copy

pinskia at gcc dot gnu dot org wrote:
> The following function:
> int f(int a)
> {
>   int i = a & -129;
>   return i == 144;
> }
> Should be compiled to:
> int f1(int a)
> {
>   return (a & -129) == 144; // aka return 0;
> }
> 
> Yes this shows up in real code (gcc), found while testing out my tree combiner.
> 
Hmm?  What does SRA have to do with anything here?


Diego.


-- 


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


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

* [Bug tree-optimization/18892] missed optimization with & and ==
  2004-12-08 20:15 [Bug tree-optimization/18892] New: missed SRA of a block copy pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-12-08 20:28 ` [Bug tree-optimization/18892] missed optimization with & and == dnovillo at redhat dot com
@ 2004-12-08 20:31 ` pinskia at gcc dot gnu dot org
  2004-12-09 14:34 ` amacleod at redhat dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-08 20:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-08 20:31 -------
(In reply to comment #2)
> Subject: Re:  New: missed SRA of a block copy
> 
> Hmm?  What does SRA have to do with anything here?

Nothing I had messed up on the summary and already changed
it after seeing that I had messed up on it.

-- 


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


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

* [Bug tree-optimization/18892] missed optimization with & and ==
  2004-12-08 20:15 [Bug tree-optimization/18892] New: missed SRA of a block copy pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-12-08 20:31 ` pinskia at gcc dot gnu dot org
@ 2004-12-09 14:34 ` amacleod at redhat dot com
  2004-12-09 14:38 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: amacleod at redhat dot com @ 2004-12-09 14:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From amacleod at redhat dot com  2004-12-09 14:34 -------
Im confused.  I see a final form of:

f (a)
{
<bb 0>:
  return (a & -129) == 144;
}


when I compile this program with mainline.  Isnt this what you claimed it should
be compiled to?  or are you claiming it should be optimized to 'return 0'?


-- 


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


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

* [Bug tree-optimization/18892] missed optimization with & and ==
  2004-12-08 20:15 [Bug tree-optimization/18892] New: missed SRA of a block copy pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-12-09 14:34 ` amacleod at redhat dot com
@ 2004-12-09 14:38 ` pinskia at gcc dot gnu dot org
  2004-12-11  7:20 ` pinskia at gcc dot gnu dot org
  2005-07-12 21:28 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-09 14:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-09 14:38 -------
(In reply to comment #4)
> when I compile this program with mainline.  Isnt this what you claimed it should
> be compiled to?  or are you claiming it should be optimized to 'return 0'?

I am claiming it should be compiled to "return 0".  The full testcase which is closer to
what shows up in GCC is:

void f(int a
{
  int i = a & -129;
  if (i == 144)
    link_error ();
]

-- 


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


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

* [Bug tree-optimization/18892] missed optimization with & and ==
  2004-12-08 20:15 [Bug tree-optimization/18892] New: missed SRA of a block copy pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-12-09 14:38 ` pinskia at gcc dot gnu dot org
@ 2004-12-11  7:20 ` pinskia at gcc dot gnu dot org
  2005-07-12 21:28 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-11  7:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-11 07:19 -------
(In reply to comment #5)
> (In reply to comment #4)
> > when I compile this program with mainline.  Isnt this what you claimed it should
> > be compiled to?  or are you claiming it should be optimized to 'return 0'?
> 
> I am claiming it should be compiled to "return 0".  The full testcase which is closer to
> what shows up in GCC is:
> 
> void f(int a)
> {
>   int i = a & -129;
>   if (i == 144)
>     link_error ();
> }

The testcase works but for the wrong reason (we call fold for COND_EXPR after out of ssa because
of tree_cleanup_cfg).

Here is a testcase which fails though:

void g(int)  __attribute__((noinline);
void g(int a) { a+=2; }

void f(int a)
{
  int i = a & -129;
  g(i);
  if (i == 144)
    link_error ();
}

-- 


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


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

* [Bug tree-optimization/18892] missed optimization with & and ==
  2004-12-08 20:15 [Bug tree-optimization/18892] New: missed SRA of a block copy pinskia at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-12-11  7:20 ` pinskia at gcc dot gnu dot org
@ 2005-07-12 21:28 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-12 21:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-12 21:27 -------
It might be a while for me to rewrite the tree combiner so unassigning for now.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug tree-optimization/18892] missed optimization with & and ==
       [not found] <bug-18892-4@http.gcc.gnu.org/bugzilla/>
@ 2014-10-31  4:02 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 11+ 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=18892
Bug 18892 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] 11+ messages in thread

* [Bug tree-optimization/18892] missed optimization with & and ==
       [not found] <bug-18892-6528@http.gcc.gnu.org/bugzilla/>
@ 2007-07-01  0:12 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-07-01  0:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2007-07-01 00:12 -------
This was fixed with one of the forwprop patches, I don't know which one though.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

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

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-08 20:15 [Bug tree-optimization/18892] New: missed SRA of a block copy pinskia at gcc dot gnu dot org
2004-12-08 20:16 ` [Bug tree-optimization/18892] " pinskia at gcc dot gnu dot org
2004-12-08 20:28 ` [Bug tree-optimization/18892] New: " Diego Novillo
2004-12-08 20:28 ` [Bug tree-optimization/18892] missed optimization with & and == dnovillo at redhat dot com
2004-12-08 20:31 ` pinskia at gcc dot gnu dot org
2004-12-09 14:34 ` amacleod at redhat dot com
2004-12-09 14:38 ` pinskia at gcc dot gnu dot org
2004-12-11  7:20 ` pinskia at gcc dot gnu dot org
2005-07-12 21:28 ` pinskia at gcc dot gnu dot org
     [not found] <bug-18892-6528@http.gcc.gnu.org/bugzilla/>
2007-07-01  0:12 ` pinskia at gcc dot gnu dot org
     [not found] <bug-18892-4@http.gcc.gnu.org/bugzilla/>
2014-10-31  4:02 ` pinskia at gcc dot gnu.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).