-
Notifications
You must be signed in to change notification settings - Fork 5k
JIT: improve scalability of optReachable #75990
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,16 +74,10 @@ PhaseStatus Compiler::optRedundantBranches() | |
} | ||
}; | ||
|
||
optReachableBitVecTraits = nullptr; | ||
OptRedundantBranchesDomTreeVisitor visitor(this); | ||
visitor.WalkTree(); | ||
|
||
// Reset visited flags, in case we set any. | ||
// | ||
for (BasicBlock* const block : Blocks()) | ||
{ | ||
block->bbFlags &= ~BBF_VISITED; | ||
} | ||
|
||
#if DEBUG | ||
if (verbose && visitor.madeChanges) | ||
{ | ||
|
@@ -1593,9 +1587,15 @@ bool Compiler::optReachable(BasicBlock* const fromBlock, BasicBlock* const toBlo | |
return true; | ||
} | ||
|
||
for (BasicBlock* const block : Blocks()) | ||
if (optReachableBitVecTraits == nullptr) | ||
{ | ||
block->bbFlags &= ~BBF_VISITED; | ||
optReachableBitVecTraits = new (this, CMK_Reachability) BitVecTraits(fgBBNumMax + 1, this); | ||
optReachableBitVec = BitVecOps::MakeEmpty(optReachableBitVecTraits); | ||
} | ||
else | ||
{ | ||
assert(BitVecTraits::GetSize(optReachableBitVecTraits) == fgBBNumMax + 1); | ||
BitVecOps::ClearD(optReachableBitVecTraits, optReachableBitVec); | ||
} | ||
|
||
ArrayStack<BasicBlock*> stack(getAllocator(CMK_Reachability)); | ||
|
@@ -1604,7 +1604,6 @@ bool Compiler::optReachable(BasicBlock* const fromBlock, BasicBlock* const toBlo | |
while (!stack.Empty()) | ||
{ | ||
BasicBlock* const nextBlock = stack.Pop(); | ||
nextBlock->bbFlags |= BBF_VISITED; | ||
assert(nextBlock != toBlock); | ||
|
||
if (nextBlock == excludedBlock) | ||
|
@@ -1619,11 +1618,13 @@ bool Compiler::optReachable(BasicBlock* const fromBlock, BasicBlock* const toBlo | |
return true; | ||
} | ||
|
||
if ((succ->bbFlags & BBF_VISITED) != 0) | ||
if (BitVecOps::IsMember(optReachableBitVecTraits, optReachableBitVec, succ->bbNum)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have this exact code in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That version uses In general, it would be nice to have the ability to represent (sparse) block sets that are independent of |
||
{ | ||
continue; | ||
} | ||
|
||
BitVecOps::AddElemD(optReachableBitVecTraits, optReachableBitVec, succ->bbNum); | ||
|
||
stack.Push(succ); | ||
} | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.