RFR: 8369167: C2: refactor LShiftINode/LShiftLNode Value/Identity/Ideal

Marc Chevalier mchevalier at openjdk.org
Fri Oct 10 08:28:22 UTC 2025


On Thu, 9 Oct 2025 13:16:13 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> This change refactor code that's similar for LShiftINode and
> LShiftLNode into shared methods. I also added extra test cases to
> cover all transformations.

Looks good to me.

There are a lot of `SomeType *name` that we are slowly converting into `SomeType* name` when we have an occasion. As you wish.

I'm also running some tests. I'll be back soon.

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...

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

PR Review: https://git.openjdk.org/jdk/pull/27725#pullrequestreview-3321957081
PR Review Comment: https://git.openjdk.org/jdk/pull/27725#discussion_r2418898051


More information about the hotspot-dev mailing list