[llvm] [MachineSink] Only add sink candidate if toBB is a successor of fromBB (PR #98540)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 11 13:30:16 PDT 2024
https://github.com/yozhu created https://github.com/llvm/llvm-project/pull/98540
Fix an issue in #97618 - only sink candidate from immediate predecessor block should be added as candidate for critical edge splitting.
>From c230c574fc3c7f3ebd837cf04a8a3aba2abf67db Mon Sep 17 00:00:00 2001
From: YongKang Zhu <yongzhu at fb.com>
Date: Thu, 11 Jul 2024 13:17:43 -0700
Subject: [PATCH] [MachineSink] Only add sink candidate if toBB is a successor
of fromBB
---
llvm/lib/CodeGen/MachineSink.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp
index bbc5ab13a0cd3..4d8de6765273f 100644
--- a/llvm/lib/CodeGen/MachineSink.cpp
+++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -913,7 +913,7 @@ bool MachineSinking::isWorthBreakingCriticalEdge(
auto Res = CEMergeCandidates.try_emplace(Key, From);
// We wanted to sink the same register into the same block, consider it to
// be profitable.
- if (!Res.second) {
+ if (!Res.second && Res.first->second->isSuccessor(To)) {
// Return the source block that was previously held off.
DeferredFromBlock = Res.first->second;
return true;
More information about the llvm-commits
mailing list