[llvm] [llvm] Adjust export annotations for tests (PR #227255)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 03:26:51 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Fabrice de Gans (Steelskin)

<details>
<summary>Changes</summary>

* Properly export templates so they work on both Windows and Linux.
* Adjust LLVM_ABI_FOR_TEST annotations to be in the right place and remove redundant annotations.

---
Full diff: https://github.com/llvm/llvm-project/pull/227255.diff


5 Files Affected:

- (modified) llvm/include/llvm/SandboxIR/Instruction.h (+7-2) 
- (modified) llvm/lib/SandboxIR/Instruction.cpp (+3-3) 
- (modified) llvm/lib/Transforms/Vectorize/VPlan.h (+11-11) 
- (modified) llvm/lib/Transforms/Vectorize/VPlanDominatorTree.h (+3-3) 
- (modified) llvm/lib/Transforms/Vectorize/VPlanValue.h (+2-2) 


``````````diff
diff --git a/llvm/include/llvm/SandboxIR/Instruction.h b/llvm/include/llvm/SandboxIR/Instruction.h
index fe54f3da818c0..1e07beec9b2cb 100644
--- a/llvm/include/llvm/SandboxIR/Instruction.h
+++ b/llvm/include/llvm/SandboxIR/Instruction.h
@@ -1967,8 +1967,8 @@ class SwitchInst : public SingleLLVMInstructionImpl<llvm::SwitchInst> {
   public:
     CaseHandleImpl(Context &Ctx, LLVMCaseItT LLVMCaseIt)
         : Ctx(Ctx), LLVMCaseIt(LLVMCaseIt) {}
-    LLVM_ABI ConstT *getCaseValue() const;
-    LLVM_ABI BlockT *getCaseSuccessor() const;
+    ConstT *getCaseValue() const;
+    BlockT *getCaseSuccessor() const;
     unsigned getCaseIndex() const {
       const auto &LLVMCaseHandle = *LLVMCaseIt;
       return LLVMCaseHandle.getCaseIndex();
@@ -2083,6 +2083,11 @@ class SwitchInst : public SingleLLVMInstructionImpl<llvm::SwitchInst> {
   }
 };
 
+extern template class LLVM_TEMPLATE_ABI SwitchInst::CaseHandleImpl<
+    llvm::SwitchInst::CaseIt, BasicBlock, ConstantInt>;
+extern template class LLVM_TEMPLATE_ABI SwitchInst::CaseHandleImpl<
+    llvm::SwitchInst::ConstCaseIt, const BasicBlock, const ConstantInt>;
+
 class UnaryOperator : public UnaryInstruction {
   static Opcode getUnaryOpcode(llvm::Instruction::UnaryOps UnOp) {
     switch (UnOp) {
diff --git a/llvm/lib/SandboxIR/Instruction.cpp b/llvm/lib/SandboxIR/Instruction.cpp
index e75672076666b..673a5645d777c 100644
--- a/llvm/lib/SandboxIR/Instruction.cpp
+++ b/llvm/lib/SandboxIR/Instruction.cpp
@@ -1164,12 +1164,12 @@ SwitchInst::CaseHandleImpl<LLVMCaseItT, BlockT, ConstT>::getCaseSuccessor()
   return cast<BlockT>(Ctx.getValue(LLVMBB));
 }
 
-template class LLVM_ABI_FOR_TEST SwitchInst::CaseHandleImpl<
+template class LLVM_EXPORT_TEMPLATE SwitchInst::CaseHandleImpl<
     llvm::SwitchInst::CaseIt, BasicBlock, ConstantInt>;
 template class SwitchInst::CaseItImpl<llvm::SwitchInst::CaseIt, BasicBlock,
                                       ConstantInt>;
-template class SwitchInst::CaseHandleImpl<llvm::SwitchInst::ConstCaseIt,
-                                          const BasicBlock, const ConstantInt>;
+template class LLVM_EXPORT_TEMPLATE SwitchInst::CaseHandleImpl<
+    llvm::SwitchInst::ConstCaseIt, const BasicBlock, const ConstantInt>;
 template class SwitchInst::CaseItImpl<llvm::SwitchInst::ConstCaseIt,
                                       const BasicBlock, const ConstantInt>;
 
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index eb1e496f6e007..b5b832ec31d0e 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1905,19 +1905,19 @@ class LLVM_ABI_FOR_TEST VPWidenCastRecipe : public VPRecipeWithIRFlags,
   VP_CLASSOF_IMPL(VPRecipeBase::VPWidenCastSC)
 
   /// Produce widened copies of the cast.
-  LLVM_ABI_FOR_TEST void execute(VPTransformState &State) override;
+  void execute(VPTransformState &State) override;
 
   /// Return the cost of this VPWidenCastRecipe.
-  LLVM_ABI_FOR_TEST InstructionCost
-  computeCost(ElementCount VF, VPCostContext &Ctx) const override;
+  InstructionCost computeCost(ElementCount VF,
+                              VPCostContext &Ctx) const override;
 
   Instruction::CastOps getOpcode() const { return Opcode; }
 
 protected:
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   /// Print the recipe.
-  LLVM_ABI_FOR_TEST void printRecipe(raw_ostream &O, const Twine &Indent,
-                                     VPSlotTracker &SlotTracker) const override;
+  void printRecipe(raw_ostream &O, const Twine &Indent,
+                   VPSlotTracker &SlotTracker) const override;
 #endif
 };
 
@@ -2013,7 +2013,7 @@ class LLVM_ABI_FOR_TEST VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags,
   }
 
   /// Produce a widened version of the vector intrinsic.
-  LLVM_ABI_FOR_TEST void execute(VPTransformState &State) override;
+  void execute(VPTransformState &State) override;
 
   /// Compute the cost of a vector intrinsic with \p ID and \p Operands.
   static InstructionCost computeCallCost(Intrinsic::ID ID,
@@ -2022,8 +2022,8 @@ class LLVM_ABI_FOR_TEST VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags,
                                          ElementCount VF, VPCostContext &Ctx);
 
   /// Return the cost of this vector intrinsic.
-  LLVM_ABI_FOR_TEST InstructionCost
-  computeCost(ElementCount VF, VPCostContext &Ctx) const override;
+  InstructionCost computeCost(ElementCount VF,
+                              VPCostContext &Ctx) const override;
 
   /// Return the ID of the intrinsic.
   Intrinsic::ID getVectorIntrinsicID() const { return VectorIntrinsicID; }
@@ -2040,13 +2040,13 @@ class LLVM_ABI_FOR_TEST VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags,
   /// Returns true if the intrinsic may have side-effects.
   bool mayHaveSideEffects() const { return MayHaveSideEffects; }
 
-  LLVM_ABI_FOR_TEST bool usesFirstLaneOnly(const VPValue *Op) const override;
+  bool usesFirstLaneOnly(const VPValue *Op) const override;
 
 protected:
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   /// Print the recipe.
-  LLVM_ABI_FOR_TEST void printRecipe(raw_ostream &O, const Twine &Indent,
-                                     VPSlotTracker &SlotTracker) const override;
+  void printRecipe(raw_ostream &O, const Twine &Indent,
+                   VPSlotTracker &SlotTracker) const override;
 #endif
 };
 
diff --git a/llvm/lib/Transforms/Vectorize/VPlanDominatorTree.h b/llvm/lib/Transforms/Vectorize/VPlanDominatorTree.h
index 5922f152ac41a..c632be1e992bb 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanDominatorTree.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanDominatorTree.h
@@ -36,8 +36,7 @@ template <> struct DomTreeNodeTraits<VPBlockBase> {
 
 /// Template specialization of the standard LLVM dominator tree utility for
 /// VPBlockBases.
-class LLVM_ABI_FOR_TEST VPDominatorTree
-    : public DominatorTreeBase<VPBlockBase, false> {
+class VPDominatorTree : public DominatorTreeBase<VPBlockBase, false> {
   using Base = DominatorTreeBase<VPBlockBase, false>;
 
 public:
@@ -45,7 +44,8 @@ class LLVM_ABI_FOR_TEST VPDominatorTree
 
   /// Returns true if \p A properly dominates \p B.
   using Base::properlyDominates;
-  bool properlyDominates(const VPRecipeBase *A, const VPRecipeBase *B) const;
+  LLVM_ABI_FOR_TEST bool properlyDominates(const VPRecipeBase *A,
+                                           const VPRecipeBase *B) const;
 };
 
 /// Template specialization of the standard LLVM post-dominator tree utility for
diff --git a/llvm/lib/Transforms/Vectorize/VPlanValue.h b/llvm/lib/Transforms/Vectorize/VPlanValue.h
index efee052081c06..7256c3b4e1f5d 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanValue.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanValue.h
@@ -363,8 +363,8 @@ class LLVM_ABI_FOR_TEST VPSingleDefValue : public VPRecipeValue {
 
 protected:
   /// Construct a VPSingleDefValue. Must only be used by VPSingleDefRecipe.
-  LLVM_ABI_FOR_TEST VPSingleDefValue(VPSingleDefRecipe *Def,
-                                     Value *UV = nullptr, Type *Ty = nullptr);
+  VPSingleDefValue(VPSingleDefRecipe *Def, Value *UV = nullptr,
+                   Type *Ty = nullptr);
 
 public:
   ~VPSingleDefValue() override;

``````````

</details>


https://github.com/llvm/llvm-project/pull/227255


More information about the llvm-commits mailing list