[llvm] [llvm] export private symbols needed by unittests (PR #145767)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 25 12:07:48 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h -- llvm/lib/CodeGen/AsmPrinter/DIEHash.h llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h llvm/lib/CodeGen/RegAllocScore.h llvm/lib/FileCheck/FileCheckImpl.h llvm/lib/Transforms/Vectorize/VPlan.h llvm/lib/Transforms/Vectorize/VPlanDominatorTree.h llvm/lib/Transforms/Vectorize/VPlanSLP.h llvm/lib/Transforms/Vectorize/VPlanTransforms.h llvm/lib/Transforms/Vectorize/VPlanValue.h llvm/lib/Transforms/Vectorize/VPlanVerifier.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
index 0a43d0e06..08b9caf82 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
@@ -38,14 +38,16 @@ class DwarfStringPool {
 public:
   using EntryRef = DwarfStringPoolEntryRef;
 
-  LLVM_ABI DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix);
+  LLVM_ABI DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm,
+                           StringRef Prefix);
 
-  LLVM_ABI void emitStringOffsetsTableHeader(AsmPrinter &Asm, MCSection *OffsetSection,
-                                    MCSymbol *StartSym);
+  LLVM_ABI void emitStringOffsetsTableHeader(AsmPrinter &Asm,
+                                             MCSection *OffsetSection,
+                                             MCSymbol *StartSym);
 
   LLVM_ABI void emit(AsmPrinter &Asm, MCSection *StrSection,
-            MCSection *OffsetSection = nullptr,
-            bool UseRelativeOffsets = false);
+                     MCSection *OffsetSection = nullptr,
+                     bool UseRelativeOffsets = false);
 
   bool empty() const { return Pool.empty(); }
 
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
index ac95093f7..8e9fdbc29 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
@@ -790,7 +790,8 @@ public:
   };
 
   LLVM_ABI MLocTracker(MachineFunction &MF, const TargetInstrInfo &TII,
-              const TargetRegisterInfo &TRI, const TargetLowering &TLI);
+                       const TargetRegisterInfo &TRI,
+                       const TargetLowering &TLI);
 
   /// Produce location ID number for a Register. Provides some small amount of
   /// type safety.
@@ -1353,9 +1354,10 @@ private:
   /// live-out arrays to the (initialized to zero) multidimensional arrays in
   /// \p MInLocs and \p MOutLocs. The outer dimension is indexed by block
   /// number, the inner by LocIdx.
-  LLVM_ABI void buildMLocValueMap(MachineFunction &MF, FuncValueTable &MInLocs,
-                         FuncValueTable &MOutLocs,
-                         SmallVectorImpl<MLocTransferMap> &MLocTransfer);
+  LLVM_ABI void
+  buildMLocValueMap(MachineFunction &MF, FuncValueTable &MInLocs,
+                    FuncValueTable &MOutLocs,
+                    SmallVectorImpl<MLocTransferMap> &MLocTransfer);
 
   /// Examine the stack indexes (i.e. offsets within the stack) to find the
   /// basic units of interference -- like reg units, but for the stack.
@@ -1364,9 +1366,9 @@ private:
   /// Install PHI values into the live-in array for each block, according to
   /// the IDF of each register.
   LLVM_ABI void placeMLocPHIs(MachineFunction &MF,
-                     SmallPtrSetImpl<MachineBasicBlock *> &AllBlocks,
-                     FuncValueTable &MInLocs,
-                     SmallVectorImpl<MLocTransferMap> &MLocTransfer);
+                              SmallPtrSetImpl<MachineBasicBlock *> &AllBlocks,
+                              FuncValueTable &MInLocs,
+                              SmallVectorImpl<MLocTransferMap> &MLocTransfer);
 
   /// Propagate variable values to blocks in the common case where there's
   /// only one value assigned to the variable. This function has better
@@ -1423,12 +1425,13 @@ private:
   /// \p AssignBlocks contains the set of blocks that aren't in \p DILoc's
   /// scope, but which do contain DBG_VALUEs, which VarLocBasedImpl tracks
   /// locations through.
-  LLVM_ABI void buildVLocValueMap(const DILocation *DILoc,
-                         const SmallSet<DebugVariableID, 4> &VarsWeCareAbout,
-                         SmallPtrSetImpl<MachineBasicBlock *> &AssignBlocks,
-                         LiveInsT &Output, FuncValueTable &MOutLocs,
-                         FuncValueTable &MInLocs,
-                         SmallVectorImpl<VLocTracker> &AllTheVLocs);
+  LLVM_ABI void
+  buildVLocValueMap(const DILocation *DILoc,
+                    const SmallSet<DebugVariableID, 4> &VarsWeCareAbout,
+                    SmallPtrSetImpl<MachineBasicBlock *> &AssignBlocks,
+                    LiveInsT &Output, FuncValueTable &MOutLocs,
+                    FuncValueTable &MInLocs,
+                    SmallVectorImpl<VLocTracker> &AllTheVLocs);
 
   /// Attempt to eliminate un-necessary PHIs on entry to a block. Examines the
   /// live-in values coming from predecessors live-outs, and replaces any PHIs
