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

Hoist nodes dependent on the loop head to above the loop

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • None
    • hotspot

      Given a node N with its control input A and B being the immediate dominator of A. If A post-dominates B (i.e. a control flow visits A iff it visits B), then N can be rewired to B. This allows N to be more freely schedulable, even hoist it above the loop because the loop entry dominates the loop head and the loop head post-dominates the loop entry.

      For example:

          public static void test(Blackhole bh, NativeMemorySegment a) {
              for (int i = 0; i < 100; i++) {
                  bh.consume(a.get(ValueLayout.JAVA_INT_UNALIGNED, 0));
              }
          }

      Since the native load is an unsafe load, when the range check is predicated out, it is wired to the loop head. We can hoist it to the loop entry. Note that we may not be able to do this with stores because of some assertions that I don't fully understand.

            Unassigned Unassigned
            qamai Quan Anh Mai
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: