RFR: 8364766: C2: Improve Value() of DivI and DivL for non-constant inputs [v6]
Manuel Hässig
mhaessig at openjdk.org
Mon Aug 25 09:22:56 UTC 2025
On Mon, 25 Aug 2025 09:08:33 GMT, Benoît Maillard <bmaillard at openjdk.org> wrote:
>> Tobias Hotz has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Remove too strict assert from old code path
>
> src/hotspot/share/opto/divnode.cpp line 543:
>
>> 541: NativeType i2_hi = i2->_hi == 0 ? -1 : i2->_hi;
>> 542: NativeType min_val = std::numeric_limits<NativeType>::min();
>> 543: assert(min_val == min_jint || min_val == min_jlong, "min has to be either min_jint or min_jlong");
>
> I find this assert a little confusing, as its outcome is completely independent from the inputs of the function. I would remove it
It depends on the template type. I would rather keep it to sanity check that the minimum value of `NativeType` is as we expect. If that does not hold, the optimization below is potentially wrong and has UB.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26143#discussion_r2297570098
More information about the hotspot-compiler-dev
mailing list