Skip to content
Merged
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
17 changes: 17 additions & 0 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@ bool IntegralRange::Contains(int64_t value) const
}
break;

case GT_CNS_INT:
if (node->IsIntegralConst(0) || node->IsIntegralConst(1))
{
return {SymbolicIntegerValue::Zero, SymbolicIntegerValue::One};
}
break;

case GT_QMARK:
return Union(ForNode(node->AsQmark()->ThenNode(), compiler),
ForNode(node->AsQmark()->ElseNode(), compiler));

case GT_CAST:
return ForCastOutput(node->AsCast());

Expand Down Expand Up @@ -430,6 +441,12 @@ bool IntegralRange::Contains(int64_t value) const
return {lowerBound, upperBound};
}

/* static */ IntegralRange IntegralRange::Union(IntegralRange range1, IntegralRange range2)
{
return IntegralRange(min(range1.GetLowerBound(), range2.GetLowerBound()),
max(range1.GetUpperBound(), range2.GetUpperBound()));
}

#ifdef DEBUG
/* static */ void IntegralRange::Print(IntegralRange range)
{
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,7 @@ class IntegralRange
static IntegralRange ForNode(GenTree* node, Compiler* compiler);
static IntegralRange ForCastInput(GenTreeCast* cast);
static IntegralRange ForCastOutput(GenTreeCast* cast);
static IntegralRange Union(IntegralRange range1, IntegralRange range2);

#ifdef DEBUG
static void Print(IntegralRange range);
Expand Down
10 changes: 10 additions & 0 deletions src/coreclr/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -5712,6 +5712,16 @@ struct GenTreeQmark : public GenTreeOp
assert((colon != nullptr) && colon->OperIs(GT_COLON));
}

GenTree* ThenNode()
{
return gtOp2->AsColon()->ThenNode();
}

GenTree* ElseNode()
{
return gtOp2->AsColon()->ElseNode();
}

#if DEBUGGABLE_GENTREE
GenTreeQmark() : GenTreeOp()
{
Expand Down