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))) {