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

C2: Improve Value() of DivI and DivL for non-constant inputs

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      Currently, C2 only emits a good type for interger division nodes if either input is constant. But we can also cover the generic case by looking at the for cases [min_divident / min_divisor], [max_divident / min_divisor], [min_divident / max_divisor] and [max_divident / max_divisor]. This is guranteed to find the extrema that we can use for min/max. Some special logic is required for MIN_INT / -1, as this is a special case. We also need some special logic to handle ranges that cross zero, but in this case, we just need to check for the negative and positive range once.
      In some cases, this algorithm can lead to a constant Value() result even though both inputs are non-constant!

      I've already built a PR for this: https://github.com/openjdk/jdk/pull/26143


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: