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

--- Comment #9 from Marc Glisse <glisse at gcc dot gnu.org> ---
--- gimple-ssa-evrp-analyze.c   (revision 268474)
+++ gimple-ssa-evrp-analyze.c   (working copy)
@@ -217,7 +217,8 @@ evrp_range_analyzer::record_ranges_from_
              push_value_range (vrs[i].first, vrs[i].second);
              if (is_fallthru
                  && m_update_global_ranges
-                 && all_uses_feed_or_dominated_by_stmt (vrs[i].first, stmt))
+                 && all_uses_feed_or_dominated_by_stmt (vrs[i].first, stmt)
+                 && !has_single_use (vrs[i].first))
                {
                  set_ssa_range_info (vrs[i].first, vrs[i].second);
                  maybe_set_nonzero_bits (pred_e, vrs[i].first);

does remove the warning on the reduced testcase. But I didn't run the testsuite
to check if it made sense. And if it does, it should probably come before
all_uses_feed_or_dominated_by_stmt because it is cheaper (or be integrated with
it, since it also iterates over all uses and is used only here).

It is a bit strange that EVRP sets a range that means the condition is always
false (well, that is not quite true, sometimes range intersection gives
something weaker), but doesn't remove the unreachable branch itself, which
survives all the way to VRP1. I guess it doesn't cause any trouble except for
having a slightly larger function during IPA.

Reply via email to