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

Optimize signed integer comparison

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b29
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        JDK-8042786 changes implemented optimization for unsigned integer comparison when one of input is AddI or SubI and its int type can be represented as set of type regions.

        This optimization might also be beneficial on some signed comparisons, notably (r1+r2)==0 where r1 and r2 are both [1..maxint].

        The problem rise when result of AddI(SubI) may overflow signed integer value.
        Let say the input type is [256, maxint] then adding +128 will create 2 ranges due to
        overflow: [minint, minint+127] and [384, maxint].
        C2 type system keep only 1 type range and as result it use general [minint, maxint] type
        for this case which we can't optimize.

        Make 2 separate type ranges based on types of AddI(SubI) inputs and compare results of their compare. If results are the same CmpI node can be optimized. Note, only signed equality can be optimized this way.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  thartmann Tobias Hartmann
                  Reporter:
                  kvn Vladimir Kozlov
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: