RFR: 8374078: C2_MacroAssembler::verify_int_in_range has incorrect early return condition
Quan Anh Mai
qamai at openjdk.org
Fri Dec 19 11:19:07 UTC 2025
On Fri, 19 Dec 2025 10:48:12 GMT, Dean Long <dlong at openjdk.org> wrote:
>> Hi,
>>
>> This PR fixes the incorrect early return condition in `C2_MacroAssembler::verify_int_in_range`. Previously, `lo == min_jint && hi == max_jint` is equivalent to `t == Type::INT`. But this is not true anymore.
>>
>> Please take a look and leave your reviews, thanks a lot.
>
> Is it possible to write a regression test for this?
@dean-long Thanks for your comment. I have not been able to come up with a regression now. The reason is that unsigned bounds and known bits have only been implemented for `And/Or/Xor`. But since `min_jint == 0x10...00` and `max_jint == 0x01...11`, any known bit will imply `_lo > min_jint || _hi < max_jint`. So there is no case when `t != TypeInt::INT` but `t->_lo == min_jint || t->_hi == max_jint`.
I encountered this issue when trying to implement inference for `Add/Sub`, which may make the above situation arise.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28916#issuecomment-3674670316
More information about the hotspot-compiler-dev
mailing list