From 02ef859f79cbc2e6225998001af299ba36fe991b Mon Sep 17 00:00:00 2001 From: Cesar Soares Lucas Date: Tue, 22 Aug 2023 07:58:51 +0000 Subject: [PATCH] 8313689: C2: compiler/c2/irTests/scalarReplacement/AllocationMergesTests.java fails intermittently with -XX:-TieredCompilation Reviewed-by: kvn, thartmann --- .../scalarReplacement/AllocationMergesTests.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/test/hotspot/jtreg/compiler/c2/irTests/scalarReplacement/AllocationMergesTests.java b/test/hotspot/jtreg/compiler/c2/irTests/scalarReplacement/AllocationMergesTests.java index aa2f39ef6e6..8effcd63ae7 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/scalarReplacement/AllocationMergesTests.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/scalarReplacement/AllocationMergesTests.java @@ -43,6 +43,9 @@ public class AllocationMergesTests { "-XX:+ReduceAllocationMerges", "-XX:+TraceReduceAllocationMerges", "-XX:+DeoptimizeALot", + "-XX:CompileCommand=inline,*::charAt*", + "-XX:CompileCommand=inline,*PicturePositions::*", + "-XX:CompileCommand=inline,*Point::*", "-XX:CompileCommand=exclude,*::dummy*"); } @@ -92,9 +95,11 @@ public class AllocationMergesTests { "testString_two_C2" }) public void runner(RunInfo info) { + invocations++; + Random random = info.getRandom(); - boolean cond1 = random.nextBoolean(); - boolean cond2 = random.nextBoolean(); + boolean cond1 = invocations % 2 == 0; + boolean cond2 = !cond1; int l = random.nextInt(); int w = random.nextInt(); @@ -551,9 +556,10 @@ public class AllocationMergesTests { new F(); } + int res = s.a; dummy(); - return s.a; + return res; } @Test @@ -1196,12 +1202,13 @@ public class AllocationMergesTests { global_escape = p; } + int res = p.x; if (is_c2) { // This will show up to C2 as a trap. dummy_defaults(); } - return p.y; + return res; } @Test