[PATCH] Fix a type mismatch assert in SCEV division
Brendon Cahoon
bcahoon at codeaurora.org
Thu Apr 16 08:13:38 PDT 2015
Hi Sanjoy - thanks for the review and comments. I appreciate the feedback.
In http://reviews.llvm.org/D9021#156823, @sanjoy wrote:
> It might be helpful to explicitly document that `SCEVDivision::divide` sign extends the narrower integer to the width of the wider integer before division. Is it correct to state that invariant here is that if `SCEVDivision::divide` returns `Q` and `R` after dividing `N` by `D` then `sext_if_needed(N)` `==` `sext_if_needed(Q)` `*` `sext_if_needed(D)` `+` `sext_if_needed(R)` where `sext_if_needed` sign extends to the widest of widths of `N` and `R`? If so, it'll be helpful to document that too.
I'm also curious if the the invariant you state above is true in all cases. Clearly, it is assumed in some cases, for example, in `visitConstant`, as you mention. If so, it should be possible to explicitly sign extend when needed, and then remove the various checks for a type mismatch in the visitor functions. This could help generate more precise results.
REPOSITORY
rL LLVM
http://reviews.llvm.org/D9021
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list