r219517 added a use of SCEV divide in HowFarToZero computation. This divide can produce incorrect results as we are using an unsigned divide for what should be a modular divide. This change reverts back to a more conservative computation using trailing zeros.
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Andrew, any comment on this? This just reverts back to a previous more
conservative (and correct) analysis.
Mark
Comment Actions
Sorry I didn't respond. I wasn't able to easily convince myself that this fixes the problem. Since this reverts to the previous implementation, I think it's a good change. But the code is written in a way that is extremely hard to reason about.
For example:
- StepV could be negative but still be a power of two, is this expected?
- Why are we checking GetMinTrailingZeros(getNegativeSCEV(Start)) instead of GetMinTrailingZeros(Distance)?
If we can only handle counting up here, lets be more clear about that.