Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/coreclr/jit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ set( JIT_HEADERS
namedintrinsiclist.h
objectalloc.h
opcode.h
optcse.h
phase.h
promotion.h
rangecheck.h
Expand Down
57 changes: 4 additions & 53 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ struct InitVarDscInfo; // defined in registerargconvention.h
class FgStack; // defined in fgbasic.cpp
class Instrumentor; // defined in fgprofile.cpp
class SpanningTreeVisitor; // defined in fgprofile.cpp
class CSE_DataFlow; // defined in OptCSE.cpp
class CSE_DataFlow; // defined in optcse.cpp
struct CSEdsc; // defined in optcse.h
class OptBoolsDsc; // defined in optimizer.cpp
struct RelopImplicationInfo; // defined in redundantbranchopts.cpp
struct JumpThreadInfo; // defined in redundantbranchopts.cpp
Expand Down Expand Up @@ -2482,6 +2483,8 @@ class Compiler
friend class Phase;
friend class Lowering;
friend class CSE_DataFlow;
friend class CSE_HeuristicCommon;
friend class CSE_HeuristicRandom;
friend class CSE_Heuristic;
friend class CodeGenInterface;
friend class CodeGen;
Expand Down Expand Up @@ -7306,58 +7309,6 @@ class Compiler

EXPSET_TP cseCallKillsMask; // Computed once - A mask that is used to kill available CSEs at callsites

/* Generic list of nodes - used by the CSE logic */

struct treeLst
{
treeLst* tlNext;
GenTree* tlTree;
};

struct treeStmtLst
{
treeStmtLst* tslNext;
GenTree* tslTree; // tree node
Statement* tslStmt; // statement containing the tree
BasicBlock* tslBlock; // block containing the statement
};

// The following logic keeps track of expressions via a simple hash table.

struct CSEdsc
{
CSEdsc* csdNextInBucket; // used by the hash table
size_t csdHashKey; // the original hashkey
ssize_t csdConstDefValue; // When we CSE similar constants, this is the value that we use as the def
ValueNum csdConstDefVN; // When we CSE similar constants, this is the ValueNumber that we use for the LclVar
// assignment
unsigned csdIndex; // 1..optCSECandidateCount
bool csdIsSharedConst; // true if this CSE is a shared const
bool csdLiveAcrossCall;

unsigned short csdDefCount; // definition count
unsigned short csdUseCount; // use count (excluding the implicit uses at defs)

weight_t csdDefWtCnt; // weighted def count
weight_t csdUseWtCnt; // weighted use count (excluding the implicit uses at defs)

GenTree* csdTree; // treenode containing the 1st occurrence
Statement* csdStmt; // stmt containing the 1st occurrence
BasicBlock* csdBlock; // block containing the 1st occurrence

treeStmtLst* csdTreeList; // list of matching tree nodes: head
treeStmtLst* csdTreeLast; // list of matching tree nodes: tail

ValueNum defExcSetPromise; // The exception set that is now required for all defs of this CSE.
// This will be set to NoVN if we decide to abandon this CSE

ValueNum defExcSetCurrent; // The set of exceptions we currently can use for CSE uses.

ValueNum defConservNormVN; // if all def occurrences share the same conservative normal value
// number, this will reflect it; otherwise, NoVN.
// not used for shared const CSE's
};

static const size_t s_optCSEhashSizeInitial;
static const size_t s_optCSEhashGrowthFactor;
static const size_t s_optCSEhashBucketSize;
Expand Down
9 changes: 5 additions & 4 deletions src/coreclr/jit/jitconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ CONFIG_INTEGER(JitStackChecks, W("JitStackChecks"), 0)
CONFIG_INTEGER(JitStress, W("JitStress"), 0) // Internal Jit stress mode: 0 = no stress, 2 = all stress, other = vary
// stress based on a hash of the method and this value
CONFIG_INTEGER(JitStressBBProf, W("JitStressBBProf"), 0) // Internal Jit stress mode
CONFIG_INTEGER(JitStressBiasedCSE, W("JitStressBiasedCSE"), 0x101) // Internal Jit stress mode: decimal bias value
// between (0,100) to perform CSE on a candidate.
// 100% = All CSEs. 0% = 0 CSE. (> 100) means no
// stress.
CONFIG_INTEGER(JitStressModeNamesOnly, W("JitStressModeNamesOnly"), 0) // Internal Jit stress: if nonzero, only enable
// stress modes listed in JitStressModeNames
CONFIG_INTEGER(JitStressProcedureSplitting, W("JitStressProcedureSplitting"), 0) // Always split after the first basic
Expand Down Expand Up @@ -402,6 +398,11 @@ CONFIG_INTEGER(JitCSEMask, W("JitCSEMask"), 0)

// Enable metric output in jit disasm & elsewhere
CONFIG_INTEGER(JitMetrics, W("JitMetrics"), 0)

// When nonzero, choose CSE candidates randomly, with probability
// specified by the (decimal) value of the config
CONFIG_INTEGER(JitRandomCSE, W("JitRandomCSE"), 0)

#endif

///
Expand Down
Loading