[Bug middle-end/85598] [7/8/9 Regression] Incorrect warning only at -O2 and -O3

rguenther at suse dot de gcc-bugzilla@gcc.gnu.org
Fri Nov 23 10:42:00 GMT 2018


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

--- Comment #15 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 23 Nov 2018, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85598
> 
> --- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> (In reply to rguenther@suse.de from comment #13)
> > Note that dom after vrp1 should be able to adjust the value-ranges given
> > it uses EVRP to track ranges...  why doesn't that work?
> 
> From what I see, dom never calls record_ranges_from_phis, but even if it would,
> it wouldn't handle the relevant case here, which is to interset the range of
> the SSA_NAME phi arg with the edge condition (as if there was an assertion
> registered).

It records ranges from incoming edges though via evrp_range_analyzer.enter
(dom_opt_dom_walker::before_dom_children).

Yeah, it then just does

  /* Create equivalences from redundant PHIs.  PHIs are only truly
     redundant when they exist in the same block, so push another
     marker and unwind right afterwards.  */
  m_avail_exprs_stack->push_marker ();
  for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
    eliminate_redundant_computations (&gsi, m_const_and_copies,
                                      m_avail_exprs_stack);

this is where it would need to call into evrp_range_analyzer.  I guess
simply doing

      evrp_range_analyzer.record_ranges_from_stmt (gsi_stmt (gsi), false);

there would work?

> I think I'm able to implement this in forwprop using with using the
> get_range_info (const_tree, value_range_base &),
> value_range::{deep_copy,intersect,union} APIs, or defer to somebody familiar
> with  dom and evrp range analyzer to do it in dom (Jeff, Aldy).
> 
>


More information about the Gcc-bugs mailing list