Fixes GitHub Issue 16065
Bug in the CSE phase when a CSE use contains a CSE def
For the error cases we could unmark or discard a CSE def. This CSE def might be needed when
performing a subsequent CSE replacement. This could lead to an uninitialized value being
used for the CSE use.
Changed optUnmarkCSE method to return a bool instead of a void.
Changed optValuenumCSE_UnmarkCSEs to take a write-back mutable wbKeepList argument
Removed an unreachable code block in fgRemoveStmt and replaced it with a noway_assert
Added method headers for optUnmarkCSE and optUnmarkCSEs
Removed the code that allowed unmarking of a CSE def, instead we return false
Retyped the second arguments to optUnmarksCSEs and optValueNumCSE_UnmarkCSEs
to support appending new nodes to keep using wbKeepList
Code modifications to PerformCSE() to support collecting both persistent side effects and
any nested CSE defs found in CSE uses. Move the location of the call to
optValueNumCSE_UnmarkCSEs so that it comes before the decision to create a GT_COMMA node
for the cse use.
Commit migrated from https://github.com/dotnet/coreclr/commit/
eee738adae200f39296e0d3536be07b19be7649e