Skip to content

Commit

Permalink
JIT: experimental changes to redundant branch opts
Browse files Browse the repository at this point in the history
Recognize a particular case where a control flow pattern involving two BBJ_COND
blocks with relops that test the same VNs can be simplified to a single relop
in the dominating block.

As part of this, teach VN about some of the rudiments of boolean simplification
(DeMorgan's laws)  and how to simplify some NOT / AND / OR expressions involving
relops.

Addresses some of the cases in dotnet#81220.
  • Loading branch information
AndyAyersMS committed Mar 23, 2023
1 parent 8999f4b commit 6483987
Show file tree
Hide file tree
Showing 4 changed files with 895 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -7142,6 +7142,8 @@ class Compiler
PhaseStatus optRedundantBranches();
bool optRedundantRelop(BasicBlock* const block);
bool optRedundantBranch(BasicBlock* const block);
bool optHasIgnorableSideEffects(BasicBlock* const block);
bool optSubsumeRelop(BasicBlock* const block, BasicBlock* const domBlock, bool trueReaches);
bool optJumpThreadDom(BasicBlock* const block, BasicBlock* const domBlock, bool domIsSameRelop);
bool optJumpThreadPhi(BasicBlock* const block, GenTree* tree, ValueNum treeNormVN);
bool optJumpThreadCheck(BasicBlock* const block, BasicBlock* const domBlock);
Expand Down
Loading

0 comments on commit 6483987

Please sign in to comment.