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

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 18
    • 18
    • hotspot
    • b28
    • generic
    • generic

        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.



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

                Created:
                Updated:
                Resolved: