Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6294,6 +6294,10 @@ PhaseStatus Compiler::optAssertionPropMain()
madeChanges |= optCreateJumpTableImpliedAssertions(switchBlock);
}

assert(!optLocalAssertionProp);
Metrics.GlobalAssertionCount = optAssertionCount;
Metrics.GlobalAssertionOverflow = optAssertionOverflow;

if (optAssertionCount == 0)
{
// Zero out the bbAssertionIn values, as these can be referenced in RangeCheck::MergeAssertion
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/jit/jitmetadatalist.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ JITMETADATAMETRIC(NewArrayHelperCalls, int, 0)
JITMETADATAMETRIC(StackAllocatedArrays, int, 0)
JITMETADATAMETRIC(LocalAssertionCount, int, 0)
JITMETADATAMETRIC(LocalAssertionOverflow, int, 0)
JITMETADATAMETRIC(GlobalAssertionCount, int, 0)
JITMETADATAMETRIC(GlobalAssertionOverflow, int, 0)
JITMETADATAMETRIC(MorphTrackedLocals, int, 0)
JITMETADATAMETRIC(MorphLocals, int, 0)
JITMETADATAMETRIC(EnumeratorGDVProvisionalNoEscape, int, 0)
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/jit/optcse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4866,6 +4866,14 @@ void CSE_HeuristicCommon::PerformCSE(CSE_Candidate* successfulCandidate)
lclDsc->lvType = cseLclVarTyp;
lclDsc->lvIsCSE = true;

// Propagate IsNeverNegative from the CSE expression to the temp.
// Mainly targeting Span.Length.
if (cseLclVarTyp == TYP_INT && successfulCandidate->Expr()->OperIs(GT_IND, GT_LCL_VAR) &&
successfulCandidate->Expr()->IsNeverNegative(m_compiler))
{
lclDsc->SetIsNeverNegative(true);
}

// Record that we created a new LclVar for use as a CSE temp
//
m_addCSEcount++;
Expand Down
Loading