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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-05-24
           Priority|P3                          |P2

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> if (_14 != _15)
>     goto <bb 19>; [50.00%]
>   else
>     goto <bb 16>; [50.00%]
> 
> ...
> 
>   <bb 16> [local count: 507317172]:
>   _50 = _15 - _14;
>   if (_50 != 0)
>     goto <bb 17>; [50.00%]
>   else
>     goto <bb 18>; [50.00%]
> 
>   <bb 17> [local count: 253658586]:
>   _51 = (long unsigned int) _50;
>   _52 = __builtin_memcmp (_14, 0B, _51);
>   _53 = _52 == 0;
> 
>   <bb 18> [local count: 507317172]:
>   # _54 = PHI <1(16), _53(17)>
> 
> 
> The function call is in an unreachable basic block.
> 
> Since _15 == _14 holds true in bb16, _50 == 0 will hold true. so bb 17 is
> never entered.
> Looks like a pass ordering issue ...

All ranger, DOM and VN know this trick though...

We warn from post_ipa_warn here, not sure why.  The late diagnostics code
is spread all over the place which makes it not sensible places :/
It seems this is _specifically_ for -Wnonnull.

Jakub - do you remember why you added the pass at this point, right after
inlining but before scalar cleanup gets the chance to remove dead code?

The memcmp is gone after 112.fre3, there's

      NEXT_PASS (pass_post_ipa_warn);
      /* Must run before loop unrolling.  */
      NEXT_PASS (pass_warn_access, /*early=*/true);
      NEXT_PASS (pass_complete_unrolli);
      NEXT_PASS (pass_backprop);
      NEXT_PASS (pass_phiprop);
      NEXT_PASS (pass_forwprop);
      /* pass_build_alias is a dummy pass that ensures that we
         execute TODO_rebuild_alias at this point.  */
      NEXT_PASS (pass_build_alias);
      NEXT_PASS (pass_return_slot);
      NEXT_PASS (pass_fre, true /* may_iterate */);

Reply via email to