Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: enable cloning of try regions #110020

Merged
merged 20 commits into from
Dec 4, 2024
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
38 changes: 37 additions & 1 deletion src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,9 @@ class FlowGraphNaturalLoop
bool HasDef(unsigned lclNum);

bool CanDuplicate(INDEBUG(const char** reason));
bool CanDuplicateWithEH(INDEBUG(const char** reason));
void Duplicate(BasicBlock** insertAfter, BlockToBlockMap* map, weight_t weightScale);
void DuplicateWithEH(BasicBlock** insertAfter, BlockToBlockMap* map, weight_t weightScale);

bool MayExecuteBlockMultipleTimesPerIteration(BasicBlock* block);

Expand Down Expand Up @@ -2557,6 +2559,29 @@ struct RelopImplicationInfo
bool reverseSense = false;
};

//------------------------------------------------------------------------
// CloneTryInfo
//
// Describes information needed to clone a try region, and information
// produced by cloning that region
//
struct CloneTryInfo
{
CloneTryInfo(Compiler* comp);

// bbID based traits and vector
//
BitVecTraits Traits;
BitVec Visited;

BlockToBlockMap* Map = nullptr;
jitstd::vector<BasicBlock*>* BlocksToClone = nullptr;
weight_t ProfileScale = 0.0;
unsigned EHIndexShift = 0;
bool AddEdges = false;
bool ScaleOriginalBlockProfile = false;
};

/*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Expand Down Expand Up @@ -3001,7 +3026,7 @@ class Compiler

void fgRemoveEHTableEntry(unsigned XTnum);

EHblkDsc* fgAddEHTableEntry(unsigned XTnum);
EHblkDsc* fgTryAddEHTableEntries(unsigned XTnum, unsigned count = 1, bool deferAdding = false);

void fgSortEHTable();

Expand Down Expand Up @@ -5359,6 +5384,10 @@ class Compiler

PhaseStatus fgCloneFinally();

bool fgCanCloneTryRegion(BasicBlock* tryEntry);

BasicBlock* fgCloneTryRegion(BasicBlock* tryEntry, CloneTryInfo& info, BasicBlock** insertAfter = nullptr);

void fgUpdateACDsBeforeEHTableEntryRemoval(unsigned XTnum);

void fgCleanupContinuation(BasicBlock* continuation);
Expand Down Expand Up @@ -12263,6 +12292,13 @@ class EHClauses
assert((m_begin != nullptr) || (m_begin == m_end));
}

EHClauses(Compiler* comp, EHblkDsc* begin)
: m_begin(begin)
, m_end(comp->compHndBBtab + comp->compHndBBtabCount)
{
assert((m_begin != nullptr) || (m_begin == m_end));
}

iterator begin() const
{
return iterator(m_begin);
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/compmemkind.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ CompMemKindMacro(EarlyProp)
CompMemKindMacro(ZeroInit)
CompMemKindMacro(Pgo)
CompMemKindMacro(MaskConversionOpt)
CompMemKindMacro(TryRegionClone)
//clang-format on

#undef CompMemKindMacro
Loading
Loading