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/45971] [4.6 Regression] ice in vect_update_ivs_after_vectorizer


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45971

Ira Rosen <irar at il dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |irar at il dot ibm.com

--- Comment #8 from Ira Rosen <irar at il dot ibm.com> 2010-11-09 09:12:43 UTC ---
Looking at this loop:

void
foo (int *x, int *y)
{
  int i;
  for (i = 0; i < 11; i++)
    y[i] = (x[i] == 1) ? i + 1 : -(i + 1);
}


I see that first time that we try to analyze phi i_19 = PHI <prephitmp.8_25(4),
0(2)> (to detect induction), scev analysis succeeds:

(analyze_scalar_evolution
  (loop_nb = 1)
  (scalar = i_19)
(get_scalar_evolution
  (scalar = i_19)
  (scalar_evolution = {0, +, 1}_1))
(set_scalar_evolution
  instantiated_below = 2
  (scalar = i_19)
  (scalar_evolution = {0, +, 1}_1))
)

pr45971.c:5: note: Access function of PHI: {0, +, 1}_1
pr45971.c:5: note: step: 1,  init: 0


But when we try to check the same phi later (in transformation), evolution
analysis fails:

pr45971.c:5: note: vect_update_ivs_after_vectorizer: phi: i_19 = PHI
<prephitmp.8_25(4), 0(8)>
(analyze_scalar_evolution
  (loop_nb = 1)
  (scalar = i_19)
(get_scalar_evolution
  (scalar = i_19)
  (scalar_evolution = ))
(analyze_initial_condition
  (loop_phi_node =
i_19 = PHI <prephitmp.8_25(4), 0(8)>
)
  (init_cond = 0))
(analyze_evolution_in_loop
  (loop_phi_node = i_19 = PHI <prephitmp.8_25(4), 0(8)>
)
  (evolution_function = scev_not_known))
(set_scalar_evolution
  instantiated_below = 8
  (scalar = i_19)
  (scalar_evolution = i_19))
)

pr45971.c:5: note: Access function of PHI: i_19

causing ICE.

Here is the code that if-cvt generates:

  # i_19 = PHI <prephitmp.8_25(4), 0(2)>
  # ivtmp.9_15 = PHI <ivtmp.9_23(4), 11(2)>
  D.2688_4 = (long unsigned int) i_19;
  D.2689_5 = D.2688_4 * 4;
  D.2690_7 = y_6(D) + D.2689_5;
  D.2692_11 = x_10(D) + D.2689_5;
  D.2693_12 = *D.2692_11;
  iftmp.0_13 = i_19 + 1;
  D.2707_22 = D.2693_12 == 1;
  iftmp.0_14 = ~i_19;
  pretmp.7_24 = i_19 + 1;
  D.2708_21 = D.2693_12 != 1;
  iftmp.0_2 = [cond_expr] D.2693_12 == 1 ? iftmp.0_13 : iftmp.0_14;
  prephitmp.8_25 = [cond_expr] D.2693_12 == 1 ? iftmp.0_13 : pretmp.7_24;
  *D.2690_7 = iftmp.0_2;
  ivtmp.9_23 = ivtmp.9_15 - 1;
  if (ivtmp.9_23 != 0)
    goto <bb 4>;
  else
    goto <bb 5>;

prephitmp.8_25 is actually always i_19 + 1, so the second cond_expr is
redundant.


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