Skip to content
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
10 changes: 6 additions & 4 deletions src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ void Compiler::impAppendStmt(Statement* stmt, unsigned chkLevel, bool checkConsu
// needs to be spilled to preserve correct ordering.
//
GenTree* expr = stmt->GetRootNode();
GenTreeFlags flags = expr->gtFlags & GTF_GLOB_EFFECT;
GenTreeFlags flags = expr->gtFlags & GTF_ALL_EFFECT;

// Stores to unaliased locals require special handling. Here, we look for trees that
// can modify them and spill the references. In doing so, we make two assumptions:
Expand Down Expand Up @@ -416,7 +416,7 @@ void Compiler::impAppendStmt(Statement* stmt, unsigned chkLevel, bool checkConsu
{
// For stores, limit the checking to what the value could modify/interfere with.
GenTree* value = expr->AsLclVarCommon()->Data();
flags = value->gtFlags & GTF_GLOB_EFFECT;
flags = value->gtFlags & GTF_ALL_EFFECT;

// We don't mark indirections off of "aliased" locals with GLOB_REF, but they must still be
// considered as such in the interference checking.
Expand All @@ -429,7 +429,9 @@ void Compiler::impAppendStmt(Statement* stmt, unsigned chkLevel, bool checkConsu

if (flags != 0)
{
impSpillSideEffects((flags & (GTF_ASG | GTF_CALL)) != 0, chkLevel DEBUGARG("impAppendStmt"));
// Ordering side effects must not move ahead of global reads.
impSpillSideEffects((flags & (GTF_ASG | GTF_CALL | GTF_ORDER_SIDEEFF)) != 0,
chkLevel DEBUGARG("impAppendStmt"));
Comment thread
jakobbotsch marked this conversation as resolved.
Comment thread
jakobbotsch marked this conversation as resolved.
}
else
{
Expand Down Expand Up @@ -1839,7 +1841,7 @@ void Compiler::impSpillSideEffect(bool spillGlobEffects, unsigned i DEBUGARG(con
{
assert(i <= stackState.esStackDepth);

GenTreeFlags spillFlags = spillGlobEffects ? GTF_GLOB_EFFECT : GTF_SIDE_EFFECT;
GenTreeFlags spillFlags = spillGlobEffects ? GTF_ALL_EFFECT : (GTF_SIDE_EFFECT | GTF_ORDER_SIDEEFF);
Comment thread
jakobbotsch marked this conversation as resolved.
GenTree* tree = stackState.esStack[i].val;

if ((tree->gtFlags & spillFlags) != 0 ||
Expand Down
14 changes: 4 additions & 10 deletions src/coreclr/jit/importervectorization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,15 +519,12 @@ GenTree* Compiler::impUtf16StringComparison(StringComparisonKind kind, CORINFO_S

impPopStack(argsCount);

// Include global reads so nonfaulting volatile loads stay ahead of the comparison.
impSpillSideEffects(true, CHECK_SPILL_ALL DEBUGARG("unrolled UTF16 string comparison"));

impStoreToTemp(varStrTmp, varStr, CHECK_SPILL_NONE);
impStoreToTemp(varStrTmp, varStr, CHECK_SPILL_ALL);
if (unrolled->OperIs(GT_QMARK))
{
// QMARK nodes cannot reside on the evaluation stack
unsigned rootTmp = lvaGrabTemp(true DEBUGARG("spilling unroll qmark"));
impStoreToTemp(rootTmp, unrolled, CHECK_SPILL_NONE);
impStoreToTemp(rootTmp, unrolled, CHECK_SPILL_ALL);
unrolled = gtNewLclvNode(rootTmp, TYP_INT);
}

Expand Down Expand Up @@ -691,19 +688,16 @@ GenTree* Compiler::impUtf16SpanComparison(StringComparisonKind kind, CORINFO_SIG
{
impPopStack(argsCount);

// Include global reads so nonfaulting volatile loads stay ahead of the comparison.
impSpillSideEffects(true, CHECK_SPILL_ALL DEBUGARG("unrolled UTF16 span comparison"));

if (!spanObj->OperIs(GT_LCL_VAR))
{
impStoreToTemp(spanLclNum, spanObj, CHECK_SPILL_NONE);
impStoreToTemp(spanLclNum, spanObj, CHECK_SPILL_ALL);
}

if (unrolled->OperIs(GT_QMARK))
{
// QMARK can't be a root node, spill it to a temp
unsigned rootTmp = lvaGrabTemp(true DEBUGARG("spilling unroll qmark"));
impStoreToTemp(rootTmp, unrolled, CHECK_SPILL_NONE);
impStoreToTemp(rootTmp, unrolled, CHECK_SPILL_ALL);
unrolled = gtNewLclvNode(rootTmp, TYP_INT);
}

Expand Down
Loading