diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index 8b7189eb5b8..c9016fe988d 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -1183,6 +1183,13 @@ ranger_cache::entry_range (vrange &r, tree name, basic_block bb, return; } + // If NAME is invariant, simply return the defining range. + if (!gori ().has_edge_range_p (name)) + { + range_of_def (r, name); + return; + } + // Look for the on-entry value of name in BB from the cache. // Otherwise pick up the best available global value. if (!m_on_entry.get_bb_range (r, name, bb))