8303513: C2: LoadKlassNode::make fails with 'expecting TypeKlassPtr'

Reviewed-by: thartmann, kvn
This commit is contained in:
Roberto Castañeda Lozano 2023-06-15 10:08:28 +00:00
parent de8aca27ba
commit 83d92672d4

@ -167,6 +167,15 @@ bool SubTypeCheckNode::verify(PhaseGVN* phase) {
const TypeKlassPtr* subk = sub_t->isa_klassptr() ? sub_t->is_klassptr() : sub_t->is_oopptr()->as_klass_type();
if (super_t->singleton() && subk != nullptr) {
if (obj_or_subklass->bottom_type() == Type::TOP) {
// The bottom type of obj_or_subklass is TOP, despite its recorded type
// being an OOP or a klass pointer. This can happen for example in
// transient scenarios where obj_or_subklass is a projection of the TOP
// node. In such cases, skip verification to avoid violating the contract
// of LoadKlassNode::make(). This does not weaken the effect of verify(),
// as SubTypeCheck nodes with TOP obj_or_subklass inputs are dead anyway.
return true;
}
const Type* cached_t = Value(phase); // cache the type to validate consistency
switch (C->static_subtype_check(superk, subk)) {
case Compile::SSC_easy_test: {