Skip to content

Commit 546c090

Browse files
committed
[MachineSink] Only add sink candidate if ToBB is a successor of fromBB
1 parent 5aed6d6 commit 546c090

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/CodeGen/MachineSink.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ bool MachineSinking::isWorthBreakingCriticalEdge(
913913
auto Res = CEMergeCandidates.try_emplace(Key, From);
914914
// We wanted to sink the same register into the same block, consider it to
915915
// be profitable.
916-
if (!Res.second) {
916+
if (!Res.second && Res.first->second->isSuccessor(To)) {
917917
// Return the source block that was previously held off.
918918
DeferredFromBlock = Res.first->second;
919919
return true;

0 commit comments

Comments
 (0)