[llvm] MachinePipeliner: Pass instruction to findLoopIncrementValue (PR #219966)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 31 06:15:51 PDT 2026
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/219966
The helper recovered the loop block from the operand's parent instruction.
Pass the containing instruction directly so it no longer depends on
MachineOperand::getParent().
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
>From 6cfe4292d755071433c5efb05b1bd49d35758694 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 28 Aug 2026 16:25:51 +0200
Subject: [PATCH] MachinePipeliner: Pass instruction to findLoopIncrementValue
The helper recovered the loop block from the operand's parent instruction.
Pass the containing instruction directly so it no longer depends on
MachineOperand::getParent().
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
---
llvm/lib/CodeGen/MachinePipeliner.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 662d9dc8ea0b1..8ce8351b2af46 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -2932,13 +2932,14 @@ static Register findUniqueOperandDefinedInLoop(const MachineInstr &MI) {
/// When Op is a value that is incremented recursively in a loop and there is a
/// unique instruction that increments it, returns true and sets Value.
-static bool findLoopIncrementValue(const MachineOperand &Op, int &Value) {
+static bool findLoopIncrementValue(const MachineInstr &MI,
+ const MachineOperand &Op, int &Value) {
if (!Op.isReg() || !Op.getReg().isVirtual())
return false;
Register OrgReg = Op.getReg();
Register CurReg = OrgReg;
- const MachineBasicBlock *LoopBB = Op.getParent()->getParent();
+ const MachineBasicBlock *LoopBB = MI.getParent();
const MachineRegisterInfo &MRI = LoopBB->getParent()->getRegInfo();
const TargetInstrInfo *TII =
@@ -3026,7 +3027,7 @@ bool SwingSchedulerDAG::computeDelta(const MachineInstr &MI, int &Delta) const {
if (!BaseOp->isReg())
return false;
- return findLoopIncrementValue(*BaseOp, Delta);
+ return findLoopIncrementValue(MI, *BaseOp, Delta);
}
/// Check if we can change the instruction to use an offset value from the
More information about the llvm-commits
mailing list