Skip to content

Commit

Permalink
remove morphing
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo committed Jan 26, 2024
1 parent 58d830d commit 8d699cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/coreclr/jit/helperexpansion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2279,18 +2279,13 @@ bool Compiler::fgLateCastExpansionForCall(BasicBlock** pBlock, Statement* stmt,
}
else
{
GenTreeCall* helperCall = call;
if (typeCheckFailedAction == TypeCheckFailedAction::CallHelper_Specialized)
{
// Re-create the call with a specialized helper
// For JIT we probably can just change the gtCallMethHnd in the existing call, but let's unify with AOT
helperCall = gtNewHelperCallNode(CORINFO_HELP_CHKCASTCLASS_SPECIAL, call->TypeGet(),
helperCall->gtArgs.GetUserArgByIndex(0)->GetNode(),
helperCall->gtArgs.GetUserArgByIndex(1)->GetNode());
fgMorphCall(helperCall);
gtSetEvalOrder(helperCall);
// A slightly faster fallback which assumes that we've already checked
// for null and for castToCls itself.
call->gtCallMethHnd = eeFindHelper(CORINFO_HELP_CHKCASTCLASS_SPECIAL);
}
GenTree* fallbackTree = gtNewTempStore(tmpNum, helperCall);
GenTree* fallbackTree = gtNewTempStore(tmpNum, call);
fallbackBb = fgNewBBFromTreeAfter(BBJ_ALWAYS, typeCheckBb, fallbackTree, debugInfo, lastBb, true);
}

Expand Down Expand Up @@ -2337,10 +2332,7 @@ bool Compiler::fgLateCastExpansionForCall(BasicBlock** pBlock, Statement* stmt,
//
nullcheckBb->inheritWeight(firstBb);
typeCheckBb->inheritWeightPercentage(nullcheckBb, 50);
fallbackBb->inheritWeightPercentage(typeCheckBb,
(typeCheckFailedAction == TypeCheckFailedAction::CallHelper_AlwaysThrows)
? 0
: 100 - likelihood);
fallbackBb->inheritWeightPercentage(typeCheckBb, fallbackBb->KindIs(BBJ_THROW) ? 0 : 100 - likelihood);
typeCheckSucceedBb->inheritWeightPercentage(typeCheckBb, likelihood);
lastBb->inheritWeight(firstBb);

Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5460,6 +5460,9 @@ GenTree* Compiler::impCastClassOrIsInstToTree(
shouldExpandInline = isCastClass && isClassExact;
}

// CI test
shouldExpandInline = false;

// Pessimistically assume the jit cannot expand this as an inline test
bool canExpandInline = false;
bool reversedMTCheck = false;
Expand Down

0 comments on commit 8d699cd

Please sign in to comment.