RFR: 8271600: C2: CheckCastPP which should closely follow Allocate is sunk of a loop

Roland Westrelin roland at openjdk.java.net
Mon Aug 23 09:03:28 UTC 2021


On Fri, 20 Aug 2021 12:02:25 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

> Proposed fix is to keep such cast nodes intact. Moreover, I propose to disable the optimization for all flavors of cast nodes.
> Cast nodes usually accompany runtime checks and I don't see much benefit in moving the cast node away while leaving the runtime check inside the loop.

That looks too conservative to me. It's not always the case that a cast is guarded by a test (the test could have been optimized out). Also, if a node is in a loop nest composed of 2 loops and can be sunk out of both loops, this would be done in 2 loop opts pass. First, from the inner loop and then from the outer loop. On the first pass, cast nodes are added to pin the node out of the inner loop. The change you propose would then prevent sinking out of the outer loop.

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

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


More information about the hotspot-compiler-dev mailing list