On 11/27/2017 06:39 AM, Richard Biener wrote: > > The following avoids -Wformat-overflow false positives by teaching > EVRP the trick about __builtin_unreachable () "other" edges and > attaching range info to SSA names. EVRP does a better job in keeping > ranges for every SSA name from conditional info (VRP "optimizes" its > costly ASSERT_EXPR insertion process). > > Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. > > This will also fix the testcase from PR83072 but it doesn't really > fix all cases I want to fix with a fix for it. OTOH it might be > this is enough for stage3. > > Richard. > > 2017-11-27 Richard Biener <rguent...@suse.de> > > PR tree-optimization/80776 > * gimple-ssa-evrp-analyze.h (evrp_range_analyzer::set_ssa_range_info): > Declare. > * gimple-ssa-evrp-analyze.c (evrp_range_analyzer::set_ssa_range_info): > New function. > (evrp_range_analyzer::record_ranges_from_incoming_edges): > If the incoming edge is an effective fallthru because the other > edge only reaches a __builtin_unreachable () then record ranges > derived from the controlling condition in SSA info. > (evrp_range_analyzer::record_ranges_from_phis): Use set_ssa_range_info. > (evrp_range_analyzer::record_ranges_from_stmt): Likewise. > > * gcc.dg/pr80776-1.c: New testcase. > * gcc.dg/pr80776-2.c: Likewise. So the thing to make sure of here is that the range information we reflect back into the SSA_NAME actually applies everywhere the SSA_NAME can appear. ie, it's globally valid.
This means we can't reflect anything we derive from conditionals or things like a *p making the range non-null back to the SSA_NAME. I'd be concerned about the change to record_ranges_from_incoming_edge. Jeff