[llvm] [CodeGen] Do not include undef registers in the set of used ops (PR #80367)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 4 10:03:09 PST 2024
https://github.com/AtariDreams updated https://github.com/llvm/llvm-project/pull/80367
>From e8f57e98d2b4c3a8d9f073737cf680cf0645e855 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] [CodeGen] Do not include undef registers in the set of used
ops
Undef registers are no-ops, and therefore do not have any dependency associated with them, nor should undef registers be counted as a used op.
---
llvm/lib/CodeGen/MachineSink.cpp | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp
index e7e8f60268348..5c065f2ed224f 100644
--- a/llvm/lib/CodeGen/MachineSink.cpp
+++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -1979,11 +1979,10 @@ 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 entire condition
+ // with MO.readReg().
+ } else if (!MO.isUndef() && MO.isUse()) {
if (!ModifiedRegUnits.available(Reg)) {
HasRegDependency = true;
break;
More information about the llvm-commits
mailing list