Skip to content

Commit

Permalink
JIT: Generalize jump threading very slightly (dotnet#98107)
Browse files Browse the repository at this point in the history
If the dominator is a direct predecessor then it should be ok to jump
thread its direct edge, even if the other edge also reaches.
  • Loading branch information
jakobbotsch authored Feb 8, 2024
1 parent e6b5da2 commit a78ddcc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/coreclr/jit/redundantbranchopts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1258,10 +1258,10 @@ bool Compiler::optJumpThreadDom(BasicBlock* const block, BasicBlock* const domBl
continue;
}

const bool isTruePred = ((predBlock == domBlock) && (domTrueSuccessor == block)) ||
optReachable(domTrueSuccessor, predBlock, domBlock);
const bool isFalsePred = ((predBlock == domBlock) && (domFalseSuccessor == block)) ||
optReachable(domFalseSuccessor, predBlock, domBlock);
const bool isTruePred =
(predBlock == domBlock) ? (domTrueSuccessor == block) : optReachable(domTrueSuccessor, predBlock, domBlock);
const bool isFalsePred = (predBlock == domBlock) ? (domFalseSuccessor == block)
: optReachable(domFalseSuccessor, predBlock, domBlock);

if (isTruePred == isFalsePred)
{
Expand Down

0 comments on commit a78ddcc

Please sign in to comment.