diff options
author | Pat Gavlin <pagavlin@microsoft.com> | 2017-06-20 18:22:45 -0700 |
---|---|---|
committer | Pat Gavlin <pagavlin@microsoft.com> | 2017-06-24 14:10:19 -0700 |
commit | 04668c8a76da2b1ee07b48e00ae0376ddfbad960 (patch) | |
tree | 76e044caadb00e43853ba89b93aa329a2bef0136 /src/jit/rationalize.cpp | |
parent | ab7f3407fa9a03110157ee659b5145a8f6e392ca (diff) | |
download | coreclr-04668c8a76da2b1ee07b48e00ae0376ddfbad960.tar.gz coreclr-04668c8a76da2b1ee07b48e00ae0376ddfbad960.tar.bz2 coreclr-04668c8a76da2b1ee07b48e00ae0376ddfbad960.zip |
Maintain `LIR::IsUnusedValue` in the backend.
This flag indicates whether or not the SDSU temp produced by a node is
ever read. This information is needed by the register allocator, but is
also useful in other parts of the compiler (for example, `TryGetUse` can
return immediately if this flag is set). Setting this flag properly in
rationalize and maintaining it through decomposition and lowering allows
us to remove an IR walk immediately prior to LSRA.
Diffstat (limited to 'src/jit/rationalize.cpp')
-rw-r--r-- | src/jit/rationalize.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/jit/rationalize.cpp b/src/jit/rationalize.cpp index 0afdff40ac..c7f63a3cb4 100644 --- a/src/jit/rationalize.cpp +++ b/src/jit/rationalize.cpp @@ -790,11 +790,18 @@ Compiler::fgWalkResult Rationalizer::RewriteNode(GenTree** useEdge, ArrayStack<G BlockRange().Delete(comp, m_block, std::move(lhsRange)); } + else + { + op1->gtLIRFlags |= LIR::Flags::IsUnusedValue; + } + + BlockRange().Remove(node); GenTree* replacement = node->gtGetOp2(); if (!use.IsDummyUse()) { use.ReplaceWith(comp, replacement); + node = replacement; } else { @@ -812,9 +819,11 @@ Compiler::fgWalkResult Rationalizer::RewriteNode(GenTree** useEdge, ArrayStack<G BlockRange().Delete(comp, m_block, std::move(rhsRange)); } + else + { + node = replacement; + } } - - BlockRange().Remove(node); } break; @@ -984,6 +993,11 @@ Compiler::fgWalkResult Rationalizer::RewriteNode(GenTree** useEdge, ArrayStack<G node->gtFlags &= ~GTF_CALL; } + if (use.IsDummyUse()) + { + node->gtLIRFlags |= LIR::Flags::IsUnusedValue; + } + if (node->TypeGet() == TYP_LONG) { comp->compLongUsed = true; @@ -1096,7 +1110,7 @@ void Rationalizer::DoPhase() this, true); } - assert(BlockRange().CheckLIR(comp)); + assert(BlockRange().CheckLIR(comp, true)); } comp->compRationalIRForm = true; |