Skip to content
Merged
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
60 changes: 33 additions & 27 deletions src/coreclr/jit/liveness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ class Liveness
//
// * Outside SSA: Partial defs are _not_ full defs and are also not
// considered uses. They do not get included in bbVarUse/bbVarDef.
SsaLiveness = false,
ComputeMemoryLiveness = false,
IsLIR = false,
IsEarly = false,
EliminateDeadCode = false,
SsaLiveness = false,
ComputeMemoryLiveness = false,
IsLIR = false,
IsEarly = false,
EliminateDeadCode = false,
TrackAddressExposedLocals = false,
};

Liveness(Compiler* compiler)
Expand Down Expand Up @@ -446,7 +447,7 @@ void Liveness<TLiveness>::SelectTrackedLocals()
// Pinned variables may not be tracked (a condition of the GCInfo representation)
// or enregistered, on x86 -- it is believed that we can enregister pinned (more properly, "pinning")
// references when using the general GC encoding.
if (varDsc->IsAddressExposed())
if (!TLiveness::TrackAddressExposedLocals && varDsc->IsAddressExposed())
{
varDsc->lvTracked = 0;
assert(varDsc->lvType != TYP_STRUCT || varDsc->lvDoNotEnregister); // For structs, should have set this when
Expand Down Expand Up @@ -1044,7 +1045,8 @@ void Liveness<TLiveness>::MarkUseDef(GenTreeLclVarCommon* tree)
// We don't treat stores to tracked locals as modifications of ByrefExposed memory;
// Make sure no tracked local is addr-exposed, to make sure we don't incorrectly CSE byref
// loads aliasing it across a store to it.
Comment thread
jakobbotsch marked this conversation as resolved.
assert(!varDsc->IsAddressExposed());
assert(!varDsc->IsAddressExposed() ||
(TLiveness::TrackAddressExposedLocals && !TLiveness::ComputeMemoryLiveness));

if (TLiveness::IsLIR && (varDsc->lvType != TYP_STRUCT) && !varTypeIsMultiReg(varDsc))
{
Expand Down Expand Up @@ -2822,11 +2824,12 @@ void Compiler::fgSsaLiveness()
{
enum
{
SsaLiveness = true,
ComputeMemoryLiveness = true,
IsLIR = false,
IsEarly = false,
EliminateDeadCode = true,
SsaLiveness = true,
ComputeMemoryLiveness = true,
IsLIR = false,
IsEarly = false,
EliminateDeadCode = true,
TrackAddressExposedLocals = false,
};

SsaLivenessClass(Compiler* comp)
Expand All @@ -2848,11 +2851,12 @@ void Compiler::fgAsyncLiveness()
{
enum
{
SsaLiveness = false,
ComputeMemoryLiveness = false,
IsLIR = true,
IsEarly = false,
EliminateDeadCode = false,
SsaLiveness = false,
ComputeMemoryLiveness = false,
IsLIR = true,
IsEarly = false,
EliminateDeadCode = false,
TrackAddressExposedLocals = true,
};

AsyncLiveness(Compiler* comp)
Expand All @@ -2874,11 +2878,12 @@ void Compiler::fgPostLowerLiveness()
{
enum
{
SsaLiveness = false,
ComputeMemoryLiveness = false,
IsLIR = true,
IsEarly = false,
EliminateDeadCode = true,
SsaLiveness = false,
ComputeMemoryLiveness = false,
IsLIR = true,
IsEarly = false,
EliminateDeadCode = true,
TrackAddressExposedLocals = false,
};

PostLowerLiveness(Compiler* comp)
Expand Down Expand Up @@ -2918,11 +2923,12 @@ PhaseStatus Compiler::fgEarlyLiveness()
{
enum
{
SsaLiveness = false,
ComputeMemoryLiveness = false,
IsLIR = false,
IsEarly = true,
EliminateDeadCode = true,
SsaLiveness = false,
ComputeMemoryLiveness = false,
IsLIR = false,
IsEarly = true,
EliminateDeadCode = true,
TrackAddressExposedLocals = false,
};

EarlyLiveness(Compiler* comp)
Expand Down
Loading