Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit29efda6

Browse files
authored
Merge branch 'main' into linqtoarray
2 parents548de22 +0823c5c commit29efda6

File tree

50 files changed

+513
-563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+513
-563
lines changed

‎src/coreclr/jit/lower.cpp‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,8 @@ GenTree* Lowering::LowerNode(GenTree* node)
500500
case GT_NEG:
501501
#ifdef TARGET_ARM64
502502
{
503-
GenTree* next =TryLowerNegToMulLongOp(node->AsOp());
504-
if (next !=nullptr)
503+
GenTree* next;
504+
if (TryLowerNegToMulLongOp(node->AsOp(), &next))
505505
{
506506
return next;
507507
}
@@ -6384,14 +6384,13 @@ GenTree* Lowering::LowerAdd(GenTreeOp* node)
63846384
#ifdef TARGET_ARM64
63856385
if (node->OperIs(GT_ADD))
63866386
{
6387-
GenTree* next =LowerAddForPossibleContainment(node);
6388-
if (next !=nullptr)
6387+
GenTree* next;
6388+
if (TryLowerAddForPossibleContainment(node, &next))
63896389
{
63906390
return next;
63916391
}
63926392

6393-
next =TryLowerAddSubToMulLongOp(node);
6394-
if (next !=nullptr)
6393+
if (TryLowerAddSubToMulLongOp(node, &next))
63956394
{
63966395
return next;
63976396
}

‎src/coreclr/jit/lower.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ class Lowering final : public Phase
8888
voidContainCheckLclHeap(GenTreeOp* node);
8989
voidContainCheckRet(GenTreeUnOp* ret);
9090
#ifdef TARGET_ARM64
91-
GenTree*TryLowerAndOrToCCMP(GenTreeOp* tree);
91+
boolTryLowerAndOrToCCMP(GenTreeOp* tree, GenTree** next);
9292
insCflagsTruthifyingFlags(GenCondition cond);
9393
voidContainCheckConditionalCompare(GenTreeCCMP* ccmp);
9494
voidContainCheckNeg(GenTreeOp* neg);
9595
voidTryLowerCnsIntCselToCinc(GenTreeOp* select, GenTree* cond);
9696
voidTryLowerCselToCSOp(GenTreeOp* select, GenTree* cond);
97-
GenTree*TryLowerAddSubToMulLongOp(GenTreeOp* op);
98-
GenTree*TryLowerNegToMulLongOp(GenTreeOp* op);
97+
boolTryLowerAddSubToMulLongOp(GenTreeOp* op, GenTree** next);
98+
boolTryLowerNegToMulLongOp(GenTreeOp* op, GenTree** next);
9999
#endif
100100
voidContainCheckSelect(GenTreeOp* select);
101101
voidContainCheckBitCast(GenTree* node);
@@ -386,7 +386,7 @@ class Lowering final : public Phase
386386
boolIsValidConstForMovImm(GenTreeHWIntrinsic* node);
387387
voidLowerHWIntrinsicFusedMultiplyAddScalar(GenTreeHWIntrinsic* node);
388388
voidLowerModPow2(GenTree* node);
389-
GenTree*LowerAddForPossibleContainment(GenTreeOp* node);
389+
boolTryLowerAddForPossibleContainment(GenTreeOp* node, GenTree** next);
390390
#endif// !TARGET_XARCH && !TARGET_ARM64
391391
GenTree*InsertNewSimdCreateScalarUnsafeNode(var_types type,
392392
GenTree* op1,

‎src/coreclr/jit/lowerarmarch.cpp‎

Lines changed: 64 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,8 @@ GenTree* Lowering::LowerBinaryArithmetic(GenTreeOp* binOp)
526526
#ifdef TARGET_ARM64
527527
if (binOp->OperIs(GT_AND, GT_OR))
528528
{
529-
GenTree* next =TryLowerAndOrToCCMP(binOp);
530-
if (next !=nullptr)
529+
GenTree* next;
530+
if (TryLowerAndOrToCCMP(binOp, &next))
531531
{
532532
return next;
533533
}
@@ -536,8 +536,8 @@ GenTree* Lowering::LowerBinaryArithmetic(GenTreeOp* binOp)
536536
if (binOp->OperIs(GT_SUB))
537537
{
538538
// Attempt to optimize for umsubl/smsubl.
539-
GenTree* next =TryLowerAddSubToMulLongOp(binOp);
540-
if (next !=nullptr)
539+
GenTree* next;
540+
if (TryLowerAddSubToMulLongOp(binOp, &next))
541541
{
542542
return next;
543543
}
@@ -957,25 +957,29 @@ void Lowering::LowerModPow2(GenTree* node)
957957
//
958958
// Arguments:
959959
// node - the node to lower
960+
// next - [out] Next node to lower if this function returns true
960961
//
961-
GenTree*Lowering::LowerAddForPossibleContainment(GenTreeOp* node)
962+
// Return Value:
963+
// false if no changes were made
964+
//
965+
boolLowering::TryLowerAddForPossibleContainment(GenTreeOp* node, GenTree** next)
962966
{
963967
assert(node->OperIs(GT_ADD));
964968

965969
if (!comp->opts.OptimizationEnabled())
966-
returnnullptr;
970+
returnfalse;
967971

968972
if (node->isContained())
969-
returnnullptr;
973+
returnfalse;
970974

971975
if (!varTypeIsIntegral(node))
972-
returnnullptr;
976+
returnfalse;
973977

974978
if (node->gtFlags & GTF_SET_FLAGS)
975-
returnnullptr;
979+
returnfalse;
976980

977981
if (node->gtOverflow())
978-
returnnullptr;
982+
returnfalse;
979983

980984
GenTree* op1 = node->gtGetOp1();
981985
GenTree* op2 = node->gtGetOp2();
@@ -984,7 +988,7 @@ GenTree* Lowering::LowerAddForPossibleContainment(GenTreeOp* node)
984988
// then we do not want to risk moving it around
985989
// in this transformation.
986990
if (IsContainableImmed(node, op2))
987-
returnnullptr;
991+
returnfalse;
988992

989993
GenTree* mul =nullptr;
990994
GenTree* c =nullptr;
@@ -1018,7 +1022,8 @@ GenTree* Lowering::LowerAddForPossibleContainment(GenTreeOp* node)
10181022

10191023
ContainCheckNode(node);
10201024

1021-
return node->gtNext;
1025+
*next = node->gtNext;
1026+
returntrue;
10221027
}
10231028
// Transform "a * -b + c" to "c - a * b"
10241029
elseif (b->OperIs(GT_NEG) && !(b->gtFlags & GTF_SET_FLAGS) && !a->OperIs(GT_NEG) && !b->isContained() &&
@@ -1032,7 +1037,8 @@ GenTree* Lowering::LowerAddForPossibleContainment(GenTreeOp* node)
10321037

10331038
ContainCheckNode(node);
10341039

1035-
return node->gtNext;
1040+
*next = node->gtNext;
1041+
returntrue;
10361042
}
10371043
// Transform "a * b + c" to "c + a * b"
10381044
elseif (op1->OperIs(GT_MUL))
@@ -1042,11 +1048,12 @@ GenTree* Lowering::LowerAddForPossibleContainment(GenTreeOp* node)
10421048

10431049
ContainCheckNode(node);
10441050

1045-
return node->gtNext;
1051+
*next = node->gtNext;
1052+
returntrue;
10461053
}
10471054
}
10481055

1049-
returnnullptr;
1056+
returnfalse;
10501057
}
10511058
#endif
10521059

@@ -2349,14 +2356,18 @@ void Lowering::ContainCheckCompare(GenTreeOp* cmp)
23492356
//
23502357
// Arguments:
23512358
// tree - pointer to the node
2359+
// next - [out] Next node to lower if this function returns true
2360+
//
2361+
// Return Value:
2362+
// false if no changes were made
23522363
//
2353-
GenTree*Lowering::TryLowerAndOrToCCMP(GenTreeOp* tree)
2364+
boolLowering::TryLowerAndOrToCCMP(GenTreeOp* tree, GenTree** next)
23542365
{
23552366
assert(tree->OperIs(GT_AND, GT_OR));
23562367

23572368
if (!comp->opts.OptimizationEnabled())
23582369
{
2359-
returnnullptr;
2370+
returnfalse;
23602371
}
23612372

23622373
GenTree* op1 = tree->gtGetOp1();
@@ -2395,7 +2406,7 @@ GenTree* Lowering::TryLowerAndOrToCCMP(GenTreeOp* tree)
23952406
{
23962407
JITDUMP(" ..could not turn [%06u] or [%06u] into a def of flags, bailing\n",Compiler::dspTreeID(op1),
23972408
Compiler::dspTreeID(op2));
2398-
returnnullptr;
2409+
returnfalse;
23992410
}
24002411

24012412
BlockRange().Remove(op2);
@@ -2437,7 +2448,8 @@ GenTree* Lowering::TryLowerAndOrToCCMP(GenTreeOp* tree)
24372448
DISPTREERANGE(BlockRange(), tree);
24382449
JITDUMP("\n");
24392450

2440-
return tree->gtNext;
2451+
*next = tree->gtNext;
2452+
returntrue;
24412453
}
24422454

24432455
//------------------------------------------------------------------------
@@ -2781,32 +2793,33 @@ void Lowering::TryLowerCnsIntCselToCinc(GenTreeOp* select, GenTree* cond)
27812793
// - One op is a MUL_LONG containing two integer operands, and the other is a long.
27822794
//
27832795
// Arguments:
2784-
// op - The ADD or SUB node to attempt an optimisation on.
2796+
// op - The ADD or SUB node to attempt an optimisation on.
2797+
// next - [out] Next node to lower if this function returns true
27852798
//
2786-
//Returns:
2787-
// A pointer to the next node to evaluate. Onnooperation, returns nullptr.
2799+
//Return Value:
2800+
//false ifnochanges were made
27882801
//
2789-
GenTree*Lowering::TryLowerAddSubToMulLongOp(GenTreeOp* op)
2802+
boolLowering::TryLowerAddSubToMulLongOp(GenTreeOp* op, GenTree** next)
27902803
{
27912804
assert(op->OperIs(GT_ADD, GT_SUB));
27922805

27932806
if (!comp->opts.OptimizationEnabled())
2794-
returnnullptr;
2807+
returnfalse;
27952808

27962809
if (!comp->compOpportunisticallyDependsOn(InstructionSet_ArmBase_Arm64))
2797-
returnnullptr;
2810+
returnfalse;
27982811

27992812
if (op->isContained())
2800-
returnnullptr;
2813+
returnfalse;
28012814

28022815
if (!varTypeIsIntegral(op))
2803-
returnnullptr;
2816+
returnfalse;
28042817

28052818
if ((op->gtFlags & GTF_SET_FLAGS) !=0)
2806-
returnnullptr;
2819+
returnfalse;
28072820

28082821
if (op->gtOverflow())
2809-
returnnullptr;
2822+
returnfalse;
28102823

28112824
GenTree* op1 = op->gtGetOp1();
28122825
GenTree* op2 = op->gtGetOp2();
@@ -2820,7 +2833,7 @@ GenTree* Lowering::TryLowerAddSubToMulLongOp(GenTreeOp* op)
28202833
// addValue - (mulValue1 * mulValue2)
28212834
if (op->OperIs(GT_SUB))
28222835
{
2823-
returnnullptr;
2836+
returnfalse;
28242837
}
28252838

28262839
mul = op1->AsOp();
@@ -2834,20 +2847,20 @@ GenTree* Lowering::TryLowerAddSubToMulLongOp(GenTreeOp* op)
28342847
else
28352848
{
28362849
// Exit if neither operation are GT_MUL_LONG.
2837-
returnnullptr;
2850+
returnfalse;
28382851
}
28392852

28402853
// Additional value must be of long size.
28412854
if (!addVal->TypeIs(TYP_LONG))
2842-
returnnullptr;
2855+
returnfalse;
28432856

28442857
// Mul values must both be integers.
28452858
if (!genActualTypeIsInt(mul->gtOp1) || !genActualTypeIsInt(mul->gtOp2))
2846-
returnnullptr;
2859+
returnfalse;
28472860

28482861
// The multiply must evaluate to the same thing if moved.
28492862
if (!IsInvariantInRange(mul, op))
2850-
returnnullptr;
2863+
returnfalse;
28512864

28522865
// Create the new node and replace the original.
28532866
NamedIntrinsic intrinsicId =
@@ -2870,14 +2883,13 @@ GenTree* Lowering::TryLowerAddSubToMulLongOp(GenTreeOp* op)
28702883
BlockRange().Remove(mul);
28712884
BlockRange().Remove(op);
28722885

2873-
#ifdef DEBUG
28742886
JITDUMP("Converted to HW_INTRINSIC 'NI_ArmBase_Arm64_MultiplyLong[Add/Sub]'.\n");
28752887
JITDUMP(":\n");
28762888
DISPTREERANGE(BlockRange(), outOp);
28772889
JITDUMP("\n");
2878-
#endif
28792890

2880-
return outOp;
2891+
*next = outOp;
2892+
returntrue;
28812893
}
28822894

28832895
//----------------------------------------------------------------------------------------------
@@ -2887,44 +2899,45 @@ GenTree* Lowering::TryLowerAddSubToMulLongOp(GenTreeOp* op)
28872899
// - op1 is a MUL_LONG containing two integer operands.
28882900
//
28892901
// Arguments:
2890-
// op - The NEG node to attempt an optimisation on.
2902+
// op - The NEG node to attempt an optimisation on.
2903+
// next - [out] Next node to lower if this function returns true
28912904
//
2892-
//Returns:
2893-
// A pointer to the next node to evaluate. Onnooperation, returns nullptr.
2905+
//Return Value:
2906+
//false ifnochanges were made
28942907
//
2895-
GenTree*Lowering::TryLowerNegToMulLongOp(GenTreeOp* op)
2908+
boolLowering::TryLowerNegToMulLongOp(GenTreeOp* op, GenTree** next)
28962909
{
28972910
assert(op->OperIs(GT_NEG));
28982911

28992912
if (!comp->opts.OptimizationEnabled())
2900-
returnnullptr;
2913+
returnfalse;
29012914

29022915
if (!comp->compOpportunisticallyDependsOn(InstructionSet_ArmBase_Arm64))
2903-
returnnullptr;
2916+
returnfalse;
29042917

29052918
if (op->isContained())
2906-
returnnullptr;
2919+
returnfalse;
29072920

29082921
if (!varTypeIsIntegral(op))
2909-
returnnullptr;
2922+
returnfalse;
29102923

29112924
if ((op->gtFlags & GTF_SET_FLAGS) !=0)
2912-
returnnullptr;
2925+
returnfalse;
29132926

29142927
GenTree* op1 = op->gtGetOp1();
29152928

29162929
// Ensure the negated operand is a MUL_LONG.
29172930
if (!op1->OperIs(GT_MUL_LONG))
2918-
returnnullptr;
2931+
returnfalse;
29192932

29202933
// Ensure the MUL_LONG contains two integer parameters.
29212934
GenTreeOp* mul = op1->AsOp();
29222935
if (!genActualTypeIsInt(mul->gtOp1) || !genActualTypeIsInt(mul->gtOp2))
2923-
returnnullptr;
2936+
returnfalse;
29242937

29252938
// The multiply must evaluate to the same thing if evaluated at 'op'.
29262939
if (!IsInvariantInRange(mul, op))
2927-
returnnullptr;
2940+
returnfalse;
29282941

29292942
// Able to optimise, create the new node and replace the original.
29302943
GenTreeHWIntrinsic* outOp =
@@ -2953,7 +2966,8 @@ GenTree* Lowering::TryLowerNegToMulLongOp(GenTreeOp* op)
29532966
JITDUMP("\n");
29542967
#endif
29552968

2956-
return outOp;
2969+
*next = outOp;
2970+
returntrue;
29572971
}
29582972
#endif// TARGET_ARM64
29592973

‎src/libraries/System.Linq.Parallel/tests/QueryOperators/AsEnumerableTests.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public static void AsEnumerable_LinqBinding(Labeled<ParallelQuery<int>> labeled,
5757
Assert.IsNotType<ParallelQuery<int>>(enumerable.Cast<int>());
5858
Assert.True(enumerable.Cast<int>()isParallelQuery<int>);
5959

60-
Assert.False(enumerable.Concat(Enumerable.Range(0,count))isParallelQuery<int>);
6160
Assert.False(enumerable.DefaultIfEmpty()isParallelQuery<int>);
6261
Assert.False(enumerable.Distinct()isParallelQuery<int>);
6362
Assert.False(enumerable.Except(Enumerable.Range(0,count))isParallelQuery<int>);

‎src/libraries/System.Linq.Parallel/tests/QueryOperators/AsSequentialTests.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public static void AsSequential_LinqBinding(Labeled<ParallelQuery<int>> labeled,
5757
Assert.IsNotType<ParallelQuery<int>>(seq.Cast<int>());
5858
Assert.True(seq.Cast<int>()isParallelQuery<int>);
5959

60-
Assert.False(seq.Concat(Enumerable.Range(0,count))isParallelQuery<int>);
6160
Assert.False(seq.DefaultIfEmpty()isParallelQuery<int>);
6261
Assert.False(seq.Distinct()isParallelQuery<int>);
6362
Assert.False(seq.Except(Enumerable.Range(0,count))isParallelQuery<int>);

‎src/libraries/System.Linq/src/System.Linq.csproj‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
</PropertyGroup>
1313

1414
<ItemGroupCondition="'$(OptimizeForSize)' == true">
15-
<CompileInclude="System\Linq\Enumerable.SizeOpt.cs" />
1615
<CompileInclude="System\Linq\Skip.SizeOpt.cs" />
1716
<CompileInclude="System\Linq\Take.SizeOpt.cs" />
1817
</ItemGroup>
@@ -22,7 +21,6 @@
2221
<CompileInclude="System\Linq\Concat.SpeedOpt.cs" />
2322
<CompileInclude="System\Linq\DefaultIfEmpty.SpeedOpt.cs" />
2423
<CompileInclude="System\Linq\Distinct.SpeedOpt.cs" />
25-
<CompileInclude="System\Linq\Enumerable.SpeedOpt.cs" />
2624
<CompileInclude="System\Linq\Grouping.SpeedOpt.cs" />
2725
<CompileInclude="System\Linq\Lookup.SpeedOpt.cs" />
2826
<CompileInclude="System\Linq\OrderedEnumerable.SpeedOpt.cs" />

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp