Skip to content

Commit 98afcea

Browse files
committed
Improvements
1 parent d8e2d7c commit 98afcea

File tree

4 files changed

+40
-13
lines changed

4 files changed

+40
-13
lines changed

src/coreclr/jit/compiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10362,7 +10362,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1036210362
static fgWalkPreFn gsMarkPtrsAndAssignGroups; // Shadow param analysis tree-walk
1036310363
static fgWalkPreFn gsReplaceShadowParams; // Shadow param replacement tree-walk
1036410364

10365-
#define DEFAULT_MAX_INLINE_SIZE 200 // Methods with > DEFAULT_MAX_INLINE_SIZE IL bytes will never be inlined.
10365+
#define DEFAULT_MAX_INLINE_SIZE 500 // Methods with > DEFAULT_MAX_INLINE_SIZE IL bytes will never be inlined.
1036610366
// This can be overwritten by setting complus_JITInlineSize env variable.
1036710367

1036810368
#define DEFAULT_MAX_INLINE_DEPTH 20 // Methods at more than this level deep will not be inlined

src/coreclr/jit/fgbasic.cpp

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,8 +1465,9 @@ void Compiler::fgFindJumpTargets(const BYTE* codeAddr, IL_OFFSET codeSize, Fixed
14651465
{
14661466
compInlineResult->Note(InlineObservation::CALLSITE_FOLDABLE_BRANCH);
14671467
}
1468-
else if (FgStack::IsArgument(op1))
1468+
else
14691469
{
1470+
// E.g. brtrue is basically "if (X == 0)"
14701471
compInlineResult->Note(InlineObservation::CALLEE_BINARY_EXRP_WITH_CNS);
14711472
}
14721473
break;
@@ -1489,6 +1490,36 @@ void Compiler::fgFindJumpTargets(const BYTE* codeAddr, IL_OFFSET codeSize, Fixed
14891490
break;
14901491
}
14911492

1493+
case CEE_LDELEMA:
1494+
case CEE_LDELEM_I1:
1495+
case CEE_LDELEM_U1:
1496+
case CEE_LDELEM_I2:
1497+
case CEE_LDELEM_U2:
1498+
case CEE_LDELEM_I4:
1499+
case CEE_LDELEM_U4:
1500+
case CEE_LDELEM_I8:
1501+
case CEE_LDELEM_I:
1502+
case CEE_LDELEM_R4:
1503+
case CEE_LDELEM_R8:
1504+
case CEE_LDELEM_REF:
1505+
case CEE_STELEM_I:
1506+
case CEE_STELEM_I1:
1507+
case CEE_STELEM_I2:
1508+
case CEE_STELEM_I4:
1509+
case CEE_STELEM_I8:
1510+
case CEE_STELEM_R4:
1511+
case CEE_STELEM_R8:
1512+
case CEE_STELEM_REF:
1513+
case CEE_LDELEM:
1514+
case CEE_STELEM:
1515+
{
1516+
if (FgStack::IsArgument(pushedStack.Top()) || FgStack::IsArgument(pushedStack.Top(1)))
1517+
{
1518+
compInlineResult->Note(InlineObservation::CALLEE_ARG_FEEDS_RANGE_CHECK);
1519+
}
1520+
break;
1521+
}
1522+
14921523
case CEE_SWITCH:
14931524
{
14941525
if (makeInlineObservations)

src/coreclr/jit/importer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18983,6 +18983,7 @@ void Compiler::impMakeDiscretionaryInlineObservations(InlineInfo* pInlineInfo, I
1898318983
{
1898418984
inlineResult->Note(InlineObservation::CALLEE_CLASS_PROMOTABLE);
1898518985
}
18986+
inlineResult->Note(InlineObservation::CALLEE_CLASS_VALUETYPE);
1898618987
}
1898718988

1898818989
#ifdef FEATURE_SIMD

src/coreclr/jit/inlinepolicy.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -558,10 +558,7 @@ void DefaultPolicy::DumpXml(FILE* file, unsigned indent) const
558558
XATTR_I4(m_CallsiteDepth);
559559
XATTR_I4(m_InstructionCount);
560560
XATTR_I4(m_LoadStoreCount);
561-
XATTR_I4(m_ArgFeedsTest);
562-
XATTR_I4(m_ArgFeedsConstantTest);
563561
XATTR_I4(m_ArgFeedsRangeCheck);
564-
XATTR_I4(m_ConstantArgFeedsConstantTest);
565562
XATTR_I4(m_BinaryExprWithCns);
566563
XATTR_I4(m_ArgCasted);
567564
XATTR_I4(m_ArgIsStructByValue);
@@ -849,7 +846,7 @@ double DefaultPolicy::DetermineMultiplier()
849846

850847
if (m_IsFromValueClass)
851848
{
852-
multiplier += 3;
849+
multiplier += 5.0;
853850
JITDUMP("\nmultiplier in methods of struct increased to %g.", multiplier);
854851
}
855852

@@ -885,7 +882,7 @@ double DefaultPolicy::DetermineMultiplier()
885882
if (m_ReturnsStructByValue)
886883
{
887884
// For structs-passed-by-value we might avoid expensive copy operations if we inline
888-
multiplier += 2.0;
885+
multiplier += 5.0;
889886
JITDUMP("\nInline candidate returns a struct by value. Multiplier increased to %g.", multiplier);
890887
}
891888

@@ -912,7 +909,7 @@ double DefaultPolicy::DetermineMultiplier()
912909
// if (Math.Abs(arg0) > 10) { // same here
913910
// etc.
914911
//
915-
multiplier += 4.0 + m_FoldableBranch;
912+
multiplier += 4.0 + m_FoldableBranch * 1.5;
916913
JITDUMP("\nInline candidate has %d foldable branches. Multiplier increased to %g.", m_FoldableBranch,
917914
multiplier);
918915
}
@@ -926,10 +923,10 @@ double DefaultPolicy::DetermineMultiplier()
926923

927924
if (m_FldAccessOverArgStruct > 0)
928925
{
929-
multiplier += m_ArgCasted;
926+
multiplier += 2.0 + m_ArgCasted;
930927
// Such ldfld/stfld are cheap for promotable structs
931928
JITDUMP("\n%d ldfld or stfld over arguments which are structs. Multiplier increased to %g.",
932-
m_ArgIsStructByValue, multiplier);
929+
m_FldAccessOverArgStruct, multiplier);
933930
}
934931

