https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105086
--- Comment #4 from Andrew Macleod <amacleod at redhat dot com> --- (In reply to Richard Biener from comment #3) > (In reply to Andrew Macleod from comment #2) > > > I have an alternate question. it looks like when we utilize scev to pick up > > ranges we just give up if scev_probably_wraps_p() is true. > > > > Analyzing # of iterations of loop 1 > > exit condition 1 < [4294967273, + , 1] > > bounds on difference of bases: 4294967272 ... 4294967272 > > result: > > # of iterations 23, bounded by 23 > > > > Statement (exit)if (a_1 > 1) > > is executed at most 23 (bounded by 23) + 1 times in loop 1. > > > > but we neglect to create range for the PHI. We should be able to properly > > create a range for this from the SCEV info rather than giving up? It would > > be [0,0][4294967273, 4294967295]. > > Well, we give up if the IV wraps because then the logic we have to compute > the IV range doesn't work. I'm talking about bounds_of_var_in_loop > which basically computes the range as [base, base + step * niter] with > adjustments to create proper ranges for negative step. > Yeah, that is exactly where I was looking, and it looked like it was just to keep things simple. > > And even with the old value_range we could use anti-range and produce > > ~[1, 4294967272]? > > It should use the range as computed by the "iteration", just not use > SCEV to refine it. > > > Is there a practical reason we don't look any closer at wrap cases to see if > > they are "simple wraps" or not? I think that would also solve this issue. > > The only reason is that nobody implemented it. The important thing is to > compute that it will wrap exactly once of course. I suspected as much. I think we can enhance this next stage 1.