public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/15255] New: [tree-ssa] a * 2 + a * 2 is not converted to a * 4
@ 2004-05-03  7:14 kazu at cs dot umass dot edu
  2004-05-03 11:24 ` [Bug optimization/15255] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-03  7:14 UTC (permalink / raw)
  To: gcc-bugs

int
foo (int a)
{
  return a * 2 + a * 2;
}

The last SSA form looks like:

foo (a)
{
  int T.0;

<bb 0>:
  T.0_2 = a_1 + a_1;
  return T.0_2 * 2;

}

Why not return a_1 * 4?

Interestingly, a * 3 + a * 5 is converted to a * 8, but if I compute like so

int
foo (int a)
{
  int b = a * 3;
  int c = a * 5;
  return b + c;
}

I get:

  b_2 = a_1 * 3;
  c_3 = a_1 * 5;
  return b_2 + c_3;

-- 
           Summary: [tree-ssa] a * 2 + a * 2 is not converted to a * 4
           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=15255


^ permalink raw reply	[flat|nested] 14+ messages in thread
[parent not found: <bug-15255-5009@http.gcc.gnu.org/bugzilla/>]
[parent not found: <bug-15255-4@http.gcc.gnu.org/bugzilla/>]

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

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-03  7:14 [Bug optimization/15255] New: [tree-ssa] a * 2 + a * 2 is not converted to a * 4 kazu at cs dot umass dot edu
2004-05-03 11:24 ` [Bug optimization/15255] " pinskia at gcc dot gnu dot org
2004-05-24 21:23 ` [Bug tree-optimization/15255] " pinskia at gcc dot gnu dot org
2004-05-25 14:30 ` pinskia at gcc dot gnu dot org
2004-05-27  8:36 ` pinskia at gcc dot gnu dot org
2004-06-21  5:13 ` pinskia at gcc dot gnu dot org
2005-02-16  4:22 ` pinskia at gcc dot gnu dot org
     [not found] <bug-15255-5009@http.gcc.gnu.org/bugzilla/>
2008-04-28 20:20 ` rguenth at gcc dot gnu dot org
2008-04-29 14:18 ` rguenth at gcc dot gnu dot org
2008-04-29 16:01 ` rguenth at gcc dot gnu dot org
2008-04-29 16:04 ` rguenth at gcc dot gnu dot org
2008-08-13  9:00 ` rguenth at gcc dot gnu dot org
2008-08-13  9:02 ` rguenth at gcc dot gnu dot org
     [not found] <bug-15255-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).