From e606a7fcc3eae5fb9d2c0aa1f2a323df0b498dd0 Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Wed, 10 Jan 2024 12:54:14 +0100 Subject: [PATCH 1/3] JIT: Align newly recognized loops Also remove quirk when checking for inner-most loops. --- src/coreclr/jit/compiler.cpp | 25 +------------------------ src/coreclr/scripts/superpmi.py | 2 +- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index fcc8da7b792cf7..84f2edd9c7eb66 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -5231,21 +5231,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl #if FEATURE_LOOP_ALIGN -// TODO-Quirk: Remove -static bool HasOldChildLoop(Compiler* comp, FlowGraphNaturalLoop* loop) -{ - for (FlowGraphNaturalLoop* child = loop->GetChild(); child != nullptr; child = child->GetSibling()) - { - if (child->GetHeader()->HasFlag(BBF_OLD_LOOP_HEADER_QUIRK)) - return true; - - if (HasOldChildLoop(comp, child)) - return true; - } - - return false; -} - //------------------------------------------------------------------------ // shouldAlignLoop: Check if it is legal and profitable to align a loop. // @@ -5265,16 +5250,8 @@ static bool HasOldChildLoop(Compiler* comp, FlowGraphNaturalLoop* loop) // bool Compiler::shouldAlignLoop(FlowGraphNaturalLoop* loop, BasicBlock* top) { - // TODO-Quirk: Remove. When removing we will likely need to add some - // form of "lexicality" heuristic here: only align loops whose blocks - // are fairly tightly packed together physically. - if (!loop->GetHeader()->HasFlag(BBF_OLD_LOOP_HEADER_QUIRK)) - { - return false; - } - // TODO-Quirk: Switch to loop->GetChild() != nullptr - if (HasOldChildLoop(this, loop)) + if (loop->GetChild() != nullptr) { JITDUMP("Skipping alignment for " FMT_LP "; not an innermost loop\n", loop->GetIndex()); return false; diff --git a/src/coreclr/scripts/superpmi.py b/src/coreclr/scripts/superpmi.py index eb3de0734962a4..6fe21c584cb507 100644 --- a/src/coreclr/scripts/superpmi.py +++ b/src/coreclr/scripts/superpmi.py @@ -1971,7 +1971,7 @@ def replay_with_asm_diffs(self): # These vars are force overridden in the SPMI runs for both the base and diff, always. replay_vars = { - "DOTNET_JitAlignLoops": "0", # disable loop alignment to filter noise + #"DOTNET_JitAlignLoops": "0", # disable loop alignment to filter noise "DOTNET_JitEnableNoWayAssert": "1", "DOTNET_JitNoForceFallback": "1", } From 6f395daee709854bf8de601b92ba4f6b931a8bd5 Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Wed, 10 Jan 2024 13:28:41 +0100 Subject: [PATCH 2/3] Nit --- src/coreclr/jit/compiler.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index 84f2edd9c7eb66..2a6abc11be7d67 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -5250,7 +5250,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl // bool Compiler::shouldAlignLoop(FlowGraphNaturalLoop* loop, BasicBlock* top) { - // TODO-Quirk: Switch to loop->GetChild() != nullptr if (loop->GetChild() != nullptr) { JITDUMP("Skipping alignment for " FMT_LP "; not an innermost loop\n", loop->GetIndex()); From 8046426ca5890afe17d1a87a76f3d80abf516cb2 Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Thu, 11 Jan 2024 08:03:07 +0100 Subject: [PATCH 3/3] Update superpmi.py --- src/coreclr/scripts/superpmi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/scripts/superpmi.py b/src/coreclr/scripts/superpmi.py index 8c70338cdbb3a2..23bd265620dfdb 100644 --- a/src/coreclr/scripts/superpmi.py +++ b/src/coreclr/scripts/superpmi.py @@ -1971,7 +1971,7 @@ def replay_with_asm_diffs(self): # These vars are force overridden in the SPMI runs for both the base and diff, always. replay_vars = { - #"DOTNET_JitAlignLoops": "0", # disable loop alignment to filter noise + "DOTNET_JitAlignLoops": "0", # disable loop alignment to filter noise "DOTNET_JitEnableNoWayAssert": "1", "DOTNET_JitNoForceFallback": "1", }