test/hotspot/jtreg/compiler/loopstripmining/BackedgeNodeWithOutOfLoopControl.java
author roland
Tue, 12 Mar 2019 15:42:32 +0100
changeset 54119 6bf8877eb1b9
parent 48526 d52bb1d8ae7b
permissions -rw-r--r--
8220374: C2: LoopStripMining doesn't strip as expected Reviewed-by: rkennke, thartmann, mdoerr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48526
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
     1
/*
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
     2
 * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
     4
 *
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
     8
 *
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    13
 * accompanied this code).
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    14
 *
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    18
 *
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    21
 * questions.
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    22
 */
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    23
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    24
/**
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    25
 * @test
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    26
 * @bug 8194914
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    27
 * @summary "node not on backedge" assert in OuterStripMinedLoopNode::adjust_strip_mined_loop
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    28
 *
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    29
 * @run main/othervm -XX:-TieredCompilation -XX:+IgnoreUnrecognizedVMOptions -XX:-BackgroundCompilation -XX:+UseCountedLoopSafepoints -XX:LoopStripMiningIter=1000 BackedgeNodeWithOutOfLoopControl
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    30
 *
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    31
 */
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    32
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    33
public class BackedgeNodeWithOutOfLoopControl {
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    34
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    35
  public static void accessArrayVariables(int[] array, int i) {
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    36
    for (int j = 0; j < 100000; j++) {
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    37
      array[i-2]++;
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    38
      array[i-1]++;
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    39
    }
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    40
  }
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    41
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    42
  public void test() {
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    43
    int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    44
    for (int i = 0; i < 2000; i++) {
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    45
        accessArrayVariables(array, 5);
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    46
    }
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    47
  }
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    48
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    49
  public static void main(String [] args) {
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    50
      BackedgeNodeWithOutOfLoopControl aa = new BackedgeNodeWithOutOfLoopControl();
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    51
      aa.test();
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    52
  }
d52bb1d8ae7b 8194914: Compilation fails with "node not on backedge" in OuterStripMinedLoopNode::adjust_strip_mined_loop
roland
parents:
diff changeset
    53
}