-
Notifications
You must be signed in to change notification settings - Fork 5.5k
JIT: Invalidate loop table after unrolling and dominators after MarkLocalVars #95854
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
c57d1a5
e4e3a57
4e3bae4
616f01a
ef97b7f
ac329dd
3db6c4f
83bc1f7
630bfaa
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 |
|---|---|---|
|
|
@@ -1925,7 +1925,7 @@ bool Compiler::fgCanCompactBlocks(BasicBlock* block, BasicBlock* bNext) | |
| } | ||
|
|
||
| // Don't compact away any loop entry blocks that we added in optCanonicalizeLoops | ||
| if (optIsLoopEntry(block)) | ||
| if (block->HasFlag(BBF_OLD_LOOP_HEADER_QUIRK)) | ||
| { | ||
| return false; | ||
| } | ||
|
|
@@ -2355,20 +2355,28 @@ void Compiler::fgCompactBlocks(BasicBlock* block, BasicBlock* bNext) | |
| // before the updates, we can create pred lists with duplicate m_block->bbNum | ||
| // values (though different m_blocks). | ||
| // | ||
| if (fgDomsComputed && (block->bbNum > fgDomBBcount)) | ||
| if ((fgDomsComputed || fgCompactRenumberQuirk) && (block->bbNum > fgDomBBcount)) | ||
| { | ||
| assert(fgReachabilitySetsValid); | ||
| BlockSetOps::Assign(this, block->bbReach, bNext->bbReach); | ||
| BlockSetOps::ClearD(this, bNext->bbReach); | ||
| if (fgDomsComputed) | ||
| { | ||
| assert(fgReachabilitySetsValid); | ||
| BlockSetOps::Assign(this, block->bbReach, bNext->bbReach); | ||
| BlockSetOps::ClearD(this, bNext->bbReach); | ||
|
|
||
| block->bbIDom = bNext->bbIDom; | ||
| bNext->bbIDom = nullptr; | ||
| block->bbIDom = bNext->bbIDom; | ||
| bNext->bbIDom = nullptr; | ||
|
|
||
| // In this case, there's no need to update the preorder and postorder numbering | ||
| // since we're changing the bbNum, this makes the basic block all set. | ||
| // | ||
| JITDUMP("Renumbering " FMT_BB " to be " FMT_BB " to preserve dominator information\n", block->bbNum, | ||
| bNext->bbNum); | ||
| // In this case, there's no need to update the preorder and postorder numbering | ||
| // since we're changing the bbNum, this makes the basic block all set. | ||
| // | ||
| JITDUMP("Renumbering " FMT_BB " to be " FMT_BB " to preserve dominator information\n", block->bbNum, | ||
| bNext->bbNum); | ||
| } | ||
| else | ||
| { | ||
| // TODO-Quirk: Remove | ||
| JITDUMP("Renumbering " FMT_BB " to be " FMT_BB " for a quirk\n", block->bbNum, bNext->bbNum); | ||
| } | ||
|
Comment on lines
+2375
to
+2379
Member
Author
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. This quirk has surprisingly large diffs. |
||
|
|
||
| block->bbNum = bNext->bbNum; | ||
|
|
||
|
|
@@ -2387,7 +2395,10 @@ void Compiler::fgCompactBlocks(BasicBlock* block, BasicBlock* bNext) | |
| } | ||
| } | ||
|
|
||
| fgUpdateLoopsAfterCompacting(block, bNext); | ||
| if (optLoopTableValid) | ||
| { | ||
| fgUpdateLoopsAfterCompacting(block, bNext); | ||
| } | ||
|
|
||
| #if DEBUG | ||
| if (verbose && 0) | ||
|
|
@@ -6227,8 +6238,11 @@ bool Compiler::fgUpdateFlowGraph(bool doTailDuplication, bool isPhase) | |
| /* Mark the block as removed */ | ||
| bNext->SetFlags(BBF_REMOVED); | ||
|
|
||
| // Update the loop table if we removed the bottom of a loop, for example. | ||
| fgUpdateLoopsAfterCompacting(block, bNext); | ||
| if (optLoopTableValid) | ||
| { | ||
| // Update the loop table if we removed the bottom of a loop, for example. | ||
| fgUpdateLoopsAfterCompacting(block, bNext); | ||
| } | ||
|
|
||
| // If this is the first Cold basic block update fgFirstColdBlock | ||
| if (bNext->IsFirstColdBlock(this)) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1339,10 +1339,13 @@ void OptBoolsDsc::optOptimizeBoolsUpdateTrees() | |
| } | ||
|
|
||
| // Update loop table | ||
| m_comp->fgUpdateLoopsAfterCompacting(m_b1, m_b2); | ||
| if (optReturnBlock) | ||
| if (m_comp->optLoopTableValid) | ||
| { | ||
| m_comp->fgUpdateLoopsAfterCompacting(m_b1, m_b3); | ||
| m_comp->fgUpdateLoopsAfterCompacting(m_b1, m_b2); | ||
| if (optReturnBlock) | ||
| { | ||
| m_comp->fgUpdateLoopsAfterCompacting(m_b1, m_b3); | ||
| } | ||
|
Comment on lines
+1342
to
+1348
Member
Author
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. Some of these checks are always false, like in this case... I'll remove them all as part of the big code deletion in the future. |
||
| } | ||
|
|
||
| // Update IL range of first block | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lvaMarkLocalVarsusesCompiler::IsDominatedByExceptionalEntryto setLclVarDsc::lvVolatileHint. That is used by VN-based copy prop as part of the heuristic. My next step will be to compute SSA's dominators after unrolling above and then use those dominators to compute this heuristic instead. That will allow us to movefgDomsComputedup to where the loop table is invalidated as well.