From 23a4562bacfb4b11d7e8273287888be944673e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:42:34 +0200 Subject: [PATCH 01/17] Update importer.cpp --- src/coreclr/jit/importer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 9dc29e2b989591..e1f0b79a002ae3 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -4258,7 +4258,7 @@ GenTree* Compiler::impImportStaticFieldAddress(CORINFO_RESOLVED_TOKEN* pResolved } if (isStaticReadOnlyInitedRef) { - indirFlags |= (GTF_IND_INVARIANT | GTF_IND_NONNULL); + indirFlags |= (GTF_IND_NONFAULTING | GTF_IND_INVARIANT | GTF_IND_NONNULL); } break; } @@ -12632,7 +12632,9 @@ void Compiler::impFixPredLists() // bool Compiler::impIsInvariant(const GenTree* tree) { - return tree->OperIsConst() || impIsAddressInLocal(tree) || tree->OperIs(GT_FTN_ADDR); + return tree->OperIsConst() || impIsAddressInLocal(tree) || tree->OperIs(GT_FTN_ADDR) || + (tree->OperIs(GT_IND) && tree->AsIndir()->IsInvariantLoad() && + ((tree->AsIndir()->gtFlags & GTF_SIDE_EFFECT) == 0)); } //------------------------------------------------------------------------ From 243f4b539bfc03e7449ae72f836166e25dc54daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:44:25 +0200 Subject: [PATCH 02/17] Update gentree.cpp --- src/coreclr/jit/gentree.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index e021613381de5b..98b6856cdd937d 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -30333,7 +30333,8 @@ bool GenTreeLclFld::IsOffsetMisaligned() const bool GenTree::IsInvariant() const { - return OperIsConst() || OperIs(GT_LCL_ADDR) || OperIs(GT_FTN_ADDR); + return OperIsConst() || OperIs(GT_LCL_ADDR) || OperIs(GT_FTN_ADDR) || + (OperIs(GT_IND) && AsIndir()->IsInvariantLoad() && ((AsIndir()->gtFlags & GTF_SIDE_EFFECT) == 0)); } //------------------------------------------------------------------- From dc3948d77171d71a128361dd3a1b4413589b2235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Tue, 1 Oct 2024 18:31:51 +0200 Subject: [PATCH 03/17] Update importer.cpp --- src/coreclr/jit/importer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index e1f0b79a002ae3..ddbbde809359ec 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -13069,6 +13069,7 @@ void Compiler::impInlineRecordArgInfo(InlineInfo* pInlineInfo, if (impIsInvariant(curArgVal)) { inlCurArgInfo->argIsInvariant = true; + inlCurArgInfo->argIsConstant = !curArgVal->OperIs(GT_IND); if (inlCurArgInfo->argIsThis && (curArgVal->gtOper == GT_CNS_INT) && (curArgVal->AsIntCon()->gtIconVal == 0)) { // Abort inlining at this call site @@ -13079,6 +13080,7 @@ void Compiler::impInlineRecordArgInfo(InlineInfo* pInlineInfo, else if (gtIsTypeof(curArgVal)) { inlCurArgInfo->argIsInvariant = true; + inlCurArgInfo->argIsConstant = true; inlCurArgInfo->argHasSideEff = false; } From 3325ae08bcf24fc264e952bbb54fccbd8da9439e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Tue, 1 Oct 2024 18:32:31 +0200 Subject: [PATCH 04/17] Update inline.h --- src/coreclr/jit/inline.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/jit/inline.h b/src/coreclr/jit/inline.h index a2aeba6fed7254..d24e6a7d9c15e7 100644 --- a/src/coreclr/jit/inline.h +++ b/src/coreclr/jit/inline.h @@ -650,6 +650,7 @@ struct InlArgInfo unsigned argIsByRefToStructLocal : 1; // Is this arg an address of a struct local or a normed struct local or a // field in them? unsigned argIsExact : 1; // Is this arg of an exact class? + unsigned argIsConstant : 1; // the argument is a constant or a local variable address }; // InlLclVarInfo describes inline candidate argument and local variable properties. From 1d4066489844b33cbd417f9953217221099b46e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Tue, 1 Oct 2024 18:33:29 +0200 Subject: [PATCH 05/17] Update fgbasic.cpp --- src/coreclr/jit/fgbasic.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/jit/fgbasic.cpp b/src/coreclr/jit/fgbasic.cpp index 25d7919dd80c87..336c8244d36ede 100644 --- a/src/coreclr/jit/fgbasic.cpp +++ b/src/coreclr/jit/fgbasic.cpp @@ -2671,7 +2671,7 @@ void Compiler::fgObserveInlineConstants(OPCODE opcode, const FgStack& stack, boo // Check for the double whammy of an incoming constant argument // feeding a constant test. unsigned varNum = FgStack::SlotTypeToArgNum(slot0); - if (impInlineInfo->inlArgInfo[varNum].argIsInvariant) + if (impInlineInfo->inlArgInfo[varNum].argIsConstant) { compInlineResult->Note(InlineObservation::CALLSITE_CONSTANT_ARG_FEEDS_TEST); } @@ -2713,7 +2713,7 @@ void Compiler::fgObserveInlineConstants(OPCODE opcode, const FgStack& stack, boo compInlineResult->Note(InlineObservation::CALLEE_ARG_FEEDS_TEST); unsigned varNum = FgStack::SlotTypeToArgNum(slot0); - if (impInlineInfo->inlArgInfo[varNum].argIsInvariant) + if (impInlineInfo->inlArgInfo[varNum].argIsConstant) { compInlineResult->Note(InlineObservation::CALLSITE_CONSTANT_ARG_FEEDS_TEST); } @@ -2724,7 +2724,7 @@ void Compiler::fgObserveInlineConstants(OPCODE opcode, const FgStack& stack, boo compInlineResult->Note(InlineObservation::CALLEE_ARG_FEEDS_TEST); unsigned varNum = FgStack::SlotTypeToArgNum(slot1); - if (impInlineInfo->inlArgInfo[varNum].argIsInvariant) + if (impInlineInfo->inlArgInfo[varNum].argIsConstant) { compInlineResult->Note(InlineObservation::CALLSITE_CONSTANT_ARG_FEEDS_TEST); } From 64c05733d2bbd97d48f5edba0551da1a8a215cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:34:39 +0200 Subject: [PATCH 06/17] Update fgbasic.cpp --- src/coreclr/jit/fgbasic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/jit/fgbasic.cpp b/src/coreclr/jit/fgbasic.cpp index 336c8244d36ede..ded35303010582 100644 --- a/src/coreclr/jit/fgbasic.cpp +++ b/src/coreclr/jit/fgbasic.cpp @@ -853,7 +853,7 @@ class FgStack const unsigned argNum = value - SLOT_ARGUMENT; if (argNum < info->argCnt) { - return info->inlArgInfo[argNum].argIsInvariant; + return info->inlArgInfo[argNum].argIsConstant; } return false; } From 34bba9a5f3575bb87e40412cc4708a73a4239aca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:35:57 +0200 Subject: [PATCH 07/17] Update importer.cpp --- src/coreclr/jit/importer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index ddbbde809359ec..b2fdce51fa1773 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -13214,6 +13214,7 @@ void Compiler::impInlineInitVars(InlineInfo* pInlineInfo) if (arg.GetNode()->IsCnsIntOrI()) { ctxInfo->argIsInvariant = true; + ctxInfo->argIsConstant = true; } else { From 86711881f92b33810b95c1fd9d120716060ed27d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Fri, 4 Oct 2024 19:24:34 +0200 Subject: [PATCH 08/17] Update fgbasic.cpp --- src/coreclr/jit/fgbasic.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/jit/fgbasic.cpp b/src/coreclr/jit/fgbasic.cpp index ded35303010582..bba0f779260ff8 100644 --- a/src/coreclr/jit/fgbasic.cpp +++ b/src/coreclr/jit/fgbasic.cpp @@ -2671,7 +2671,7 @@ void Compiler::fgObserveInlineConstants(OPCODE opcode, const FgStack& stack, boo // Check for the double whammy of an incoming constant argument // feeding a constant test. unsigned varNum = FgStack::SlotTypeToArgNum(slot0); - if (impInlineInfo->inlArgInfo[varNum].argIsConstant) + if (impInlineInfo->inlArgInfo[varNum].argIsInvariant) { compInlineResult->Note(InlineObservation::CALLSITE_CONSTANT_ARG_FEEDS_TEST); } @@ -2713,7 +2713,7 @@ void Compiler::fgObserveInlineConstants(OPCODE opcode, const FgStack& stack, boo compInlineResult->Note(InlineObservation::CALLEE_ARG_FEEDS_TEST); unsigned varNum = FgStack::SlotTypeToArgNum(slot0); - if (impInlineInfo->inlArgInfo[varNum].argIsConstant) + if (impInlineInfo->inlArgInfo[varNum].argIsInvariant) { compInlineResult->Note(InlineObservation::CALLSITE_CONSTANT_ARG_FEEDS_TEST); } @@ -2724,7 +2724,7 @@ void Compiler::fgObserveInlineConstants(OPCODE opcode, const FgStack& stack, boo compInlineResult->Note(InlineObservation::CALLEE_ARG_FEEDS_TEST); unsigned varNum = FgStack::SlotTypeToArgNum(slot1); - if (impInlineInfo->inlArgInfo[varNum].argIsConstant) + if (impInlineInfo->inlArgInfo[varNum].argIsInvariant) { compInlineResult->Note(InlineObservation::CALLSITE_CONSTANT_ARG_FEEDS_TEST); } From 8b55a52e2e36748df67b24f005de8162e66e01bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Fri, 4 Oct 2024 20:42:56 +0200 Subject: [PATCH 09/17] Update inline.h --- src/coreclr/jit/inline.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/jit/inline.h b/src/coreclr/jit/inline.h index d24e6a7d9c15e7..16aa7757ebc471 100644 --- a/src/coreclr/jit/inline.h +++ b/src/coreclr/jit/inline.h @@ -638,7 +638,7 @@ struct InlArgInfo GenTree* argBashTmpNode; // tmp node created, if it may be replaced with actual arg unsigned argTmpNum; // the argument tmp number unsigned argIsUsed : 1; // is this arg used at all? - unsigned argIsInvariant : 1; // the argument is a constant or a local variable address + unsigned argIsInvariant : 1; // the argument is a constant, a local variable address or a static readonly field unsigned argIsLclVar : 1; // the argument is a local variable unsigned argIsThis : 1; // the argument is the 'this' pointer unsigned argHasSideEff : 1; // the argument has side effects From 64184e2ec505359694c05ec6a0dadaebf46bbe69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Fri, 4 Oct 2024 20:46:16 +0200 Subject: [PATCH 10/17] Update fgbasic.cpp --- src/coreclr/jit/fgbasic.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/jit/fgbasic.cpp b/src/coreclr/jit/fgbasic.cpp index bba0f779260ff8..5d4ab6a57f157c 100644 --- a/src/coreclr/jit/fgbasic.cpp +++ b/src/coreclr/jit/fgbasic.cpp @@ -853,6 +853,7 @@ class FgStack const unsigned argNum = value - SLOT_ARGUMENT; if (argNum < info->argCnt) { + assert(info->inlArgInfo[argNum].argIsInvariant); return info->inlArgInfo[argNum].argIsConstant; } return false; From d5ae1563b80ab34a5b31f64c6f3358e1324e0cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Sun, 6 Oct 2024 17:49:30 +0200 Subject: [PATCH 11/17] Update importer.cpp --- src/coreclr/jit/importer.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index b2fdce51fa1773..5c38e9ea30d85e 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -338,7 +338,8 @@ void Compiler::impAppendStmtCheck(Statement* stmt, unsigned chkLevel) { for (unsigned level = 0; level < chkLevel; level++) { - assert((verCurrentState.esStack[level].val->gtFlags & GTF_GLOB_EFFECT) == 0); + assert((verCurrentState.esStack[level].val->gtFlags & GTF_GLOB_EFFECT) == 0 || + impIsInvariant(verCurrentState.esStack[level].val))); } } @@ -361,7 +362,8 @@ void Compiler::impAppendStmtCheck(Statement* stmt, unsigned chkLevel) { for (unsigned level = 0; level < chkLevel; level++) { - assert((verCurrentState.esStack[level].val->gtFlags & GTF_GLOB_REF) == 0); + assert((verCurrentState.esStack[level].val->gtFlags & GTF_GLOB_REF) == 0 || + impIsInvariant(verCurrentState.esStack[level].val))); } } } @@ -1839,13 +1841,18 @@ void Compiler::impEvalSideEffects() void Compiler::impSpillSideEffect(bool spillGlobEffects, unsigned i DEBUGARG(const char* reason)) { assert(i <= verCurrentState.esStackDepth); + GenTree* tree = verCurrentState.esStack[i].val; + + if (impIsInvariant(tree)) + { + // No need to spill invariant trees like LCL_ADDR or static readonly loads + return; + } GenTreeFlags spillFlags = spillGlobEffects ? GTF_GLOB_EFFECT : GTF_SIDE_EFFECT; - GenTree* tree = verCurrentState.esStack[i].val; if ((tree->gtFlags & spillFlags) != 0 || (spillGlobEffects && // Only consider the following when spillGlobEffects == true - !impIsAddressInLocal(tree) && // No need to spill the LCL_ADDR nodes. gtHasLocalsWithAddrOp(tree))) // Spill if we still see GT_LCL_VAR that contains lvHasLdAddrOp or // lvAddrTaken flag. { From 3443adbac0599b3df6d33be55d9712a6019e75ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Sun, 6 Oct 2024 18:30:12 +0200 Subject: [PATCH 12/17] Update importer.cpp --- src/coreclr/jit/importer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 5c38e9ea30d85e..4af806a50df099 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -339,7 +339,7 @@ void Compiler::impAppendStmtCheck(Statement* stmt, unsigned chkLevel) for (unsigned level = 0; level < chkLevel; level++) { assert((verCurrentState.esStack[level].val->gtFlags & GTF_GLOB_EFFECT) == 0 || - impIsInvariant(verCurrentState.esStack[level].val))); + impIsInvariant(verCurrentState.esStack[level].val)); } } @@ -363,7 +363,7 @@ void Compiler::impAppendStmtCheck(Statement* stmt, unsigned chkLevel) for (unsigned level = 0; level < chkLevel; level++) { assert((verCurrentState.esStack[level].val->gtFlags & GTF_GLOB_REF) == 0 || - impIsInvariant(verCurrentState.esStack[level].val))); + impIsInvariant(verCurrentState.esStack[level].val)); } } } From 2524527fbe13afa86e5b3b785e3f7cbab22a8a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Mon, 7 Oct 2024 00:28:43 +0200 Subject: [PATCH 13/17] Update fgbasic.cpp --- src/coreclr/jit/fgbasic.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/fgbasic.cpp b/src/coreclr/jit/fgbasic.cpp index 5d4ab6a57f157c..445535f1d31227 100644 --- a/src/coreclr/jit/fgbasic.cpp +++ b/src/coreclr/jit/fgbasic.cpp @@ -851,10 +851,10 @@ class FgStack return false; } const unsigned argNum = value - SLOT_ARGUMENT; - if (argNum < info->argCnt) + if ((argNum < info->argCnt) && info->inlArgInfo[argNum].argIsConstant) { assert(info->inlArgInfo[argNum].argIsInvariant); - return info->inlArgInfo[argNum].argIsConstant; + return true; } return false; } From b5bac8596ada0d2a03c9b475e14b826bac9659b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Tue, 22 Oct 2024 03:19:05 +0200 Subject: [PATCH 14/17] Revert no longer needed changes --- src/coreclr/jit/importer.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 1599745a543a28..54ce5d121ccb62 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -338,8 +338,7 @@ void Compiler::impAppendStmtCheck(Statement* stmt, unsigned chkLevel) { for (unsigned level = 0; level < chkLevel; level++) { - assert((verCurrentState.esStack[level].val->gtFlags & GTF_GLOB_EFFECT) == 0 || - impIsInvariant(verCurrentState.esStack[level].val)); + assert((verCurrentState.esStack[level].val->gtFlags & GTF_GLOB_EFFECT) == 0); } } @@ -362,8 +361,7 @@ void Compiler::impAppendStmtCheck(Statement* stmt, unsigned chkLevel) { for (unsigned level = 0; level < chkLevel; level++) { - assert((verCurrentState.esStack[level].val->gtFlags & GTF_GLOB_REF) == 0 || - impIsInvariant(verCurrentState.esStack[level].val)); + assert((verCurrentState.esStack[level].val->gtFlags & GTF_GLOB_REF) == 0); } } } @@ -1841,18 +1839,13 @@ void Compiler::impEvalSideEffects() void Compiler::impSpillSideEffect(bool spillGlobEffects, unsigned i DEBUGARG(const char* reason)) { assert(i <= verCurrentState.esStackDepth); - GenTree* tree = verCurrentState.esStack[i].val; - - if (impIsInvariant(tree)) - { - // No need to spill invariant trees like LCL_ADDR or static readonly loads - return; - } GenTreeFlags spillFlags = spillGlobEffects ? GTF_GLOB_EFFECT : GTF_SIDE_EFFECT; + GenTree* tree = verCurrentState.esStack[i].val; if ((tree->gtFlags & spillFlags) != 0 || (spillGlobEffects && // Only consider the following when spillGlobEffects == true + !impIsAddressInLocal(tree) && // No need to spill the LCL_ADDR nodes. gtHasLocalsWithAddrOp(tree))) // Spill if we still see GT_LCL_VAR that contains lvHasLdAddrOp or // lvAddrTaken flag. { From 789acd40a894bc80668011890869af02b7528777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Tue, 22 Oct 2024 03:58:07 +0200 Subject: [PATCH 15/17] Reduce diffs --- src/coreclr/jit/fgbasic.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/fgbasic.cpp b/src/coreclr/jit/fgbasic.cpp index ab9866b860a465..786271a2730f14 100644 --- a/src/coreclr/jit/fgbasic.cpp +++ b/src/coreclr/jit/fgbasic.cpp @@ -2714,8 +2714,9 @@ void Compiler::fgObserveInlineConstants(OPCODE opcode, const FgStack& stack, boo compInlineResult->Note(InlineObservation::CALLEE_ARG_FEEDS_TEST); unsigned varNum = FgStack::SlotTypeToArgNum(slot0); - if (impInlineInfo->inlArgInfo[varNum].argIsInvariant) + if (impInlineInfo->inlArgInfo[varNum].argIsConstant) { + assert(impInlineInfo->inlArgInfo[varNum].argIsInvariant); compInlineResult->Note(InlineObservation::CALLSITE_CONSTANT_ARG_FEEDS_TEST); } } @@ -2725,8 +2726,9 @@ void Compiler::fgObserveInlineConstants(OPCODE opcode, const FgStack& stack, boo compInlineResult->Note(InlineObservation::CALLEE_ARG_FEEDS_TEST); unsigned varNum = FgStack::SlotTypeToArgNum(slot1); - if (impInlineInfo->inlArgInfo[varNum].argIsInvariant) + if (impInlineInfo->inlArgInfo[varNum].argIsConstant) { + assert(impInlineInfo->inlArgInfo[varNum].argIsInvariant); compInlineResult->Note(InlineObservation::CALLSITE_CONSTANT_ARG_FEEDS_TEST); } } From 33b5739a846cb2c34a325393db6f99b21732cba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= Date: Tue, 22 Oct 2024 17:24:18 +0200 Subject: [PATCH 16/17] Apply format --- src/coreclr/jit/inline.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/coreclr/jit/inline.h b/src/coreclr/jit/inline.h index 174b1e3f93752b..2fef508096a7b1 100644 --- a/src/coreclr/jit/inline.h +++ b/src/coreclr/jit/inline.h @@ -643,22 +643,22 @@ struct LateDevirtualizationInfo struct InlArgInfo { - CallArg* arg; // the caller argument - GenTree* argBashTmpNode; // tmp node created, if it may be replaced with actual arg - unsigned argTmpNum; // the argument tmp number - unsigned argIsUsed : 1; // is this arg used at all? - unsigned argIsInvariant : 1; // the argument is a constant, a local variable address or a static readonly field - unsigned argIsLclVar : 1; // the argument is a local variable - unsigned argIsThis : 1; // the argument is the 'this' pointer - unsigned argHasSideEff : 1; // the argument has side effects - unsigned argHasGlobRef : 1; // the argument has a global ref + CallArg* arg; // the caller argument + GenTree* argBashTmpNode; // tmp node created, if it may be replaced with actual arg + unsigned argTmpNum; // the argument tmp number + unsigned argIsUsed : 1; // is this arg used at all? + unsigned argIsInvariant : 1; // the argument is a constant, a local variable address or a static readonly field + unsigned argIsLclVar : 1; // the argument is a local variable + unsigned argIsThis : 1; // the argument is the 'this' pointer + unsigned argHasSideEff : 1; // the argument has side effects + unsigned argHasGlobRef : 1; // the argument has a global ref unsigned argHasCallerLocalRef : 1; // the argument value depends on an aliased caller local unsigned argHasTmp : 1; // the argument will be evaluated to a temp unsigned argHasLdargaOp : 1; // Is there LDARGA(s) operation on this argument? unsigned argHasStargOp : 1; // Is there STARG(s) operation on this argument? unsigned argIsByRefToStructLocal : 1; // Is this arg an address of a struct local or a normed struct local or a // field in them? - unsigned argIsExact : 1; // Is this arg of an exact class? + unsigned argIsExact : 1; // Is this arg of an exact class? unsigned argIsConstant : 1; // the argument is a constant or a local variable address }; From 0672b4673a663ee6210d64862aec78eb2866f0e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= Date: Wed, 23 Oct 2024 04:08:19 +0200 Subject: [PATCH 17/17] Reduce diffs --- src/coreclr/jit/fgbasic.cpp | 3 ++- src/coreclr/jit/gentree.cpp | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/jit/fgbasic.cpp b/src/coreclr/jit/fgbasic.cpp index 786271a2730f14..b6285e7a6424c1 100644 --- a/src/coreclr/jit/fgbasic.cpp +++ b/src/coreclr/jit/fgbasic.cpp @@ -2672,8 +2672,9 @@ void Compiler::fgObserveInlineConstants(OPCODE opcode, const FgStack& stack, boo // Check for the double whammy of an incoming constant argument // feeding a constant test. unsigned varNum = FgStack::SlotTypeToArgNum(slot0); - if (impInlineInfo->inlArgInfo[varNum].argIsInvariant) + if (impInlineInfo->inlArgInfo[varNum].argIsConstant) { + assert(impInlineInfo->inlArgInfo[varNum].argIsInvariant); compInlineResult->Note(InlineObservation::CALLSITE_CONSTANT_ARG_FEEDS_TEST); } } diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index aa3cda5735f9f6..748f31087980d0 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -30340,8 +30340,7 @@ bool GenTreeLclFld::IsOffsetMisaligned() const bool GenTree::IsInvariant() const { - return OperIsConst() || OperIs(GT_LCL_ADDR) || OperIs(GT_FTN_ADDR) || - (OperIs(GT_IND) && AsIndir()->IsInvariantLoad() && ((AsIndir()->gtFlags & GTF_SIDE_EFFECT) == 0)); + return OperIsConst() || OperIs(GT_LCL_ADDR) || OperIs(GT_FTN_ADDR); } //-------------------------------------------------------------------