@@ -1437,9 +1440,10 @@ private:
   /// \p LiveIn Old live-in value, overwritten with new one if live-in changes.
   /// \returns true if any live-ins change value, either from value propagation
   ///          or PHI elimination.
-  LLVM_ABI bool vlocJoin(MachineBasicBlock &MBB, LiveIdxT &VLOCOutLocs,
-                SmallPtrSet<const MachineBasicBlock *, 8> &BlocksToExplore,
-                DbgValue &LiveIn);
+  LLVM_ABI bool
+  vlocJoin(MachineBasicBlock &MBB, LiveIdxT &VLOCOutLocs,
+           SmallPtrSet<const MachineBasicBlock *, 8> &BlocksToExplore,
+           DbgValue &LiveIn);
 
   /// For the given block and live-outs feeding into it, try to find
   /// machine locations for each debug operand where all the values feeding
diff --git a/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h b/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
index 6dc63c838..626151806 100644
--- a/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
+++ b/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.h
@@ -42,13 +42,12 @@ LLVM_ABI void extractInstructionFeatures(
     const int MBBFreqIndex, const int MBBMappingIndex,
     const SlotIndex LastIndex);
 
-LLVM_ABI void extractMBBFrequency(const SlotIndex CurrentIndex,
-                         const size_t CurrentInstructionIndex,
-                         std::map<MachineBasicBlock *, size_t> &VisitedMBBs,
-                         function_ref<float(SlotIndex)> GetMBBFreq,
-                         MachineBasicBlock *CurrentMBBReference,
-                         MLModelRunner *RegallocRunner, const int MBBFreqIndex,
-                         const int MBBMappingIndex);
+LLVM_ABI void extractMBBFrequency(
+    const SlotIndex CurrentIndex, const size_t CurrentInstructionIndex,
+    std::map<MachineBasicBlock *, size_t> &VisitedMBBs,
+    function_ref<float(SlotIndex)> GetMBBFreq,
+    MachineBasicBlock *CurrentMBBReference, MLModelRunner *RegallocRunner,
+    const int MBBFreqIndex, const int MBBMappingIndex);
 
 // This is the maximum number of interfererring ranges. That's the number of
 // distinct AllocationOrder values, which comes from MCRegisterClass::RegsSize.
diff --git a/llvm/lib/FileCheck/FileCheckImpl.h b/llvm/lib/FileCheck/FileCheckImpl.h
index a4a1f0bb1..fbb2fab09 100644
--- a/llvm/lib/FileCheck/FileCheckImpl.h
+++ b/llvm/lib/FileCheck/FileCheckImpl.h
@@ -98,7 +98,8 @@ public:
 
   /// \returns the value corresponding to string representation \p StrVal
   /// according to the matching format represented by this instance.
-  LLVM_ABI APInt valueFromStringRepr(StringRef StrVal, const SourceMgr &SM) const;
+  LLVM_ABI APInt valueFromStringRepr(StringRef StrVal,
+                                     const SourceMgr &SM) const;
 };
 
 /// Class to represent an overflow error that might result when manipulating a
@@ -116,10 +117,14 @@ public:
 
 /// Performs operation and \returns its result or an error in case of failure,
 /// such as if an overflow occurs.
