summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Tremoulet <JCTremoulet@gmail.com>2017-01-20 07:20:09 -0500
committerGitHub <noreply@github.com>2017-01-20 07:20:09 -0500
commit9b198314362c12b5cd82545c51de18ae884522f3 (patch)
treecdaf661121f1a1d38068796c7d63f6fc96defd50
parent4ac7fe064c2e57c818f565ba2c5192bc73250bf4 (diff)
parent2db8230de17b541b082aa5c27bce5eaf3a6163e3 (diff)
downloadcoreclr-9b198314362c12b5cd82545c51de18ae884522f3.tar.gz
coreclr-9b198314362c12b5cd82545c51de18ae884522f3.tar.bz2
coreclr-9b198314362c12b5cd82545c51de18ae884522f3.zip
Merge pull request #9004 from JosephTremoulet/MoreLessKillHeap
More heap liveness fixes
-rw-r--r--src/jit/codegenlegacy.cpp17
-rw-r--r--src/jit/liveness.cpp4
2 files changed, 7 insertions, 14 deletions
diff --git a/src/jit/codegenlegacy.cpp b/src/jit/codegenlegacy.cpp
index 1e6fa3799d..f1243a64d6 100644
--- a/src/jit/codegenlegacy.cpp
+++ b/src/jit/codegenlegacy.cpp
@@ -20829,7 +20829,7 @@ GenTreePtr Compiler::fgLegacyPerStatementLocalVarLiveness(GenTreePtr startNode,
// If the GT_CLS_VAR is the lhs of an assignment, we'll handle it as a heap def, when we get to
// assignment.
// Otherwise, we treat it as a use here.
- if (!fgCurHeapDef && (tree->gtFlags & GTF_CLS_VAR_ASG_LHS) == 0)
+ if ((tree->gtFlags & GTF_CLS_VAR_ASG_LHS) == 0)
{
fgCurHeapUse = true;
}
@@ -20857,10 +20857,7 @@ GenTreePtr Compiler::fgLegacyPerStatementLocalVarLiveness(GenTreePtr startNode,
GenTreePtr addrArg = tree->gtOp.gtOp1->gtEffectiveVal(/*commaOnly*/ true);
if (!addrArg->DefinesLocalAddr(this, /*width doesn't matter*/ 0, &dummyLclVarTree, &dummyIsEntire))
{
- if (!fgCurHeapDef)
- {
- fgCurHeapUse = true;
- }
+ fgCurHeapUse = true;
}
else
{
@@ -20882,10 +20879,7 @@ GenTreePtr Compiler::fgLegacyPerStatementLocalVarLiveness(GenTreePtr startNode,
case GT_XADD:
case GT_XCHG:
case GT_CMPXCHG:
- if (!fgCurHeapDef)
- {
- fgCurHeapUse = true;
- }
+ fgCurHeapUse = true;
fgCurHeapDef = true;
fgCurHeapHavoc = true;
break;
@@ -20911,10 +20905,7 @@ GenTreePtr Compiler::fgLegacyPerStatementLocalVarLiveness(GenTreePtr startNode,
}
if (modHeap)
{
- if (!fgCurHeapDef)
- {
- fgCurHeapUse = true;
- }
+ fgCurHeapUse = true;
fgCurHeapDef = true;
fgCurHeapHavoc = true;
}
diff --git a/src/jit/liveness.cpp b/src/jit/liveness.cpp
index 0d47716c10..569debb633 100644
--- a/src/jit/liveness.cpp
+++ b/src/jit/liveness.cpp
@@ -1129,7 +1129,9 @@ class LiveVarAnalysis
VarSetOps::DiffD(m_compiler, m_liveIn, block->bbVarDef);
VarSetOps::UnionD(m_compiler, m_liveIn, block->bbVarUse);
- m_heapLiveIn = (m_heapLiveOut && !block->bbHeapDef) || block->bbHeapUse;
+ // Even if m_heapDef is set, we must assume that it doesn't kill heap if m_heapLiveOut, since
+ // (without proof otherwise) the use and def may touch different heap memory at run-time.
+ m_heapLiveIn = m_heapLiveOut || block->bbHeapUse;
/* Can exceptions from this block be handled (in this function)? */