-
Notifications
You must be signed in to change notification settings - Fork 5.2k
JIT: Add fgRedirectTrueEdge, fgRedirectFalseEdge #99561
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 4 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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -449,6 +449,84 @@ void Compiler::fgRedirectTargetEdge(BasicBlock* block, BasicBlock* newTarget) | |||||
| newTarget->bbRefs++; | ||||||
| } | ||||||
|
|
||||||
| void Compiler::fgRedirectTrueEdge(BasicBlock* block, BasicBlock* newTarget) | ||||||
| { | ||||||
| assert(block != nullptr); | ||||||
| assert(newTarget != nullptr); | ||||||
| assert(block->KindIs(BBJ_COND)); | ||||||
| assert(!block->TrueEdgeIs(block->GetFalseEdge())); | ||||||
|
|
||||||
| // Update oldTarget's pred list. | ||||||
| // We could call fgRemoveRefPred, but since we're removing the one and only ref from block to oldTarget, | ||||||
| // fgRemoveAllRefPreds is slightly more efficient (one fewer branch, doesn't update edge's dup count, etc). | ||||||
| // | ||||||
| FlowEdge* trueEdge = block->GetTrueEdge(); | ||||||
| BasicBlock* oldTarget = trueEdge->getDestinationBlock(); | ||||||
| fgRemoveAllRefPreds(oldTarget, block); | ||||||
|
|
||||||
| // Splice edge into new target block's pred list | ||||||
| // | ||||||
| FlowEdge** predListPtr = fgGetPredInsertPoint(block, newTarget); | ||||||
| FlowEdge* predEdge = *predListPtr; | ||||||
|
|
||||||
| if (block->FalseEdgeIs(predEdge)) | ||||||
| { | ||||||
| block->SetTrueEdge(predEdge); | ||||||
| predEdge->incrementDupCount(); | ||||||
| } | ||||||
| else | ||||||
| { | ||||||
| trueEdge->setNextPredEdge(predEdge); | ||||||
| trueEdge->setDestinationBlock(newTarget); | ||||||
| *predListPtr = trueEdge; | ||||||
| } | ||||||
|
|
||||||
| newTarget->bbRefs++; | ||||||
|
|
||||||
| // Pred list of target should (stilL) be ordered | ||||||
|
||||||
| // Pred list of target should (stilL) be ordered | |
| // Pred list of target should (still) be ordered |
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.
Please add a header comment block for this method
Outdated
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.
| // Pred list of target should (stilL) be ordered | |
| // Pred list of target should (still) be ordered |
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.
Please add a header comment block for this method