RFR: JDK-8287284: C2: loop optimization performs split_thru_phi infinitely many times [v3]
Tobias Holenstein
tholenstein at openjdk.org
Wed Nov 8 11:51:59 UTC 2023
On Mon, 6 Nov 2023 08:56:02 GMT, Roland Westrelin <roland at openjdk.org> wrote:
> > So you think this problem only exists for Loads? Can we not have a similar split_thru_phi problem with another node?
>
> The exit of the inner loop has to be some control split with a projection that's in the outer loop. The cloned node should be assigned that projection as control (in the outer loop) unless there's something pushing it in the inner loop which I assume in this case is a store. Not sure how that would happen with other nodes.
>
> > As you say: early control is not sufficient, as it could still have all uses outside the inner loop and would then be scheduled after the inner loop (ending up in the outer loop). I guess we could just check for the late control then?
>
> Yes, late control would be better but it's unclear to me how straightforward it is and given this is a corner case, a simple solution is likely good enough.
We do not always have late control. So I lets stay with early control to keep the fix simple.
Since testing with early control does not give an exact result, and the infinite loop only occurs for Loads, I suggest we apply the fix only for Loads.
I updated the code and comments.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15536#issuecomment-1801731396
More information about the hotspot-compiler-dev
mailing list