IfNode::fold_compares() requires ctrl has single output. I found a fold-compares case is postpone until IterGVN2. The reason is that a dead region prevents IfNode::fold_compares() from transforming code.
here is an example. At beginning of IterGVN, the control of 205 If is 194 Region.
```
205 If === 194 204 [[ 206 207 ]] P=1.000000, C=6784.000000 Type:{0:control, 1:control} !jvms: java.time.temporal.ChronoField::isDateBased @ bci:23 (line 687) java.time.chrono.ChronoLocalDate::isSupported @ bci:8 (line 388)
194 Region === _ 150 [[ 205 ]] Type:control !jvms: java.time.temporal.ChronoField::isDateBased @ bci:20 (line 687) java.time.chrono.ChronoLocalDate::isSupported @ bci:8 (line 388)
```
IfNode::Ideal() calls Node::remove_dead_region() for 205. it simplified code a little bit. IfNode's control changes from 194 to 150.
```
150 IfFalse === 148 [[ 194 205 ]] #0 Type:control !jvms: java.time.temporal.ChronoField::isDateBased @ bci:10 (line 687) java.time.chrono.ChronoLocalDate::isSupported @ bci:8 (line 388)
205 If === 150 204 [[ 206 207 ]] P=1.000000, C=6784.000000 Type:{0:control, 1:control} !jvms: java.time.temporal.ChronoField::isDateBased @ bci:23 (line 687) java.time.chrono.ChronoLocalDate::isSupported @ bci:8 (line 388)
194 Region === _ 150 [[]] Type:control !jvms: java.time.temporal.ChronoField::isDateBased @ bci:20 (line 687) java.time.chrono.ChronoLocalDate::isSupported @ bci:8 (line 388)
```
Even 194 Region is dead, but igvn can't remove it in time. This code shape still miss IfNode::fold_compares() because 150's output isn't single.
if (is_ctrl_folds(ctrl, igvn) && ctrl->outcnt() == 1) {}
here is an example. At beginning of IterGVN, the control of 205 If is 194 Region.
```
205 If === 194 204 [[ 206 207 ]] P=1.000000, C=6784.000000 Type:{0:control, 1:control} !jvms: java.time.temporal.ChronoField::isDateBased @ bci:23 (line 687) java.time.chrono.ChronoLocalDate::isSupported @ bci:8 (line 388)
194 Region === _ 150 [[ 205 ]] Type:control !jvms: java.time.temporal.ChronoField::isDateBased @ bci:20 (line 687) java.time.chrono.ChronoLocalDate::isSupported @ bci:8 (line 388)
```
IfNode::Ideal() calls Node::remove_dead_region() for 205. it simplified code a little bit. IfNode's control changes from 194 to 150.
```
150 IfFalse === 148 [[ 194 205 ]] #0 Type:control !jvms: java.time.temporal.ChronoField::isDateBased @ bci:10 (line 687) java.time.chrono.ChronoLocalDate::isSupported @ bci:8 (line 388)
205 If === 150 204 [[ 206 207 ]] P=1.000000, C=6784.000000 Type:{0:control, 1:control} !jvms: java.time.temporal.ChronoField::isDateBased @ bci:23 (line 687) java.time.chrono.ChronoLocalDate::isSupported @ bci:8 (line 388)
194 Region === _ 150 [[]] Type:control !jvms: java.time.temporal.ChronoField::isDateBased @ bci:20 (line 687) java.time.chrono.ChronoLocalDate::isSupported @ bci:8 (line 388)
```
Even 194 Region is dead, but igvn can't remove it in time. This code shape still miss IfNode::fold_compares() because 150's output isn't single.
if (is_ctrl_folds(ctrl, igvn) && ctrl->outcnt() == 1) {}
- relates to
-
JDK-8333393 PhaseCFG::insert_anti_dependences can fail to raise LCAs and to add necessary anti-dependence edges
-
- Resolved
-