public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14844] New: [tree-ssa] narrow types if wide result is not needed
@ 2004-04-04 16:16 kazu at cs dot umass dot edu
  2004-04-04 16:20 ` [Bug optimization/14844] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-04-04 16:16 UTC (permalink / raw)
  To: gcc-bugs

Consider:

int
foo (int a, int b)
{
  long long aa = a;
  long long bb = b;
  return aa + bb;
}

The last tree looks like:

foo (a, b)
{
<bb 0>:
  return (int)(long long int)a + (int)(long long int)b;

}

We may be able to solve this problem by propagating narrowing casts backward.

-- 
           Summary: [tree-ssa] narrow types if wide result is not needed
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Keywords: pessimizes-code
          Severity: enhancement
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug optimization/14844] [tree-ssa] narrow types if wide result is not needed
  2004-04-04 16:16 [Bug optimization/14844] New: [tree-ssa] narrow types if wide result is not needed kazu at cs dot umass dot edu
@ 2004-04-04 16:20 ` pinskia at gcc dot gnu dot org
  2004-04-05  1:12 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-04 16:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-04 16:20 -------
Confirmed, but already fixed by my cast patch: <http://gcc.gnu.org/ml/gcc-patches/2004-04/
msg00169.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
           Keywords|                            |patch
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-04 16:20:45
               date|                            |
   Target Milestone|---                         |tree-ssa


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


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

* [Bug optimization/14844] [tree-ssa] narrow types if wide result is not needed
  2004-04-04 16:16 [Bug optimization/14844] New: [tree-ssa] narrow types if wide result is not needed kazu at cs dot umass dot edu
  2004-04-04 16:20 ` [Bug optimization/14844] " pinskia at gcc dot gnu dot org
@ 2004-04-05  1:12 ` pinskia at gcc dot gnu dot org
  2004-04-06  0:06 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-05  1:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-05 01:12 -------
