------- Comment #17 from steven at gcc dot gnu dot org  2008-11-23 13:11 -------
For the test case of comment #0, the proof-of-concept patch does the following
in the .084t.pre dump (relevant excerpts only):

VBEOUT[2] := { {lshift_expr,a_2(D),1} (0004) }
  Inserting expression 5 into AVAIL_OUT[2]
Inserted pretmp.12_8 = a_2(D) << 1;
 in predecessor 2
AVAIL_OUT[2] := { a_2(D) (0002), a.0_3 (0003), pretmp.12_8 (0004) }
Successor 1 not dominated by 5 -> empty set
VBEOUT[5] := {  }
AVAIL_OUT[5] := { a_2(D) (0002), a.0_3 (0003), a_1 (0001), pretmp.12_8 (0004) }
Successor 5 not dominated by 4 -> empty set
VBEOUT[4] := {  }
AVAIL_OUT[4] := { a_2(D) (0002), a.0_3 (0003), pretmp.12_8 (0004) }
Successor 5 not dominated by 3 -> empty set
VBEOUT[3] := {  }
AVAIL_OUT[3] := { a_2(D) (0002), a.0_3 (0003), a_5 (0005), pretmp.12_8 (0004) }
Replaced a_2(D) << 1 with pretmp.12_8 in a_4 = a_2(D) << 1;
Replaced a_2(D) << 1 with pretmp.12_8 in a_6 = a_2(D) << 1;

...

f (short unsigned int a)
{
  short unsigned int pretmp.12;
  short int a.0;

<bb 2>:
  a.0_3 = (short int) a_2(D);
  pretmp.12_8 = a_2(D) << 1;
  if (a.0_3 < 0)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  a_4 = pretmp.12_8;
  a_5 = a_4 ^ 4129;
  goto <bb 5>;

<bb 4>:
  a_6 = pretmp.12_8;

<bb 5>:
  # a_1 = PHI <a_5(3), a_6(4)>
  return a_1;

}


which eventually leads to the following in the .126t.final_cleanup dump:


;; Function f (f)

f (short unsigned int a)
{
  short unsigned int a.22;

<bb 2>:
  a.22 = a << 1;
  if ((short int) a < 0)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  a.22 = a.22 ^ 4129;

<bb 4>:
  return a.22;

}


-- 


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

Reply via email to