RFR(S): 8250609: C2 crash in IfNode::fold_compares
Vladimir Kozlov
vladimir.kozlov at oracle.com
Mon Jul 27 19:15:03 UTC 2020
It happens because 'lo' is new node created just now and have no uses yet.
For such new nodes we usually add dummy use to avoid removal from graph:
http://hg.openjdk.java.net/jdk/jdk/file/c379dc750a02/src/hotspot/share/opto/convertnode.cpp#l403
Thanks,
Vladimir K
On 7/27/20 5:27 AM, Yangfei (Felix) wrote:
> Hi,
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8250609
> Webrev: http://cr.openjdk.java.net/~fyang/8250609/webrev.00/
>
> In IfNode::fold_compares_helper, C2 tries to fold 2 CmpI into a single CmpU.
> At the crash site in IfNode::fold_compares_helper:
> 995 if (lo && hi) {
> 996 // Merge the two compares into a single unsigned compare by building (CmpU (n - lo) (hi - lo))
> 997 Node* adjusted_val = igvn->transform(new SubINode(n, lo));
> 998 if (adjusted_lim == NULL) {
> 999 adjusted_lim = igvn->transform(new SubINode(hi, lo));
> 1000 }
>
> At line 997, we have:
> (gdb) p lo->dump()
> 641 AddI === _ 513 92 [[]]
> $1 = void
>
> After the transformation at line 997, we have
> (gdb) p lo->dump()
> 641 AddI === _ _ _ [[]] [34200641]
> $3 = void
>
> Then node 641 was used at line 999, which triggers the crash.
> Patch fixes the issue by delaying transformation in IfNode::fold_compares temporarily.
> Tier1-3 tested on aarch64-linux-gnu & x86_64-linux-gnu.
> Newly added test fail without the patch and pass otherwise.
> Suggestions?
>
> Thanks,
> Felix
>
More information about the hotspot-compiler-dev
mailing list