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

New subnode ideal optimization: converting "c0 - (x + c1)" into "(c0 - c1) - x"

    XMLWordPrintable

    Details

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

      Backports

        Description

        A DESCRIPTION OF THE PROBLEM :
        ## Synopsis
        New subnode ideal optimization: converting "c0 - (x + c1)" into "(c0 - c1) - x"


        ## Description
        A new ideal optimization can be introduced for subnode: converting "c0 - (x + c1)" into "(c0 - c1) - x".

        // Convert "c0 - (x + c1)" into "(c0 - c1) - x"
        if (in2->Opcode() == Op_AddI
            && phase->type(in1)->isa_int() != NULL
            && phase->type(in1)->isa_int()->is_con()
            && phase->type(in2->in(2))->isa_int() != NULL
            && phase->type(in2->in(2))->isa_int()->is_con()) {
            jint c0 = phase->type(in1)->isa_int()->get_con();
            jint c1 = phase->type(in2->in(2))->isa_int()->get_con();
          return new SubINode(phase->intcon(java_subtract(c0, c1)), in2->in(1));
        }

        I have submitted a pull request https://github.com/openjdk/jdk/pull/6441 and included both microbenchmark and jtreg tests.



          Attachments

            Issue Links

              Activity

                People

                Assignee:
                iveresov Igor Veresov
                Reporter:
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: