diff options
Diffstat (limited to 'src/jit/gentree.cpp')
-rw-r--r-- | src/jit/gentree.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp index e0b13a43ad..49b6bb32ea 100644 --- a/src/jit/gentree.cpp +++ b/src/jit/gentree.cpp @@ -15718,19 +15718,23 @@ bool GenTree::IsFieldAddr(Compiler* comp, GenTreePtr* pObj, GenTreePtr* pStatic, baseAddr = gtOp.gtOp1; } } + // Check if "this" has a zero-offset annotation. + else if (comp->GetZeroOffsetFieldMap()->Lookup(this, &newFldSeq)) + { + baseAddr = this; + mustBeStatic = true; + } + else if (OperGet() == GT_CNS_INT && gtIntCon.gtFieldSeq != nullptr) + { + // Address is a literal constant; must be a static field. + newFldSeq = gtIntCon.gtFieldSeq; + baseAddr = this; + mustBeStatic = true; + } else { - // Check if "this" has a zero-offset annotation. - if (!comp->GetZeroOffsetFieldMap()->Lookup(this, &newFldSeq)) - { - // If not, this is not a field address. - return false; - } - else - { - baseAddr = this; - mustBeStatic = true; - } + // This is not a field address. + return false; } // If not we don't have a field seq, it's not a field address. |