From 7144106712b44ac4a012e3df3e708525d8964327 Mon Sep 17 00:00:00 2001 From: Pat Gavlin Date: Fri, 6 Jan 2017 14:12:35 -0800 Subject: [PATCH] Simplify lclNum fetching and a few assertions. Commit migrated from https://github.com/dotnet/coreclr/commit/a5bfd0769ec7cce40c2c5717663b34e2059d75a8 --- src/coreclr/src/jit/liveness.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/coreclr/src/jit/liveness.cpp b/src/coreclr/src/jit/liveness.cpp index 1b19785..b73a9fa 100644 --- a/src/coreclr/src/jit/liveness.cpp +++ b/src/coreclr/src/jit/liveness.cpp @@ -22,19 +22,12 @@ */ void Compiler::fgMarkUseDef(GenTreeLclVarCommon* tree) { - unsigned lclNum; - if (tree->gtOper == GT_LCL_VAR || tree->gtOper == GT_LCL_VAR_ADDR || tree->gtOper == GT_STORE_LCL_VAR) - { - lclNum = tree->gtLclNum; - } - else - { - assert(tree->OperIsLocalField()); - lclNum = tree->gtLclFld.gtLclNum; - } + assert((tree->OperIsLocal() && (tree->OperGet() != GT_PHI_ARG)) || tree->OperIsLocalAddr()); + const unsigned lclNum = tree->gtLclNum; assert(lclNum < lvaCount); - LclVarDsc* const varDsc = lvaTable + lclNum; + + LclVarDsc* const varDsc = &lvaTable[lclNum]; // We should never encounter a reference to a lclVar that has a zero refCnt. if (varDsc->lvRefCnt == 0 && (!varTypeIsPromotable(varDsc) || !varDsc->lvPromoted)) -- 2.7.4