@@ -1415,8 +1415,10 @@ enum class PhaseChecks
1415
1415
// Specify compiler data that a phase might modify
1416
1416
enum class PhaseStatus : unsigned
1417
1417
{
1418
- MODIFIED_NOTHING,
1419
- MODIFIED_EVERYTHING
1418
+ MODIFIED_NOTHING, // Phase did not make any changes that warrant running post-phase checks or dumping
1419
+ // the main jit data strutures.
1420
+ MODIFIED_EVERYTHING, // Phase made changes that warrant running post-phase checks or dumping
1421
+ // the main jit data strutures.
1420
1422
};
1421
1423
1422
1424
// The following enum provides a simple 1:1 mapping to CLR API's
@@ -3242,7 +3244,7 @@ class Compiler
3242
3244
3243
3245
void lvaSortByRefCount ();
3244
3246
3245
- void lvaMarkLocalVars (); // Local variable ref-counting
3247
+ PhaseStatus lvaMarkLocalVars (); // Local variable ref-counting
3246
3248
void lvaComputeRefCounts (bool isRecompute, bool setSlotNumbers);
3247
3249
void lvaMarkLocalVars (BasicBlock* block, bool isRecompute);
3248
3250
@@ -4710,7 +4712,7 @@ class Compiler
4710
4712
inline bool PreciseRefCountsRequired ();
4711
4713
4712
4714
// Performs SSA conversion.
4713
- void fgSsaBuild ();
4715
+ PhaseStatus fgSsaBuild ();
4714
4716
4715
4717
// Reset any data structures to the state expected by "fgSsaBuild", so it can be run again.
4716
4718
void fgResetForSsa ();
@@ -4734,7 +4736,7 @@ class Compiler
4734
4736
4735
4737
// Do value numbering (assign a value number to each
4736
4738
// tree node).
4737
- void fgValueNumber ();
4739
+ PhaseStatus fgValueNumber ();
4738
4740
4739
4741
void fgValueNumberLocalStore (GenTree* storeNode,
4740
4742
GenTreeLclVarCommon* lclDefNode,
@@ -5177,7 +5179,7 @@ class Compiler
5177
5179
5178
5180
bool fgCheckRemoveStmt (BasicBlock* block, Statement* stmt);
5179
5181
5180
- void fgCreateLoopPreHeader (unsigned lnum);
5182
+ bool fgCreateLoopPreHeader (unsigned lnum);
5181
5183
5182
5184
void fgUnreachableBlock (BasicBlock* block);
5183
5185
@@ -5260,12 +5262,12 @@ class Compiler
5260
5262
5261
5263
bool fgUpdateFlowGraph (bool doTailDup = false );
5262
5264
5263
- void fgFindOperOrder ();
5265
+ PhaseStatus fgFindOperOrder ();
5264
5266
5265
5267
// method that returns if you should split here
5266
5268
typedef bool (fgSplitPredicate)(GenTree* tree, GenTree* parent, fgWalkData* data);
5267
5269
5268
- void fgSetBlockOrder ();
5270
+ PhaseStatus fgSetBlockOrder ();
5269
5271
5270
5272
void fgRemoveReturnBlock (BasicBlock* block);
5271
5273
@@ -5914,7 +5916,7 @@ class Compiler
5914
5916
5915
5917
protected:
5916
5918
// Do hoisting for all loops.
5917
- void optHoistLoopCode ();
5919
+ PhaseStatus optHoistLoopCode ();
5918
5920
5919
5921
// To represent sets of VN's that have already been hoisted in outer loops.
5920
5922
typedef JitHashTable<ValueNum, JitSmallPrimitiveKeyFuncs<ValueNum>, bool > VNSet;
@@ -5955,17 +5957,10 @@ class Compiler
5955
5957
5956
5958
// Do hoisting of all loops nested within loop "lnum" (an index into the optLoopTable), followed
5957
5959
// by the loop "lnum" itself.
5958
- //
5959
- // "m_pHoistedInCurLoop" helps a lot in eliminating duplicate expressions getting hoisted
5960
- // and reducing the count of total expressions hoisted out of loop. When calculating the
5961
- // profitability, we compare this with number of registers and hence, lower the number of expressions
5962
- // getting hoisted, better chances that they will get enregistered and CSE considering them.
5963
- //
5964
- void optHoistLoopNest (unsigned lnum, LoopHoistContext* hoistCtxt);
5960
+ bool optHoistLoopNest (unsigned lnum, LoopHoistContext* hoistCtxt);
5965
5961
5966
5962
// Do hoisting for a particular loop ("lnum" is an index into the optLoopTable.)
5967
- // Returns the new preheaders created.
5968
- void optHoistThisLoop (unsigned lnum, LoopHoistContext* hoistCtxt, BasicBlockList* existingPreHeaders);
5963
+ bool optHoistThisLoop (unsigned lnum, LoopHoistContext* hoistCtxt, BasicBlockList* existingPreHeaders);
5969
5964
5970
5965
// Hoist all expressions in "blocks" that are invariant in loop "loopNum" (an index into the optLoopTable)
5971
5966
// outside of that loop.
@@ -6015,7 +6010,7 @@ class Compiler
6015
6010
void optPerformHoistExpr (GenTree* expr, BasicBlock* exprBb, unsigned lnum);
6016
6011
6017
6012
public:
6018
- void optOptimizeBools ();
6013
+ PhaseStatus optOptimizeBools ();
6019
6014
6020
6015
public:
6021
6016
PhaseStatus optInvertLoops (); // Invert loops so they're entered at top and tested at bottom.
@@ -6104,6 +6099,8 @@ class Compiler
6104
6099
int lpLoopVarFPCount; // The register count for the FP LclVars that are read/written inside this loop
6105
6100
int lpVarInOutFPCount; // The register count for the FP LclVars that are alive inside or across this loop
6106
6101
6102
+ bool lpHoistAddedPreheader; // The loop preheader was added during hoisting
6103
+
6107
6104
typedef JitHashTable<CORINFO_FIELD_HANDLE, JitPtrKeyFuncs<struct CORINFO_FIELD_STRUCT_ >, FieldKindForVN>
6108
6105
FieldHandleSet;
6109
6106
FieldHandleSet* lpFieldsModified; // This has entries for all static field and object instance fields modified
@@ -6270,6 +6267,7 @@ class Compiler
6270
6267
6271
6268
public:
6272
6269
LoopDsc* optLoopTable; // loop descriptor table
6270
+ bool optLoopTableValid; // info in loop table should be valid
6273
6271
unsigned char optLoopCount; // number of tracked loops
6274
6272
unsigned char loopAlignCandidates; // number of loops identified for alignment
6275
6273
@@ -6295,7 +6293,7 @@ class Compiler
6295
6293
BasicBlock* exit,
6296
6294
unsigned char exitCnt);
6297
6295
6298
- void optClearLoopIterInfo ();
6296
+ PhaseStatus optClearLoopIterInfo ();
6299
6297
6300
6298
#ifdef DEBUG
6301
6299
void optPrintLoopInfo (unsigned lnum, bool printVerbose = false );
@@ -6906,9 +6904,9 @@ class Compiler
6906
6904
GenTree* optPropGetValue (unsigned lclNum, unsigned ssaNum, optPropKind valueKind);
6907
6905
GenTree* optEarlyPropRewriteTree (GenTree* tree, LocalNumberToNullCheckTreeMap* nullCheckMap);
6908
6906
bool optDoEarlyPropForBlock (BasicBlock* block);
6909
- bool optDoEarlyPropForFunc ();
6910
- void optEarlyProp ();
6911
- void optFoldNullCheck (GenTree* tree, LocalNumberToNullCheckTreeMap* nullCheckMap);
6907
+ bool optDoEarlyPropForFunc ();
6908
+ PhaseStatus optEarlyProp ();
6909
+ bool optFoldNullCheck (GenTree* tree, LocalNumberToNullCheckTreeMap* nullCheckMap);
6912
6910
GenTree* optFindNullCheckToFold (GenTree* tree, LocalNumberToNullCheckTreeMap* nullCheckMap);
6913
6911
bool optIsNullCheckFoldingLegal (GenTree* tree,
6914
6912
GenTree* nullCheckTree,
@@ -7308,7 +7306,7 @@ class Compiler
7308
7306
static void optDumpAssertionIndices (const char * header, ASSERT_TP assertions, const char * footer = nullptr );
7309
7307
static void optDumpAssertionIndices (ASSERT_TP assertions, const char * footer = nullptr );
7310
7308
7311
- void optAddCopies ();
7309
+ PhaseStatus optAddCopies ();
7312
7310
7313
7311
/* *************************************************************************
7314
7312
* Range checks
@@ -7364,9 +7362,6 @@ class Compiler
7364
7362
7365
7363
bool optReachWithoutCall (BasicBlock* srcBB, BasicBlock* dstBB);
7366
7364
7367
- protected:
7368
- bool optLoopsMarked;
7369
-
7370
7365
/*
7371
7366
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7372
7367
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0 commit comments