未验证 提交 db5c4337 编写于 作者: S SingleAccretion 提交者: GitHub

Delete `GTF_VAR_CAST` (#74461)

It is unused.

Tighten an assert in the ref counter.
上级 161464e3
......@@ -9218,10 +9218,6 @@ void cTreeFlags(Compiler* comp, GenTree* tree)
{
chars += printf("[VAR_USEASG]");
}
if (tree->gtFlags & GTF_VAR_CAST)
{
chars += printf("[VAR_CAST]");
}
if (tree->gtFlags & GTF_VAR_ITERATOR)
{
chars += printf("[VAR_ITERATOR]");
......
......@@ -10442,12 +10442,6 @@ void Compiler::gtDispNode(GenTree* tree, IndentStack* indentStack, _In_ _In_opt_
--msgLength;
break;
}
if (tree->gtFlags & GTF_VAR_CAST)
{
printf("C");
--msgLength;
break;
}
if (tree->gtFlags & GTF_VAR_CONTEXT)
{
printf("!");
......
......@@ -468,11 +468,10 @@ enum GenTreeFlags : unsigned int
GTF_LIVENESS_MASK = GTF_VAR_DEF | GTF_VAR_USEASG | GTF_VAR_DEATH_MASK,
GTF_VAR_CAST = 0x01000000, // GT_LCL_VAR -- has been explicitly cast (variable node may not be type of local)
GTF_VAR_ITERATOR = 0x00800000, // GT_LCL_VAR -- this is a iterator reference in the loop condition
GTF_VAR_CLONED = 0x00400000, // GT_LCL_VAR -- this node has been cloned or is a clone
GTF_VAR_CONTEXT = 0x00200000, // GT_LCL_VAR -- this node is part of a runtime lookup
GTF_VAR_FOLDED_IND = 0x00100000, // GT_LCL_VAR -- this node was folded from *(typ*)&lclVar expression tree in fgMorphSmpOp()
GTF_VAR_ITERATOR = 0x01000000, // GT_LCL_VAR -- this is a iterator reference in the loop condition
GTF_VAR_CLONED = 0x00800000, // GT_LCL_VAR -- this node has been cloned or is a clone
GTF_VAR_CONTEXT = 0x00400000, // GT_LCL_VAR -- this node is part of a runtime lookup
GTF_VAR_FOLDED_IND = 0x00200000, // GT_LCL_VAR -- this node was folded from *(typ*)&lclVar expression tree in fgMorphSmpOp()
// where 'typ' is a small type and 'lclVar' corresponds to a normalized-on-store local variable.
// This flag identifies such nodes in order to make sure that fgDoNormalizeOnStore() is called
// on their parents in post-order morph.
......@@ -2313,20 +2312,18 @@ public:
bool IsReuseRegVal() const
{
// This can be extended to non-constant nodes, but not to local or indir nodes.
if (IsInvariant() && ((gtFlags & GTF_REUSE_REG_VAL) != 0))
{
return true;
}
return false;
return OperIsConst() && ((gtFlags & GTF_REUSE_REG_VAL) != 0);
}
void SetReuseRegVal()
{
assert(IsInvariant());
assert(OperIsConst());
gtFlags |= GTF_REUSE_REG_VAL;
}
void ResetReuseRegVal()
{
assert(IsInvariant());
assert(OperIsConst());
gtFlags &= ~GTF_REUSE_REG_VAL;
}
......
......@@ -4452,7 +4452,7 @@ void Compiler::lvaMarkLclRefs(GenTree* tree, BasicBlock* block, Statement* stmt,
#if FEATURE_PARTIAL_SIMD_CALLEE_SAVE
// TODO-CQ: If the varType needs partial callee save, conservatively do not enregister
// such variable. In future, need to enable enregisteration for such variables.
// such variable. In future, we should enable enregisteration for such variables.
if (!varTypeNeedsPartialCalleeSave(varDsc->GetRegisterType()))
#endif
{
......@@ -4463,48 +4463,11 @@ void Compiler::lvaMarkLclRefs(GenTree* tree, BasicBlock* block, Statement* stmt,
}
}
bool allowStructs = false;
#ifdef UNIX_AMD64_ABI
// On System V the type of the var could be a struct type.
allowStructs = varTypeIsStruct(varDsc);
#endif // UNIX_AMD64_ABI
/* Variables must be used as the same type throughout the method */
noway_assert(varDsc->lvType == TYP_UNDEF || tree->gtType == TYP_UNKNOWN || allowStructs ||
genActualType(varDsc->TypeGet()) == genActualType(tree->gtType) ||
(tree->gtType == TYP_BYREF && varDsc->TypeGet() == TYP_I_IMPL) ||
(tree->gtType == TYP_I_IMPL && varDsc->TypeGet() == TYP_BYREF) || (tree->gtFlags & GTF_VAR_CAST) ||
(varTypeIsFloating(varDsc) && varTypeIsFloating(tree)) ||
(varTypeIsStruct(varDsc) == varTypeIsStruct(tree)));
/* Remember the type of the reference */
if (tree->gtType == TYP_UNKNOWN || varDsc->lvType == TYP_UNDEF)
{
varDsc->lvType = tree->gtType;
noway_assert(genActualType(varDsc->TypeGet()) == tree->gtType); // no truncation
}
#ifdef DEBUG
if (tree->gtFlags & GTF_VAR_CAST)
{
// it should never be bigger than the variable slot
// Trees don't store the full information about structs
// so we can't check them.
if (tree->TypeGet() != TYP_STRUCT)
{
unsigned treeSize = genTypeSize(tree->TypeGet());
unsigned varSize = genTypeSize(varDsc->TypeGet());
if (varDsc->TypeGet() == TYP_STRUCT)
{
varSize = varDsc->lvSize();
}
assert(treeSize <= varSize);
}
}
#endif
// Check that the LCL_VAR node has the same type as the underlying variable, save a few mismatches we allow.
assert(tree->TypeIs(varDsc->TypeGet(), genActualType(varDsc)) ||
(tree->TypeIs(TYP_I_IMPL) && (varDsc->TypeGet() == TYP_BYREF)) || // Created for spill clique import.
(tree->TypeIs(TYP_BYREF) && (varDsc->TypeGet() == TYP_I_IMPL)) || // Created by inliner substitution.
(tree->TypeIs(TYP_INT) && (varDsc->TypeGet() == TYP_LONG))); // Created by "optNarrowTree".
}
}
......
......@@ -4548,8 +4548,8 @@ GenTree* Compiler::fgMorphIndexAddr(GenTreeIndexAddr* indexAddr)
{
unsigned arrRefTmpNum = lvaGrabTemp(true DEBUGARG("arr expr"));
arrRefDefn = gtNewTempAssign(arrRefTmpNum, arrRef);
arrRef = gtNewLclvNode(arrRefTmpNum, arrRef->TypeGet());
arrRef2 = gtNewLclvNode(arrRefTmpNum, arrRef->TypeGet());
arrRef = gtNewLclvNode(arrRefTmpNum, lvaGetDesc(arrRefTmpNum)->TypeGet());
arrRef2 = gtNewLclvNode(arrRefTmpNum, lvaGetDesc(arrRefTmpNum)->TypeGet());
}
else
{
......@@ -4563,8 +4563,8 @@ GenTree* Compiler::fgMorphIndexAddr(GenTreeIndexAddr* indexAddr)
{
unsigned indexTmpNum = lvaGrabTemp(true DEBUGARG("index expr"));
indexDefn = gtNewTempAssign(indexTmpNum, index);
index = gtNewLclvNode(indexTmpNum, index->TypeGet());
index2 = gtNewLclvNode(indexTmpNum, index->TypeGet());
index = gtNewLclvNode(indexTmpNum, lvaGetDesc(indexTmpNum)->TypeGet());
index2 = gtNewLclvNode(indexTmpNum, lvaGetDesc(indexTmpNum)->TypeGet());
}
else
{
......@@ -17285,7 +17285,7 @@ bool Compiler::fgMorphArrayOpsStmt(MorphMDArrayTempCache* pTempCache, BasicBlock
// Side-effect; create a temp.
// unsigned newIdxLcl = m_compiler->lvaGrabTemp(true DEBUGARG("MD array index copy"));
unsigned newIdxLcl = m_pTempCache->GrabTemp(idx->TypeGet());
GenTree* newIdx = m_compiler->gtNewLclvNode(newIdxLcl, idx->TypeGet());
GenTree* newIdx = m_compiler->gtNewLclvNode(newIdxLcl, genActualType(idx));
idxToUse[i] = newIdx;
idxToCopy[i] = newIdxLcl;
anyIdxWithSideEffects = true;
......
......@@ -1432,7 +1432,6 @@ GenTree* MorphCopyBlockHelper::CopyFieldByField()
(m_srcVarDsc->lvType == TYP_STRUCT) ? m_srcVarDsc->lvExactSize : genTypeSize(m_srcVarDsc);
if (destSize == srcSize)
{
m_srcLclNode->gtFlags |= GTF_VAR_CAST;
m_srcLclNode->ChangeOper(GT_LCL_FLD);
m_srcLclNode->gtType = destType;
m_comp->lvaSetVarDoNotEnregister(m_srcLclNum DEBUGARG(DoNotEnregisterReason::LocalField));
......
......@@ -5850,12 +5850,6 @@ bool Compiler::optNarrowTree(GenTree* tree, var_types srct, var_types dstt, Valu
tree->gtType = dstt;
tree->SetVNs(vnpNarrow);
/* Make sure we don't mess up the variable type */
if ((oper == GT_LCL_VAR) || (oper == GT_LCL_FLD))
{
tree->gtFlags |= GTF_VAR_CAST;
}
}
return true;
......
......@@ -8512,7 +8512,8 @@ void Compiler::fgValueNumberTree(GenTree* tree)
}
else
{
assert((varDsc->TypeGet() == TYP_I_IMPL) && lcl->TypeIs(TYP_BYREF));
assert(((varDsc->TypeGet() == TYP_I_IMPL) && lcl->TypeIs(TYP_BYREF)) ||
((varDsc->TypeGet() == TYP_BYREF) && lcl->TypeIs(TYP_I_IMPL)));
lcl->gtVNPair = wholeLclVarVNP;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册