[Bug tree-optimization/102950] [11/12 Regression] Dead Code Elimination Regression at -O3 (trunk&11.2.0 vs 10.3.0)

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Oct 27 00:42:22 GMT 2021


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.3
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-10-27
            Summary|[11 Regression] Dead Code   |[11/12 Regression] Dead
                   |Elimination Regression at   |Code Elimination Regression
                   |-O3 (trunk&11.2.0 vs        |at -O3 (trunk&11.2.0 vs
                   |10.3.0)                     |10.3.0)
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |missed-optimization

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

In GCC 10, forwprop2 gets:
  a.0_1 = a;
  _2 = (int) a.0_1;
  _3 = _2 ^ 233;
  _4 = (unsigned int) _3;
  b_7 = (char) _4;
  a = b_7;
  if (b_7 != 0)
    goto <bb 6>; [34.00%]
  else
    goto <bb 3>; [66.00%]

  <bb 3> [local count: 708669601]:
  if (_4 <= 1)
    goto <bb 4>; [41.00%]
  else
    goto <bb 6>; [59.00%]

  <bb 4> [local count: 290554533]:
  if (_4 == 0)
    goto <bb 5>; [33.00%]
  else
    goto <bb 6>; [67.00%]

  <bb 5> [local count: 95882995]:
  foo ();

While in GCC 11 we get:
  a.0_1 = a;
  _2 = (int) a.0_1;
  _3 = _2 ^ 233;
  _4 = (unsigned int) _3;
  b_7 = (char) _4;
  a = b_7;
  if (b_7 != 0)
    goto <bb 5>; [34.00%]
  else
    goto <bb 3>; [66.00%]

  <bb 3> [local count: 708669601]:
  if (_4 <= 1)
    goto <bb 4>; [25.50%]
  else
    goto <bb 5>; [74.50%]


I still can't figure out why forwprop2 can do it in GCC 10 but not in GCC 11.


More information about the Gcc-bugs mailing list