RFR: 8369167: C2: refactor LShiftINode/LShiftLNode Value/Identity/Ideal [v2]

Roland Westrelin roland at openjdk.org
Fri Oct 10 08:47:17 UTC 2025


On Fri, 10 Oct 2025 08:23:19 GMT, Marc Chevalier <mchevalier at openjdk.org> wrote:

>> Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   sort headers
>
> src/hotspot/share/opto/mulnode.cpp line 1264:
> 
>> 1262:   int count = 0;
>> 1263:   if (const_shift_count(phase, this, &count) && (count & (bits_per_java_integer(bt) - 1)) == 0) {
>> 1264:     // Shift by a multiple of 32/64 does nothing
> 
> I know it was there before, but I wonder if it's useful. Shouldn't something like `x << K` be idealized into `x << (K mod 32)` (or 64) by `mask_and_replace_shift_amount`, and then, we just need to treat `x << 0` in `Identity`. Not that it hurts or it's really complex...

Right. Maybe it's because `Identity` can be called with no previous call to `Ideal`: `PhaseIdealLoop::split_thru_phi()` for instance, even though, not sure it makes much of a difference here.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27725#discussion_r2418961556


More information about the hotspot-dev mailing list