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
16 changes: 3 additions & 13 deletions src/coreclr/jit/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ typedef BitVec EXPSET_TP;
typedef BitVec_ValArg_T EXPSET_VALARG_TP;
typedef BitVec_ValRet_T EXPSET_VALRET_TP;

#if LARGE_EXPSET
#define EXPSET_SZ 64
#else
#define EXPSET_SZ 32
#endif

typedef BitVec ASSERT_TP;
typedef BitVec_ValArg_T ASSERT_VALARG_TP;
Expand Down Expand Up @@ -1157,24 +1153,18 @@ struct BasicBlock : private LIR::Range
*/

union {
EXPSET_TP bbCseGen; // CSEs computed by block
#if ASSERTION_PROP
EXPSET_TP bbCseGen; // CSEs computed by block
ASSERT_TP bbAssertionGen; // value assignments computed by block
#endif
};

union {
EXPSET_TP bbCseIn; // CSEs available on entry
#if ASSERTION_PROP
EXPSET_TP bbCseIn; // CSEs available on entry
ASSERT_TP bbAssertionIn; // value assignments available on entry
#endif
};

union {
EXPSET_TP bbCseOut; // CSEs available on exit
#if ASSERTION_PROP
EXPSET_TP bbCseOut; // CSEs available on exit
ASSERT_TP bbAssertionOut; // value assignments available on exit
#endif
};

void* bbEmitCookie;
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5023,7 +5023,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
//
DoPhase(this, PHASE_OPTIMIZE_VALNUM_CSES, &Compiler::optOptimizeCSEs);

#if ASSERTION_PROP
if (doAssertionProp)
{
// Assertion propagation
Expand All @@ -5042,7 +5041,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
//
DoPhase(this, PHASE_OPTIMIZE_INDEX_CHECKS, rangePhase);
}
#endif // ASSERTION_PROP

if (fgModified)
{
Expand Down
23 changes: 4 additions & 19 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,8 @@ class LclVarDsc
,
#endif // FEATURE_MULTIREG_ARGS
lvClassHnd(NO_CLASS_HANDLE)
,
#if ASSERTION_PROP
lvRefBlks(BlockSetOps::UninitVal())
,
#endif // ASSERTION_PROP
lvPerSsaData()

, lvRefBlks(BlockSetOps::UninitVal())
, lvPerSsaData()
{
}

Expand Down Expand Up @@ -477,9 +472,7 @@ class LclVarDsc
unsigned char lvIsImplicitByRef : 1; // Set if the argument is an implicit byref.
#endif // defined(TARGET_AMD64) || defined(TARGET_ARM64)

#if OPT_BOOL_OPS
unsigned char lvIsBoolean : 1; // set if variable is boolean
#endif
unsigned char lvSingleDef : 1; // variable has a single def
// before lvaMarkLocalVars: identifies ref type locals that can get type updates
// after lvaMarkLocalVars: identifies locals that are suitable for optAddCopies
Expand All @@ -498,10 +491,8 @@ class LclVarDsc
// in earlier phase and the information might not be appropriate
// in LSRA.

#if ASSERTION_PROP
unsigned char lvDisqualify : 1; // variable is no longer OK for add copy optimization
unsigned char lvVolatileHint : 1; // hint for AssertionProp
#endif

#ifndef TARGET_64BIT
unsigned char lvStructDoubleAlign : 1; // Must we double align this struct?
Expand Down Expand Up @@ -1006,11 +997,10 @@ class LclVarDsc
ClassLayout* m_layout; // layout info for structs

public:
#if ASSERTION_PROP
BlockSet lvRefBlks; // Set of blocks that contain refs
Statement* lvDefStmt; // Pointer to the statement with the single definition
void lvaDisqualifyVar(); // Call to disqualify a local variable from use in optAddCopies
#endif

var_types TypeGet() const
{
return (var_types)lvType;
Expand Down Expand Up @@ -6431,10 +6421,8 @@ class Compiler
GenTree* fgMorphTree(GenTree* tree, MorphAddrContext* mac = nullptr);

private:
#if LOCAL_ASSERTION_PROP
void fgKillDependentAssertionsSingle(unsigned lclNum DEBUGARG(GenTree* tree));
void fgKillDependentAssertions(unsigned lclNum DEBUGARG(GenTree* tree));
#endif
void fgMorphTreeDone(GenTree* tree, GenTree* oldTree = nullptr DEBUGARG(int morphNum = 0));

Statement* fgMorphStmt;
Expand Down Expand Up @@ -7583,7 +7571,6 @@ class Compiler
bool optJumpThread(BasicBlock* const block, BasicBlock* const domBlock, bool domIsSameRelop);
bool optReachable(BasicBlock* const fromBlock, BasicBlock* const toBlock, BasicBlock* const excludedBlock);

#if ASSERTION_PROP
/**************************************************************************
* Value/Assertion propagation
*************************************************************************/
Expand Down Expand Up @@ -7838,10 +7825,8 @@ class Compiler
AssertionDsc* optGetAssertion(AssertionIndex assertIndex);
void optAssertionInit(bool isLocalProp);
void optAssertionTraitsInit(AssertionIndex assertionCount);
#if LOCAL_ASSERTION_PROP
void optAssertionReset(AssertionIndex limit);
void optAssertionRemove(AssertionIndex index);
#endif

// Assertion prop data flow functions.
void optAssertionPropMain();
Expand Down Expand Up @@ -7935,11 +7920,11 @@ class Compiler
void optDebugCheckAssertion(AssertionDsc* assertion);
void optDebugCheckAssertions(AssertionIndex AssertionIndex);
#endif

static void optDumpAssertionIndices(const char* header, ASSERT_TP assertions, const char* footer = nullptr);
static void optDumpAssertionIndices(ASSERT_TP assertions, const char* footer = nullptr);

void optAddCopies();
#endif // ASSERTION_PROP

/**************************************************************************
* Range checks
Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,9 +779,7 @@ inline GenTree::GenTree(genTreeOps oper, var_types type DEBUGARG(bool largeNode)
gtDebugFlags = GTF_DEBUG_NONE;
#endif // DEBUG
gtCSEnum = NO_CSE;
#if ASSERTION_PROP
ClearAssertion();
#endif

gtNext = nullptr;
gtPrev = nullptr;
Expand Down Expand Up @@ -3219,8 +3217,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/

#if LOCAL_ASSERTION_PROP

/*****************************************************************************
*
* The following resets the value assignment table
Expand Down Expand Up @@ -3332,7 +3328,6 @@ inline void Compiler::optAssertionRemove(AssertionIndex index)
optAssertionReset(newAssertionCount);
}
}
#endif // LOCAL_ASSERTION_PROP

inline void Compiler::LoopDsc::AddModifiedField(Compiler* comp, CORINFO_FIELD_HANDLE fldHnd)
{
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/jit/compphases.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ CompPhaseNameMacro(PHASE_OPTIMIZE_INDEX_CHECKS, "Optimize index checks",
CompPhaseNameMacro(PHASE_OPTIMIZE_VALNUM_CSES, "Optimize Valnum CSEs", "OPT-CSE", false, -1, false)
CompPhaseNameMacro(PHASE_VN_COPY_PROP, "VN based copy prop", "CP-PROP", false, -1, false)
CompPhaseNameMacro(PHASE_OPTIMIZE_BRANCHES, "Redundant branch opts", "OPT-BR", false, -1, false)
#if ASSERTION_PROP
CompPhaseNameMacro(PHASE_ASSERTION_PROP_MAIN, "Assertion prop", "AST-PROP", false, -1, false)
#endif
CompPhaseNameMacro(PHASE_OPT_UPDATE_FLOW_GRAPH, "Update flow graph opt pass", "UPD-FG-O", false, -1, false)
CompPhaseNameMacro(PHASE_COMPUTE_EDGE_WEIGHTS2, "Compute edge weights (2, false)","EDG-WGT2", false, -1, false)
CompPhaseNameMacro(PHASE_INSERT_GC_POLLS, "Insert GC Polls", "GC-POLLS", false, -1, true)
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,6 @@ struct GenTree

unsigned char gtLIRFlags; // Used for nodes that are in LIR. See LIR::Flags in lir.h for the various flags.

#if ASSERTION_PROP
AssertionInfo gtAssertionInfo;

bool GeneratesAssertion() const
Expand All @@ -784,7 +783,6 @@ struct GenTree
{
gtAssertionInfo = info;
}
#endif

//
// Cost metrics on the node. Don't allow direct access to the variable for setting.
Expand Down
16 changes: 1 addition & 15 deletions src/coreclr/jit/jit.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,21 +353,7 @@ class GlobalJitOptions
/*****************************************************************************/

#define CSE_INTO_HANDLERS 0

#define LARGE_EXPSET 1 // Track 64 or 32 assertions/copies/consts/rangechecks
#define ASSERTION_PROP 1 // Enable value/assertion propagation

#define LOCAL_ASSERTION_PROP ASSERTION_PROP // Enable local assertion propagation

//=============================================================================

#define OPT_BOOL_OPS 1 // optimize boolean operations

//=============================================================================

#define REDUNDANT_LOAD 1 // track locals in regs, suppress loads
#define DUMP_FLOWGRAPHS DEBUG // Support for creating Xml Flowgraph reports in *.fgx files

#define DUMP_FLOWGRAPHS DEBUG // Support for creating Xml Flowgraph reports in *.fgx files
#define HANDLER_ENTRY_MUST_BE_IN_HOT_SECTION 1 // if 1 we must have all handler entry points in the Hot code section

/*****************************************************************************/
Expand Down
14 changes: 0 additions & 14 deletions src/coreclr/jit/lclvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1404,12 +1404,10 @@ void Compiler::lvaInitVarDsc(LclVarDsc* varDsc,
varDsc->lvType = type;
}

#if OPT_BOOL_OPS
if (type == TYP_BOOL)
{
varDsc->lvIsBoolean = true;
}
#endif

#ifdef DEBUG
varDsc->SetStackOffset(BAD_STK_OFFS);
Expand Down Expand Up @@ -3621,7 +3619,6 @@ void Compiler::lvaSortByRefCount()
#endif
}

#if ASSERTION_PROP
/*****************************************************************************
*
* This is called by lvaMarkLclRefs to disqualify a variable from being
Expand All @@ -3633,7 +3630,6 @@ void LclVarDsc::lvaDisqualifyVar()
this->lvSingleDef = false;
this->lvDefStmt = nullptr;
}
#endif // ASSERTION_PROP

#ifdef FEATURE_SIMD
var_types LclVarDsc::GetSimdBaseType() const
Expand Down Expand Up @@ -3908,8 +3904,6 @@ void Compiler::lvaMarkLclRefs(GenTree* tree, BasicBlock* block, Statement* stmt,
GenTree* op1 = tree->AsOp()->gtOp1;
GenTree* op2 = tree->AsOp()->gtOp2;

#if OPT_BOOL_OPS

/* Is this an assignment to a local variable? */

if (op1->gtOper == GT_LCL_VAR && op2->gtType != TYP_BOOL)
Expand Down Expand Up @@ -3957,7 +3951,6 @@ void Compiler::lvaMarkLclRefs(GenTree* tree, BasicBlock* block, Statement* stmt,
break;
}
}
#endif
}
}

