Jit: Remove bounds checks with tests against length. (#40180)
authornathan-moore <nathanmoore424@gmail.com>
Tue, 6 Oct 2020 20:36:08 +0000 (16:36 -0400)
committerGitHub <noreply@github.com>
Tue, 6 Oct 2020 20:36:08 +0000 (13:36 -0700)
commit30e643e2f2433055d6ed433af38a925ee657d4ad
tree9fdb6ea1710e304ce945a8c28fee3ccbcf77de03
parentd1c0fa82435ec5774f038dd7f33dfada1f1083b9
Jit: Remove bounds checks with tests against length. (#40180)

* Introduce a concept of minimum array length into range check

* Some cleanup

* fix potential underflow

* bug fix and cleanup

* Revert string changes

* Allow elimination of arr[0] with  len != 0 test

* Revert "Revert string changes"

This reverts commit 6f77bf8c8acce1f5382bb704875384c6f8e2f984.

* Fix up tests

* reverting lower bound merging as it may be unsound

* Fix CI exposed bug and add a couple of test cases

* code review feedback

* comment nit

* feedback

* Add missing break
src/coreclr/src/jit/assertionprop.cpp
src/coreclr/src/jit/compiler.h
src/coreclr/src/jit/rangecheck.cpp
src/coreclr/src/jit/rangecheck.h
src/libraries/System.Private.CoreLib/src/System/String.cs
src/tests/JIT/opt/AssertionPropagation/ArrBoundMinLength.cs [new file with mode: 0644]
src/tests/JIT/opt/AssertionPropagation/ArrBoundMinLength.csproj [new file with mode: 0644]