[llvm] AMDGPU: Remove unnecessary lookup of function from machineinstr (PR #208222)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 06:31:57 PDT 2026


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/208222

The function is already a shadowed member of the class.

>From da2bd970754a0d8eff6e47081947bb63fed2e7d9 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Wed, 8 Jul 2026 15:30:54 +0200
Subject: [PATCH] AMDGPU: Remove unnecessary lookup of function from
 machineinstr

The function is already a shadowed member of the class.
---
 llvm/lib/Target/AMDGPU/SIFoldOperands.cpp | 2 --
 1 file changed, 2 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
index e13c2f4746190..ee20f138f245f 100644
--- a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
+++ b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
@@ -1376,7 +1376,6 @@ void SIFoldOperandsImpl::foldOperand(
       if (MovOp == AMDGPU::V_MOV_B16_t16_e64) {
         const auto &SrcOp = UseMI->getOperand(UseOpIdx);
         MachineOperand NewSrcOp(SrcOp);
-        MachineFunction *MF = UseMI->getMF();
         UseMI->removeOperand(1);
         UseMI->addOperand(*MF, MachineOperand::CreateImm(0)); // src0_modifiers
         UseMI->addOperand(NewSrcOp);                          // src0
@@ -1833,7 +1832,6 @@ bool SIFoldOperandsImpl::foldInstOperand(MachineInstr &MI,
   if (CopiesToReplace.empty() && FoldList.empty())
     return Changed;
 
-  MachineFunction *MF = MI.getMF();
   // Make sure we add EXEC uses to any new v_mov instructions created.
   for (MachineInstr *Copy : CopiesToReplace)
     Copy->addImplicitDefUseOperands(*MF);



More information about the llvm-commits mailing list