Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Consider CALLFINALLY block as one of the pred of handler block during…
… assertion prop
  • Loading branch information
kunalspathak committed Jul 14, 2021
commit ec286c8e8cf69ae0628275f91ec6e81c0bb36a5e
15 changes: 12 additions & 3 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ void Compiler::optPrintAssertion(AssertionDsc* curAssertion, AssertionIndex asse
break;

case O2K_SUBRANGE:
printf("[%d..%d]", curAssertion->op2.u2.loBound, curAssertion->op2.u2.hiBound);
printf("[%u..%u]", curAssertion->op2.u2.loBound, curAssertion->op2.u2.hiBound);
break;

default:
Expand Down Expand Up @@ -2325,7 +2325,7 @@ AssertionIndex Compiler::optFindComplementary(AssertionIndex assertIndex)
/*****************************************************************************
*
* Given a lclNum, a fromType and a toType, return assertion index of the assertion that
* claims that a variable's value is always a valid subrange of the formType.
* claims that a variable's value is always a valid subrange of the fromType.
* Thus we can discard or omit a cast to fromType. Returns NO_ASSERTION_INDEX
* if one such assertion could not be found in "assertions."
*/
Expand Down Expand Up @@ -4830,6 +4830,15 @@ class AssertionPropFlowCallback
// It means we can propagate only assertions that are valid for the whole try region.
void MergeHandler(BasicBlock* block, BasicBlock* firstTryBlock, BasicBlock* lastTryBlock)
{
if (VerboseDataflow())
{
JITDUMP("Merge : " FMT_BB " ", block->bbNum);
Compiler::optDumpAssertionIndices("in -> ", block->bbAssertionIn, "; ");
JITDUMP("firstTryBlock " FMT_BB " ", firstTryBlock->bbNum);
Compiler::optDumpAssertionIndices("in -> ", firstTryBlock->bbAssertionIn, "; ");
JITDUMP("lastTryBlock " FMT_BB " ", lastTryBlock->bbNum);
Compiler::optDumpAssertionIndices("out -> ", lastTryBlock->bbAssertionOut, "\n");
}
BitVecOps::IntersectionD(apTraits, block->bbAssertionIn, firstTryBlock->bbAssertionIn);
BitVecOps::IntersectionD(apTraits, block->bbAssertionIn, lastTryBlock->bbAssertionOut);
}
Expand Down Expand Up @@ -4933,8 +4942,8 @@ ASSERT_TP* Compiler::optComputeAssertionGen()
}
else // is jump edge assertion
{
valueAssertionIndex = optFindComplementary(info.GetAssertionIndex());
jumpDestAssertionIndex = info.GetAssertionIndex();
valueAssertionIndex = optFindComplementary(jumpDestAssertionIndex);
}

if (valueAssertionIndex != NO_ASSERTION_INDEX)
Expand Down
11 changes: 7 additions & 4 deletions src/coreclr/jit/dataflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,18 @@ void DataFlow::ForwardAnalysis(TCallback& callback)
worklist.erase(worklist.begin());

callback.StartMerge(block);
if (m_pCompiler->bbIsHandlerBeg(block))
bool isHandlerBegBlock = m_pCompiler->bbIsHandlerBeg(block);
if (isHandlerBegBlock)
{
EHblkDsc* ehDsc = m_pCompiler->ehGetBlockHndDsc(block);
callback.MergeHandler(block, ehDsc->ebdTryBeg, ehDsc->ebdTryLast);
}
else

flowList* preds = m_pCompiler->BlockPredsWithEH(block);
for (flowList* pred = preds; pred; pred = pred->flNext)
{
flowList* preds = m_pCompiler->BlockPredsWithEH(block);
for (flowList* pred = preds; pred; pred = pred->flNext)
// For handler start block, also consider the block BBJ_CALLFINALLY as one of the pred.
if (!isHandlerBegBlock || pred->getBlock()->bbJumpKind == BBJ_CALLFINALLY)
{
callback.Merge(block, pred->getBlock(), pred->flDupCount);
}
Expand Down