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

JIT: Always consider empty remainders to be dying in physical promotion #88665

Merged
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
6 changes: 3 additions & 3 deletions src/coreclr/jit/promotion.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ class Promotion
// Class to represent liveness information for a struct local's fields and remainder.
class StructDeaths
{
BitVec m_deaths;
unsigned m_numFields = 0;
BitVec m_deaths;
AggregateInfo* m_aggregate = nullptr;

friend class PromotionLiveness;

private:
StructDeaths(BitVec deaths, unsigned numFields) : m_deaths(deaths), m_numFields(numFields)
StructDeaths(BitVec deaths, AggregateInfo* agg) : m_deaths(deaths), m_aggregate(agg)
{
}

Expand Down
14 changes: 11 additions & 3 deletions src/coreclr/jit/promotionliveness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ StructDeaths PromotionLiveness::GetDeathsForStructLocal(GenTreeLclVarCommon* lcl

unsigned lclNum = lcl->GetLclNum();
AggregateInfo* aggInfo = m_aggregates.Lookup(lclNum);
return StructDeaths(aggDeaths, (unsigned)aggInfo->Replacements.size());
return StructDeaths(aggDeaths, aggInfo);
}

//------------------------------------------------------------------------
Expand All @@ -820,7 +820,13 @@ StructDeaths PromotionLiveness::GetDeathsForStructLocal(GenTreeLclVarCommon* lcl
//
bool StructDeaths::IsRemainderDying() const
{
BitVecTraits traits(1 + m_numFields, nullptr);
if (m_aggregate->UnpromotedMax <= m_aggregate->UnpromotedMin)
{
// No remainder.
return true;
}

BitVecTraits traits(1 + (unsigned)m_aggregate->Replacements.size(), nullptr);
return BitVecOps::IsMember(&traits, m_deaths, 0);
}

Expand All @@ -833,7 +839,9 @@ bool StructDeaths::IsRemainderDying() const
//
bool StructDeaths::IsReplacementDying(unsigned index) const
{
BitVecTraits traits(1 + m_numFields, nullptr);
assert(index < m_aggregate->Replacements.size());

BitVecTraits traits(1 + (unsigned)m_aggregate->Replacements.size(), nullptr);
return BitVecOps::IsMember(&traits, m_deaths, 1 + index);
}

Expand Down
Loading