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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
The example also shows that niter analysis fails to optimize the may_be_zero
condition but retails n <= 0 for it.  Trying to wire in range_on_edge to
niter analysis in simplify_using_initial_conditions shows that
range_on_edge degenerates to a context-less query for GENERIC expressions:

#1  0x00000000014edddf in gimple_ranger::range_on_edge (this=0x4d79a40, r=..., 
    e=<edge 0x7ffff6750e70 (5 -> 3)>, name=<le_expr 0x7ffff675d230>)
    at ../../src/gcc/gcc/gimple-range.cc:255
255         res = get_tree_range (r, name, NULL);
(gdb) l
250           return true;
251         }
252
253       bool res = true;
254       if (!gimple_range_ssa_p (name))
255         res = get_tree_range (r, name, NULL);
256       else
257         {
258           range_on_exit (r, e->src, name);

range_on_exit handles GENERIC expressions in a better way aldready.  With

diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index e91eeb455f1..4bc54cbc502 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -252,7 +252,7 @@ gimple_ranger::range_on_edge (vrange &r, edge e, tree name)

   bool res = true;
   if (!gimple_range_ssa_p (name))
-    res = get_tree_range (r, name, NULL);
+    res = get_tree_range (r, name, NULL, NULL, e->src);
   else
     {
       range_on_exit (r, e->src, name);

it works.

Reply via email to