Expand Down Expand Up @@ -4015,15 +4008,12 @@ void Compiler::lvaMarkLclRefs(GenTree* tree, BasicBlock* block, Statement* stmt,

if (tree->gtOper == GT_LCL_FLD)
{
#if ASSERTION_PROP
// variables that have uses inside a GT_LCL_FLD
// cause problems, so we will disqualify them here
varDsc->lvaDisqualifyVar();
#endif // ASSERTION_PROP
return;
}

#if ASSERTION_PROP
if (fgDomsComputed && IsDominatedByExceptionalEntry(block))
{
SetVolatileHint(varDsc);
Expand Down Expand Up @@ -4114,8 +4104,6 @@ void Compiler::lvaMarkLclRefs(GenTree* tree, BasicBlock* block, Statement* stmt,
}
}

#endif // ASSERTION_PROP

bool allowStructs = false;
#ifdef UNIX_AMD64_ABI
// On System V the type of the var could be a struct type.
Expand Down Expand Up @@ -4359,12 +4347,10 @@ void Compiler::lvaMarkLocalVars()
lvaGetDesc(info.compTypeCtxtArg)->lvImplicitlyReferenced = reportParamTypeArg;
}

#if ASSERTION_PROP
assert(PreciseRefCountsRequired());

// Note: optAddCopies() depends on lvaRefBlks, which is set in lvaMarkLocalVars(BasicBlock*), called above.
optAddCopies();
#endif
}

//------------------------------------------------------------------------
Expand Down
Loading