-
Notifications
You must be signed in to change notification settings - Fork 5.3k
JIT: Handle multi-reg async calls stored to promoted locals #121749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In some cases the async transformation needs to introduce a new local to
store the result of an async call to. If the previous store was a
multi-reg call stored to an independently promoted local then we would
produce illegal IR. For example, the IR
```
t79 = ▌ CALL struct <unknown method> (async) $702
┌──▌ t79 struct
▌ STORE_LCL_VAR struct<System.ValueTuple`3, 16>(P) V25 tmp9
▌ ref field V25.Item3 (fldOffset=0x0) -> V275 tmp259 d:2
▌ int field V25.Item2 (fldOffset=0x8) -> V276 tmp260 d:1
▌ ubyte field V25.Item1 (fldOffset=0xc) -> V277 tmp261 d:1 $VN.Void
```
would be canonicalized into
```
t79 = ▌ CALL struct <unknown method> (async) $702
┌──▌ t79 struct
▌ STORE_LCL_VAR struct<System.ValueTuple`3, 16> V337 rat6
t5027 = LCL_VAR struct<System.ValueTuple`3, 16> V337 rat6
┌──▌ t5027 struct
▌ STORE_LCL_VAR struct<System.ValueTuple`3, 16>(P) V25 tmp9
▌ ref field V25.Item3 (fldOffset=0x0) -> V275 tmp259 d:2
▌ int field V25.Item2 (fldOffset=0x8) -> V276 tmp260 d:1
▌ ubyte field V25.Item1 (fldOffset=0xc) -> V277 tmp261 d:1 $VN.Void
```
but that store to the promoted local with a LCL_VAR source is not legal.
Fix the problem by decomposing the store when necessary.
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue in the JIT's async transformation where multi-register async calls stored to independently promoted locals would produce illegal IR. The problem occurred when ReplaceWithLclVar created an intermediate store, resulting in a LCL_VAR source for a promoted local store, which is not supported.
Key Changes
- Added detection for multi-reg calls stored to independently promoted locals
- Implemented decomposition logic that creates field stores using
LCL_FLDnodes to access individual fields from the intermediate temporary - Removed the illegal promoted local store while keeping the intermediate store
|
cc @dotnet/jit-contrib PTAL @EgorBo |
In some cases the async transformation needs to introduce a new local to store the result of an async call to. If the previous store was a multi-reg call stored to an independently promoted local then we would produce illegal IR. For example, the IR
would be canonicalized into
but that store to the promoted local with a LCL_VAR source is not legal.
Fix the problem by decomposing the store when necessary.
Fixes #119432 (comment)