From 50674345708fcb22e0ff003f3fab22478f0aa6e1 Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Fri, 5 Jun 2026 06:50:14 -0700 Subject: [PATCH] JIT test: remove SimdLoadBetweenBCs from ElidedBoundsChecks Exception behavior of Vector128.Create from contiguous array indices changed in #128965 (no longer recognized as a single SIMD load with ArgumentOutOfRangeException). Fixes #129037. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../JIT/opt/RangeChecks/ElidedBoundsChecks.cs | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/src/tests/JIT/opt/RangeChecks/ElidedBoundsChecks.cs b/src/tests/JIT/opt/RangeChecks/ElidedBoundsChecks.cs index 23d32a2f7304cb..1674adfff96da8 100644 --- a/src/tests/JIT/opt/RangeChecks/ElidedBoundsChecks.cs +++ b/src/tests/JIT/opt/RangeChecks/ElidedBoundsChecks.cs @@ -205,20 +205,6 @@ static int TwoArrays(int[] a, int[] b) return a[0] + b[0] + a[3] + b[1]; } - [MethodImpl(MethodImplOptions.NoInlining)] - static float SimdLoadBetweenBCs(float[] a) - { - // The contiguous Vector128.Create from a[1..4] is lowered to a single - // SIMD load whose bounds check throws ArgumentOutOfRangeException, not - // IndexOutOfRangeException. It must act as a barrier: if a[0]'s check - // were strengthened to a[7] across it, a too-short array would observe - // IndexOutOfRangeException instead of the ArgumentOutOfRangeException - // the SIMD load is required to throw first. - float x = a[0]; - Vector128 v = Vector128.Create(a[1], a[2], a[3], a[4]); - return x + v.ToScalar() + a[7]; - } - [MethodImpl(MethodImplOptions.NoInlining)] static int UnsignedShiftBySignBit(int i) { @@ -350,20 +336,6 @@ public static int TestEntryPoint() if (UnsignedShiftBySignBit(-1) != 1 || UnsignedShiftBySignBit(0) != 0) return 0; - // A SIMD load with a non-IOOB bounds check (ArgumentOutOfRangeException) - // between two array checks must act as a barrier: a[0]'s check must not - // be strengthened across it, otherwise a short array would observe - // IndexOutOfRangeException instead of ArgumentOutOfRangeException. - // The contiguous Vector128.Create -> single SIMD load recognition and the - // bounds-check coalescing being validated here are RyuJIT-specific, so - // only assert the exact exception type on CoreCLR. - if (!TestLibrary.Utilities.IsMonoRuntime && Vector128.IsHardwareAccelerated) - { - if (SimdLoadBetweenBCs(new float[8]) != 0f) - return 0; - Assert.Throws(() => SimdLoadBetweenBCs(new float[1])); - } - return 100; } }