diff options
author | Brian Sullivan <briansul@microsoft.com> | 2019-05-07 17:46:29 -0700 |
---|---|---|
committer | Brian Sullivan <briansul@microsoft.com> | 2019-05-08 12:58:49 -0700 |
commit | d3120b8c1b0fac8ef24929a9fb8cede7eca2e914 (patch) | |
tree | 46ab271cf55fc14b56686feb470eb7ab27638071 /src/jit | |
parent | b7836c0b6e59f4e6bd6af984569f4ce8b3573f4e (diff) | |
download | coreclr-d3120b8c1b0fac8ef24929a9fb8cede7eca2e914.tar.gz coreclr-d3120b8c1b0fac8ef24929a9fb8cede7eca2e914.tar.bz2 coreclr-d3120b8c1b0fac8ef24929a9fb8cede7eca2e914.zip |
Fix Issue 24440
gtGetStructHandleIfPresent can return nullptr (NO_CLASS_HANDLE)
Diffstat (limited to 'src/jit')
-rw-r--r-- | src/jit/optcse.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/jit/optcse.cpp b/src/jit/optcse.cpp index a25e17c4fa..ddf22a79ae 100644 --- a/src/jit/optcse.cpp +++ b/src/jit/optcse.cpp @@ -1753,7 +1753,12 @@ public: canEnregister = false; GenTree* value = candidate->Expr(); CORINFO_CLASS_HANDLE structHnd = m_pCompiler->gtGetStructHandleIfPresent(candidate->Expr()); - assert((structHnd != NO_CLASS_HANDLE) || (cseLclVarTyp != TYP_STRUCT)); + if (structHnd == NO_CLASS_HANDLE) + { + JITDUMP("Can't determine the struct size, so we can't consider it for CSE promotion\n"); + return false; // Do not make this a CSE + } + unsigned size = m_pCompiler->info.compCompHnd->getClassSize(structHnd); // Note that the slotCount is used to estimate the reference cost, but it may overestimate this // because it doesn't take into account that we might use a vector register for struct copies. |