From 9e1887d0d483798e29381e4137489608fee78d41 Mon Sep 17 00:00:00 2001 From: Bruce Forstall Date: Sun, 13 Nov 2016 19:17:36 -0800 Subject: [PATCH] Fix the arg name/number dumping for call args in LIR Use the arg number in the arg info table. Before this, I saw cases where the args were named: arg0, arg1, arg1, arg3, instead of: arg0, arg2, arg1, arg3, for example. Commit migrated from https://github.com/dotnet/coreclr/commit/4535df67481edeeefbed21efcaceaf4a504ebcc9 --- src/coreclr/src/jit/gentree.cpp | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/src/coreclr/src/jit/gentree.cpp b/src/coreclr/src/jit/gentree.cpp index 9ed1f51..aa879ef 100644 --- a/src/coreclr/src/jit/gentree.cpp +++ b/src/coreclr/src/jit/gentree.cpp @@ -11886,22 +11886,8 @@ void Compiler::gtDispLIRNode(GenTree* node) const bool nodeIsCall = node->IsCall(); - int numCallEarlyArgs = 0; - if (nodeIsCall) - { - GenTreeCall* call = node->AsCall(); - for (GenTreeArgList* args = call->gtCallArgs; args != nullptr; args = args->Rest()) - { - if (!args->Current()->IsArgPlaceHolderNode() && args->Current()->IsValue()) - { - numCallEarlyArgs++; - } - } - } - // Visit operands - IndentInfo operandArc = IIArcTop; - int callArgNumber = 0; + IndentInfo operandArc = IIArcTop; for (GenTree* operand : node->Operands()) { if (operand->IsArgPlaceHolderNode() || !operand->IsValue()) @@ -11932,20 +11918,22 @@ void Compiler::gtDispLIRNode(GenTree* node) } else { - int callLateArgNumber = callArgNumber - numCallEarlyArgs; + fgArgTabEntryPtr curArgTabEntry = gtArgEntryByNode(call, operand); + assert(curArgTabEntry); + if (operand->OperGet() == GT_LIST) { int listIndex = 0; for (GenTreeArgList* element = operand->AsArgList(); element != nullptr; element = element->Rest()) { operand = element->Current(); - if (callLateArgNumber < 0) + if (curArgTabEntry->lateArgInx == (unsigned)-1) { - gtGetArgMsg(call, operand, callArgNumber, listIndex, buf, sizeof(buf)); + gtGetArgMsg(call, operand, curArgTabEntry->argNum, listIndex, buf, sizeof(buf)); } else { - gtGetLateArgMsg(call, operand, callLateArgNumber, listIndex, buf, sizeof(buf)); + gtGetLateArgMsg(call, operand, curArgTabEntry->lateArgInx, listIndex, buf, sizeof(buf)); } displayOperand(operand, buf, operandArc, indentStack); @@ -11954,19 +11942,17 @@ void Compiler::gtDispLIRNode(GenTree* node) } else { - if (callLateArgNumber < 0) + if (curArgTabEntry->lateArgInx == (unsigned)-1) { - gtGetArgMsg(call, operand, callArgNumber, -1, buf, sizeof(buf)); + gtGetArgMsg(call, operand, curArgTabEntry->argNum, -1, buf, sizeof(buf)); } else { - gtGetLateArgMsg(call, operand, callLateArgNumber, -1, buf, sizeof(buf)); + gtGetLateArgMsg(call, operand, curArgTabEntry->lateArgInx, -1, buf, sizeof(buf)); } displayOperand(operand, buf, operandArc, indentStack); } - - callArgNumber++; } } else if (node->OperIsDynBlkOp()) -- 2.7.4