-
Notifications
You must be signed in to change notification settings - Fork 5.2k
JIT: Improve weight distribution in internal blocks produced by casts #50082
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 10 commits
31aad96
782a370
697ff0c
d94791b
b43a364
3774ed9
625a42a
ff71daf
9efadff
6bfd188
2a970e3
a4f3eb6
b33be63
9823550
c24ac4d
a2f9ba9
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 |
|---|---|---|
|
|
@@ -17681,6 +17681,9 @@ void Compiler::fgExpandQmarkForCastInstOf(BasicBlock* block, Statement* stmt) | |
|
|
||
| assert(qmark->gtFlags & GTF_QMARK_CAST_INSTOF); | ||
|
|
||
| float currBbWeight = block->bbWeight; | ||
| float nextBbWeight = (block->bbNext != nullptr) ? block->bbNext->bbWeight : currBbWeight; | ||
EgorBo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // Get cond, true, false exprs for the qmark. | ||
| GenTree* condExpr = qmark->gtGetOp1(); | ||
| GenTree* trueExpr = qmark->gtGetOp2()->AsColon()->ThenNode(); | ||
|
|
@@ -17766,11 +17769,18 @@ void Compiler::fgExpandQmarkForCastInstOf(BasicBlock* block, Statement* stmt) | |
| cond1Block->bbJumpDest = remainderBlock; | ||
| cond2Block->bbJumpDest = remainderBlock; | ||
|
|
||
| // Set the weights; some are guesses. | ||
| // Currently, we don't instrument internal blocks, so the only way we can set weights to these blocks | ||
| // is to analyze successors and take a guess. | ||
| float cond2BlockWeight = 0; | ||
EgorBo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
EgorBo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (currBbWeight > 0) | ||
|
||
| { | ||
| cond2BlockWeight = min(max(50.0f * nextBbWeight / currBbWeight + 50.0f, 50.0f), 100.0f); | ||
| } | ||
|
|
||
| asgBlock->inheritWeight(block); | ||
| cond1Block->inheritWeight(block); | ||
| cond2Block->inheritWeightPercentage(cond1Block, 50); | ||
| helperBlock->inheritWeightPercentage(cond2Block, 50); | ||
| cond2Block->inheritWeightPercentage(block, (UINT32)cond2BlockWeight); | ||
| helperBlock->inheritWeightPercentage(block, 100 - (UINT32)cond2BlockWeight); | ||
|
|
||
| // Append cond1 as JTRUE to cond1Block | ||
| GenTree* jmpTree = gtNewOperNode(GT_JTRUE, TYP_VOID, condExpr); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.