From b1b70691f968fe0d8fe635fe13f7d2db1387958f Mon Sep 17 00:00:00 2001 From: Marc Brooks Date: Wed, 28 Jun 2023 19:29:24 -0500 Subject: [PATCH 1/2] Remove redundant call Call to `type.ConvertToCanonForm(CanonicalFormKind.Specific)` is redundant as we just computed the `canonType` two lines up. Reuse the computed value --- .../Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs index 55cfdaba36c12..87c0a036297f0 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs @@ -106,7 +106,7 @@ internal static void AddSignatureDependency(ref DependencyList dependencies, Nod TypeDesc canonType = type.ConvertToCanonForm(CanonicalFormKind.Specific); if (canonType.IsCanonicalSubtype(CanonicalFormKind.Any)) - GenericTypesTemplateMap.GetTemplateTypeDependencies(ref dependencies, factory, type.ConvertToCanonForm(CanonicalFormKind.Specific)); + GenericTypesTemplateMap.GetTemplateTypeDependencies(ref dependencies, factory, canonType); else dependencies.Add(factory.MaximallyConstructableType(canonType), reason); } From f3aa150e2b43579b7641dadc4dfb6eeb0d87449a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Thu, 29 Jun 2023 09:34:48 +0900 Subject: [PATCH 2/2] Update src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs --- .../Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs index 87c0a036297f0..5014526b677de 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs @@ -108,7 +108,7 @@ internal static void AddSignatureDependency(ref DependencyList dependencies, Nod if (canonType.IsCanonicalSubtype(CanonicalFormKind.Any)) GenericTypesTemplateMap.GetTemplateTypeDependencies(ref dependencies, factory, canonType); else - dependencies.Add(factory.MaximallyConstructableType(canonType), reason); + dependencies.Add(factory.MaximallyConstructableType(type), reason); } public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)