This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/69574] [4.9/5/6 Regression] gcc ICE at -O2 and -O3 on x86_64-linux-gnu in hide_evolution_in_other_loops_than_loop


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |spop at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we try to instantiate

{(unsigned char) d_lsm.14_51, +, 255}_4

in _4s outer loop where _51 is defined on the exit edge of an inner loop of a
preceeding sibling loop of 4 ({0, +, 255}_2).

So somehow instantiation misses to replace that with the "overall effect" of
that loop.  When trying to build the above polynomial chrec we then reach

140       if (!no_evolution_in_loop_p (left, loop_num, &val)
141           || !val)
142         return chrec_dont_know;

which does

static inline bool
no_evolution_in_loop_p (tree chrec, unsigned loop_num, bool *res)
{
  tree scev;

  if (chrec == chrec_not_analyzed_yet
      || chrec == chrec_dont_know
      || chrec_contains_symbols_defined_in_loop (chrec, loop_num))
    return false;

  STRIP_NOPS (chrec);
  scev = hide_evolution_in_other_loops_than_loop (chrec, loop_num);
  *res = !tree_contains_chrecs (scev, NULL);
  return true;

and

tree
hide_evolution_in_other_loops_than_loop (tree chrec,
                                         unsigned loop_num)
{
  struct loop *loop = get_loop (cfun, loop_num), *chloop;
  if (automatically_generated_chrec_p (chrec))
    return chrec;

  switch (TREE_CODE (chrec))
    {
    case POLYNOMIAL_CHREC:
      chloop = get_chrec_loop (chrec);

      if (chloop == loop)
        return build_polynomial_chrec
          (loop_num,
           hide_evolution_in_other_loops_than_loop (CHREC_LEFT (chrec),
                                                    loop_num),
           CHREC_RIGHT (chrec));

      else if (flow_loop_nested_p (chloop, loop))
        /* There is no evolution in this loop.  */
        return initial_condition (chrec);

      else
        {
          gcc_assert (flow_loop_nested_p (loop, chloop));
          return hide_evolution_in_other_loops_than_loop (CHREC_LEFT (chrec),
                                                          loop_num);

which asserts this kind of "nesting" doesn't happen.

One way to "paper over" this issue is doing the following though it might
be that the problem lies further up and we shouldn't call this function
in this particular way.

Index: tree-chrec.c
===================================================================
--- tree-chrec.c        (revision 233033)
+++ tree-chrec.c        (working copy)
@@ -728,12 +728,12 @@ hide_evolution_in_other_loops_than_loop
        /* There is no evolution in this loop.  */
        return initial_condition (chrec);

+      else if (flow_loop_nested_p (loop, chloop))
+       return hide_evolution_in_other_loops_than_loop (CHREC_LEFT (chrec),
+                                                       loop_num);
+
       else
-       {
-         gcc_assert (flow_loop_nested_p (loop, chloop));
-         return hide_evolution_in_other_loops_than_loop (CHREC_LEFT (chrec),
-                                                         loop_num);
-       }
+       return chrec_dont_know;

     default:
       return chrec;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]