RFR: 8276162: Optimise unsigned comparison pattern [v3]
Mai Đặng Quân Anh
duke at openjdk.java.net
Sat Nov 13 05:22:13 UTC 2021
On Thu, 11 Nov 2021 07:41:28 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:
>> Mai Đặng Quân Anh has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - replace cmpx->Opcode() with cmpx_op
>> - address reviews, remove checks for subtraction operatios
>
> src/hotspot/share/opto/subnode.cpp line 1534:
>
>> 1532: }
>> 1533:
>> 1534: // Change x + Integer.MIN_VALUE <=> y + Integer.MIN_VALUE into x u<=> y
>
> The `<=>` in the comment is confusing because it usually denotes logical equality. Also, you are only handling `<` and `>` below. What about the other variants? Shouldn't they be canonicalized in `idealize_test` (see `ifnode.cpp`)?
>
> I would recommend making it explicit in the comment and use brackets for readability:
>
> // Change (x + Integer.MIN_VALUE < y + Integer.MIN_VALUE) into (x u< y) and
> // (x + Integer.MIN_VALUE > y + Integer.MIN_VALUE) into (x u> y).
I have added `eq` and `ne` to the transformation, leaving the comment simply as `cmp (add X min_jint) (add Y min_jint)`.
> src/hotspot/share/opto/subnode.cpp line 1546:
>
>> 1544: } else if (cmp2_op == Op_AddI &&
>> 1545: phase->type(cmp2->in(2)) == TypeInt::MIN) {
>> 1546: Node *ncmp = phase->transform(new CmpUNode(cmp1->in(1), cmp2->in(1)));
>
> `Node *ncmp` -> `Node* ncmp`
Done, sir.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6101
More information about the hotspot-compiler-dev
mailing list