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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-01-20
                 CC|                            |rguenth at gcc dot gnu.org
          Component|middle-end                  |tree-optimization
            Summary|possibly lost DCE           |possibly lost DCE /
                   |optimization                |invariant motion
                   |                            |optimization
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
f reads from memory (which may trap).  We fail the opportunity to hoist f as
loop invariant which is because we choose to inline it (and we can't move
invariant sub-loops).  Confirmed for that.

Note I think we do not necessarily have to preserve the possible trap so we
fail to optimize the loop in

f (const char * s)
{
  char _2;

  <bb 2> [0.00%]:

  <bb 3> [0.00%]:
  # s_3 = PHI <s_4(D)(2), s_5(3)>
  s_5 = s_3 + 1;
  _2 = *s_3;
  if (_2 == 48)
    goto <bb 3>; [0.00%]
  else
    goto <bb 4>; [0.00%]

  <bb 4> [0.00%]:
  return;

as dead which we do not because we can't prove the finiteness of this loop
(because of the implementation detail how we do that).

Reply via email to