Commit 5b921e2
authored
JIT: Model GetFfr* with a special side effect and handle it in VN (#105973)
- Add `HW_Flag_SpecialSideEffect_Other` to GetFfr* HW intrinsics. These intrinsics essentially read memory from memory that we do not model, so we have to treat them conservatively.
- Add `GTF_CALL` and `GTF_GLOB_REF` to `GetFfr*` HW intrinsics. We have to give these a conservative set of a flag to disallow the rest of the JIT from potentially reordering them with `SetFfr`.
- Teach VN to give all HW intrinsics with any special side effect a unique VN
Fix #105944
In the test case head-merging reorders a `SetFfr` with a `GetFfr` since `GetFfr` is not given appropriately conservative side effect flags:
```
*************** Starting PHASE Head and tail merge
Both succs of BB01 start with the same tree
STMT00006 ( 0x02F[E-] ... 0x03C )
[000039] --C-G------ * HWINTRINSIC void ubyte SetFfr
[000037] ----------- \--* HWINTRINSIC mask ubyte CreateTrueMaskByte
[000036] ----------- \--* CNS_INT int 31
Checking if we can move it into the predecessor...
We can; moving statement
unlinking STMT00006 ( 0x02F[E-] ... 0x03C )
[000039] --C-G------ * HWINTRINSIC void ubyte SetFfr
[000037] ----------- \--* HWINTRINSIC mask ubyte CreateTrueMaskByte
[000036] ----------- \--* CNS_INT int 31
from BB02
unlinking STMT00004 ( 0x03D[E-] ... 0x04A )
[000031] --C-G------ * HWINTRINSIC void ubyte SetFfr
[000029] ----------- \--* HWINTRINSIC mask ubyte CreateTrueMaskByte
[000028] ----------- \--* CNS_INT int 31
from BB03
Did 1 head merges in BB01
...
------------ BB01 [0000] [000..02F) -> BB03(0.5),BB02(0.5) (cond), preds={} succs={BB02,BB03}
***** BB01 [0000]
STMT00000 ( 0x000[E-] ... 0x01B )
[000003] --C-G------ * HWINTRINSIC void ubyte SetFfr
[000001] ----------- \--* HWINTRINSIC mask ubyte CreateTrueMaskByte
[000000] ----------- \--* CNS_INT int 31
***** BB01 [0000]
STMT00001 ( 0x00C[E-] ... ??? )
[000016] DA-XG------ * STORE_LCL_VAR simd16 V02 tmp1
[000013] ---XG------ \--* HWINTRINSIC simd16 ubyte LoadVectorFirstFaulting
[000015] ----------- +--* HWINTRINSIC mask ubyte ConvertVectorToMask
[000014] ----------- | +--* HWINTRINSIC mask ubyte CreateTrueMaskAll
[000008] ----------- | \--* HWINTRINSIC simd16 ubyte ConvertMaskToVector
[000007] ----------- | \--* HWINTRINSIC mask ubyte CreateTrueMaskByte
[000006] ----------- | \--* CNS_INT int 31
[000012] ----------- \--* ADD long
[000009] ----------- +--* LCL_VAR long V00 arg0
[000011] ----------- \--* CAST long <- int
[000010] ----------- \--* CNS_INT int 1
***** BB01 [0000]
STMT00002 ( ??? ... ??? )
[000018] ----------- * NOP void
***** BB01 [0000]
STMT00006 ( 0x02F[E-] ... 0x03C )
[000039] --C-G------ * HWINTRINSIC void ubyte SetFfr ; head-merging moved this from the then/else blocks
[000037] ----------- \--* HWINTRINSIC mask ubyte CreateTrueMaskByte
[000036] ----------- \--* CNS_INT int 31
***** BB01 [0000]
STMT00003 ( 0x01C[E-] ... 0x02D )
[000027] ----------- * JTRUE void
[000026] ----------- \--* EQ int
[000024] ----------- +--* HWINTRINSIC int ubyte op_Equality
[000020] ----------- | +--* HWINTRINSIC simd16 ubyte ConvertMaskToVector
[000019] ----------- | | \--* HWINTRINSIC mask ubyte GetFfrByte
[000023] ----------- | \--* HWINTRINSIC simd16 ubyte ConvertMaskToVector
[000022] ----------- | \--* HWINTRINSIC mask ubyte CreateTrueMaskByte
[000021] ----------- | \--* CNS_INT int 31
[000025] ----------- \--* CNS_INT int 0
```1 parent bcca12c commit 5b921e2
File tree
6 files changed
+98
-12
lines changed- src
- coreclr/jit
- tests/JIT/Regression/JitBlue/Runtime_105944
6 files changed
+98
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3436 | 3436 | | |
3437 | 3437 | | |
3438 | 3438 | | |
| 3439 | + | |
| 3440 | + | |
| 3441 | + | |
| 3442 | + | |
| 3443 | + | |
| 3444 | + | |
| 3445 | + | |
| 3446 | + | |
3439 | 3447 | | |
3440 | 3448 | | |
3441 | 3449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27268 | 27268 | | |
27269 | 27269 | | |
27270 | 27270 | | |
| 27271 | + | |
| 27272 | + | |
| 27273 | + | |
| 27274 | + | |
| 27275 | + | |
| 27276 | + | |
| 27277 | + | |
| 27278 | + | |
27271 | 27279 | | |
27272 | 27280 | | |
27273 | 27281 | | |
| |||
27459 | 27467 | | |
27460 | 27468 | | |
27461 | 27469 | | |
| 27470 | + | |
| 27471 | + | |
| 27472 | + | |
| 27473 | + | |
| 27474 | + | |
| 27475 | + | |
| 27476 | + | |
| 27477 | + | |
27462 | 27478 | | |
27463 | 27479 | | |
27464 | 27480 | | |
| |||
0 commit comments