Skip to content

Instantly share code, notes, and snippets.

@pgavlin
Created August 20, 2016 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgavlin/77e2364408d6e63223b19319757c2170 to your computer and use it in GitHub Desktop.
Save pgavlin/77e2364408d6e63223b19319757c2170 to your computer and use it in GitHub Desktop.
diff --git a/src/jit/decomposelongs.cpp b/src/jit/decomposelongs.cpp
index 15198e3..35dea9d 100644
--- a/src/jit/decomposelongs.cpp
+++ b/src/jit/decomposelongs.cpp
@@ -409,7 +409,7 @@ GenTree* DecomposeLongs::DecomposeStoreLclVar(LIR::Use& use)
// itself should not have any. The lo and hi rhs parts could, at least
// in theory, have different side effects so we can't simply copy the
// original store's side effecs to both parts.
- unsigned flags = tree->gtFlags & ~GTF_ALL_EFFECT;
+ unsigned flags = (tree->gtFlags & ~GTF_ALL_EFFECT) | GTF_ASG;
unsigned loFlags = flags | (loRhs->gtFlags & GTF_ALL_EFFECT);
unsigned hiFlags = flags | (hiRhs->gtFlags & GTF_ALL_EFFECT);
@@ -525,6 +525,7 @@ GenTree* DecomposeLongs::DecomposeCast(LIR::Use& use)
{
loResult = cast->gtGetOp1();
hiResult = m_compiler->gtNewZeroConNode(TYP_INT);
+ m_compiler->gtPrepareCost(hiResult);
BlockRange().Remove(cast);
BlockRange().InsertAfter(loResult, hiResult);
@@ -544,6 +545,7 @@ GenTree* DecomposeLongs::DecomposeCast(LIR::Use& use)
loResult->gtType = TYP_INT;
hiResult = m_compiler->gtNewZeroConNode(TYP_INT);
+ m_compiler->gtPrepareCost(hiResult);
BlockRange().InsertAfter(loResult, hiResult);
}
@@ -559,7 +561,7 @@ GenTree* DecomposeLongs::DecomposeCast(LIR::Use& use)
hiResult = m_compiler->gtNewOperNode(GT_RSH, TYP_INT, loCopy, shiftBy);
BlockRange().Remove(cast);
- BlockRange().InsertAfter(loResult, loCopy, shiftBy, hiResult);
+ BlockRange().InsertAfter(loResult, LIR::SeqTree(m_compiler, hiResult));
m_compiler->lvaIncRefCnts(loCopy);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment