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
32 changes: 27 additions & 5 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4648,14 +4648,36 @@ class AssertionPropFlowCallback
}

// During merge, perform the actual merging of the predecessor's (since this is a forward analysis) dataflow flags.
void Merge(BasicBlock* block, BasicBlock* predBlock, flowList* preds)
void Merge(BasicBlock* block, BasicBlock* predBlock, unsigned dupCount)
{
ASSERT_TP pAssertionOut = ((predBlock->bbJumpKind == BBJ_COND) && (predBlock->bbJumpDest == block))
? mJumpDestOut[predBlock->bbNum]
: predBlock->bbAssertionOut;
ASSERT_TP pAssertionOut;

if (predBlock->bbJumpKind == BBJ_COND && (predBlock->bbJumpDest == block))
{
pAssertionOut = mJumpDestOut[predBlock->bbNum];

if (dupCount > 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This deserves a comment and some extra jit dump output, since it is an unusual case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Added.

{
// Scenario where next block and conditional block, both point to the same block.
// In such case, intersect the assertions present on both the out edges of predBlock.
assert(predBlock->bbNext == block);
BitVecOps::IntersectionD(apTraits, pAssertionOut, predBlock->bbAssertionOut);

JITDUMP("AssertionPropCallback::Merge : Duplicate flow, " FMT_BB " in -> %s, predBlock " FMT_BB
" out1 -> %s, out2 -> %s\n",
block->bbNum, BitVecOps::ToString(apTraits, block->bbAssertionIn), predBlock->bbNum,
BitVecOps::ToString(apTraits, mJumpDestOut[predBlock->bbNum]),
BitVecOps::ToString(apTraits, predBlock->bbAssertionOut));
}
}
else
{
pAssertionOut = predBlock->bbAssertionOut;
}

JITDUMP("AssertionPropCallback::Merge : " FMT_BB " in -> %s, predBlock " FMT_BB " out -> %s\n",
block->bbNum, BitVecOps::ToString(apTraits, block->bbAssertionIn), predBlock->bbNum,
BitVecOps::ToString(apTraits, predBlock->bbAssertionOut));
BitVecOps::ToString(apTraits, pAssertionOut));
BitVecOps::IntersectionD(apTraits, block->bbAssertionIn, pAssertionOut);
}

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/dataflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// {
// public:
// void StartMerge(BasicBlock* block);
// void Merge(BasicBlock* block, BasicBlock* pred, flowList* preds);
// void Merge(BasicBlock* block, BasicBlock* pred, unsigned dupCount);
// bool EndMerge(BasicBlock* block);
// };
#pragma once
Expand Down Expand Up @@ -61,7 +61,7 @@ void DataFlow::ForwardAnalysis(TCallback& callback)
flowList* preds = m_pCompiler->BlockPredsWithEH(block);
for (flowList* pred = preds; pred; pred = pred->flNext)
{
callback.Merge(block, pred->getBlock(), preds);
callback.Merge(block, pred->getBlock(), pred->flDupCount);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16245,9 +16245,9 @@ bool Compiler::fgFoldConditional(BasicBlock* block)
// no side effects, remove the jump entirely
fgRemoveStmt(block, lastStmt);
}
// block is a BBJ_COND that we are folding the conditional for
// bTaken is the path that will always be taken from block
// bNotTaken is the path that will never be taken from block
// block is a BBJ_COND that we are folding the conditional for.
// bTaken is the path that will always be taken from block.
// bNotTaken is the path that will never be taken from block.
//
BasicBlock* bTaken;
BasicBlock* bNotTaken;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/optcse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ class CSE_DataFlow
}

// Merge: perform the merging of each of the predecessor's liveness values (since this is a forward analysis)
void Merge(BasicBlock* block, BasicBlock* predBlock, flowList* preds)
void Merge(BasicBlock* block, BasicBlock* predBlock, unsigned dupCount)
{
#ifdef DEBUG
if (m_comp->verbose)
Expand Down