diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2022-09-09 01:56:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-09 01:56:37 +0300 |
commit | 22dc69137cfc948d6affdc6e90048b81172d9768 (patch) | |
tree | bdebb1392d48630a33c851af4b878054f28ac44b /src | |
parent | 3db9d172401246b9a0e574fa8b3edb8f954f27bf (diff) |
JIT: Fix unrecognized unaligned field indirections on ARM32 (#75250)
For large field offsets we need to insert explicit null checks. This was
breaking recognition of unaligned accesses that needs special treatment
for floating point instructions.
Fix #74260
Co-authored-by: Jakob Botsch Nielsen <jakob.botsch.nielsen@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/coreclr/jit/morph.cpp | 7 | ||||
-rw-r--r-- | src/tests/JIT/Regression/JitBlue/Runtime_34170/Runtime_34170.cs | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index fff00343e88..dcf1fd4c619 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -11198,13 +11198,14 @@ DONE_MORPHING_CHILDREN: temp = nullptr; } } - else if (op1->OperGet() == GT_ADD) + else { #ifdef TARGET_ARM + GenTree* effOp1 = op1->gtEffectiveVal(true); // Check for a misalignment floating point indirection. - if (varTypeIsFloating(typ)) + if (effOp1->OperIs(GT_ADD) && varTypeIsFloating(typ)) { - GenTree* addOp2 = op1->AsOp()->gtGetOp2(); + GenTree* addOp2 = effOp1->gtGetOp2(); if (addOp2->IsCnsIntOrI()) { ssize_t offset = addOp2->AsIntCon()->gtIconVal; diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_34170/Runtime_34170.cs b/src/tests/JIT/Regression/JitBlue/Runtime_34170/Runtime_34170.cs index 19fd90aff05..622bbc1d04f 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_34170/Runtime_34170.cs +++ b/src/tests/JIT/Regression/JitBlue/Runtime_34170/Runtime_34170.cs @@ -21,7 +21,7 @@ internal struct FloatNonAlignedFieldWithSmallOffset [StructLayout(LayoutKind.Explicit)] internal struct FloatNonAlignedFieldWithLargeOffset { - [FieldOffset(1021)] + [FieldOffset(0x10001)] public float field; public FloatNonAlignedFieldWithLargeOffset(float a) @@ -45,7 +45,7 @@ internal struct DoubleNonAlignedFieldWithSmallOffset [StructLayout(LayoutKind.Explicit)] internal struct DoubleNonAlignedFieldWithLargeOffset { - [FieldOffset(1021)] + [FieldOffset(0x10001)] public double field; public DoubleNonAlignedFieldWithLargeOffset(float a) |