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

OS#19979778 : Merge uses of auxSlotPtrSym on dead edges as well #5935

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 33 additions & 2 deletions lib/Backend/BackwardPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ BackwardPass::MergeSuccBlocksInfo(BasicBlock * block)
BVSparse<JitArenaAllocator> * typesNeedingKnownObjectLayout = nullptr;
BVSparse<JitArenaAllocator> * slotDeadStoreCandidates = nullptr;
BVSparse<JitArenaAllocator> * byteCodeUpwardExposedUsed = nullptr;
BVSparse<JitArenaAllocator> * auxSlotPtrUpwardExposedUses = nullptr;
BVSparse<JitArenaAllocator> * couldRemoveNegZeroBailoutForDef = nullptr;
BVSparse<JitArenaAllocator> * liveFixedFields = nullptr;
#if DBG
Expand All @@ -508,6 +509,11 @@ BackwardPass::MergeSuccBlocksInfo(BasicBlock * block)
#endif
}

if ((this->tag == Js::DeadStorePhase) && !PHASE_OFF(Js::ReuseAuxSlotPtrPhase, this->func))
{
auxSlotPtrUpwardExposedUses = JitAnew(this->tempAlloc, BVSparse<JitArenaAllocator>, this->tempAlloc);
}

#if DBG
if (!IsCollectionPass() && this->DoMarkTempObjectVerify())
{
Expand Down Expand Up @@ -1128,6 +1134,29 @@ BackwardPass::MergeSuccBlocksInfo(BasicBlock * block)
NEXT_DEAD_SUCCESSOR_BLOCK;
}

if (auxSlotPtrUpwardExposedUses)
{
FOREACH_SUCCESSOR_BLOCK(blockSucc, block)
{
Assert(blockSucc->auxSlotPtrUpwardExposedUses || blockSucc->isLoopHeader);
if (blockSucc->auxSlotPtrUpwardExposedUses)
{
auxSlotPtrUpwardExposedUses->Or(blockSucc->auxSlotPtrUpwardExposedUses);
}
}
NEXT_SUCCESSOR_BLOCK;

FOREACH_DEAD_SUCCESSOR_BLOCK(deadBlockSucc, block)
{
Assert(deadBlockSucc->auxSlotPtrUpwardExposedUses || deadBlockSucc->isLoopHeader);
if (deadBlockSucc->auxSlotPtrUpwardExposedUses)
{
auxSlotPtrUpwardExposedUses->Or(deadBlockSucc->auxSlotPtrUpwardExposedUses);
}
}
NEXT_DEAD_SUCCESSOR_BLOCK;
}

if (block->isLoopHeader)
{
this->DeleteBlockData(block);
Expand Down Expand Up @@ -1191,6 +1220,7 @@ BackwardPass::MergeSuccBlocksInfo(BasicBlock * block)
block->upwardExposedFields = upwardExposedFields;
block->typesNeedingKnownObjectLayout = typesNeedingKnownObjectLayout;
block->byteCodeUpwardExposedUsed = byteCodeUpwardExposedUsed;
block->auxSlotPtrUpwardExposedUses = auxSlotPtrUpwardExposedUses;
#if DBG
block->byteCodeRestoreSyms = byteCodeRestoreSyms;
block->excludeByteCodeUpwardExposedTracking = excludeByteCodeUpwardExposedTracking;
Expand Down Expand Up @@ -4315,6 +4345,7 @@ BackwardPass::DumpBlockData(BasicBlock * block, IR::Instr* instr)
{ block->typesNeedingKnownObjectLayout, _u("Needs Known Object Layout") },
{ block->upwardExposedFields, _u("Exposed Fields") },
{ block->byteCodeUpwardExposedUsed, _u("Byte Code Use") },
{ block->auxSlotPtrUpwardExposedUses, _u("Aux Slot Use")},
{ byteCodeRegisterUpwardExposed, _u("Byte Code Reg Use") },
{ !this->IsCollectionPass() && !block->isDead && this->DoDeadStoreSlots() ? block->slotDeadStoreCandidates : nullptr, _u("Slot deadStore candidates") },
};
Expand Down Expand Up @@ -5673,12 +5704,12 @@ BackwardPass::TrackObjTypeSpecProperties(IR::PropertySymOpnd *opnd, BasicBlock *
{
// This is an upward-exposed use of the aux slot pointer.
Assert(auxSlotPtrSym);
auxSlotPtrUpwardExposed = this->currentBlock->upwardExposedUses->TestAndSet(auxSlotPtrSym->m_id);
auxSlotPtrUpwardExposed = this->currentBlock->auxSlotPtrUpwardExposedUses->TestAndSet(auxSlotPtrSym->m_id);
}
else if (auxSlotPtrSym != nullptr)
{
// The aux slot pointer is not upward-exposed at this point.
auxSlotPtrUpwardExposed = this->currentBlock->upwardExposedUses->TestAndClear(auxSlotPtrSym->m_id);
auxSlotPtrUpwardExposed = this->currentBlock->auxSlotPtrUpwardExposedUses->TestAndClear(auxSlotPtrSym->m_id);
}
if (!this->IsPrePass() && auxSlotPtrUpwardExposed)
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Backend/FlowGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ class BasicBlock
BVSparse<JitArenaAllocator> * upwardExposedFields;
BVSparse<JitArenaAllocator> * typesNeedingKnownObjectLayout;
BVSparse<JitArenaAllocator> * slotDeadStoreCandidates;
BVSparse<JitArenaAllocator> * auxSlotPtrUpwardExposedUses;
TempNumberTracker * tempNumberTracker;
TempObjectTracker * tempObjectTracker;
#if DBG
Expand Down Expand Up @@ -441,6 +442,7 @@ class BasicBlock
upwardExposedFields(nullptr),
typesNeedingKnownObjectLayout(nullptr),
slotDeadStoreCandidates(nullptr),
auxSlotPtrUpwardExposedUses(nullptr),
tempNumberTracker(nullptr),
tempObjectTracker(nullptr),
#if DBG
Expand Down