From dd6696a29c77c3256d35ef25970fba7c09440aca Mon Sep 17 00:00:00 2001 From: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com> Date: Tue, 4 Oct 2022 20:04:44 +0300 Subject: [PATCH] Do not produce full-width local field stores for normalize-on-store locals (#76549) The underlying stack location must always remain normalized. --- src/coreclr/jit/lclmorph.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/coreclr/jit/lclmorph.cpp b/src/coreclr/jit/lclmorph.cpp index 4480a46027774..1c283981a2c7c 100644 --- a/src/coreclr/jit/lclmorph.cpp +++ b/src/coreclr/jit/lclmorph.cpp @@ -1012,14 +1012,6 @@ class LocalAddressVisitor final : public GenTreeVisitor return IndirTransform::LclVar; } - // Locals are not enregistered when optimizations are disabled; there is no point - // in spending time finding LCL_VAR-equivalent trees for them. TODO-ADDR: move - // this check earlier. - if (m_compiler->opts.OptimizationDisabled()) - { - return IndirTransform::LclFld; - } - // Bool and ubyte are the same type. if ((indir->TypeIs(TYP_BOOL) && (varDsc->TypeGet() == TYP_UBYTE)) || (indir->TypeIs(TYP_UBYTE) && (varDsc->TypeGet() == TYP_BOOL))) @@ -1035,6 +1027,11 @@ class LocalAddressVisitor final : public GenTreeVisitor return IndirTransform::LclVar; } + if (m_compiler->opts.OptimizationDisabled()) + { + return IndirTransform::LclFld; + } + // Turn this into a bitcast if we can. if ((genTypeSize(indir) == genTypeSize(varDsc)) && (varTypeIsFloating(indir) || varTypeIsFloating(varDsc))) {