RFR: 8318049: C2: assert(!failure) failed: Missed optimization opportunity in PhaseIterGVN
Emanuel Peter
epeter at openjdk.org
Thu Oct 19 09:56:41 UTC 2023
On Thu, 19 Oct 2023 09:48:39 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> This patch fixes [JDK-8318049](https://bugs.openjdk.org/browse/JDK-8318049) by informing XorI and XorL nodes in addition to sub and phi nodes when Cast nodes are updated during IGVN.
>>
>> The bug manifests when loop optimizations change the IR:
>> 
>>
>> To the following form:
>> 
>>
>> XorI nodes check for that form in their `Value` call, to do the `x ^ x => 0` transformation, checking through casts. As the cast node didn't inform the Xor when it changes, the transformation doesn't have a chance to run.
>> https://github.com/openjdk/jdk/blob/5bd10521eb5e51e76b20e955addd45f76abba6f7/src/hotspot/share/opto/addnode.cpp#L947-L950
>>
>> I've attached a reduced version of the test found in the bug. Reviews would be appreciated!
>
> src/hotspot/share/opto/phaseX.cpp line 1603:
>
>> 1601: // ConstraintCast+ -> Xor
>> 1602: if (use->is_ConstraintCast()) {
>> 1603: auto push_phi_or_sub_uses_to_worklist = [&](Node* n){
>
> Suggestion:
>
> auto push_the_uses_to_worklist = [&](Node* n){
Change the name now. Maybe something more generic is good, since we do not know how many more of these examples we will eventually add to this.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16214#discussion_r1365231067
More information about the hotspot-compiler-dev
mailing list