RFR: 8339303: C2: dead node after failing to match cloned address expression [v2]

Vladimir Ivanov vlivanov at openjdk.org
Tue Nov 5 21:43:31 UTC 2024


On Tue, 5 Nov 2024 17:07:13 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

>> This changeset prevents the x86 platform-specific logic from cloning address expressions consisting of two chained `AddP` nodes with a small constant offset each, such as in the following example:
>> 
>> ![example](https://github.com/user-attachments/assets/86c143a1-3895-4e0c-936b-0d22b7c80e73)
>> 
>> Such patterns cannot be fully subsumed into x86 complex addressing modes, and cloning them can cause the matcher to introduce dead nodes that trigger a segmentation fault in the subsequent global code motion phase. See a detailed analysis of the failure in the [JBS issue description](https://bugs.openjdk.org/browse/JDK-8339303).
>> 
>> The changeset additionally extends the post-matching verification logic to check that no old node is reachable by travesing both node inputs and outputs. This extension would have caused the original test case to fail directly after matching with an informative assertion message rather than an opaque segmentation fault in an unrelated code generation phase.
>> 
>> Note that the pattern causing the failure should be in general optimized by `AddPNode::Ideal` into a single `AddP` node with the constant sum of the offsets. While [JDK-8343067](https://bugs.openjdk.org/browse/JDK-8343067) should address the missing optimization, this changeset proposes a complementary solution that is easily backportable and avoids relying on specific optimizations for correctness.
>> 
>> #### Testing
>> 
>> ##### Functionality
>> 
>> - tier1-5 (linux-x64, windows-x64, macosx-x64, linux-aarch64, macosx-aarch64; release and debug mode).
>> 
>> ##### Performance
>> 
>> - Tested performance on a set of standard benchmark suites (DaCapo, SPECjbb2015, SPECjvm2008). No significant change was observed.
>
> Roberto Castañeda Lozano has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use DUIterator_Fast to traverse node outputs

Marked as reviewed by vlivanov (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/21829#pullrequestreview-2416750596


More information about the hotspot-compiler-dev mailing list