[llvm] [IR] Remove unused MINARITY operand trait tpl args, NFC (PR #107165)
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 3 15:55:25 PDT 2024
https://github.com/rnk created https://github.com/llvm/llvm-project/pull/107165
These don't look like they've been used since the original 'use-diet' branch was merged in 2008 ( f6caff66a1bfa6464e6a17c0bcfcf06a09a9b909)
>From 6493fd8a4fe09e28ab7cd7e9a8fa18af5f951c89 Mon Sep 17 00:00:00 2001
From: Reid Kleckner <rnk at google.com>
Date: Tue, 3 Sep 2024 22:51:33 +0000
Subject: [PATCH] [IR] Remove unused MINARITY operand trait tpl args, NFC
These don't look like they've been used since the original 'use-diet'
branch was merged in 2008 ( f6caff66a1bfa6464e6a17c0bcfcf06a09a9b909)
---
llvm/include/llvm/Analysis/MemorySSA.h | 2 +-
llvm/include/llvm/IR/Constants.h | 2 +-
llvm/include/llvm/IR/Function.h | 3 +--
llvm/include/llvm/IR/InstrTypes.h | 4 ++--
llvm/include/llvm/IR/Instructions.h | 29 +++++++++-----------------
llvm/include/llvm/IR/OperandTraits.h | 4 +---
llvm/include/llvm/IR/Operator.h | 4 ++--
llvm/include/llvm/IR/User.h | 1 -
llvm/lib/IR/ConstantsContext.h | 2 +-
9 files changed, 19 insertions(+), 32 deletions(-)
diff --git a/llvm/include/llvm/Analysis/MemorySSA.h b/llvm/include/llvm/Analysis/MemorySSA.h
index 43fea6ba27ec4f..c5eff151ca4180 100644
--- a/llvm/include/llvm/Analysis/MemorySSA.h
+++ b/llvm/include/llvm/Analysis/MemorySSA.h
@@ -689,7 +689,7 @@ inline void MemoryUseOrDef::resetOptimized() {
cast<MemoryUse>(this)->resetOptimized();
}
-template <> struct OperandTraits<MemoryPhi> : public HungoffOperandTraits<2> {};
+template <> struct OperandTraits<MemoryPhi> : public HungoffOperandTraits {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(MemoryPhi, MemoryAccess)
/// Encapsulates MemorySSA, including all data associated with memory
diff --git a/llvm/include/llvm/IR/Constants.h b/llvm/include/llvm/IR/Constants.h
index 2788751e8b62a1..62ccde96e5397b 100644
--- a/llvm/include/llvm/IR/Constants.h
+++ b/llvm/include/llvm/IR/Constants.h
@@ -1381,7 +1381,7 @@ class ConstantExpr : public Constant {
template <>
struct OperandTraits<ConstantExpr>
- : public VariadicOperandTraits<ConstantExpr, 1> {};
+ : public VariadicOperandTraits<ConstantExpr> {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantExpr, Constant)
diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h
index 4abf978687d9d5..ce48eed7883e62 100644
--- a/llvm/include/llvm/IR/Function.h
+++ b/llvm/include/llvm/IR/Function.h
@@ -1038,8 +1038,7 @@ class LLVM_EXTERNAL_VISIBILITY Function : public GlobalObject,
/// Return value: true => null pointer dereference is not undefined.
bool NullPointerIsDefined(const Function *F, unsigned AS = 0);
-template <>
-struct OperandTraits<Function> : public HungoffOperandTraits<3> {};
+template <> struct OperandTraits<Function> : public HungoffOperandTraits {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(Function, Value)
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index afae564bf022d2..6fddedd86e97b8 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -2407,7 +2407,7 @@ class CallBase : public Instruction {
};
template <>
-struct OperandTraits<CallBase> : public VariadicOperandTraits<CallBase, 1> {};
+struct OperandTraits<CallBase> : public VariadicOperandTraits<CallBase> {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CallBase, Value)
@@ -2474,7 +2474,7 @@ class FuncletPadInst : public Instruction {
template <>
struct OperandTraits<FuncletPadInst>
- : public VariadicOperandTraits<FuncletPadInst, /*MINARITY=*/1> {};
+ : public VariadicOperandTraits<FuncletPadInst> {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(FuncletPadInst, Value)
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index dbd7d49a3e7672..6257d03458cab2 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -1112,9 +1112,8 @@ class GetElementPtrInst : public Instruction {
};
template <>
-struct OperandTraits<GetElementPtrInst> :
- public VariadicOperandTraits<GetElementPtrInst, 1> {
-};
+struct OperandTraits<GetElementPtrInst>
+ : public VariadicOperandTraits<GetElementPtrInst> {};
GetElementPtrInst::GetElementPtrInst(Type *PointeeType, Value *Ptr,
ArrayRef<Value *> IdxList, unsigned Values,
@@ -2723,9 +2722,7 @@ class PHINode : public Instruction {
void growOperands();
};
-template <>
-struct OperandTraits<PHINode> : public HungoffOperandTraits<2> {
-};
+template <> struct OperandTraits<PHINode> : public HungoffOperandTraits {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(PHINode, Value)
@@ -2825,8 +2822,7 @@ class LandingPadInst : public Instruction {
};
template <>
-struct OperandTraits<LandingPadInst> : public HungoffOperandTraits<1> {
-};
+struct OperandTraits<LandingPadInst> : public HungoffOperandTraits {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(LandingPadInst, Value)
@@ -2903,8 +2899,7 @@ class ReturnInst : public Instruction {
};
template <>
-struct OperandTraits<ReturnInst> : public VariadicOperandTraits<ReturnInst> {
-};
+struct OperandTraits<ReturnInst> : public VariadicOperandTraits<ReturnInst> {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ReturnInst, Value)
@@ -3039,8 +3034,7 @@ class BranchInst : public Instruction {
};
template <>
-struct OperandTraits<BranchInst> : public VariadicOperandTraits<BranchInst, 1> {
-};
+struct OperandTraits<BranchInst> : public VariadicOperandTraits<BranchInst> {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BranchInst, Value)
@@ -3428,9 +3422,7 @@ class SwitchInstProfUpdateWrapper {
static CaseWeightOpt getSuccessorWeight(const SwitchInst &SI, unsigned idx);
};
-template <>
-struct OperandTraits<SwitchInst> : public HungoffOperandTraits<2> {
-};
+template <> struct OperandTraits<SwitchInst> : public HungoffOperandTraits {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(SwitchInst, Value)
@@ -3554,8 +3546,7 @@ class IndirectBrInst : public Instruction {
};
template <>
-struct OperandTraits<IndirectBrInst> : public HungoffOperandTraits<1> {
-};
+struct OperandTraits<IndirectBrInst> : public HungoffOperandTraits {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(IndirectBrInst, Value)
@@ -4105,7 +4096,7 @@ class CatchSwitchInst : public Instruction {
};
template <>
-struct OperandTraits<CatchSwitchInst> : public HungoffOperandTraits<2> {};
+struct OperandTraits<CatchSwitchInst> : public HungoffOperandTraits {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CatchSwitchInst, Value)
@@ -4337,7 +4328,7 @@ class CleanupReturnInst : public Instruction {
template <>
struct OperandTraits<CleanupReturnInst>
- : public VariadicOperandTraits<CleanupReturnInst, /*MINARITY=*/1> {};
+ : public VariadicOperandTraits<CleanupReturnInst> {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CleanupReturnInst, Value)
diff --git a/llvm/include/llvm/IR/OperandTraits.h b/llvm/include/llvm/IR/OperandTraits.h
index ffece6324aab02..efc3d7838feaf0 100644
--- a/llvm/include/llvm/IR/OperandTraits.h
+++ b/llvm/include/llvm/IR/OperandTraits.h
@@ -64,8 +64,7 @@ struct OptionalOperandTraits : public FixedNumOperandTraits<SubClass, ARITY> {
/// when it is a prefix to the User object, and the number of Use objects is
/// only known at allocation time.
-template <typename SubClass, unsigned MINARITY = 0>
-struct VariadicOperandTraits {
+template <typename SubClass> struct VariadicOperandTraits {
static Use *op_begin(SubClass* U) {
static_assert(
!std::is_polymorphic<SubClass>::value,
@@ -91,7 +90,6 @@ struct VariadicOperandTraits {
/// This is the traits class that is needed when the Use array must be
/// resizable.
-template <unsigned MINARITY = 1>
struct HungoffOperandTraits {
static Use *op_begin(User* U) {
return U->getHungOffOperands();
diff --git a/llvm/include/llvm/IR/Operator.h b/llvm/include/llvm/IR/Operator.h
index f63f54ef941076..88b9bfc0be4b15 100644
--- a/llvm/include/llvm/IR/Operator.h
+++ b/llvm/include/llvm/IR/Operator.h
@@ -533,8 +533,8 @@ class GEPOperator
};
template <>
-struct OperandTraits<GEPOperator>
- : public VariadicOperandTraits<GEPOperator, 1> {};
+struct OperandTraits<GEPOperator> : public VariadicOperandTraits<GEPOperator> {
+};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GEPOperator, Value)
diff --git a/llvm/include/llvm/IR/User.h b/llvm/include/llvm/IR/User.h
index a9cf60151e5dc6..910815f236abea 100644
--- a/llvm/include/llvm/IR/User.h
+++ b/llvm/include/llvm/IR/User.h
@@ -42,7 +42,6 @@ template <class>
struct OperandTraits;
class User : public Value {
- template <unsigned>
friend struct HungoffOperandTraits;
LLVM_ATTRIBUTE_ALWAYS_INLINE static void *
diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index acf05379e8a2a6..bd19ec6b9dcac0 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -246,7 +246,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ShuffleVectorConstantExpr, Value)
template <>
struct OperandTraits<GetElementPtrConstantExpr>
- : public VariadicOperandTraits<GetElementPtrConstantExpr, 1> {};
+ : public VariadicOperandTraits<GetElementPtrConstantExpr> {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(GetElementPtrConstantExpr, Value)
More information about the llvm-commits
mailing list