RFR: 8286625: C2 fails with assert(!n->is_Store() && !n->is_LoadStore()) failed: no node with a side effect [v2]

Tobias Hartmann thartmann at openjdk.java.net
Wed Jun 8 05:15:32 UTC 2022


On Tue, 7 Jun 2022 15:08:29 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> It's another case where because of overunrolling, the main loop is
>> never executed but not optimized out and the type of some
>> CastII/ConvI2L for a range check conflicts with the type of its input
>> resulting in a broken graph for the main loop.
>> 
>> This is supposed to have been solved by skeleton predicates. There's
>> indeed a predicate that should catch that the loop is unreachable but
>> it doesn't constant fold. The shape of the predicate is:
>> 
>> (CmpUL (SubL 15 (ConvI2L (AddI (CastII int:>=1) 15) minint..maxint)) 16)
>> 
>> I propose adding a CastII, that is in this case:
>> 
>> (CmpUL (SubL 15 (ConvI2L (CastII (AddI (CastII int:>=1) 15) 0..max-1) minint..maxint)) 16)
>> 
>> The justification for the CastII is that the skeleton predicate is a
>> predicate for a specific iteration of the loop. That iteration of the
>> loop must be in the range of the iv Phi.
>> 
>> With the extra CastII, the AddI can be pushed through the CastII and
>> ConvI2L and the check constant folds. Actually, with the extra CastII,
>> the predicate is not implemented with a CmpUL but a CmpU because the
>> code can tell there's no risk of overflow (I did force the use of
>> CmpUL as an experiment and the CmpUL does constant fold)
>
> Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update test/hotspot/jtreg/compiler/loopopts/TestOverUnrolling2.java
>   
>   Co-authored-by: Tobias Hartmann <tobias.hartmann at oracle.com>

All tests passed.

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

PR: https://git.openjdk.java.net/jdk/pull/8996


More information about the hotspot-compiler-dev mailing list