diff options
author | Andy Ayers <andya@microsoft.com> | 2018-03-19 17:28:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-19 17:28:51 -0700 |
commit | 58f8744af4fb3494ca8cc305c2d1a0eb3fb9d35a (patch) | |
tree | 3de2aa13f58f3bce63b7bbe51122ec5cfbcaeab5 /src/jit/compiler.hpp | |
parent | 20f7c219e79f55ab8062282c6cb1d89310f365ea (diff) | |
download | coreclr-58f8744af4fb3494ca8cc305c2d1a0eb3fb9d35a.tar.gz coreclr-58f8744af4fb3494ca8cc305c2d1a0eb3fb9d35a.tar.bz2 coreclr-58f8744af4fb3494ca8cc305c2d1a0eb3fb9d35a.zip |
JIT: tolerate nonzero constant byrefs in impCheckForNullPointer (#17042)
With the advent of #16966 we may now see constant nonzero byrefs from
things like RVA statics. Tolerate these in `impCheckForNullPointer`.
Note previously we'd type these as ints/longs and so bail out of
`impCheckForNullPointer` after the first check.
Closes #17008.
Diffstat (limited to 'src/jit/compiler.hpp')
-rw-r--r-- | src/jit/compiler.hpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp index 2a6fd86153..93db46bfef 100644 --- a/src/jit/compiler.hpp +++ b/src/jit/compiler.hpp @@ -4355,7 +4355,13 @@ inline GenTree* Compiler::impCheckForNullPointer(GenTree* obj) if (obj->gtOper == GT_CNS_INT) { assert(obj->gtType == TYP_REF || obj->gtType == TYP_BYREF); - assert(obj->gtIntCon.gtIconVal == 0); + + // We can see non-zero byrefs for RVA statics. + if (obj->gtIntCon.gtIconVal != 0) + { + assert(obj->gtType == TYP_BYREF); + return obj; + } unsigned tmp = lvaGrabTemp(true DEBUGARG("CheckForNullPointer")); |