diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index a513dc7eeeca8..32aa1633c84ee 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -8777,6 +8777,10 @@ GenTree* Compiler::gtCloneExpr( // Update side effect flags since they may be different from the source side effect flags. // For example, we may have replaced some locals with constants and made indirections non-throwing. gtUpdateNodeSideEffects(copy); + if ((varNum != BAD_VAR_NUM) && copy->OperIsSsaDef()) + { + fgAssignSetVarDef(copy); + } } /* GTF_COLON_COND should be propagated from 'tree' to 'copy' */