RFR: 8308504: C2: "malformed control flow" after JDK-8303466 [v3]
Christian Hagedorn
chagedorn at openjdk.org
Mon Jul 24 15:36:44 UTC 2023
On Mon, 24 Jul 2023 11:18:10 GMT, Roland Westrelin <roland at openjdk.org> wrote:
>> I took that bug over from Emanuel because he's away:
>> https://github.com/openjdk/jdk/pull/14331
>>
>> I tried adding a `CastII` to narrow the limit of the loop as I
>> suggested in a comment on the PR but I found that doesn't work in all
>> cases: if the type of the initial value for the loop variable is not
>> narrow enough, then the narrower type for the limit doesn't help
>> narrow the loop phi type.
>>
>> What I propose instead is to add an assert predicate that catches when
>> the main loop is unreachable but the zero trip count doesn't constant
>> fold. For that to work, the order of predicates must be preserved when
>> they are copied or updated. I had to make some small changes to
>> guarantee that.
>
> Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
>
> review
> I tried adding a CastII to narrow the limit of the loop as I
suggested in a comment on the PR but I found that doesn't work in all
cases: if the type of the initial value for the loop variable is not
narrow enough, then the narrower type for the limit doesn't help
narrow the loop phi type.
I hoped that this would be enough. Can you show an example where this failed?
src/hotspot/share/opto/loopPredicate.cpp line 1505:
> 1503: (stride > 0) != (scale > 0), overflow);
> 1504: add_template_assertion_predicate_helper(predicate_proj, reason, upper_bound_proj, bol,
> 1505: overflow ? Op_If : iff->Opcode());
Is this supposed to replace L1506-1510?
src/hotspot/share/opto/loopPredicate.cpp line 1524:
> 1522: bol = rc_predicate(loop, new_proj, scale, offset, max_value, limit, stride, rng, (stride > 0) != (scale > 0),
> 1523: overflow);
> 1524: add_template_assertion_predicate_helper(predicate_proj, reason, new_proj, bol, overflow ? Op_If : iff->Opcode());
You probably need to assign the result to `new_proj`?
-------------
PR Review: https://git.openjdk.org/jdk/pull/14973#pullrequestreview-1543608845
PR Review Comment: https://git.openjdk.org/jdk/pull/14973#discussion_r1272338663
PR Review Comment: https://git.openjdk.org/jdk/pull/14973#discussion_r1272369875
More information about the hotspot-compiler-dev
mailing list