8343747: C2: TestReplicateAtConv.java crashes with -XX:MaxVectorSize=8

Reviewed-by: epeter, kvn
This commit is contained in:
Roland Westrelin 2024-12-06 09:19:55 +00:00
parent d9a22139fb
commit 874d68a96c
2 changed files with 6 additions and 2 deletions

View File

@ -1466,6 +1466,9 @@ bool VectorCastNode::implemented(int opc, uint vlen, BasicType src_type, BasicTy
if (is_java_primitive(dst_type) &&
is_java_primitive(src_type) &&
(vlen > 1) && is_power_of_2(vlen) &&
// In rare case, the input to the VectorCast could be a Replicate node. We need to make sure creating is supported:
// check the src_type:
VectorNode::vector_size_supported_auto_vectorization(src_type, vlen) &&
VectorNode::vector_size_supported_auto_vectorization(dst_type, vlen)) {
int vopc = VectorCastNode::opcode(opc, src_type);
return vopc > 0 && Matcher::match_rule_supported_auto_vectorization(vopc, vlen, dst_type);

View File

@ -23,9 +23,10 @@
/**
* @test
* @bug 8341834
* @summary C2 compilation fails with "bad AD file" due to Replicate
* @bug 8341834 8343747
* @summary Replicate node at a VectorCast (ConvL2I) causes superword to fail
* @run main/othervm -XX:CompileCommand=compileonly,TestReplicateAtConv::test -Xcomp TestReplicateAtConv
* @run main/othervm -XX:CompileCommand=compileonly,TestReplicateAtConv::test -Xcomp -XX:MaxVectorSize=8 TestReplicateAtConv
*/
public class TestReplicateAtConv {