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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |85316

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
EVRP constant folds the expressions, but there's one difference, case 7: is
not resolved.  It seems EVRP misses the PHI argument value singleton
replacement when there's no intermediate stmt.  Possibly confused
because the PHI arg edge source block is the gswitch block and there is
no forwarder.  There is one in late VRP, but even there we fail the
substitution.

I'll note that in general substituting the same constant as was tested
beforehand is not an optimization as we'd have to materialize it when
it's already in a register.

So possibly this is a missed optimization in switch conversion which
should identify this 1:1 identity itself to avoid the need to pessimize
the IL.  I didn't check if uncprop an undo a possible substitution
(IIRC it doesn't consider switches).


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases

Reply via email to