Skip to content

Commit 852405c

Browse files
authored
JIT: don't bother with GDV for an abstract class (#61191)
Fixes #61190.
1 parent fd07214 commit 852405c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/coreclr/jit/importer.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22230,6 +22230,17 @@ void Compiler::considerGuardedDevirtualization(
2223022230
return;
2223122231
}
2223222232

22233+
uint32_t const likelyClassAttribs = info.compCompHnd->getClassAttribs(likelyClass);
22234+
22235+
if ((likelyClassAttribs & CORINFO_FLG_ABSTRACT) != 0)
22236+
{
22237+
// We may see an abstract likely class, if we have a stale profile.
22238+
// No point guessing for this.
22239+
//
22240+
JITDUMP("Not guessing for class; abstract (stale profile)\n");
22241+
return;
22242+
}
22243+
2223322244
// Figure out which method will be called.
2223422245
//
2223522246
CORINFO_DEVIRTUALIZATION_INFO dvInfo;
@@ -22253,7 +22264,6 @@ void Compiler::considerGuardedDevirtualization(
2225322264
// Add this as a potential candidate.
2225422265
//
2225522266
uint32_t const likelyMethodAttribs = info.compCompHnd->getMethodAttribs(likelyMethod);
22256-
uint32_t const likelyClassAttribs = info.compCompHnd->getClassAttribs(likelyClass);
2225722267
addGuardedDevirtualizationCandidate(call, likelyMethod, likelyClass, likelyMethodAttribs, likelyClassAttribs,
2225822268
likelihood);
2225922269
}

0 commit comments

Comments
 (0)