Skip to content

Commit

Permalink
JIT: Add explicit successor for BBJ_COND false branch (#95773)
Browse files Browse the repository at this point in the history
This change refactors the BasicBlock API surface such that for BBJ_COND blocks, bbTrueTarget must be used in lieu of bbTarget, and bbFalseTarget must be used in lieu of bbNext (for now, BBJ_COND blocks still fall through into the next block if the false branch is taken, so bbFalseTarget is consistent with bbNext).
  • Loading branch information
amanasifkhalid authored Dec 11, 2023
1 parent 81856ea commit 6c7e6e2
Show file tree
Hide file tree
Showing 42 changed files with 1,267 additions and 975 deletions.
10 changes: 5 additions & 5 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5550,15 +5550,15 @@ class AssertionPropFlowCallback
{
ASSERT_TP pAssertionOut;

if (predBlock->KindIs(BBJ_COND) && predBlock->HasJumpTo(block))
if (predBlock->KindIs(BBJ_COND) && predBlock->TrueTargetIs(block))
{
pAssertionOut = mJumpDestOut[predBlock->bbNum];

if (dupCount > 1)
{
// 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->NextIs(block));
assert(predBlock->FalseTargetIs(block));
BitVecOps::IntersectionD(apTraits, pAssertionOut, predBlock->bbAssertionOut);

if (VerboseDataflow())
Expand Down Expand Up @@ -5728,7 +5728,7 @@ ASSERT_TP* Compiler::optComputeAssertionGen()

if (jumpDestAssertionIndex != NO_ASSERTION_INDEX)
{
// Update jumpDestValueGen if we have an assertion for the bbJumpDest edge
// Update jumpDestValueGen if we have an assertion for the bbTarget edge
optImpliedAssertions(jumpDestAssertionIndex, jumpDestValueGen);
BitVecOps::AddElemD(apTraits, jumpDestValueGen, jumpDestAssertionIndex - 1);
}
Expand All @@ -5755,7 +5755,7 @@ ASSERT_TP* Compiler::optComputeAssertionGen()
optPrintAssertionIndices(block->bbAssertionGen);
if (block->KindIs(BBJ_COND))
{
printf(" => " FMT_BB " valueGen = ", block->GetJumpDest()->bbNum);
printf(" => " FMT_BB " valueGen = ", block->GetTrueTarget()->bbNum);
optPrintAssertionIndices(jumpDestGen[block->bbNum]);
}
printf("\n");
Expand Down Expand Up @@ -6315,7 +6315,7 @@ PhaseStatus Compiler::optAssertionPropMain()
optDumpAssertionIndices(" out = ", block->bbAssertionOut, "\n");
if (block->KindIs(BBJ_COND))
{
printf(" " FMT_BB " = ", block->GetJumpDest()->bbNum);
printf(" " FMT_BB " = ", block->GetTrueTarget()->bbNum);
optDumpAssertionIndices(bbJtrueAssertionOut[block->bbNum], "\n");
}
}
Expand Down
Loading

0 comments on commit 6c7e6e2

Please sign in to comment.