From 2d44ad66203707398bd6a33cd2c676c07763419c Mon Sep 17 00:00:00 2001 From: Carol Eidt Date: Thu, 5 Apr 2018 14:35:13 -0700 Subject: Remove fgMorphLocalField invalid assert --- src/jit/morph.cpp | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp index 22d6b619d5..0df36c953c 100644 --- a/src/jit/morph.cpp +++ b/src/jit/morph.cpp @@ -18410,31 +18410,29 @@ Compiler::fgWalkResult Compiler::fgMorphLocalField(GenTree* tree, fgWalkData* fg #endif ) { - // There is an existing sub-field we can use + // There is an existing sub-field we can use. tree->gtLclFld.SetLclNum(fieldLclIndex); - // We need to keep the types 'compatible'. If we can switch back to a GT_LCL_VAR - CLANG_FORMAT_COMMENT_ANCHOR; - -#ifdef _TARGET_ARM_ - assert(varTypeIsIntegralOrI(tree->TypeGet()) || varTypeIsFloating(tree->TypeGet())); -#else - assert(varTypeIsIntegralOrI(tree->TypeGet())); -#endif - if (varTypeCanReg(fldVarDsc->TypeGet())) - { - // If the type is integer-ish, then we can use it as-is - tree->ChangeOper(GT_LCL_VAR); - assert(tree->gtLclVarCommon.gtLclNum == fieldLclIndex); - tree->gtType = fldVarDsc->TypeGet(); + // The field must be an enregisterable type; otherwise it would not be a promoted field. + // The tree type may not match, e.g. for return types that have been morphed, but both + // must be enregisterable types. + // TODO-Cleanup: varTypeCanReg should presumably return true for SIMD types, but + // there may be places where that would violate existing assumptions. + var_types treeType = tree->TypeGet(); + var_types fieldType = fldVarDsc->TypeGet(); + assert((varTypeCanReg(treeType) || varTypeIsSIMD(treeType)) && + (varTypeCanReg(fieldType) || varTypeIsSIMD(fieldType))); + + tree->ChangeOper(GT_LCL_VAR); + assert(tree->gtLclVarCommon.gtLclNum == fieldLclIndex); + tree->gtType = fldVarDsc->TypeGet(); #ifdef DEBUG - if (verbose) - { - printf("Replacing the GT_LCL_FLD in promoted struct with a local var:\n"); - fgWalkPre->printModified = true; - } -#endif // DEBUG + if (verbose) + { + printf("Replacing the GT_LCL_FLD in promoted struct with a local var:\n"); + fgWalkPre->printModified = true; } +#endif // DEBUG GenTree* parent = fgWalkPre->parentStack->Index(1); if ((parent->gtOper == GT_ASG) && (parent->gtOp.gtOp1 == tree)) -- cgit v1.2.3