Skip to content

Commit 8d699cd

Browse files
committed
remove morphing
1 parent 58d830d commit 8d699cd

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

src/coreclr/jit/helperexpansion.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2279,18 +2279,13 @@ bool Compiler::fgLateCastExpansionForCall(BasicBlock** pBlock, Statement* stmt,
22792279
}
22802280
else
22812281
{
2282-
GenTreeCall* helperCall = call;
22832282
if (typeCheckFailedAction == TypeCheckFailedAction::CallHelper_Specialized)
22842283
{
2285-
// Re-create the call with a specialized helper
2286-
// For JIT we probably can just change the gtCallMethHnd in the existing call, but let's unify with AOT
2287-
helperCall = gtNewHelperCallNode(CORINFO_HELP_CHKCASTCLASS_SPECIAL, call->TypeGet(),
2288-
helperCall->gtArgs.GetUserArgByIndex(0)->GetNode(),
2289-
helperCall->gtArgs.GetUserArgByIndex(1)->GetNode());
2290-
fgMorphCall(helperCall);
2291-
gtSetEvalOrder(helperCall);
2284+
// A slightly faster fallback which assumes that we've already checked
2285+
// for null and for castToCls itself.
2286+
call->gtCallMethHnd = eeFindHelper(CORINFO_HELP_CHKCASTCLASS_SPECIAL);
22922287
}
2293-
GenTree* fallbackTree = gtNewTempStore(tmpNum, helperCall);
2288+
GenTree* fallbackTree = gtNewTempStore(tmpNum, call);
22942289
fallbackBb = fgNewBBFromTreeAfter(BBJ_ALWAYS, typeCheckBb, fallbackTree, debugInfo, lastBb, true);
22952290
}
22962291

@@ -2337,10 +2332,7 @@ bool Compiler::fgLateCastExpansionForCall(BasicBlock** pBlock, Statement* stmt,
23372332
//
23382333
nullcheckBb->inheritWeight(firstBb);
23392334
typeCheckBb->inheritWeightPercentage(nullcheckBb, 50);
2340-
fallbackBb->inheritWeightPercentage(typeCheckBb,
2341-
(typeCheckFailedAction == TypeCheckFailedAction::CallHelper_AlwaysThrows)
2342-
? 0
2343-
: 100 - likelihood);
2335+
fallbackBb->inheritWeightPercentage(typeCheckBb, fallbackBb->KindIs(BBJ_THROW) ? 0 : 100 - likelihood);
23442336
typeCheckSucceedBb->inheritWeightPercentage(typeCheckBb, likelihood);
23452337
lastBb->inheritWeight(firstBb);
23462338

src/coreclr/jit/importer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5460,6 +5460,9 @@ GenTree* Compiler::impCastClassOrIsInstToTree(
54605460
shouldExpandInline = isCastClass && isClassExact;
54615461
}
54625462

5463+
// CI test
5464+
shouldExpandInline = false;
5465+
54635466
// Pessimistically assume the jit cannot expand this as an inline test
54645467
bool canExpandInline = false;
54655468
bool reversedMTCheck = false;

0 commit comments

Comments
 (0)