[llvm] MachinePipeliner: Fix using getUniqueVRegDef on a physical register (PR #216793)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 07:47:09 PDT 2026
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/216793
>From 9005b8cb24e5d432be17a650a065cd31fe00dbde Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Mon, 17 Aug 2026 19:46:44 +0200
Subject: [PATCH 1/2] MachinePipeliner: Fix using getUniqueVRegDef on a
physical register
Currently this is permissive and doesn't assert when called with
a physical register, but I'm working on changing this edge case.
No current observable change.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
---
llvm/lib/CodeGen/MachinePipeliner.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 8ce8351b2af46..7245236bc0793 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -1323,6 +1323,8 @@ void SwingSchedulerDAG::updatePhiDependences() {
}
} else if (MO.isUse()) {
// If the register is defined by a Phi, then create a true dependence.
+ if (!Reg.isVirtual())
+ continue;
MachineInstr *DefMI = MRI.getUniqueVRegDef(Reg);
if (DefMI == nullptr)
continue;
>From ef516336c2ee72f3b62be7084d0484648e41ef11 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Tue, 8 Sep 2026 16:01:56 +0200
Subject: [PATCH 2/2] Move check up
---
llvm/lib/CodeGen/MachinePipeliner.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 7245236bc0793..5190a98ef714d 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -1288,6 +1288,9 @@ void SwingSchedulerDAG::updatePhiDependences() {
if (!MO.isReg())
continue;
Register Reg = MO.getReg();
+ if (!Reg.isVirtual())
+ continue;
+
if (MO.isDef()) {
// If the register is used by a Phi, then create an anti dependence.
for (MachineRegisterInfo::use_instr_iterator
@@ -1323,8 +1326,6 @@ void SwingSchedulerDAG::updatePhiDependences() {
}
} else if (MO.isUse()) {
// If the register is defined by a Phi, then create a true dependence.
- if (!Reg.isVirtual())
- continue;
MachineInstr *DefMI = MRI.getUniqueVRegDef(Reg);
if (DefMI == nullptr)
continue;
More information about the llvm-commits
mailing list