Skip to content

Commit a78ddcc

Browse files
authored
JIT: Generalize jump threading very slightly (#98107)
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.
1 parent e6b5da2 commit a78ddcc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/coreclr/jit/redundantbranchopts.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1258,10 +1258,10 @@ bool Compiler::optJumpThreadDom(BasicBlock* const block, BasicBlock* const domBl
12581258
continue;
12591259
}
12601260

1261-
const bool isTruePred = ((predBlock == domBlock) && (domTrueSuccessor == block)) ||
1262-
optReachable(domTrueSuccessor, predBlock, domBlock);
1263-
const bool isFalsePred = ((predBlock == domBlock) && (domFalseSuccessor == block)) ||
1264-
optReachable(domFalseSuccessor, predBlock, domBlock);
1261+
const bool isTruePred =
1262+
(predBlock == domBlock) ? (domTrueSuccessor == block) : optReachable(domTrueSuccessor, predBlock, domBlock);
1263+
const bool isFalsePred = (predBlock == domBlock) ? (domFalseSuccessor == block)
1264+
: optReachable(domFalseSuccessor, predBlock, domBlock);
12651265

12661266
if (isTruePred == isFalsePred)
12671267
{

0 commit comments

Comments
 (0)