forked from openjdk/jdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
8316105: C2: Back to back Parse Predicates from different loops but w…
…ith same deopt reason are wrongly grouped together
- Loading branch information
1 parent
9480078
commit 32020ae
Showing
2 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
test/hotspot/jtreg/compiler/predicates/TestBackToBackParsePredicates.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
* | ||
*/ | ||
|
||
/* | ||
* @test | ||
* @bug 8316105 | ||
* @library /test/lib | ||
* @summary Test that back to back Parse Predicates with same deopt reason are not grouped together | ||
* @run main/othervm -Xbatch compiler.predicates.TestBackToBackParsePredicates | ||
*/ | ||
|
||
package compiler.predicates; | ||
|
||
import jdk.test.lib.Asserts; | ||
|
||
public class TestBackToBackParsePredicates { | ||
static long lFld; | ||
|
||
public static void main(String[] strArr2) { | ||
for (int i = -350; i <= 0; i++) { | ||
lFld = 30; | ||
test(i); | ||
check(); | ||
} | ||
lFld = 30; | ||
test(1); | ||
check(); | ||
} | ||
|
||
// Inlined | ||
static void foo() { | ||
for (int i12 = 1; i12 < 5; i12++) { // Loop A | ||
lFld += 1; // StoreL | ||
} | ||
} | ||
|
||
static void test(int x) { | ||
foo(); | ||
|
||
// After fully unrolling loop A and after next round of IGVN: | ||
// We wrongly treat two back to back Loop Limit Check Parse Predicates as single Predicate Block. We therefore | ||
// keep the Loop Parse Predicate of loop A: | ||
// | ||
// Loop Parse Predicate (of A) | ||
// Loop Limit Check Parse Predicate (of A) | | ||
// -> StoreL of lFld pinned here | Wrongly treated as single Predicate Block | ||
// Loop Limit Check Parse Predicate (of B) | | ||
for (int i = 7; i < 212; i++) { // Loop B | ||
for (int j = 1; j < 80; j++) { | ||
switch (x % 8) { | ||
case 0: | ||
case 2: | ||
break; | ||
case 6: | ||
case 7: | ||
} | ||
} | ||
} | ||
} | ||
|
||
static void check() { | ||
Asserts.assertEQ(34L, lFld); | ||
} | ||
} |