RFR: 8347515: C2: assert(!success || (C->macro_count() == (old_macro_count - 1))) failed: elimination must have deleted one node from macro list [v3]

Christian Hagedorn chagedorn at openjdk.org
Mon May 5 12:07:47 UTC 2025


On Mon, 5 May 2025 09:23:05 GMT, Saranya Natarajan <duke at openjdk.org> wrote:

>> Issue: The assertion failure , `assert(!success || (C->macro_count() == (old_macro_count - 1))) failed: elimination must have deleted one node from macro list`, occurs when [loop striping mining  ](https://bugs.openjdk.org/browse/JDK-8186027)may create a [MaxL](https://bugs.openjdk.org/browse/JDK-8324655)  after macro expansion.
>> 
>> Analysis : Before the macro nodes are expanded in` expand_macro_nodes`, there is a process where nodes from the macro list are eliminated. This also includes elimination of  any `OuterStripMinedLoop` node in the macro list. The bug occurs due to the refining of the strip mined loop in `adjust_strip_mined_loop` function just before it is eliminated. In this case, a` MaxL` node is added to the macro list in `adjust_strip_mined_loop`. 
>> 
>> Fix: The fix involves performing the refining of the strip mined loop before elimination process. More specifically, moving the `adjust_strip_mined_loop` function outside the elimination loop.
>> 
>> Improvement:  The process of eliminating macro nodes by calling `eliminate_macro_nodes` and performing additional Opaque and LoopLimit nodes elimination in ` expand_macro_nodes` is unintuitive as suggested in [JDK-8325478 ](https://bugs.openjdk.org/browse/JDK-8325478) and the current fix should be moved along with the other elimination code.
>
> Saranya Natarajan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   moving the fix to a separate method

Otherwise, looks good, thanks for the update!

src/hotspot/share/opto/macro.cpp line 2354:

> 2352: 
> 2353: void PhaseMacroExpand::refine_strip_mined_loop_macro_node() {
> 2354:    // Perform refining of strip mined loop node in the  macro nodes list.

Should probably added as method comment:
Suggestion:

// Perform refining of strip mined loop node in the macro nodes list.
void PhaseMacroExpand::refine_strip_mined_loop_macro_node() {

src/hotspot/share/opto/macro.hpp line 205:

> 203:     _igvn.set_delay_transform(true);
> 204:   }
> 205:   void refine_strip_mined_loop_macro_node();

Suggestion:


  void refine_strip_mined_loop_macro_node();

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

Marked as reviewed by chagedorn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/24890#pullrequestreview-2814584871
PR Review Comment: https://git.openjdk.org/jdk/pull/24890#discussion_r2073315860
PR Review Comment: https://git.openjdk.org/jdk/pull/24890#discussion_r2073316455


More information about the hotspot-compiler-dev mailing list