https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102580
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aldyh at gcc dot gnu.org, | |amacleod at redhat dot com, | |jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- To be precise, expand_expr_divmod uses get_range_pos_neg for that during expansion (unless we'd e.g. somehow noted it in some very late pass before expansion that the division ought to be expanded both ways and cost compared), and get_range_pos_neg uses the global range of SSA_NAME only. In order to optimize #c0 we'd need to query range with the use stmt and enabling ranger in the pass (that is possible in some pass before expansion, but doing it during expansion (which would be useful to other spots too, say .*_OVERFLOW expansion) would need to deal with some basic blocks already converted into RTL and others still at GIMPLE).