JIT: fix overly aggressive type propagation from returns#21316
Conversation
For quite a while now the jit has been propagating return types from callees to the return spill temp. However this is only safe when the callee has a single return site (or all return sites return the same type). Because return spill temps often end up getting assigned to still more temps we haven't seen this overly aggressive type propgagation lead to bugs, but now that we're tracking single def temps and doing more type propagation during the late devirtualization callback, the fact that these types are wrong has been exposed and can lead to incorrect devirtualization. The fix is to only consider the return spill temp as single def if the callee has a single return site, and to check that the return spill temp is single def before trying to propagate the type. Fixes #21295.
|
@briansull PTAL A handful diffs from PMI... these may not have lead to observable bugs; it depends on which type was actually returned by the callee. This bug was exposed in JitStress=2 via random inlining. Methods with multiple returns tend not to get inlined by default, but the random inliner (intentionally) doesn't play by the normal rules. @dotnet-bot test Windows_NT x64 Cross Checked corefx_jitstress2 Build and Test |
|
@dotnet-bot test Windows_NT x86_arm_altjit Checked corefx_jitstress2 |
|
@AndyAyersMS This is failing because of a new test. I am checking in something that should fx the issue, but if it doesn;t I will simply disable the test. |
|
Ok, thanks... |
|
@dotnet-bot test Windows_NT x64 Checked corefx_jitstress2 |
|
See #21315 @dotnet-bot test Windows_NT arm Cross Debug Innerloop Build please |
|
I can't repro the trace listener failures in the x64 checked corefx jitstress 2 and other runs. Wonder if there is some artifact where if the test run crosses over a month-end boundary they might fail. Errors are of the form So am going to retry these. @dotnet-bot test Windows_NT x64 Checked corefx_jitstress2 There also appear to be some baseline failures in the CoreFX jitstress2 runs, but only a handful. |
|
Think the remaining jitstress 2 failures are unrelated. |
…clr#21316) For quite a while now the jit has been propagating return types from callees to the return spill temp. However this is only safe when the callee has a single return site (or all return sites return the same type). Because return spill temps often end up getting assigned to still more temps we haven't seen this overly aggressive type propgagation lead to bugs, but now that we're tracking single def temps and doing more type propagation during the late devirtualization callback, the fact that these types are wrong has been exposed and can lead to incorrect devirtualization. The fix is to only consider the return spill temp as single def if the callee has a single return site, and to check that the return spill temp is single def before trying to propagate the type. Fixes dotnet/coreclr#21295. Commit migrated from dotnet/coreclr@562ae44
For quite a while now the jit has been propagating return types from
callees to the return spill temp. However this is only safe when the
callee has a single return site (or all return sites return the same
type).
Because return spill temps often end up getting assigned to still more
temps we haven't seen this overly aggressive type propgagation lead to
bugs, but now that we're tracking single def temps and doing more type
propagation during the late devirtualization callback, the fact that
these types are wrong has been exposed and can lead to incorrect
devirtualization.
The fix is to only consider the return spill temp as single def if the
callee has a single return site, and to check that the return spill temp
is single def before trying to propagate the type.
Fixes #21295.