Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly type primary selectors in fgMemoryVNForLoopSideEffects #60505

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -7977,6 +7977,9 @@ class Compiler

bool eeIsValueClass(CORINFO_CLASS_HANDLE clsHnd);
bool eeIsJitIntrinsic(CORINFO_METHOD_HANDLE ftn);
bool eeIsFieldStatic(CORINFO_FIELD_HANDLE fldHnd);

var_types eeGetFieldType(CORINFO_FIELD_HANDLE fldHnd);

#if defined(DEBUG) || defined(FEATURE_JIT_METHOD_PERF) || defined(FEATURE_SIMD) || defined(TRACK_LSRA_STATS)

Expand Down
12 changes: 12 additions & 0 deletions src/coreclr/jit/ee_il_dll.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ bool Compiler::eeIsJitIntrinsic(CORINFO_METHOD_HANDLE ftn)
return info.compCompHnd->isJitIntrinsic(ftn);
}

FORCEINLINE
bool Compiler::eeIsFieldStatic(CORINFO_FIELD_HANDLE fldHnd)
{
return info.compCompHnd->isFieldStatic(fldHnd);
}

FORCEINLINE
var_types Compiler::eeGetFieldType(CORINFO_FIELD_HANDLE fldHnd)
{
return JITtype2varType(info.compCompHnd->getFieldType(fldHnd));
}

FORCEINLINE
void Compiler::eeGetSig(unsigned sigTok,
CORINFO_MODULE_HANDLE scope,
Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6798,8 +6798,12 @@ ValueNum Compiler::fgMemoryVNForLoopSideEffects(MemoryKind memoryKind,
}
#endif // DEBUG

// Instance field maps get the placeholder TYP_REF - they do not represent "singular"
// values. Static field maps, on the other hand, do, and so must be given proper types.
var_types fldMapType = eeIsFieldStatic(fldHnd) ? eeGetFieldType(fldHnd) : TYP_REF;

newMemoryVN =
vnStore->VNForMapStore(TYP_REF, newMemoryVN, fldHndVN, vnStore->VNForExpr(entryBlock, TYP_REF));
vnStore->VNForMapStore(TYP_REF, newMemoryVN, fldHndVN, vnStore->VNForExpr(entryBlock, fldMapType));
}
}
// Now do the array maps.
Expand Down