[llvm] CodeGen: Pass instruction to DetectDeadLanes::isUndefInput (PR #219467)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 28 06:16:37 PDT 2026
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/219467
The helper only used the operand to recover its parent instruction. Pass the
containing instruction directly so it no longer depends on the
MachineOperand's parent.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
>From deb20bf1a2069b6277be0d7a6c97dbd59cf62223 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 28 Aug 2026 02:29:27 +0200
Subject: [PATCH] CodeGen: Pass instruction to DetectDeadLanes::isUndefInput
The helper only used the operand to recover its parent instruction. Pass the
containing instruction directly so it no longer depends on the
MachineOperand's parent.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
---
llvm/lib/CodeGen/DetectDeadLanes.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/CodeGen/DetectDeadLanes.cpp b/llvm/lib/CodeGen/DetectDeadLanes.cpp
index 13ac076d75bf5..cc40df81b279c 100644
--- a/llvm/lib/CodeGen/DetectDeadLanes.cpp
+++ b/llvm/lib/CodeGen/DetectDeadLanes.cpp
@@ -383,8 +383,8 @@ class DetectDeadLanes {
bool isUndefRegAtInput(const MachineOperand &MO,
const DeadLaneDetector::VRegInfo &RegInfo) const;
- bool isUndefInput(const DeadLaneDetector &DLD, const MachineOperand &MO,
- bool *CrossCopy) const;
+ bool isUndefInput(const DeadLaneDetector &DLD, const MachineInstr &MI,
+ const MachineOperand &MO, bool *CrossCopy) const;
const MachineRegisterInfo *MRI = nullptr;
const TargetRegisterInfo *TRI = nullptr;
@@ -422,11 +422,11 @@ bool DetectDeadLanes::isUndefRegAtInput(
}
bool DetectDeadLanes::isUndefInput(const DeadLaneDetector &DLD,
+ const MachineInstr &MI,
const MachineOperand &MO,
bool *CrossCopy) const {
if (!MO.isUse())
return false;
- const MachineInstr &MI = *MO.getParent();
if (!lowersToCopies(MI))
return false;
const MachineOperand &Def = MI.getOperand(0);
@@ -521,7 +521,7 @@ DetectDeadLanes::modifySubRegisterOperandStatus(const DeadLaneDetector &DLD,
<< "Marking operand '" << MO << "' as undef in " << MI);
MO.setIsUndef();
Changed = true;
- } else if (isUndefInput(DLD, MO, &CrossCopy)) {
+ } else if (isUndefInput(DLD, MI, MO, &CrossCopy)) {
LLVM_DEBUG(dbgs()
<< "Marking operand '" << MO << "' as undef in " << MI);
MO.setIsUndef();
More information about the llvm-commits
mailing list