From 049490114656e675739cd17a9bb6a49697d447e5 Mon Sep 17 00:00:00 2001 From: Brian Sullivan Date: Wed, 5 Dec 2018 17:46:49 -0800 Subject: [PATCH] Added NullChk exceptions for GT_ARR_LENTH, GT_ARR_ELEM and GT_ARR_OFFSET Commit migrated from https://github.com/dotnet/coreclr/commit/425f8428461bb4770bbec56d3bbb13e0a6c0adf6 --- src/coreclr/src/jit/valuenum.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/coreclr/src/jit/valuenum.cpp b/src/coreclr/src/jit/valuenum.cpp index 7e7a681..a59e918 100644 --- a/src/coreclr/src/jit/valuenum.cpp +++ b/src/coreclr/src/jit/valuenum.cpp @@ -9622,16 +9622,31 @@ void Compiler::fgValueNumberAddExceptionSet(GenTree* tree) // Don't add exception set on LHS of assignment break; } - // fall through + __fallthrough; case GT_BLK: case GT_OBJ: case GT_DYN_BLK: - case GT_ARR_LENGTH: // Implicit null check. - case GT_NULLCHECK: // Explicit null check. + case GT_NULLCHECK: fgValueNumberAddExceptionSetForIndirection(tree, tree->AsIndir()->Addr()); break; + case GT_ARR_LENGTH: + fgValueNumberAddExceptionSetForIndirection(tree, tree->AsArrLen()->ArrRef()); + break; + + case GT_ARR_ELEM: + fgValueNumberAddExceptionSetForIndirection(tree, tree->gtArrElem.gtArrObj); + break; + + case GT_ARR_INDEX: + fgValueNumberAddExceptionSetForIndirection(tree, tree->gtArrIndex.ArrObj()); + break; + + case GT_ARR_OFFSET: + fgValueNumberAddExceptionSetForIndirection(tree, tree->gtArrOffs.gtArrObj); + break; + case GT_DIV: case GT_UDIV: case GT_MOD: -- 2.7.4