Fix issue with hoisting and copy prop interaction (#85493)
authorBruce Forstall <brucefo@microsoft.com>
Thu, 18 May 2023 16:16:07 +0000 (09:16 -0700)
committerGitHub <noreply@github.com>
Thu, 18 May 2023 16:16:07 +0000 (09:16 -0700)
commit32b7be762b314205556069f67a58efcc7897366f
tree632a48f7e4249d4779036f66e3ffabb857ccdb61
parent7b0d8fede14d6cdf510006599c21b21e88ae808a
Fix issue with hoisting and copy prop interaction (#85493)

* Fix issue with hoisting and copy prop interaction

After hoisting creates a tree copy, it morphs it. That morph might
lose the value numbers on LCL_VAR uses, but leave the SSA numbers.
Copy prop was assuming that such a use had a VN. Instead, check this
dynamically instead of asserting.

Fixes #84619

* Further optimize cast in fgOptimizeCastOnStore()

If we optimize the cast, call `fgOptimizeCast` to see if it can be
optimized further.

* Add regression test

* Feedback
src/coreclr/jit/copyprop.cpp
src/coreclr/jit/morph.cpp
src/tests/JIT/Regression/JitBlue/Runtime_84619/Runtime_84619.cs [new file with mode: 0644]
src/tests/JIT/Regression/JitBlue/Runtime_84619/Runtime_84619.csproj [new file with mode: 0644]