8374043: C2: assert(_base >= VectorMask && _base <= VectorZ) failed: Not a Vector

Reviewed-by: qamai, vlivanov
This commit is contained in:
Xiaohong Gong 2026-01-26 01:50:57 +00:00
parent 932556026d
commit 38b66b1258
2 changed files with 14 additions and 1 deletions

View File

@ -175,6 +175,10 @@ Node* GraphKit::unbox_vector(Node* v, const TypeInstPtr* vbox_type, BasicType el
assert(check_vbox(vbox_type), ""); assert(check_vbox(vbox_type), "");
const TypeVect* vt = TypeVect::make(elem_bt, num_elem, is_vector_mask(vbox_type->instance_klass())); const TypeVect* vt = TypeVect::make(elem_bt, num_elem, is_vector_mask(vbox_type->instance_klass()));
Node* unbox = gvn().transform(new VectorUnboxNode(C, vt, v, merged_memory())); Node* unbox = gvn().transform(new VectorUnboxNode(C, vt, v, merged_memory()));
if (gvn().type(unbox)->isa_vect() == nullptr) {
assert(gvn().type(unbox) == Type::TOP, "sanity");
return nullptr; // not a vector
}
return unbox; return unbox;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1919,6 +1919,15 @@ Node* VectorMaskToLongNode::Ideal_MaskAll(PhaseGVN* phase) {
// saved with a predicate type. // saved with a predicate type.
if (in1->Opcode() == Op_VectorStoreMask) { if (in1->Opcode() == Op_VectorStoreMask) {
Node* mask = in1->in(1); Node* mask = in1->in(1);
// Skip the optimization if the mask is dead.
if (phase->type(mask) == Type::TOP) {
return nullptr;
}
// If the ideal graph is transformed correctly, the input mask should be a
// vector type node. Following optimization can ignore the mismatched type
// issue. But we still keep the sanity check for the mask type by using
// "is_vect()" in the assertion below, so that there can be less optimizations
// evolved before the compiler finally runs into a problem.
assert(!Matcher::mask_op_prefers_predicate(Opcode(), mask->bottom_type()->is_vect()), "sanity"); assert(!Matcher::mask_op_prefers_predicate(Opcode(), mask->bottom_type()->is_vect()), "sanity");
in1 = mask; in1 = mask;
} }