diff options
author | Sergey Andreenko <seandree@microsoft.com> | 2019-03-27 10:59:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-27 10:59:04 -0700 |
commit | cbeadacafba718557e47fc166d7fd688b01515d7 (patch) | |
tree | 453639f037b33ca1df630bf30b1343f3d3ecbc22 /src/jit/lower.cpp | |
parent | 6cb120cc74ca61fc314e3cc43007778d2aafd041 (diff) | |
download | coreclr-cbeadacafba718557e47fc166d7fd688b01515d7.tar.gz coreclr-cbeadacafba718557e47fc166d7fd688b01515d7.tar.bz2 coreclr-cbeadacafba718557e47fc166d7fd688b01515d7.zip |
Revert "Delete unused variables in jit. Part 2. (#23481)" (#23488)
This reverts commit 6cb120cc74ca61fc314e3cc43007778d2aafd041.
Diffstat (limited to 'src/jit/lower.cpp')
-rw-r--r-- | src/jit/lower.cpp | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/src/jit/lower.cpp b/src/jit/lower.cpp index 4189dcee66..fc507c4c50 100644 --- a/src/jit/lower.cpp +++ b/src/jit/lower.cpp @@ -496,6 +496,8 @@ GenTree* Lowering::LowerSwitch(GenTree* node) noway_assert(jumpCnt >= 2); // Spill the argument to the switch node into a local so that it can be used later. + unsigned blockWeight = originalSwitchBB->getBBWeight(comp); + LIR::Use use(switchBBRange, &(node->gtOp.gtOp1), node); ReplaceWithLclVar(use); @@ -506,8 +508,9 @@ GenTree* Lowering::LowerSwitch(GenTree* node) assert(node->gtOper == GT_SWITCH); GenTree* temp = node->gtOp.gtOp1; assert(temp->gtOper == GT_LCL_VAR); - unsigned tempLclNum = temp->gtLclVarCommon.gtLclNum; - var_types tempLclType = temp->TypeGet(); + unsigned tempLclNum = temp->gtLclVarCommon.gtLclNum; + LclVarDsc* tempVarDsc = comp->lvaTable + tempLclNum; + var_types tempLclType = temp->TypeGet(); BasicBlock* defaultBB = jumpTab[jumpCnt - 1]; BasicBlock* followingBB = originalSwitchBB->bbNext; @@ -2041,7 +2044,8 @@ void Lowering::LowerFastTailCall(GenTreeCall* call) // This should not be a GT_PHI_ARG. assert(treeNode->OperGet() != GT_PHI_ARG); - GenTreeLclVarCommon* lcl = treeNode->AsLclVarCommon(); + GenTreeLclVarCommon* lcl = treeNode->AsLclVarCommon(); + LclVarDsc* lclVar = &comp->lvaTable[lcl->gtLclNum]; // Fast tail calling criteria permits passing of structs of size 1, 2, 4 and 8 as args. // It is possible that the callerArgLclNum corresponds to such a struct whose stack slot @@ -2562,11 +2566,11 @@ GenTree* Lowering::OptimizeConstCompare(GenTree* cmp) #if defined(_TARGET_XARCH_) || defined(_TARGET_ARM64_) GenTree* op1 = cmp->gtGetOp1(); + var_types op1Type = op1->TypeGet(); GenTreeIntCon* op2 = cmp->gtGetOp2()->AsIntCon(); ssize_t op2Value = op2->IconValue(); #ifdef _TARGET_XARCH_ - var_types op1Type = op1->TypeGet(); if (IsContainableMemoryOp(op1) && varTypeIsSmall(op1Type) && genSmallTypeCanRepresentValue(op1Type, op2Value)) { // @@ -3837,6 +3841,7 @@ GenTree* Lowering::LowerNonvirtPinvokeCall(GenTreeCall* call) // platform. They may be changed in the future such that they preserve all register values. GenTree* result = nullptr; + void* addr = nullptr; // assert we have seen one of these noway_assert(comp->info.compCallUnmanaged != 0); @@ -4188,6 +4193,8 @@ bool Lowering::AreSourcesPossiblyModifiedLocals(GenTree* addr, GenTree* base, Ge { assert(addr != nullptr); + unsigned markCount = 0; + SideEffectSet baseSideEffects; if (base != nullptr) { @@ -4335,6 +4342,8 @@ GenTree* Lowering::TryCreateAddrMode(LIR::Use&& use, bool isIndir) return addr; } + GenTree* arrLength = nullptr; + JITDUMP("Addressing mode:\n"); JITDUMP(" Base\n "); DISPNODE(base); @@ -4394,6 +4403,8 @@ GenTree* Lowering::TryCreateAddrMode(LIR::Use&& use, bool isIndir) // GenTree* Lowering::LowerAdd(GenTree* node) { + GenTree* next = node->gtNext; + #ifndef _TARGET_ARMARCH_ if (varTypeIsIntegralOrI(node)) { @@ -4448,6 +4459,7 @@ bool Lowering::LowerUnsignedDivOrMod(GenTreeOp* divMod) assert(divMod->OperGet() != GT_UMOD); #endif // _TARGET_ARM64_ + GenTree* next = divMod->gtNext; GenTree* dividend = divMod->gtGetOp1(); GenTree* divisor = divMod->gtGetOp2(); @@ -4821,6 +4833,9 @@ GenTree* Lowering::LowerConstIntDivOrMod(GenTree* node) // We need to use the dividend node multiple times so its value needs to be // computed once and stored in a temp variable. + + unsigned curBBWeight = comp->compCurBB->getBBWeight(comp); + LIR::Use opDividend(BlockRange(), &divMod->gtOp.gtOp1, divMod); dividend = ReplaceWithLclVar(opDividend); @@ -4897,7 +4912,10 @@ GenTree* Lowering::LowerConstIntDivOrMod(GenTree* node) GenTree* Lowering::LowerSignedDivOrMod(GenTree* node) { assert((node->OperGet() == GT_DIV) || (node->OperGet() == GT_MOD)); - GenTree* next = node->gtNext; + GenTree* next = node->gtNext; + GenTree* divMod = node; + GenTree* dividend = divMod->gtGetOp1(); + GenTree* divisor = divMod->gtGetOp2(); if (varTypeIsIntegral(node->TypeGet())) { @@ -5054,8 +5072,9 @@ void Lowering::WidenSIMD12IfNecessary(GenTreeLclVarCommon* node) GenTree* Lowering::LowerArrElem(GenTree* node) { // This will assert if we don't have an ArrElem node - GenTreeArrElem* arrElem = node->AsArrElem(); - const unsigned char rank = arrElem->gtArrElem.gtArrRank; + GenTreeArrElem* arrElem = node->AsArrElem(); + const unsigned char rank = arrElem->gtArrElem.gtArrRank; + const unsigned blockWeight = m_block->getBBWeight(comp); JITDUMP("Lowering ArrElem\n"); JITDUMP("============\n"); @@ -5074,6 +5093,8 @@ GenTree* Lowering::LowerArrElem(GenTree* node) GenTree* arrObjNode = arrElem->gtArrObj; assert(arrObjNode->IsLocal()); + LclVarDsc* const varDsc = &comp->lvaTable[arrElem->gtArrObj->AsLclVarCommon()->gtLclNum]; + GenTree* insertionPoint = arrElem; // The first ArrOffs node will have 0 for the offset of the previous dimension. |