Kenneth Zadeck <zad...@naturalbridge.com> writes: > I am a little confused here. what is the reason for doing the the > is_sign_extended thing? > is the point of deferring the canonization that we can avoid the use of > the scratch array until the value is actually used. then we > canonicalize on demand?
The idea is that we conservatively treat upper bits as undefined when reading, just like you did originally. But (assuming I understood the idea correctly) the traits class has an ::is_sign_extended member that may be able to tell you at compile time that the upper bits are actually sign-extended. This would be true for wide_int and rtx, but not tree. We can then use ::is_sign_extended to add fast paths to the functions that are better with sign-extended inputs (like eq_p and lts_p) without adding any extra run-time checks. Thanks, Richard