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/57396] [4.7/4.8/4.9 Regression] Wrong code with -fpredictive-commoning in Fortran double-loop


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
DR_OFFSETs are (ssizetype) ((sizetype) (-stride.3_18 - _30) * 4)
vs. (ssizetype) ((sizetype) (stride.3_18 * -2 - _30) * 4)

and in the affine combination together with DR_INITs of zero we get

{
  type = ssizetype
  offset = 0
  elements = {
    [0] = MAX_EXPR <stride.3_17, 0> * -8, 
    [1] = lbound.1_20 * stride.3_18 * -4
  }
}
{
  type = ssizetype
  offset = 0
  elements = {
    [0] = MAX_EXPR <stride.3_17, 0> * -4, 
    [1] = lbound.1_20 * stride.3_18 * -4
  }
}

(_30 = lbound.1_20 * stride.3_18)

With the difference

{
  type = ssizetype
  offset = 0
  elements = {
    [0] = MAX_EXPR <stride.3_17, 0> * -4
  }
}


DR_STEP is (ssizetype) ((sizetype) (stride.3_18 + 1) * 4)

{
  type = ssizetype
  offset = 4
  elements = {
    [0] = MAX_EXPR <stride.3_17, 0> * 4
  }
}

and double_int_constant_multiple_p's result is not interpreted correctly in
aff_combination_constant_multiple_p:

  if (!double_int_constant_multiple_p (val->offset, div->offset,
                                       &mult_set, mult))
    return false;

which doesn't handle the val->offset == 0 case where it returns true
but does not set mult.  So it looks like it should return false if
!mult_set and val->offset is not equal to div->offset.

I have a patch.


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