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

JIT: refactor logic for removing box upstream side effects #13169

Merged
merged 2 commits into from
Aug 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -2228,6 +2228,7 @@ class Compiler
gtFoldExprConst(GenTreePtr tree);
GenTreePtr gtFoldExprSpecial(GenTreePtr tree);
GenTreePtr gtFoldExprCompare(GenTreePtr tree);
bool gtTryRemoveBoxUpstreamEffects(GenTreePtr tree);

//-------------------------------------------------------------------------
// Get the handle, if any.
Expand Down Expand Up @@ -3614,9 +3615,8 @@ class Compiler
bool fgFuncletsCreated; // true if the funclet creation phase has been run
#endif // FEATURE_EH_FUNCLETS

bool fgGlobalMorph; // indicates if we are during the global morphing phase
// since fgMorphTree can be called from several places
bool fgExpandInline; // indicates that we are creating tree for the inliner
bool fgGlobalMorph; // indicates if we are during the global morphing phase
// since fgMorphTree can be called from several places

bool impBoxTempInUse; // the temp below is valid and available
unsigned impBoxTemp; // a temporary that is used for boxing
Expand Down Expand Up @@ -4479,12 +4479,6 @@ class Compiler

static GenTreePtr fgGetFirstNode(GenTreePtr tree);
static bool fgTreeIsInStmt(GenTree* tree, GenTreeStmt* stmt);

inline bool fgIsInlining()
{
return fgExpandInline;
}

void fgTraverseRPO();

//--------------------- Walking the trees in the IR -----------------------
Expand Down
11 changes: 8 additions & 3 deletions src/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ void Compiler::fgInit()
genReturnBB = nullptr;

/* We haven't reached the global morphing phase */
fgGlobalMorph = false;
fgExpandInline = false;
fgModified = false;
fgGlobalMorph = false;
fgModified = false;

#ifdef DEBUG
fgSafeBasicBlockCreation = true;
Expand Down Expand Up @@ -22676,6 +22675,12 @@ GenTreePtr Compiler::fgInlinePrependStatements(InlineInfo* inlineInfo)
}
#endif // DEBUG
}
else if (argNode->IsBoxedValue())
{
// Try to clean up any unnecessary boxing side effects
// since the box itself will be ignored.
gtTryRemoveBoxUpstreamEffects(argNode);
}
}
}
}
Expand Down
Loading