[llvm] [SPIR-V][NFC] Remove unused helpers (PR #195804)
Arseniy Obolenskiy via llvm-commits
llvm-commits at lists.llvm.org
Tue May 5 01:02:59 PDT 2026
https://github.com/aobolensk created https://github.com/llvm/llvm-project/pull/195804
None
>From 3ff40cfd60c1bc65a8007572c57adfdfc05835ec Mon Sep 17 00:00:00 2001
From: Arseniy Obolenskiy <arseniy.obolenskiy at amd.com>
Date: Tue, 5 May 2026 10:01:30 +0200
Subject: [PATCH] [SPIR-V][NFC] Remove unused helpers
---
llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp | 2 +-
llvm/lib/Target/SPIRV/SPIRVTargetObjectFile.h | 3 ---
llvm/lib/Target/SPIRV/SPIRVUtils.cpp | 4 ----
llvm/lib/Target/SPIRV/SPIRVUtils.h | 13 -------------
4 files changed, 1 insertion(+), 21 deletions(-)
diff --git a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
index f32f3006c5e0e..9acd69cddcc7f 100644
--- a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
@@ -579,7 +579,7 @@ void SPIRVModuleAnalysis::collectFuncNames(MachineInstr &MI,
if (Lnk == SPIRV::LinkageType::Import) {
// Map imported function name to function ID register.
const Function *ImportedFunc =
- F->getParent()->getFunction(getStringImm(MI, 2));
+ F->getParent()->getFunction(getSPIRVStringOperand(MI, 2));
Register Target = MI.getOperand(0).getReg();
MAI.GlobalObjMap[ImportedFunc] =
MAI.getRegisterAlias(MI.getMF(), Target);
diff --git a/llvm/lib/Target/SPIRV/SPIRVTargetObjectFile.h b/llvm/lib/Target/SPIRV/SPIRVTargetObjectFile.h
index 078af7b22d8ae..c89f30075595f 100644
--- a/llvm/lib/Target/SPIRV/SPIRVTargetObjectFile.h
+++ b/llvm/lib/Target/SPIRV/SPIRVTargetObjectFile.h
@@ -19,9 +19,6 @@ class SPIRVTargetObjectFile : public TargetLoweringObjectFile {
public:
~SPIRVTargetObjectFile() override;
- void Initialize(MCContext &ctx, const TargetMachine &TM) override {
- TargetLoweringObjectFile::Initialize(ctx, TM);
- }
// All words in a SPIR-V module (excepting the first 5 ones) are a linear
// sequence of instructions in a specific order. We put all the instructions
// in the single text section.
diff --git a/llvm/lib/Target/SPIRV/SPIRVUtils.cpp b/llvm/lib/Target/SPIRV/SPIRVUtils.cpp
index 6f8411f05cb52..200cd743f004d 100644
--- a/llvm/lib/Target/SPIRV/SPIRVUtils.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVUtils.cpp
@@ -172,10 +172,6 @@ void addStringImm(const StringRef &Str, IRBuilder<> &B,
}
}
-std::string getStringImm(const MachineInstr &MI, unsigned StartIndex) {
- return getSPIRVStringOperand(MI, StartIndex);
-}
-
std::string getStringValueFromReg(Register Reg, MachineRegisterInfo &MRI) {
MachineInstr *Def = getVRegDef(MRI, Reg);
assert(Def && Def->getOpcode() == TargetOpcode::G_GLOBAL_VALUE &&
diff --git a/llvm/lib/Target/SPIRV/SPIRVUtils.h b/llvm/lib/Target/SPIRV/SPIRVUtils.h
index 50e8788d79b2d..4cd608cc86f90 100644
--- a/llvm/lib/Target/SPIRV/SPIRVUtils.h
+++ b/llvm/lib/Target/SPIRV/SPIRVUtils.h
@@ -31,7 +31,6 @@
namespace llvm {
class MCInst;
class MachineFunction;
-class MachineInstr;
class MachineInstrBuilder;
class MachineIRBuilder;
class MachineRegisterInfo;
@@ -40,7 +39,6 @@ class StringRef;
class SPIRVInstrInfo;
class SPIRVSubtarget;
class SPIRVGlobalRegistry;
-class SPIRVTypeInst;
// This class implements a partial ordering visitor, which visits a cyclic graph
// in natural topological-like ordering. Topological ordering is not defined for
@@ -181,10 +179,6 @@ void addStringImm(const StringRef &Str, MachineInstrBuilder &MIB);
void addStringImm(const StringRef &Str, IRBuilder<> &B,
std::vector<Value *> &Args);
-// Read the series of integer operands back as a null-terminated string using
-// the reverse of the logic in addStringImm.
-std::string getStringImm(const MachineInstr &MI, unsigned StartIndex);
-
// Returns the string constant that the register refers to. It is assumed that
// Reg is a global value that contains a string.
std::string getStringValueFromReg(Register Reg, MachineRegisterInfo &MRI);
@@ -398,13 +392,6 @@ inline Type *getPointeeTypeByAttr(Argument *Arg) {
return nullptr;
}
-inline Type *reconstructFunctionType(Function *F) {
- SmallVector<Type *> ArgTys;
- for (unsigned i = 0; i < F->arg_size(); ++i)
- ArgTys.push_back(F->getArg(i)->getType());
- return FunctionType::get(F->getReturnType(), ArgTys, F->isVarArg());
-}
-
#define TYPED_PTR_TARGET_EXT_NAME "spirv.$TypedPointerType"
inline Type *getTypedPointerWrapper(Type *ElemTy, unsigned AS) {
return TargetExtType::get(ElemTy->getContext(), TYPED_PTR_TARGET_EXT_NAME,
More information about the llvm-commits
mailing list