Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f5bc205
tmp
EgorBo Dec 2, 2021
2757d64
Merge branch 'main' of https://github.com/dotnet/runtime into span-bo…
EgorBo Dec 14, 2021
1556eb8
Handle bound checks for ((uint)index cmp CNS) pattern
EgorBo Dec 15, 2021
be074e4
Fix typo
EgorBo Dec 15, 2021
1b14746
Fix build error
EgorBo Dec 15, 2021
31ab6d5
Fix 32bit platforms
EgorBo Dec 16, 2021
1b06196
Fix 32bit again
EgorBo Dec 16, 2021
81b5232
Update morph.cpp
EgorBo Dec 16, 2021
b13b852
Update morph.cpp
EgorBo Dec 16, 2021
fc5ceb2
Clean up
EgorBo Dec 17, 2021
1e14f8e
Clean up
EgorBo Dec 17, 2021
53a6405
Move to fgOptimizeRelationalComparisonWithCasts
EgorBo Dec 17, 2021
747339c
fix 32bit again
EgorBo Dec 17, 2021
f4b1ffa
fix SetUnsigned
EgorBo Dec 17, 2021
58f4f68
Clean up
EgorBo Dec 18, 2021
b9e68b0
Update morph.cpp
EgorBo Dec 18, 2021
929e53b
Merge branch 'main' of https://github.com/dotnet/runtime into bound-c…
EgorBo Dec 19, 2021
f4e82ce
test
EgorBo Dec 19, 2021
abc7d54
Introduce O1K_CONSTANT_LOOP_BND_UN
EgorBo Dec 19, 2021
3bf8534
Merge branch 'main' of https://github.com/dotnet/runtime into bound-c…
EgorBo Dec 19, 2021
aecf6a4
Update assertionprop.cpp
EgorBo Dec 20, 2021
96376f6
Merge branch 'bound-checks-constant-len' of https://github.com/EgorBo…
EgorBo Jan 15, 2022
1c9f406
Merge branch 'main' of https://github.com/dotnet/runtime into bound-c…
EgorBo Jan 27, 2022
ff58212
resolve conflicts
EgorBo Jan 27, 2022
61b1fa1
fix newline
EgorBo Jan 27, 2022
8ba164d
Merge branch 'main' of https://github.com/dotnet/runtime into bound-c…
EgorBo Jan 27, 2022
e4fff61
Merge branch 'main' of https://github.com/dotnet/runtime into bound-c…
EgorBo Feb 15, 2022
f2aa51a
Merge branch 'main' of https://github.com/dotnet/runtime into bound-c…
EgorBo Feb 18, 2022
58cec64
Address feedback
EgorBo Feb 18, 2022
10d9a0d
Apply suggestions from code review
EgorBo Feb 24, 2022
20505fd
Merge branch 'main' of https://github.com/dotnet/runtime into bound-c…
EgorBo Feb 24, 2022
a643eb6
Apply suggestions
EgorBo Feb 24, 2022
ffadcd7
use bashtoconst
EgorBo Feb 24, 2022
d2518c2
use bashtoconst
EgorBo Feb 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: SingleAccretion <[email protected]>
  • Loading branch information
EgorBo and SingleAccretion authored Feb 24, 2022
commit 10d9a0d2e4711ff1ffc2ceed9d6c27646318ea2b
17 changes: 8 additions & 9 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14031,7 +14031,7 @@ GenTree* Compiler::fgOptimizeRelationalComparisonWithCasts(GenTreeOp* tree)

bool knownPositiveIsOp2;
if (knownPositiveOp->IsIntegralConst() ||
((knownPositiveOp->OperIs(GT_CAST) && knownPositiveOp->gtGetOp1()->OperIs(GT_ARR_LENGTH))))
((knownPositiveOp->OperIs(GT_CAST) && knownPositiveOp->AsCast()->CastOp()->OperIs(GT_ARR_LENGTH))))
{
// op2 is either a LONG constant or (T)ARR_LENGTH
knownPositiveIsOp2 = true;
Expand All @@ -14045,7 +14045,7 @@ GenTree* Compiler::fgOptimizeRelationalComparisonWithCasts(GenTreeOp* tree)
knownPositiveIsOp2 = false;
}

if (castedOp->OperIs(GT_CAST) && varTypeIsLong(castedOp->CastToType()) && castedOp->gtGetOp1()->TypeIs(TYP_INT) &&
if (castedOp->OperIs(GT_CAST) && varTypeIsLong(castedOp->CastToType()) && castedOp->AsCast()->CastOp()->TypeIs(TYP_INT) &&
castedOp->IsUnsigned() && !castedOp->gtOverflow())
{
bool knownPositiveFitsIntoU32 = false;
Expand All @@ -14056,11 +14056,10 @@ GenTree* Compiler::fgOptimizeRelationalComparisonWithCasts(GenTreeOp* tree)
knownPositiveFitsIntoU32 = true;
}
else if (knownPositiveOp->OperIs(GT_CAST) && varTypeIsLong(knownPositiveOp->CastToType()) &&
knownPositiveOp->gtGetOp1()->OperIs(GT_ARR_LENGTH))
knownPositiveOp->AsCast()->CastOp()->OperIs(GT_ARR_LENGTH))
{
knownPositiveFitsIntoU32 = true;
// TODO: we need to recognize Span._length here as well
// https://github.com/dotnet/runtime/issues/59922#issuecomment-933495507
// TODO-Casts: recognize Span.Length here as well.
}

if (!knownPositiveFitsIntoU32)
Expand All @@ -14077,11 +14076,11 @@ GenTree* Compiler::fgOptimizeRelationalComparisonWithCasts(GenTreeOp* tree)
// Drop cast from castedOp
if (knownPositiveIsOp2)
{
tree->gtOp1 = castedOp->gtGetOp1();
tree->gtOp1 = castedOp->AsCast()->CastOp();
}
else
{
tree->gtOp2 = castedOp->gtGetOp1();
tree->gtOp2 = castedOp->AsCast()->CastOp();
}
DEBUG_DESTROY_NODE(castedOp);

Expand All @@ -14090,11 +14089,11 @@ GenTree* Compiler::fgOptimizeRelationalComparisonWithCasts(GenTreeOp* tree)
// Drop cast from knownPositiveOp too
if (knownPositiveIsOp2)
{
tree->gtOp2 = knownPositiveOp->gtGetOp1();
tree->gtOp2 = knownPositiveOp->AsCast()->CastOp();
}
else
{
tree->gtOp1 = knownPositiveOp->gtGetOp1();
tree->gtOp1 = knownPositiveOp->AsCast()->CastOp();
}
DEBUG_DESTROY_NODE(knownPositiveOp);
}
Expand Down