@@ -16061,10 +16061,11 @@ bool GenTreeIntConCommon::AddrNeedsReloc(Compiler* comp)
16061
16061
//------------------------------------------------------------------------
16062
16062
// IsFieldAddr: Is "this" a static or class field address?
16063
16063
//
16064
- // Recognizes the following three patterns:
16065
- // this: [Zero FldSeq]
16066
- // this: ADD(baseAddr, CONST FldSeq)
16067
- // this: ADD(CONST FldSeq, baseAddr)
16064
+ // Recognizes the following patterns:
16065
+ // this: ADD(baseAddr, CONST [FldSeq])
16066
+ // this: ADD(CONST [FldSeq], baseAddr)
16067
+ // this: CONST [FldSeq]
16068
+ // this: Zero [FldSeq]
16068
16069
//
16069
16070
// Arguments:
16070
16071
// comp - the Compiler object
@@ -16089,7 +16090,7 @@ bool GenTree::IsFieldAddr(Compiler* comp, GenTree** pBaseAddr, FieldSeqNode** pF
16089
16090
*pFldSeq = FieldSeqStore::NotAField();
16090
16091
16091
16092
GenTree* baseAddr = nullptr;
16092
- FieldSeqNode* fldSeq = nullptr ;
16093
+ FieldSeqNode* fldSeq = FieldSeqStore::NotAField() ;
16093
16094
16094
16095
if (OperIs(GT_ADD))
16095
16096
{
@@ -16113,26 +16114,28 @@ bool GenTree::IsFieldAddr(Compiler* comp, GenTree** pBaseAddr, FieldSeqNode** pF
16113
16114
assert(!baseAddr->TypeIs(TYP_REF) || !comp->GetZeroOffsetFieldMap()->Lookup(baseAddr));
16114
16115
}
16115
16116
}
16117
+ else if (IsCnsIntOrI() && IsIconHandle(GTF_ICON_STATIC_HDL))
16118
+ {
16119
+ assert(!comp->GetZeroOffsetFieldMap()->Lookup(this) && (AsIntCon()->gtFieldSeq != nullptr));
16120
+ fldSeq = AsIntCon()->gtFieldSeq;
16121
+ baseAddr = nullptr;
16122
+ }
16116
16123
else if (comp->GetZeroOffsetFieldMap()->Lookup(this, &fldSeq))
16117
16124
{
16118
16125
baseAddr = this;
16119
16126
}
16120
16127
else
16121
16128
{
16122
- // TODO-VNTypes-CQ: recognize the simple GTF_ICON_STATIC_HDL case here. It
16123
- // is not recognized right now to preserve previous behavior of this method.
16124
16129
return false;
16125
16130
}
16126
16131
16127
- // If we don't have a valid sequence, bail. Note that above we have overloaded an empty
16128
- // ("nullptr") sequence as "NotAField", as that's the way it is treated on tree nodes.
16129
- if ((fldSeq == nullptr) || (fldSeq == FieldSeqStore::NotAField()) || fldSeq->IsPseudoField())
16132
+ assert(fldSeq != nullptr);
16133
+
16134
+ if ((fldSeq == FieldSeqStore::NotAField()) || fldSeq->IsPseudoField())
16130
16135
{
16131
16136
return false;
16132
16137
}
16133
16138
16134
- assert(baseAddr != nullptr);
16135
-
16136
16139
// The above screens out obviously invalid cases, but we have more checks to perform. The
16137
16140
// sequence returned from this method *must* start with either a class (NOT struct) field
16138
16141
// or a static field. To avoid the expense of calling "getFieldClass" here, we will instead
0 commit comments