-
Notifications
You must be signed in to change notification settings - Fork 5.2k
JIT: Do not propagate some constants #70378
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 1 commit
593a3ec
72ab579
83fc086
d81b195
1d076dd
0274989
69e4d1d
3920a54
7873570
bc40d08
eaede4e
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 |
|---|---|---|
|
|
@@ -3177,6 +3177,41 @@ GenTree* Compiler::optVNConstantPropOnTree(BasicBlock* block, GenTree* tree) | |
|
|
||
| if (conValTree != nullptr) | ||
| { | ||
| if (tree->OperIs(GT_LCL_VAR)) | ||
| { | ||
| bool betterToPropagate = false; | ||
| if (conValTree->IsVectorZero() || conValTree->IsFloatPositiveZero()) | ||
| { | ||
| // These are cheap to re-materialize (unlike e.g. "1.0" or "{1,1,1,1}" which end up as | ||
| // memory loads from the data section) | ||
| betterToPropagate = true; | ||
| } | ||
| #ifdef TARGET_ARM64 | ||
| else if (conValTree->IsCnsIntOrI() && unsigned_abs(conValTree->AsIntCon()->IconValue()) < 0x0fff) | ||
| { | ||
| // This integer constant is likely immable | ||
| betterToPropagate = true; | ||
| } | ||
EgorBo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| #endif | ||
|
|
||
| if (!betterToPropagate) | ||
| { | ||
| // Try to find the block this value was defined in | ||
| // and if the current use is inside a loop while the def is not - do not propagate | ||
| unsigned lclNum = tree->AsLclVarCommon()->GetLclNum(); | ||
| unsigned ssaNum = GetSsaNumForLocalVarDef(tree); | ||
| if (ssaNum != SsaConfig::RESERVED_SSA_NUM) | ||
| { | ||
| BasicBlock* defBlock = lvaTable[lclNum].GetPerSsaData(ssaNum)->GetBlock(); | ||
|
||
| if (defBlock != nullptr && !(defBlock->bbFlags & BBF_BACKWARD_JUMP) && | ||
| (block->bbFlags & BBF_BACKWARD_JUMP)) | ||
EgorBo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| return nullptr; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Were able to optimize. | ||
| conValTree->gtVNPair = vnPair; | ||
| GenTree* sideEffList = optExtractSideEffListFromConst(tree); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.