>> Here is an attempt to do the value range computation in promoted_mode's >> type when it is overflowing. Bootstrapped on x86-84. > > Err - I think you misunderstood this as a suggestion to do this ;) > value-ranges should be computed according to the type not according > to the (promoted) mode. Otherwise we will miss optimization > opportunities.
Oops, sorry, I had my doubts about making trees aware of back-end stuff. Coming back to the original problem, what would be the best approach to handle this. Looking at the VRP pass, it seems to me that only MULT_EXPR and LSHIFT_EXPR are truncating values this way. All other operation are setting it to type_min, type_max. Can we rely on this ? Is this error not showing up in PROMOTED_MODE <= word_mode (and the mode precision of register from which we SUBREG is <= word_mode precision) is just a coincidence. Can we rely on this? Is there anyway we can fix this? Thanks again, Kugan