RFR(S): 8250609: C2 crash in IfNode::fold_compares

Yangfei (Felix) felix.yang at huawei.com
Mon Jul 27 12:27:19 UTC 2020


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