RFR: 8331575: C2: crash when ConvL2I is split thru phi at LongCountedLoop [v2]
Roland Westrelin
roland at openjdk.org
Tue May 14 08:11:02 UTC 2024
On Tue, 14 May 2024 07:32:26 GMT, Roland Westrelin <roland at openjdk.org> wrote:
>> Roland Westrelin has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - test case tweaks
>> - fuzzer test
>
> Before split if:
>
> long i = 100;
> for (; i > 0;) {
> // i here is 1..100
> int j = (int)i; // ConvL2I type is 1..100, same as loop phi
> int k = 42 / j;
> i--;
> }
>
>
> after split if:
>
>
> long i = 100;
> int j = 100;
> int k = 0;
> for (; i > 0;) {
> // i here is 1..100
> i--;
> // i here is 0..99
> j = (int)i; // ConvL2I type is still 1..100 which is not correct
> k = 42 / j;
> }
> @rwestrel which "split_if" optimization was applied in your example? Split the ConvI2L through the phi? If so, the problem seems to be that the ConvI2L floats by the exit-check, right?
Yes.
> So I guess that is really a limitation: a trip count `Phi` specifically does the narrowing, and so you cannot just split past it. The question is if that is really nice, or if we could do it differently, e.g. via a `CastLL/CastII` on the exit-check?
The issue involves conv nodes when split thru phi at a counted loop. That's a narrow corner case. I think fixing it by addressing the corner case where it occurs as proposed is simpler than trying a most general fix which can have hard to anticipate consequences.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19086#issuecomment-2109544930
More information about the hotspot-compiler-dev
mailing list