Repository navigation
[Wasm RyuJIT] initblk fix for #125756 - #125836
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
This PR tightens CoreCLR JIT’s identification of initblk-style GT_STORE_BLK nodes so that they’re recognized as init blocks only when the source is both an int-typed value and has init-value semantics (i.e., IsInitVal() after skipping reload/copy wrappers). This aligns OperIsInitBlkOp() with the intended IR invariant and prevents incorrect lowering/codegen choices (notably for WASM where initblk vs copyblk maps to different native opcodes).
Changes:
- Update
GenTree::OperIsInitBlkOp()to requireIsInitVal()(aftergtSkipReloadOrCopy()) in addition toTYP_INT. - Remove the previous DEBUG assert-by-equivalence in favor of a direct semantic check.
|
TP impact seems near-zero if I'm reading the diffs correctly. |
|
Did you look at why wasm produces the mistyped IR? This assert seems to imply that the mistyped IR is only expected for constant initialization. It seems wrong to be removing that invariant. |
|
I don't think the IR is mistyped. The RHS of the block store is a function call returning a struct, and the struct is int-sized so the JIT turns it into TYP_INT. |
Shouldn't this be kicking in to end up with a runtime/src/coreclr/jit/lower.cpp Line 6270 in 9ddca1d What happens for other backends? |
I suspect this is the case of a struct enregistered as a whole. Where we leave the For such a case, there is a structural ambiguity in the IR if the value is Logically it should be a copy block since that's what we support in codegen. But they're also semantically equivalent. After this change, we will consider them init blocks. It probably doesn't matter too much. |
|
@kg which assert in #125756 (comment) does this fix, or does it fix both of them? |
|
@AndyAyersMS (1) Assertion failed 'isInitBlk == src->gtSkipReloadOrCopy()->IsInitVal()' i think |
|
It would still be good to understand why other backends do not hit this. |
|
Do you want me to back it out? |
No, the change seems innocent enough. I am just wondering what makes other backends different in their handling and if wasm is different for a good reason or not. |
I think the only difference is that we happen to not call |
Considering the |
Nowadays it would be more accurate to rename these to Edit: if memory serves me right, before struct-typed- |
I'm guessing this will be a TP regression but I'm not sure how much. The existing code looks blatantly wrong.