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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-09-09
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is that unswitch sees

  _4 = *_3;
  t2_14 = _4 != 0;
  _12 = t2_14 & t1_15(D);
  if (_12 != 0)

and _12 isn't invariant.  Unswitch doesn't try to associate and unswitch
based on a partly invariant predicate - neither its analysis nor its
transform phase are set up to handle a case like this.

Eventually breaking out the invariant part of a combined condition to
a separate branch would be worthwhile since that branch is going to be
well-predicted while the combined one is likely not.  reassoc might
already associate a combined conditon in a way that this might be
straight-forward to do - in this case the expression is simple enough
of course.

Iff to be handled in unswitching directly I'd say it would need to key
on invariant bool uses and instead of handling only gcond and gswitch
handle assigns as well (with no obvious savings on code size of either
copy, thus less likely profitable). 

Confirmed.

Reply via email to