RFR: 8256823: C2 compilation fails with "assert(isShiftCount(imm8 >> 1)) failed: illegal shift count" [v2]
Christian Hagedorn
chagedorn at openjdk.java.net
Tue Nov 24 08:32:05 UTC 2020
On Mon, 23 Nov 2020 15:18:12 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:
>> The ideal transformation added by [JDK-8254872](https://bugs.openjdk.java.net/browse/JDK-8254872) converts `RotateLeftNode(val, shift)` into `RotateRightNode(val, 32/64 - (shift & 31/63))`. If `shift` later becomes zero, we end up trying to emit a rotate with a 32/64 shift value which triggers an assert.
>>
>> I've added an identity transformation similar to what is implemented for ShiftNodes that takes care of this. I've also noticed that the corresponding assert is not strong enough for `roll` and `rorl` (probably the author used the assert corresponding to the 64-bit version by accident). The patch also includes some refactoring.
>>
>> Thanks,
>> Tobias
>
> Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision:
>
> Refactored getShiftCon method
Looks good to me!
src/hotspot/share/opto/mulnode.cpp line 907:
> 905: int hi = ~lo; // 00007FFF
> 906: const TypeInt *t11 = phase->type(in(1)->in(1))->isa_int();
> 907: if (!t11) return this;
While at it, you could also improve the styling here (spacing, asterisk and explicitly checking against `NULL` for `t11`).
-------------
Marked as reviewed by chagedorn (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/1384
More information about the hotspot-compiler-dev
mailing list