Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Enable implicit byref struct promotion
Browse files Browse the repository at this point in the history
Remove the artificial limitation marking them address-taken.  Add a
hueristic that avoids promoting if there are too few references to the
parameter.
  • Loading branch information
JosephTremoulet committed May 16, 2017
1 parent a6a8bd2 commit 0814907
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17778,13 +17778,6 @@ void Compiler::fgRetypeImplicitByRefArgs()
size = info.compCompHnd->getClassSize(typeHnd);
}

// Temporary change to make reordering no-diff: mark any promoted implicit-by-ref args
// dependent promotions, by marking them address-taken.
if (varDsc->lvPromoted)
{
lvaSetVarAddrExposed(lclNum);
}

if (varDsc->lvPromoted)
{
// This implicit-by-ref was promoted; create a new temp to represent the
Expand Down Expand Up @@ -17821,7 +17814,8 @@ void Compiler::fgRetypeImplicitByRefArgs()
// through the pointer parameter, the same as we'd do for this
// parameter if it weren't promoted at all (otherwise the initialization
// of the new temp would just be a needless memcpy at method entry).
bool undoPromotion = lvaGetPromotionType(newVarDsc) == PROMOTION_TYPE_DEPENDENT;
bool undoPromotion = (lvaGetPromotionType(newVarDsc) == PROMOTION_TYPE_DEPENDENT) ||
(varDsc->lvRefCnt <= varDsc->lvFieldCnt);

if (!undoPromotion)
{
Expand Down

0 comments on commit 0814907

Please sign in to comment.