-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Comments and cleanup for loop cloning #49768
Conversation
@dotnet/jit-contrib |
88bbe7e
to
1a9c7bb
Compare
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.
Left a few comments. Likely you can defer them for future PRs.
@@ -346,6 +346,9 @@ void CodeGen::genCodeForBBlist() | |||
if ((block->bbPrev != nullptr) && (block->bbPrev->bbJumpKind == BBJ_COND) && | |||
(block->bbWeight != block->bbPrev->bbWeight)) | |||
{ | |||
JITDUMP("Adding label due to BB weight difference: BBJ_COND " FMT_BB " with weight " FMT_WT |
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.
While you are here, I am wondering if there is an easy way to add towards the end the mapping of BB -> IG
somehow? While looking at JITDump, it is not straightforward to find this mapping and is very helpful overall when we look backward in JITDump.
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.
LGTM with minor comments.
@@ -43,45 +117,78 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |||
|
|||
Heuristic: | |||
Therefore we will not clone if we exceed creating 4 blocks. | |||
Note: this means we never clone more than 2-dimension a[i][j] expressions | |||
(see optComputeDerefConditions()). | |||
REVIEW: make this heuristic defined by a COMPlus variable, for easier |
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.
make this heuristic defined by a COMPlus variable,
+1 on that.
This is a no-diff change Added various comments to document loop cloning. Standardized and improved some logging. Consolidated more loop cloning condition checking into `optIsLoopClonable` that was previously in `optIdentifyLoopOptInfo`. Replaced some `0` weights with `BB_ZERO_WEIGHT`. Made FMT_BB use pervasive.
Added FMT_LP formatting string. Cached often-used `optLoopTable[loopInd]` expression. Added `const` to many loop query member functions. Added static `GenTree::OperIs(compareOper, oper, oper, oper...)` functions for simplifying oper check expressions where the compareOper isn't from a GenTree node `OperGet()`. (This doesn't need to be part of GenTree, but it doesn't hurt, either.) Added a few more comments.
1a9c7bb
to
3653f16
Compare
Rename to StaticOperIs. It appears the compiler uses the wrong template in some cases, but doesn't complain about duplicate options, leading to run-time failures.
This is a no-diff change
Added various comments to document loop cloning.
Standardized and improved some logging.
Consolidated more loop cloning condition checking into
optIsLoopClonable
that was previously inoptIdentifyLoopOptInfo
.Replaced some
0
weights withBB_ZERO_WEIGHT
.Made FMT_BB use pervasive.