Integrated: 8316396: Endless loop in C2 compilation triggered by AddNode::IdealIL
Roland Westrelin
roland at openjdk.org
Wed Oct 4 12:08:54 UTC 2023
On Tue, 26 Sep 2023 13:48:56 GMT, Roland Westrelin <roland at openjdk.org> wrote:
> A number of SubI nodes are laid out in a binary tree. There are <100
> SubI nodes involved but the tree is fairly deep, and balanced and has
> 200+ millions of nodes that is the relately small number of SubI nodes
> are arranged in a way that they build a 200+ millions node tree.
>
> The `AddNode::IdealIL()` transform:
>
> "(a-b)+(c-d)" into "(a+c)-(b+d)"
>
> is applied at the root of the tree. Because `tranform()` is called on
> the resulting a+c and b+d, the same transformation is applied to each
> and recursively down the tree. So there's no endless loop but very
> slow progress because c2 is busy walking and transforming a large
> tree. There's a lot of redundant work done on the way, because the
> tree is composed of a relatively small number of nodes. The fix I
> proposed is to not call `tranform()` but enqueue a+c and b+d with
> igvn. Some subtrees are shared in the large tree of `SubI`
> nodes. Calling `tranform()` only causes the node in the tree that
> called it to be updated while, when delaying to igvn, all uses of the
> subtree are updated with the transformed subtree.
This pull request has now been integrated.
Changeset: b0d6c847
Author: Roland Westrelin <roland at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/b0d6c8472f69fef0265b41a4caf9e564adf68f6e
Stats: 70 lines in 2 files changed: 68 ins; 0 del; 2 mod
8316396: Endless loop in C2 compilation triggered by AddNode::IdealIL
Reviewed-by: thartmann, kvn
-------------
PR: https://git.openjdk.org/jdk/pull/15923
More information about the hotspot-compiler-dev
mailing list