RFR: 8356708: C2: loop strip mining expansion doesn't take sunk stores into account [v4]

Emanuel Peter epeter at openjdk.org
Tue Jun 17 07:17:36 UTC 2025


On Tue, 17 Jun 2025 06:57:13 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Roland Westrelin has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Update test/hotspot/jtreg/compiler/loopstripmining/TestStoresSunkInOuterStripMinedLoop.java
>>    
>>    Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>
>>  - Update test/hotspot/jtreg/compiler/loopstripmining/TestStoresSunkInOuterStripMinedLoop.java
>>    
>>    Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>
>
> src/hotspot/share/opto/loopnode.cpp line 3014:
> 
>> 3012:     return;
>> 3013:   }
>> 3014:   MergeMemNode* mm = safepoint_mem->as_MergeMem();
> 
> You don't use `safepoint_mem` for anything else than checking if it is a `MergeMem`. So why not do this:
> Suggestion:
> 
>   MergeMemNode* mm = safepoint->in(TypeFunc::Memory)->isa_MergeMem;
>   if (mm == nullptr) {
>     // There is no MergeMem, which should only happen if there was no memory node
>     // sunk out of the loop.
>     assert(stores_in_outer_loop_cnt == 0, "inconsistent");
>     return;
>   }

I also added a comment for this exit condition.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25717#discussion_r2151472808


More information about the hotspot-compiler-dev mailing list