935932
if (m_FoldableBox > 0)
@@ -956,7 +953,7 @@ double DefaultPolicy::DetermineMultiplier()
956953
// ceq
957954
//
958955
// so at least we can note potential constant tests
959-
multiplier += 1.5 + m_BinaryExprWithCns;
956+
multiplier += 2.5 + m_BinaryExprWithCns;
960957
JITDUMP("\nInline candidate has %d binary expressions with constants. Multiplier increased to %g.",
961958
m_BinaryExprWithCns, multiplier);
962959
}
@@ -2364,10 +2361,8 @@ void DiscretionaryPolicy::DumpData(FILE* file) const
23642361
fprintf(file, ",%u", m_IsFromPromotableValueClass ? 1 : 0);
23652362
fprintf(file, ",%u", m_HasSimd ? 1 : 0);
23662363
fprintf(file, ",%u", m_LooksLikeWrapperMethod ? 1 : 0);
2367-
fprintf(file, ",%u", m_ArgFeedsConstantTest);
23682364
fprintf(file, ",%u", m_MethodIsMostlyLoadStore ? 1 : 0);
23692365
fprintf(file, ",%u", m_ArgFeedsRangeCheck);
2370-
fprintf(file, ",%u", m_ConstantArgFeedsConstantTest);
23712366
fprintf(file, ",%d", m_CalleeNativeSizeEstimate);
23722367
fprintf(file, ",%d", m_CallsiteNativeSizeEstimate);
23732368
fprintf(file, ",%d", m_ModelCodeSizeEstimate);

0 commit comments

Comments
 (0)