Skip to content

Commit 730abc9

Browse files
Handle casts done via helpers and fold overflow operations in value numbering (#50450)
* Added a missing license header * Added a test verifying that checked arithmetic is correct * Added a test verifying that checked casts are correct * Refactored VNEvalShouldFold * Refactored gtFoldExprConst to use helpers and follow the common code style * Fixed the comment stating TYP_BYREF has no zero value * Moved checking of overflow for arithmetic operations from gtFoldExprConst into a separate namespace * Implemented folding of overflow arithmetic in value numbering * Fixed some typos in valuenum.cpp/h * Added identity-based evaluation for overflow arithmetic * Refactored gtFoldExpr some more, moved the overflow checking logic to CheckedOps, implemented overflow checking for floating point -> integer casts * Implemented folding of checked casts in value numbering, started value numbering casts via helpers like normal casts * Fixed the formatting * Made the definition of var_types a standalone header so that it can be safely #included'ed in utils.h * Replaced uses of GTF_CALL_M_SPECIAL_INTRINSIC with the equivalent helpers * Fold cast via helpers in morph * Disable the test for checked casts on Mono
1 parent 2e12730 commit 730abc9

26 files changed

+49589
-719
lines changed

src/coreclr/jit/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ if (CLR_CMAKE_TARGET_WIN32)
248248
valuenumtype.h
249249
varset.h
250250
vartype.h
251+
vartypesdef.h
251252
)
252253

253254
if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_ARM)

src/coreclr/jit/assertionprop.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4986,6 +4986,9 @@ GenTree* Compiler::optExtractSideEffListFromConst(GenTree* tree)
49864986
bool ignoreRoot = true;
49874987

49884988
gtExtractSideEffList(tree, &sideEffList, GTF_SIDE_EFFECT, ignoreRoot);
4989+
4990+
JITDUMP("Extracted side effects from a constant tree [%06u]:\n", tree->gtTreeID);
4991+
DISPTREE(sideEffList);
49894992
}
49904993

49914994
return sideEffList;

0 commit comments

Comments
 (0)