Skip to content

Commit 5fe0d49

Browse files
Break apart gtFoldExprConst into a couple functions so its more manageable (#128307)
This should be zero-diffs (minus a minor fix for 32-bit xarch) as it's just taking the logic and splitting it out so we no longer have one gigantic method. This helps make the code easier to read/browse and should help the native compiler more easily inline the key paths in some cases. Doing this refactoring since I'm planning on moving some more folding from morph into `gtFoldExpr` and this helps keep everything easy to understand.
1 parent ed8987f commit 5fe0d49

2 files changed

Lines changed: 1206 additions & 829 deletions

File tree

src/coreclr/jit/compiler.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3948,9 +3948,26 @@ class Compiler
39483948
//-------------------------------------------------------------------------
39493949

39503950
GenTree* gtFoldExpr(GenTree* tree);
3951+
GenTree* gtFoldExprConst(GenTree* tree);
3952+
39513953
GenTree* gtFoldExprUnary(GenTreeUnOp* tree);
3954+
GenTree* gtFoldExprUnaryConst(GenTreeUnOp* tree);
3955+
GenTree* gtFoldExprUnaryConstInt(GenTreeUnOp* tree, GenTreeIntCon* intCon);
3956+
GenTree* gtFoldExprUnaryConstLng(GenTreeUnOp* tree, GenTreeIntConCommon* intConCommon);
3957+
GenTree* gtFoldExprUnaryConstDbl(GenTreeUnOp* tree, GenTreeDblCon* dblCon);
3958+
39523959
GenTree* gtFoldExprBinary(GenTreeOp* tree);
3953-
GenTree* gtFoldExprConst(GenTree* tree);
3960+
GenTree* gtFoldExprBinaryConst(GenTreeOp* tree);
3961+
GenTree* gtFoldExprBinaryConstInt(GenTreeOp* tree, GenTreeIntCon* intCon1, GenTreeIntCon* intCon2);
3962+
GenTree* gtFoldExprBinaryConstLng(GenTreeOp* tree, GenTreeIntConCommon* intConCommon1, GenTreeIntConCommon* intConCommon2);
3963+
GenTree* gtFoldExprBinaryConstDbl(GenTreeOp* tree, GenTreeDblCon* dblCon1, GenTreeDblCon* dblCon2);
3964+
3965+
GenTree* gtBashTreeToConstInt(GenTree* tree, int32_t iconVal, FieldSeq* fieldSeq = nullptr);
3966+
GenTree* gtBashTreeToConstLng(GenTree* tree, int64_t lconVal, FieldSeq* fieldSeq = nullptr);
3967+
GenTree* gtBashTreeToConstDbl(GenTree* tree, double dconVal);
3968+
3969+
GenTree* gtFoldExprForOverflow(GenTree* tree);
3970+
39543971
GenTree* gtFoldIndirConst(GenTreeIndir* indir);
39553972
GenTree* gtFoldExprSpecial(GenTree* tree);
39563973
GenTree* gtFoldExprSpecialFloating(GenTree* tree);

0 commit comments

Comments
 (0)