https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95102

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-07-20
           Severity|normal                      |enhancement

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
One thing that should be done:
  if (_1 < a_4(D))
    goto <bb 4>; [50.00%]
  else
    goto <bb 3>; [50.00%]

  <bb 3> [local count: 536870913]:
  x_5 = BIT_INSERT_EXPR <x_3(D), a_4(D), 0>;

  <bb 4> [local count: 1073741824]:
  # x_2 = PHI <x_3(D)(2), x_5(3)>


Be converted to:
  _1 = BIT_FIELD_REF <x_3(D), 32, 0>;
  nt_6 = BIT_FIELD_REF <x_3(D), 32, 0>;
  if (_1 < a_4(D))
    goto <bb 4>; [50.00%]
  else
    goto <bb 3>; [50.00%]

  <bb 3> [local count: 536870913]:

  <bb 4> [local count: 1073741824]:
  # nt_7 = PHI <nt_6(2), a_4(D)(3)>
  x_2 = BIT_INSERT_EXPR <x_3(D), nt_7, 0>;

And then normal phiopt would convert it to:
_1 = BIT_FIELD_REF <x_3(D), 32, 0>;
nt_7 = MIN <_1, a_4(D);
x_2 = BIT_INSERT_EXPR <x_3(D), nt_7, 0>;

But this would require a new part of tree-ssa-phiopt which does this, this
can't be done in match as far as I can tell; I don't know how profitable this
transfomration is either.

Reply via email to