diff --git a/src/coreclr/jit/codegenlinear.cpp b/src/coreclr/jit/codegenlinear.cpp index 1f0ede80c7a8a..27040f7dd1d0b 100644 --- a/src/coreclr/jit/codegenlinear.cpp +++ b/src/coreclr/jit/codegenlinear.cpp @@ -2148,6 +2148,12 @@ void CodeGen::genProduceReg(GenTree* tree) tree->gtFlags |= GTF_SPILLED; tree->gtFlags &= ~GTF_SPILL; + if (tree->isUsedFromSpillTemp()) + { + // The register assignment is not meaningful for the use. + tree->ClearRegNum(); + } + return; } }