Skip to content

Commit f694726

Browse files
[release/7.0] [ARM64] - IsValidCompareChain should return false if both operands are not integral types (#75016)
* IsValidCompareChain should return 'false' if both operands are not integral types * Add integral type checks in ContainCheckCompareChain * Check if op is CMP or AND * feedback Co-authored-by: Will Smith <[email protected]>
1 parent 8b6997f commit f694726

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/coreclr/jit/lowerarmarch.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,7 +2086,8 @@ bool Lowering::IsValidCompareChain(GenTree* child, GenTree* parent)
20862086
return IsValidCompareChain(child->AsOp()->gtGetOp2(), child) &&
20872087
IsValidCompareChain(child->AsOp()->gtGetOp1(), child);
20882088
}
2089-
else if (child->OperIsCmpCompare())
2089+
else if (child->OperIsCmpCompare() && varTypeIsIntegral(child->gtGetOp1()) &&
2090+
varTypeIsIntegral(child->gtGetOp2()))
20902091
{
20912092
// Can the child compare be contained.
20922093
return IsSafeToContainMem(parent, child);
@@ -2148,7 +2149,8 @@ bool Lowering::ContainCheckCompareChain(GenTree* child, GenTree* parent, GenTree
21482149
child->SetContained();
21492150
return true;
21502151
}
2151-
else if (child->OperIsCmpCompare())
2152+
else if (child->OperIsCmpCompare() && varTypeIsIntegral(child->gtGetOp1()) &&
2153+
varTypeIsIntegral(child->gtGetOp2()))
21522154
{
21532155
child->AsOp()->SetContained();
21542156

0 commit comments

Comments
 (0)