Skip to content

Commit cd43a53

Browse files
Copilotmangod9
andauthored
Cherry-pick JIT PHI jump threading (PR #126812) with targeted fix for global PHI use bug (#126976)
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/1507ea1a-6b49-4f3d-977a-83f9c781da83 Co-authored-by: mangod9 <61718172+mangod9@users.noreply.github.com>
1 parent 10598c1 commit cd43a53

5 files changed

Lines changed: 431 additions & 28 deletions

File tree

src/coreclr/jit/compiler.h

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7857,14 +7857,23 @@ class Compiler
78577857

78587858
// Redundant branch opts
78597859
//
7860-
PhaseStatus optRedundantBranches();
7861-
bool optRedundantRelop(BasicBlock* const block);
7862-
bool optRedundantDominatingBranch(BasicBlock* const block);
7863-
bool optRedundantBranch(BasicBlock* const block);
7864-
bool optJumpThreadDom(BasicBlock* const block, BasicBlock* const domBlock, bool domIsSameRelop);
7865-
bool optJumpThreadPhi(BasicBlock* const block, GenTree* tree, ValueNum treeNormVN);
7866-
bool optJumpThreadCheck(BasicBlock* const block, BasicBlock* const domBlock);
7867-
bool optJumpThreadCore(JumpThreadInfo& jti);
7860+
enum class JumpThreadCheckResult
7861+
{
7862+
CannotThread,
7863+
CanThread,
7864+
NeedsPhiUseResolution,
7865+
};
7866+
7867+
PhaseStatus optRedundantBranches();
7868+
bool optRedundantRelop(BasicBlock* const block);
7869+
bool optRedundantDominatingBranch(BasicBlock* const block);
7870+
bool optRedundantBranch(BasicBlock* const block);
7871+
bool optJumpThreadDom(BasicBlock* const block, BasicBlock* const domBlock, bool domIsSameRelop);
7872+
bool optJumpThreadPhi(BasicBlock* const block, GenTree* tree, ValueNum treeNormVN);
7873+
JumpThreadCheckResult optJumpThreadCheck(BasicBlock* const block, BasicBlock* const domBlock);
7874+
bool optFindPhiUsesInBlockAndSuccessors(BasicBlock* block, GenTreeLclVar* phiDef, JumpThreadInfo& jti);
7875+
bool optCanRewritePhiUses(JumpThreadInfo& jti);
7876+
bool optJumpThreadCore(JumpThreadInfo& jti);
78687877

78697878
enum class ReachabilityResult
78707879
{

src/coreclr/jit/compmemkind.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ CompMemKindMacro(LSRA)
2828
CompMemKindMacro(LSRA_Interval)
2929
CompMemKindMacro(LSRA_RefPosition)
3030
CompMemKindMacro(Reachability)
31+
CompMemKindMacro(RedundantBranch)
3132
CompMemKindMacro(SSA)
3233
CompMemKindMacro(ValueNumber)
3334
CompMemKindMacro(LvaTable)

0 commit comments

Comments
 (0)