An other expample but it is not fixed by my patch (but I should handle though):
int
foo (int a, int b)
{
  long long aa = a;
  long long bb = b;
  long long cc = aa + bb;
  int dd = cc;
  return dd;
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|patch                       |


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


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

* [Bug optimization/14844] [tree-ssa] narrow types if wide result is not needed
  2004-04-04 16:16 [Bug optimization/14844] New: [tree-ssa] narrow types if wide result is not needed kazu at cs dot umass dot edu
  2004-04-04 16:20 ` [Bug optimization/14844] " pinskia at gcc dot gnu dot org
  2004-04-05  1:12 ` pinskia at gcc dot gnu dot org
@ 2004-04-06  0:06 ` pinskia at gcc dot gnu dot org
  2004-04-06 18:09 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-06  0:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-06 00:06 -------
It is a memory hug and a compile time hog because the number of RTL produced is too 
much.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |compile-time-hog, memory-
                   |                            |hog, TREE


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


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

* [Bug optimization/14844] [tree-ssa] narrow types if wide result is not needed
  2004-04-04 16:16 [Bug optimization/14844] New: [tree-ssa] narrow types if wide result is not needed kazu at cs dot umass dot edu
                   ` (2 preceding siblings ...)
  2004-04-06  0:06 ` pinskia at gcc dot gnu dot org
@ 2004-04-06 18:09 ` pinskia at gcc dot gnu dot org
  2004-05-18  1:20 ` [Bug tree-optimization/14844] " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-06 18:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-06 18:08 -------
Also it does not get optimized untill after register allocation which is bad news for some 
targets like x86.

-- 


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


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

* [Bug tree-optimization/14844] [tree-ssa] narrow types if wide result is not needed
  2004-04-04 16:16 [Bug optimization/14844] New: [tree-ssa] narrow types if wide result is not needed kazu at cs dot umass dot edu
                   ` (3 preceding siblings ...)
  2004-04-06 18:09 ` pinskia at gcc dot gnu dot org
@ 2004-05-18  1:20 ` pinskia at gcc dot gnu dot org
  2004-05-24 20:28 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-18  1:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-17 14:05 -------
Once fold is able to do (int)(a+b) into (int)a + (int)b, the combine pass (15459) should be able to fix 
this.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |15459


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


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

* [Bug tree-optimization/14844] [tree-ssa] narrow types if wide result is not needed
  2004-04-04 16:16 [Bug optimization/14844] New: [tree-ssa] narrow types if wide result is not needed kazu at cs dot umass dot edu
                   ` (4 preceding siblings ...)
  2004-05-18  1:20 ` [Bug tree-optimization/14844] " pinskia at gcc dot gnu dot org
@ 2004-05-24 20:28 ` pinskia at gcc dot gnu dot org
  2004-06-21  5:08 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 20:28 UTC (permalink / raw)
  To: gcc-bugs



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


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


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

* [Bug tree-optimization/14844] [tree-ssa] narrow types if wide result is not needed
  2004-04-04 16:16 [Bug optimization/14844] New: [tree-ssa] narrow types if wide result is not needed kazu at cs dot umass dot edu
                   ` (5 preceding siblings ...)
  2004-05-24 20:28 ` pinskia at gcc dot gnu dot org
@ 2004-06-21  5:08 ` pinskia at gcc dot gnu dot org
  2005-02-14 13:53 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-21  5:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-21 05:08 -------
Well I am not going to fix this one yet.

-- 
           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=14844


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

* [Bug tree-optimization/14844] [tree-ssa] narrow types if wide result is not needed
  2004-04-04 16:16 [Bug optimization/14844] New: [tree-ssa] narrow types if wide result is not needed kazu at cs dot umass dot edu
                   ` (6 preceding siblings ...)
  2004-06-21  5:08 ` pinskia at gcc dot gnu dot org
@ 2005-02-14 13:53 ` pinskia at gcc dot gnu dot org
  2005-02-14 15:00 ` schlie at comcast dot net
  2005-02-14 15:02 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-14 13:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-14 02:23 -------
Note the code from build_binop from the C and C++ front-ends need to be moved to fold and then 
when that happens my tree combiner will just work.

-- 


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


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

* [Bug tree-optimization/14844] [tree-ssa] narrow types if wide result is not needed
  2004-04-04 16:16 [Bug optimization/14844] New: [tree-ssa] narrow types if wide result is not needed kazu at cs dot umass dot edu
                   ` (7 preceding siblings ...)
  2005-02-14 13:53 ` pinskia at gcc dot gnu dot org
@ 2005-02-14 15:00 ` schlie at comcast dot net
  2005-02-14 15:02 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: schlie at comcast dot net @ 2005-02-14 15:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From schlie at comcast dot net  2005-02-14 05:47 -------
(In reply to comment #7)
> Note the code from build_binop from the C and C++ front-ends need to be moved to fold and then 
> when that happens my tree combiner will just work.

Sorry, but a little confused, as it's perfectly correct to shorten these operands to the width
of the operation's assignment, and in fact should be done? (so there's nothing to correct
and arguably should have been identifyed as such by the front-ends to begin with it would seem)

-- 


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


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

* [Bug tree-optimization/14844] [tree-ssa] narrow types if wide result is not needed
  2004-04-04 16:16 [Bug optimization/14844] New: [tree-ssa] narrow types if wide result is not needed kazu at cs dot umass dot edu
                   ` (8 preceding siblings ...)
  2005-02-14 15:00 ` schlie at comcast dot net
@ 2005-02-14 15:02 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-14 15:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-14 05:57 -------
(In reply to comment #8)
> Sorry, but a little confused, as it's perfectly correct to shorten these operands to the width
> of the operation's assignment, and in fact should be done? (so there's nothing to correct
> and arguably should have been identifyed as such by the front-ends to begin with it would seem)

What I was trying to say, is that this should not be done in the front-end as the front-end has almost 
no business to deal with optimizations.

-- 


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


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

end of thread, other threads:[~2005-02-14  5:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-04 16:16 [Bug optimization/14844] New: [tree-ssa] narrow types if wide result is not needed kazu at cs dot umass dot edu
2004-04-04 16:20 ` [Bug optimization/14844] " pinskia at gcc dot gnu dot org
2004-04-05  1:12 ` pinskia at gcc dot gnu dot org
2004-04-06  0:06 ` pinskia at gcc dot gnu dot org
2004-04-06 18:09 ` pinskia at gcc dot gnu dot org
2004-05-18  1:20 ` [Bug tree-optimization/14844] " pinskia at gcc dot gnu dot org
2004-05-24 20:28 ` pinskia at gcc dot gnu dot org
2004-06-21  5:08 ` pinskia at gcc dot gnu dot org
2005-02-14 13:53 ` pinskia at gcc dot gnu dot org
2005-02-14 15:00 ` schlie at comcast dot net
2005-02-14 15:02 ` 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).