From 0e107cde48aad5963870902ae0d0a548afbe65a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Wed, 5 Jun 2024 03:04:52 +0900 Subject: [PATCH] Weaken assert around folding constants (#103026) I ran into this assert with native AOT. It seems to be too strong - we are not allowed to fold IconHandle constants with prejit. --- 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 5df5fcdf4181a..89fae6f436709 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -9426,7 +9426,8 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac, bool* optA } /* Any constant cases should have been folded earlier */ - noway_assert(!op1->OperIsConst() || opts.OptimizationDisabled() || optValnumCSE_phase); + noway_assert(!op1->OperIsConst() || op1->IsIconHandle() || opts.OptimizationDisabled() || + optValnumCSE_phase); break; case GT_CKFINITE: