public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
[parent not found: <bug-23286-7849@http.gcc.gnu.org/bugzilla/>]
* [Bug tree-optimization/23286] New: missed fully redundant expression
@ 2005-08-08 17:46 bonzini at gcc dot gnu dot org
  2005-08-08 17:46 ` [Bug tree-optimization/23286] " bonzini at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 42+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-08-08 17:46 UTC (permalink / raw)
  To: gcc-bugs

In this code, a <<= 1 is fully redundant

  unsigned short f(unsigned short a)
  {
    if (a & 0x8000)
      a <<= 1, a = a ^ 0x1021;
    else
      a <<= 1;

    return a;
  }

the body should be turned into

  unsigned short f(unsigned short a)
  {
    unsigned short b = a << 1;
    if (a & 0x8000)
      a = b, a = a ^ 0x1021;
    else
      a = b;
  
    return a;
  }

or something similar.  However PRE leaves the GIMPLE unchanged:

f (a)
{
  int D.1267;
  short int a.0;
<bb 0>:
  a.0_3 = (short int) a_2;
  if (a.0_3 < 0) goto <L0>; else goto <L1>;

<L0>:;
  a_7 = a_2 << 1;
  a_8 = a_7 ^ 4129;
  goto <bb 3> (<L2>);
<L1>:;
  a_6 = a_2 << 1;

  # a_1 = PHI <a_8(1), a_6(2)>;
<L2>:;
  D.1267_4 = (int) a_1;
  return D.1267_4;
}

On PPC, this is only caught after reload.

Paolo

-- 
           Summary: missed fully redundant expression
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bonzini at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2021-08-21 21:55 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-23286-4@http.gcc.gnu.org/bugzilla/>
2010-11-16 14:45 ` [Bug tree-optimization/23286] missed fully redundant expression rguenth at gcc dot gnu.org
2011-07-20  0:41 ` pinskia at gcc dot gnu.org
2011-07-29 20:15 ` pinskia at gcc dot gnu.org
2012-02-15 11:23 ` rguenth at gcc dot gnu.org
2012-02-15 16:07 ` rguenth at gcc dot gnu.org
2012-02-15 18:42 ` steven at gcc dot gnu.org
2012-02-16  9:48 ` rguenther at suse dot de
2012-02-16 12:58 ` rguenth at gcc dot gnu.org
2012-02-20 12:13 ` rguenth at gcc dot gnu.org
2012-02-23 14:00 ` aldot at gcc dot gnu.org
2021-08-21 21:55 ` [Bug tree-optimization/23286] Missed code hoisting optimization pinskia at gcc dot gnu.org
     [not found] <bug-23286-7849@http.gcc.gnu.org/bugzilla/>
2005-10-28 18:43 ` [Bug tree-optimization/23286] missed fully redundant expression pinskia at gcc dot gnu dot org
2007-10-10 22:59 ` steven at gcc dot gnu dot org
2007-10-16 13:33 ` steven at gcc dot gnu dot org
2007-10-26  4:09 ` astrange at ithinksw dot com
2008-02-23  5:23 ` pinskia at gcc dot gnu dot org
2008-11-21  6:43 ` steven at gcc dot gnu dot org
2008-11-23 13:09 ` steven at gcc dot gnu dot org
2008-11-23 13:12 ` steven at gcc dot gnu dot org
2008-11-23 13:24 ` steven at gcc dot gnu dot org
2008-11-23 13:33 ` rguenth at gcc dot gnu dot org
2008-11-23 13:45 ` rguenth at gcc dot gnu dot org
2008-11-23 14:22 ` steven at gcc dot gnu dot org
2008-11-23 18:31 ` dberlin at dberlin dot org
2008-11-27 15:27 ` steven at gcc dot gnu dot org
2008-12-01 22:02 ` steven at gcc dot gnu dot org
2009-08-04  9:06 ` steven at gcc dot gnu dot org
2010-01-17 12:34 ` rguenth at gcc dot gnu dot org
2010-01-17 12:35 ` rguenth at gcc dot gnu dot org
2010-01-17 12:56 ` rguenth at gcc dot gnu dot org
2010-01-17 13:00 ` steven at gcc dot gnu dot org
2010-02-24  9:40 ` steven at gcc dot gnu dot org
2005-08-08 17:46 [Bug tree-optimization/23286] New: " bonzini at gcc dot gnu dot org
2005-08-08 17:46 ` [Bug tree-optimization/23286] " bonzini at gcc dot gnu dot org
2005-08-08 18:42 ` pinskia at gcc dot gnu dot org
2005-08-08 18:53 ` dberlin at gcc dot gnu dot org
2005-08-08 18:56 ` dberlin at gcc dot gnu dot org
2005-08-08 19:34 ` pinskia at gcc dot gnu dot org
2005-08-08 19:36 ` pinskia at gcc dot gnu dot org
2005-08-08 19:54 ` pinskia at gcc dot gnu dot org
2005-08-08 20:29 ` dberlin at dberlin dot org
2005-08-08 20:40 ` dberlin at dberlin dot org
2005-08-29 12:35 ` 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).