Skip to content

Commit

Permalink
Remove fgMorphLocalField invalid assert
Browse files Browse the repository at this point in the history
  • Loading branch information
CarolEidt committed Apr 5, 2018
1 parent 22b2d86 commit 2d44ad6
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions src/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 2d44ad6

Please sign in to comment.