RFR: 8351016: RA support for EVEX to REX/REX2 demotion to optimize NDD instructions [v18]
Jatin Bhateja
jbhateja at openjdk.org
Tue Nov 25 06:22:15 UTC 2025
On Mon, 24 Nov 2025 20:45:25 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
> if (mdef->operand_num_edges(oper_index) != 1) {
> assert(!is_ndd_demotable(mdef), "%s", mdef->Name());
> return false;
> }
We don't need this assertion, NDD commutative operation MachNode may have its first input as memory, but we may pick second input for biasing.
> src/hotspot/share/opto/chaitin.cpp line 1475:
>
>> 1473:
>> 1474: OptoReg::Name PhaseChaitin::select_bias_lrg_color(LRG &lrg) {
>> 1475: uint bias_lrg1_idx = lrg._copy_bias;
>
> Do I get it right that `_copy_bias2 != 0` implies `_copy_bias != 0`? Can you enforce it? (Here and in `PhaseChaitin::bias_color` where `_copy_bias2` is initialized.)
Bias live ranges are indipendent while marking and during enforcement.
> src/hotspot/share/opto/chaitin.cpp line 1498:
>
>> 1496: // the chances of register sharing once the bias live range
>> 1497: // becomes the part of IFG.
>> 1498: uint bias_lrg = lrgs(bias_lrg1_idx).degrees_of_freedom() >
>
> How does it work when `bias_lrg1_idx` or `bias_lrg2_idx` indices are 0? Original code had a guard against such condition.
Original code performed upfront non-zero check on copy_bias and then either selects the copy bias or constrain the register mask of defintion, now also we are checking for both the copybias upfront and select first or second bias which are also guarded with non-zero bias check else select the bias with minimum degreee of freedom if none of the live ranges are part of IFG.
> src/hotspot/share/opto/chaitin.cpp line 1538:
>
>> 1536:
>> 1537: // Try biasing the color with non-interfering bias live range[s].
>> 1538: if (lrg._copy_bias != 0 || lrg._copy_bias2 != 0) {
>
> IMO you can drop `(lrg._copy_bias != 0 || lrg._copy_bias2 != 0)` guard. Original code didn't check it and there are enough guard in `select_bias_lrg_color` to catch it.
Hi @iwanowww , guard checks were also part of [stock code](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/chaitin.cpp#L1496)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26283#discussion_r2558681296
PR Review Comment: https://git.openjdk.org/jdk/pull/26283#discussion_r2558681850
PR Review Comment: https://git.openjdk.org/jdk/pull/26283#discussion_r2558681898
PR Review Comment: https://git.openjdk.org/jdk/pull/26283#discussion_r2558682129
More information about the hotspot-compiler-dev
mailing list