From 2a291eaeef241780866cf504f3df7522f7785ead Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Fri, 21 Mar 2025 13:57:22 -0700 Subject: [PATCH] JIT: make non-null assertions about all indir addr types Instead of just GC types. This removes some gratuitous diffs when escape analysis can retype a ref or byref to long. Also remove obsolete (?) block for TYP_LONG assertions. --- src/coreclr/jit/assertionprop.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/coreclr/jit/assertionprop.cpp b/src/coreclr/jit/assertionprop.cpp index 6c4a631652e838..a5dd6e358aee5c 100644 --- a/src/coreclr/jit/assertionprop.cpp +++ b/src/coreclr/jit/assertionprop.cpp @@ -1136,14 +1136,10 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1, GenTree* op2, optAsser } // // Are we trying to make a non-null assertion? + // (note we now do this for all indirs, regardless of address type) // else if (op2 == nullptr) { - if (!varTypeIsGC(op1)) - { - return NO_ASSERTION_INDEX; // Don't make an assertion - } - // Must be an OAK_NOT_EQUAL assertion assert(assertionKind == OAK_NOT_EQUAL); @@ -1242,14 +1238,6 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1, GenTree* op2, optAsser goto DONE_ASSERTION; // Don't make an assertion } - // If the LclVar is a TYP_LONG then we only make - // assertions where op2 is also TYP_LONG - // - if ((lclVar->TypeGet() == TYP_LONG) && (op2->TypeGet() != TYP_LONG)) - { - goto DONE_ASSERTION; // Don't make an assertion - } - assertion.op2.kind = op2Kind; assertion.op2.vn = optConservativeNormalVN(op2);