[llvm] Do not include undef registers as requiring a register dependency (PR #80367)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 16:49:09 PST 2024


https://github.com/AtariDreams created https://github.com/llvm/llvm-project/pull/80367

None

>From 93ff312692193be48f099a6d0c717b24a3ea678e Mon Sep 17 00:00:00 2001
From: Rose <83477269+AtariDreams at users.noreply.github.com>
Date: Thu, 1 Feb 2024 19:23:55 -0500
Subject: [PATCH] Do not include undef registers as requiring a register
 dependency

---
 llvm/lib/CodeGen/MachineSink.cpp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp
index e7e8f60268348..778a338117186 100644
--- a/llvm/lib/CodeGen/MachineSink.cpp
+++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -1979,11 +1979,9 @@ static bool hasRegisterDependency(MachineInstr *MI,
       }
       DefedRegsInCopy.push_back(Reg);
 
-      // FIXME: instead of isUse(), readsReg() would be a better fix here,
-      // For example, we can ignore modifications in reg with undef. However,
-      // it's not perfectly clear if skipping the internal read is safe in all
-      // other targets.
-    } else if (MO.isUse()) {
+      // FIXME: It's not perfectly clear if skipping the internal read is safe in all
+      // other targets. If it is, we can replace this with MO.readReg()
+    } else if (!MO.isUndef()) {
       if (!ModifiedRegUnits.available(Reg)) {
         HasRegDependency = true;
         break;



More information about the llvm-commits mailing list