[Bug tree-optimization/94779] Bad optimization of simple switch

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 18 12:18:42 GMT 2020


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

--- Comment #20 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #19)
> > 
> > One of the work items for the next release is to multi-range enable all
> > these consumers that can make use of the information.
> 
> I would really appreciate that. I'm don't like integrating VRP into the
> CSWITCH pass mainly because it's duplicate work and EVRP runs right before
> that pass. And I would prefer a more canonical form of switch statements:

See my comment above.  It isn't any integration of VRP, just asking the ranger
about the range, and it isn't useless because to be able to optimize properly,
you need to figure out for each value one of the 3 possibilities (handled
explicitly by switch and well defined, handled by default and never reachable
or UB).  It is expected that many further passes will just query the ranger
when they need some information in the future; currently they sometimes just
get_range_info to query the static single range and often not even that.
VRP and other passes can perhaps throw out labels which won't be reachable
because they are outside of the index range (they shouldn't throw out labels
that lead to __builtin_unreachable because then information would be lost for
the optimization), but still the optimization needs to categorize the values.


More information about the Gcc-bugs mailing list