-LLVM_ABI Expected<APInt> exprAdd(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
-LLVM_ABI Expected<APInt> exprSub(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
-LLVM_ABI Expected<APInt> exprMul(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
-LLVM_ABI Expected<APInt> exprDiv(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
+LLVM_ABI Expected<APInt> exprAdd(const APInt &Lhs, const APInt &Rhs,
+                                 bool &Overflow);
+LLVM_ABI Expected<APInt> exprSub(const APInt &Lhs, const APInt &Rhs,
+                                 bool &Overflow);
+LLVM_ABI Expected<APInt> exprMul(const APInt &Lhs, const APInt &Rhs,
+                                 bool &Overflow);
+LLVM_ABI Expected<APInt> exprDiv(const APInt &Lhs, const APInt &Rhs,
+                                 bool &Overflow);
 Expected<APInt> exprMax(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
 Expected<APInt> exprMin(const APInt &Lhs, const APInt &Rhs, bool &Overflow);
 
@@ -455,7 +460,7 @@ public:
   /// \p CmdlineDefines. \returns an error list containing diagnostics against
   /// \p SM for all definition parsing failures, if any, or Success otherwise.
   LLVM_ABI Error defineCmdlineVariables(ArrayRef<StringRef> CmdlineDefines,
-                               SourceMgr &SM);
+                                        SourceMgr &SM);
 
   /// Create @LINE pseudo variable. Value is set when pattern are being
   /// matched.
@@ -658,8 +663,8 @@ public:
   /// is the name of a pseudo variable, or an error holding a diagnostic
   /// against \p SM if parsing fail. If parsing was successful, also strips
   /// \p Str from the variable name.
-  LLVM_ABI static Expected<VariableProperties> parseVariable(StringRef &Str,
-                                                    const SourceMgr &SM);
+  LLVM_ABI static Expected<VariableProperties>
+  parseVariable(StringRef &Str, const SourceMgr &SM);
   /// Parses \p Expr for a numeric substitution block at line \p LineNumber,
   /// or before input is parsed if \p LineNumber is None. Parameter
   /// \p IsLegacyLineExpr indicates whether \p Expr should be a legacy @LINE
@@ -670,7 +675,8 @@ public:
   /// successful, sets \p DefinedNumericVariable to point to the class
   /// representing the numeric variable defined in this numeric substitution
   /// block, or std::nullopt if this block does not define any variable.
-  LLVM_ABI static Expected<std::unique_ptr<Expression>> parseNumericSubstitutionBlock(
+  LLVM_ABI static Expected<std::unique_ptr<Expression>>
+  parseNumericSubstitutionBlock(
       StringRef Expr, std::optional<NumericVariable *> &DefinedNumericVariable,
       bool IsLegacyLineExpr, std::optional<size_t> LineNumber,
       FileCheckPatternContext *Context, const SourceMgr &SM);
@@ -681,8 +687,8 @@ public:
   /// global options that influence the parsing such as whitespace
   /// canonicalization, \p SM provides the SourceMgr used for error reports.
   /// \returns true in case of an error, false otherwise.
-  LLVM_ABI bool parsePattern(StringRef PatternStr, StringRef Prefix, SourceMgr &SM,
-                    const FileCheckRequest &Req);
+  LLVM_ABI bool parsePattern(StringRef PatternStr, StringRef Prefix,
+                             SourceMgr &SM, const FileCheckRequest &Req);
   struct Match {
     size_t Pos;
     size_t Len;
@@ -717,8 +723,9 @@ public:
   bool hasVariable() const {
     return !(Substitutions.empty() && VariableDefs.empty());
   }
-  LLVM_ABI void printVariableDefs(const SourceMgr &SM, FileCheckDiag::MatchType MatchTy,
-                         std::vector<FileCheckDiag> *Diags) const;
+  LLVM_ABI void printVariableDefs(const SourceMgr &SM,
+                                  FileCheckDiag::MatchType MatchTy,
+                                  std::vector<FileCheckDiag> *Diags) const;
 
   Check::FileCheckType getCheckTy() const { return CheckTy; }
 
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index aef127968..9f191f1f5 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -385,9 +385,10 @@ public:
 /// and is responsible for deleting its defined values. Single-value
 /// recipes must inherit from VPSingleDef instead of inheriting from both
 /// VPRecipeBase and VPValue separately.
-class LLVM_ABI VPRecipeBase : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
-                     public VPDef,
-                     public VPUser {
+class LLVM_ABI VPRecipeBase
+    : public ilist_node_with_parent<VPRecipeBase, VPBasicBlock>,
+      public VPDef,
+      public VPUser {
   friend VPBasicBlock;
   friend class VPBlockUtils;
 
@@ -916,8 +917,8 @@ public:
 /// executed, these instructions would always form a single-def expression as
 /// the VPInstruction is also a single def-use vertex.
 class LLVM_ABI VPInstruction : public VPRecipeWithIRFlags,
-                      public VPIRMetadata,
-                      public VPUnrollPartAccessor<1> {
+                               public VPIRMetadata,
+                               public VPUnrollPartAccessor<1> {
   friend class VPlanSlp;
 
 public:
@@ -1494,7 +1495,8 @@ public:
 };
 
 /// A recipe for widening Call instructions using library calls.
-class LLVM_ABI VPWidenCallRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
+class LLVM_ABI VPWidenCallRecipe : public VPRecipeWithIRFlags,
+                                   public VPIRMetadata {
   /// Variant stores a pointer to the chosen function. There is a 1:1 mapping
   /// between a given VF and the chosen vectorized variant, so there will be a
   /// different VPlan for each VF with a valid variant.
@@ -1588,7 +1590,8 @@ public:
 };
 
 /// A recipe for widening select instructions.
-struct LLVM_ABI VPWidenSelectRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
+struct LLVM_ABI VPWidenSelectRecipe : public VPRecipeWithIRFlags,
+                                      public VPIRMetadata {
   VPWidenSelectRecipe(SelectInst &I, ArrayRef<VPValue *> Operands)
       : VPRecipeWithIRFlags(VPDef::VPWidenSelectSC, Operands, I),
         VPIRMetadata(I) {}
@@ -1818,7 +1821,8 @@ public:
 ///  * VPWidenPointerInductionRecipe: Generate vector and scalar values for a
 ///    pointer induction. Produces either a vector PHI per-part or scalar values
 ///    per-lane based on the canonical induction.
-class LLVM_ABI VPHeaderPHIRecipe : public VPSingleDefRecipe, public VPPhiAccessors {
+class LLVM_ABI VPHeaderPHIRecipe : public VPSingleDefRecipe,
+                                   public VPPhiAccessors {
 protected:
   VPHeaderPHIRecipe(unsigned char VPDefID, Instruction *UnderlyingInstr,
                     VPValue *Start, DebugLoc DL = DebugLoc::getUnknown())
@@ -2095,7 +2099,8 @@ public:
 /// recipe is placed in an entry block to a (non-replicate) region, it must have
 /// exactly 2 incoming values, the first from the predecessor of the region and
 /// the second from the exiting block of the region.
-class LLVM_ABI VPWidenPHIRecipe : public VPSingleDefRecipe, public VPPhiAccessors {
+class LLVM_ABI VPWidenPHIRecipe : public VPSingleDefRecipe,
+                                  public VPPhiAccessors {
   /// Name to use for the generated IR instruction for the widened phi.
   std::string Name;
 
@@ -2804,7 +2809,8 @@ public:
 /// copies of the original scalar type, one per lane, instead of producing a
 /// single copy of widened type for all lanes. If the instruction is known to be
 /// a single scalar, only one copy, per lane zero, will be generated.
-class LLVM_ABI VPReplicateRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
+class LLVM_ABI VPReplicateRecipe : public VPRecipeWithIRFlags,
+                                   public VPIRMetadata {
   /// Indicator if only a single replica per lane is needed.
   bool IsSingleScalar;
 
@@ -3045,7 +3051,8 @@ public:
 
 /// A recipe for widening load operations, using the address to load from and an
 /// optional mask.
-struct LLVM_ABI VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
+struct LLVM_ABI VPWidenLoadRecipe final : public VPWidenMemoryRecipe,
+                                          public VPValue {
   VPWidenLoadRecipe(LoadInst &Load, VPValue *Addr, VPValue *Mask,
                     bool Consecutive, bool Reverse,
                     const VPIRMetadata &Metadata, DebugLoc DL)
@@ -3485,7 +3492,7 @@ public:
 /// A recipe for handling phi nodes of integer and floating-point inductions,
 /// producing their scalar values.
 class LLVM_ABI VPScalarIVStepsRecipe : public VPRecipeWithIRFlags,
-                              public VPUnrollPartAccessor<3> {
+                                       public VPUnrollPartAccessor<3> {
   Instruction::BinaryOps InductionOpcode;
 
 public:
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.h b/llvm/lib/Transforms/Vectorize/VPlanTransforms.h
index c4f411d34..9da3e62f9 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.h
@@ -54,7 +54,8 @@ struct VPlanTransforms {
       verifyVPlanIsValid(Plan);
   }
 
-  LLVM_ABI static std::unique_ptr<VPlan> buildPlainCFG(Loop *TheLoop, LoopInfo &LI);
+  LLVM_ABI static std::unique_ptr<VPlan> buildPlainCFG(Loop *TheLoop,
+                                                       LoopInfo &LI);
 
   /// Prepare the plan for vectorization. It will introduce a dedicated
   /// VPBasicBlock for the vector pre-header as well as a VPBasicBlock as exit
@@ -64,12 +65,10 @@ struct VPlanTransforms {
   /// blocks. \p InductionTy is the type of the canonical induction and used for
   /// related values, like the trip count expression.  It also creates a VPValue
   /// expression for the original trip count.
-  LLVM_ABI static void prepareForVectorization(VPlan &Plan, Type *InductionTy,
-                                      PredicatedScalarEvolution &PSE,
-                                      bool RequiresScalarEpilogueCheck,
-                                      bool TailFolded, Loop *TheLoop,
-                                      DebugLoc IVDL, bool HasUncountableExit,
-                                      VFRange &Range);
+  LLVM_ABI static void prepareForVectorization(
+      VPlan &Plan, Type *InductionTy, PredicatedScalarEvolution &PSE,
+      bool RequiresScalarEpilogueCheck, bool TailFolded, Loop *TheLoop,
+      DebugLoc IVDL, bool HasUncountableExit, VFRange &Range);
 
   /// Replace loops in \p Plan's flat CFG with VPRegionBlocks, turning \p Plan's
   /// flat CFG into a hierarchical CFG.

``````````

</details>


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


More information about the llvm-commits mailing list