mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-21 20:30:39 +00:00
8343068: C2: CastX2P Ideal transformation not always applied
Reviewed-by: kvn, thartmann
This commit is contained in:
parent
83f3d42d6b
commit
57c3bb6091
@ -1695,6 +1695,14 @@ void PhaseIterGVN::add_users_of_use_to_worklist(Node* n, Node* use, Unique_Node_
|
||||
worklist.push(cmp);
|
||||
}
|
||||
}
|
||||
if (use->Opcode() == Op_AddX) {
|
||||
for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
|
||||
Node* u = use->fast_out(i2);
|
||||
if (u->Opcode() == Op_CastX2P) {
|
||||
worklist.push(u);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Red Hat, Inc. 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.
|
||||
*/
|
||||
|
||||
package compiler.c2;
|
||||
|
||||
import compiler.lib.ir_framework.*;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8343068
|
||||
* @summary C2: CastX2P Ideal transformation not always applied
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /test/lib /
|
||||
* @run driver compiler.c2.TestCastX2NotProcessedIGVN
|
||||
*/
|
||||
|
||||
public class TestCastX2NotProcessedIGVN {
|
||||
private static final Unsafe UNSAFE = Unsafe.getUnsafe();
|
||||
static int size = 1024;
|
||||
static long base = UNSAFE.allocateMemory(4 * size);
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
TestFramework.runWithFlags("--add-modules", "java.base", "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED");
|
||||
}
|
||||
|
||||
@Test
|
||||
@IR(failOn = IRNode.ADD_L, counts = {IRNode.ADD_P, "1"})
|
||||
public static byte test1(long base) {
|
||||
int offset = 0;
|
||||
do {
|
||||
offset++;
|
||||
} while (offset < 100);
|
||||
long longOffset = ((long) offset) * 2;
|
||||
return UNSAFE.getByte(null, base + longOffset);
|
||||
}
|
||||
|
||||
@Run(test = "test1")
|
||||
public static void test1Runner() {
|
||||
test1(base);
|
||||
}
|
||||
|
||||
@Test
|
||||
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 1"})
|
||||
public static int test2(int stop, int[] array) {
|
||||
int v = 0;
|
||||
stop = Math.min(stop, Integer.MAX_VALUE / 4);
|
||||
for (int i = 0; i < stop; i++) {
|
||||
long offset = ((long)i) * 4;
|
||||
array[i] = UNSAFE.getInt(null, offset + base);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
@Run(test = "test2")
|
||||
public static void test2Runner() {
|
||||
test2(size, new int[size]);
|
||||
}
|
||||
}
|
||||
@ -219,6 +219,11 @@ public class IRNode {
|
||||
beforeMatchingNameRegex(ADD_L, "AddL");
|
||||
}
|
||||
|
||||
public static final String ADD_P = PREFIX + "ADD_P" + POSTFIX;
|
||||
static {
|
||||
beforeMatchingNameRegex(ADD_P, "AddP");
|
||||
}
|
||||
|
||||
public static final String ADD_VD = VECTOR_PREFIX + "ADD_VD" + POSTFIX;
|
||||
static {
|
||||
vectorNode(ADD_VD, "AddVD", TYPE_DOUBLE);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user