https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114151
--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> --- On Wed, 28 Feb 2024, tnfchris at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114151 > > --- Comment #3 from Tamar Christina <tnfchris at gcc dot gnu.org> --- > > > > This was a correctness fix btw, so I'm not sure we can easily recover - we > > could try using niter information for CHREC_VARIABLE but then there's > > variable niter here so I don't see a chance. > > > > It looks like it's mostly SVE suffering here. Adv. SIMD an scalar codegen > seems > to have vastly improved with it. we see ~10% improvements due to better > addressing for scalar. > > It also only happens at -O3 but -O2 is fine, which is weird as I was expected > IVopts to be enabled at -O2 too. Note the underlying issue, analyzing { a, +, b } * c differently and thus eventually dependent CHRECs failing to analyze should be independent on the architecture. What was definitely missing is consideration of POLY_INT_CSTs (and variable polys, as I think there's no range info for those). We do eventually want to improve how ranger behaves here. I'm not sure why when we do not provide a context 'stmt' it can't see to compute a range valid at the SSA names point of definition? (so basically compute the global range) Maybe there's another API to do that. But I thought it was convenient to use range_of_expr as that also handles GENERIC expression trees to some extent and those are common within SCEV.