RFR: 8261914: IfNode::fold_compares_helper faces non-canonicalized bool when running JRuby JSON workload
Roland Westrelin
roland at openjdk.java.net
Wed Feb 24 15:26:54 UTC 2021
The assert fires because the current IfNode's condition was not
canonicalized when it's being folded with a dominating
IfNode. idealize_test() should have taken care of that because it
executed before fold_compares() but it didn't because:
Node* new_b = phase->transform( new BoolNode(b->in(1), bt.negate()) );
if( !new_b->is_Bool() ) return NULL;
caused it to bail out. new_b is a constant. This happens because of
the order in which nodes are processed by IGVN. The If's current Bool
would also constant fold but it's in the IGVN worklist and hasn't been
processed yet.
The fix I propose is to keep Aleksey's defensive fix but to check that
the Bool input is indeed about to be transformed by IGVN and that that
would cause the IfNode to be reprocessed.
I tried to write a test case but didn't succeed. The 2 If nodes come
from a tableswitch that's transformed into a series of If based on
profile data. I couldn't reproduce the profile data with a simple test
case.
-------------
Commit messages:
- fix
Changes: https://git.openjdk.java.net/jdk/pull/2707/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2707&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8261914
Stats: 9 lines in 1 file changed: 3 ins; 4 del; 2 mod
Patch: https://git.openjdk.java.net/jdk/pull/2707.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2707/head:pull/2707
PR: https://git.openjdk.java.net/jdk/pull/2707
More information about the hotspot-compiler-dev
mailing list