[llvm] fixed lld-link: error: duplicate symbol: public: __cdecl llvm::Predic… (PR #169970)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 3 17:31:18 PST 2025


https://github.com/cctv130 updated https://github.com/llvm/llvm-project/pull/169970

>From cb26f79fe5f11fa3d40bf79a865b01c62e909710 Mon Sep 17 00:00:00 2001
From: cctv130 <chinaxke at gmail.com>
Date: Sat, 29 Nov 2025 03:40:48 +0000
Subject: [PATCH 1/2] fixed lld-link: error: duplicate symbol: public: __cdecl
 llvm::PredicateInfo::~PredicateInfo(void)

---
 llvm/utils/TableGen/Common/CodeGenSchedule.cpp   |  2 +-
 llvm/utils/TableGen/Common/CodeGenSchedule.h     | 10 +++++-----
 llvm/utils/TableGen/Common/PredicateExpander.cpp |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
index a47ab7667d891..12d13351f82ce 100644
--- a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
@@ -431,7 +431,7 @@ void OpcodeInfo::addPredicateForProcModel(const llvm::APInt &CpuMask,
                                           const llvm::APInt &OperandMask,
                                           const Record *Predicate) {
   auto It = llvm::find_if(
-      Predicates, [&OperandMask, &Predicate](const PredicateInfo &P) {
+      Predicates, [&OperandMask, &Predicate](const SchedulePredicateInfo &P) {
         return P.Predicate == Predicate && P.OperandMask == OperandMask;
       });
   if (It == Predicates.end()) {
diff --git a/llvm/utils/TableGen/Common/CodeGenSchedule.h b/llvm/utils/TableGen/Common/CodeGenSchedule.h
index 1d5e953cf70c7..3f8912f6f15c9 100644
--- a/llvm/utils/TableGen/Common/CodeGenSchedule.h
+++ b/llvm/utils/TableGen/Common/CodeGenSchedule.h
@@ -330,14 +330,14 @@ struct CodeGenProcModel {
 /// It may be used to describe conditions that appy only to a subset of the
 /// operands of a machine instruction, and the operands subset may not be the
 /// same for all processor models.
-struct PredicateInfo {
+struct SchedulePredicateInfo {
   llvm::APInt ProcModelMask; // A set of processor model indices.
   llvm::APInt OperandMask;   // An operand mask.
   const Record *Predicate;   // MCInstrPredicate definition.
-  PredicateInfo(llvm::APInt CpuMask, llvm::APInt Operands, const Record *Pred)
+  SchedulePredicateInfo(llvm::APInt CpuMask, llvm::APInt Operands, const Record *Pred)
       : ProcModelMask(CpuMask), OperandMask(Operands), Predicate(Pred) {}
 
-  bool operator==(const PredicateInfo &Other) const {
+  bool operator==(const SchedulePredicateInfo &Other) const {
     return ProcModelMask == Other.ProcModelMask &&
            OperandMask == Other.OperandMask && Predicate == Other.Predicate;
   }
@@ -348,7 +348,7 @@ struct PredicateInfo {
 /// There is at least one OpcodeInfo object for every opcode specified by a
 /// TIPredicate definition.
 class OpcodeInfo {
-  std::vector<PredicateInfo> Predicates;
+  std::vector<SchedulePredicateInfo> Predicates;
 
   OpcodeInfo(const OpcodeInfo &Other) = delete;
   OpcodeInfo &operator=(const OpcodeInfo &Other) = delete;
@@ -358,7 +358,7 @@ class OpcodeInfo {
   OpcodeInfo &operator=(OpcodeInfo &&Other) = default;
   OpcodeInfo(OpcodeInfo &&Other) = default;
 
-  ArrayRef<PredicateInfo> getPredicates() const { return Predicates; }
+  ArrayRef<SchedulePredicateInfo> getPredicates() const { return Predicates; }
 
   void addPredicateForProcModel(const llvm::APInt &CpuMask,
                                 const llvm::APInt &OperandMask,
diff --git a/llvm/utils/TableGen/Common/PredicateExpander.cpp b/llvm/utils/TableGen/Common/PredicateExpander.cpp
index 03252ed465b75..504f5da4f9320 100644
--- a/llvm/utils/TableGen/Common/PredicateExpander.cpp
+++ b/llvm/utils/TableGen/Common/PredicateExpander.cpp
@@ -467,7 +467,7 @@ void STIPredicateExpander::expandOpcodeGroup(raw_ostream &OS,
                                              const OpcodeGroup &Group,
                                              bool ShouldUpdateOpcodeMask) {
   const OpcodeInfo &OI = Group.getOpcodeInfo();
-  for (const PredicateInfo &PI : OI.getPredicates()) {
+  for (const SchedulePredicateInfo &PI : OI.getPredicates()) {
     const APInt &ProcModelMask = PI.ProcModelMask;
     bool FirstProcID = true;
     for (unsigned I = 0, E = ProcModelMask.getActiveBits(); I < E; ++I) {

>From 4d7ab12d57b7aa76501a95a1ff7c57863687da74 Mon Sep 17 00:00:00 2001
From: cctv130 <chinaxke at gmail.com>
Date: Mon, 1 Dec 2025 00:50:01 +0000
Subject: [PATCH 2/2] fix  clang format

---
 llvm/utils/TableGen/Common/CodeGenSchedule.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/utils/TableGen/Common/CodeGenSchedule.h b/llvm/utils/TableGen/Common/CodeGenSchedule.h
index 3f8912f6f15c9..70effffe6b77c 100644
--- a/llvm/utils/TableGen/Common/CodeGenSchedule.h
+++ b/llvm/utils/TableGen/Common/CodeGenSchedule.h
@@ -334,7 +334,8 @@ struct SchedulePredicateInfo {
   llvm::APInt ProcModelMask; // A set of processor model indices.
   llvm::APInt OperandMask;   // An operand mask.
   const Record *Predicate;   // MCInstrPredicate definition.
-  SchedulePredicateInfo(llvm::APInt CpuMask, llvm::APInt Operands, const Record *Pred)
+  SchedulePredicateInfo(llvm::APInt CpuMask, llvm::APInt Operands,
+                        const Record *Pred)
       : ProcModelMask(CpuMask), OperandMask(Operands), Predicate(Pred) {}
 
   bool operator==(const SchedulePredicateInfo &Other) const {



More information about the llvm-commits mailing list