From fdd1f635234dc33f71e2e16d208fe5c08b4147e6 Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Mon, 12 Dec 2022 21:16:37 +0100 Subject: [PATCH] JIT: Add missing case to relational with constant optimization (#79541) Almost all cases of #11349 were fixed, except for this missing one. Fix #11349 --- src/coreclr/jit/morph.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index 13e81bda6ac74..bf590a34cfae1 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -10975,7 +10975,8 @@ GenTree* Compiler::fgOptimizeRelationalComparisonWithFullRangeConst(GenTreeOp* c ret = gtNewZeroConNode(TYP_INT); } // [x0, x1] < [y0, y1] is true if x1 < y0 - else if ((op == GT_LT) && (lhsMax < rhsMin)) + // [x0, x1] <= [y0, y1] is true if x1 <= y0 + else if (((op == GT_LT) && (lhsMax < rhsMin)) || ((op == GT_LE) && (lhsMax <= rhsMin))) { ret = gtNewOneConNode(TYP_INT); }