Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8287840

Dead copy region node blocks IfNode's fold-compares

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 19
    • 19
    • hotspot
    • b26
    • generic

    Description

      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) {}

      Attachments

        Issue Links

          Activity

            People

              xliu Xin Liu
              xliu Xin Liu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: