Author: Benjamin Kramer Date: 2023-01-08T17:37:02+01:00 New Revision: b6942a2880c578d2eab89ecb75e637aac41c5e51
URL: https://github.com/llvm/llvm-project/commit/b6942a2880c578d2eab89ecb75e637aac41c5e51 DIFF: https://github.com/llvm/llvm-project/commit/b6942a2880c578d2eab89ecb75e637aac41c5e51.diff LOG: [NFC] Hide implementation details in anonymous namespaces Added: Modified: clang/lib/AST/ASTImporter.cpp clang/lib/Driver/OffloadBundler.cpp clang/lib/Sema/AnalysisBasedWarnings.cpp clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp llvm/lib/CodeGen/ExpandLargeDivRem.cpp llvm/lib/CodeGen/ExpandLargeFpConvert.cpp llvm/lib/CodeGen/MachineCycleAnalysis.cpp llvm/lib/CodeGen/SanitizerBinaryMetadata.cpp llvm/lib/MC/SPIRVObjectWriter.cpp llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp llvm/lib/Target/AMDGPU/GCNVOPDUtils.cpp llvm/lib/Target/AMDGPU/R600ISelDAGToDAG.cpp llvm/lib/Target/AMDGPU/R600MCInstLower.cpp llvm/lib/Target/AMDGPU/R600TargetMachine.cpp llvm/lib/Target/RISCV/RISCVISelLowering.cpp llvm/lib/Target/VE/VERegisterInfo.cpp llvm/lib/Target/VE/VETargetMachine.cpp llvm/lib/Target/X86/X86ReturnThunks.cpp llvm/lib/Transforms/Scalar/LoopFlatten.cpp llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp llvm/lib/Transforms/Vectorize/LoopVectorize.cpp llvm/lib/Transforms/Vectorize/VectorCombine.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index e77f57008d82f..329718c99dc65 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -8683,6 +8683,7 @@ Expected<TypeSourceInfo *> ASTImporter::Import(TypeSourceInfo *FromTSI) { return ToContext.getTrivialTypeSourceInfo(*TOrErr, *BeginLocOrErr); } +namespace { // To use this object, it should be created before the new attribute is created, // and destructed after it is created. The construction already performs the // import of the data. @@ -8813,6 +8814,7 @@ class AttrImporter { return ToAttr; } }; +} // namespace Expected<Attr *> ASTImporter::Import(const Attr *FromAttr) { AttrImporter AI(*this); diff --git a/clang/lib/Driver/OffloadBundler.cpp b/clang/lib/Driver/OffloadBundler.cpp index bcc0c320fa476..86fc4df5914a2 100644 --- a/clang/lib/Driver/OffloadBundler.cpp +++ b/clang/lib/Driver/OffloadBundler.cpp @@ -184,6 +184,7 @@ bool isCodeObjectCompatible(const OffloadTargetInfo &CodeObjectInfo, return true; } +namespace { /// Generic file handler interface. class FileHandler { public: @@ -491,8 +492,6 @@ class BinaryFileHandler final : public FileHandler { } }; -namespace { - // This class implements a list of temporary files that are removed upon // object destruction. class TempFileHandlerRAII { @@ -524,8 +523,6 @@ class TempFileHandlerRAII { std::forward_list<SmallString<128u>> Files; }; -} // end anonymous namespace - /// Handler for object files. The bundles are organized by sections with a /// designated name. /// @@ -827,6 +824,7 @@ class TextFileHandler final : public FileHandler { return Error::success(); } }; +} // namespace /// Return an appropriate object file handler. We use the specific object /// handler if we know how to deal with that format, otherwise we use a default diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index bde2036ec65c6..7f0677f3376f1 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -2143,6 +2143,7 @@ class ConsumedWarningsHandler : public ConsumedWarningsHandlerBase { // Unsafe buffer usage analysis. //===----------------------------------------------------------------------===// +namespace { class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { Sema &S; @@ -2163,7 +2164,7 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { D << F; } }; - +} // namespace //===----------------------------------------------------------------------===// // AnalysisBasedWarnings - Worker object used by Sema to execute analysis-based diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp index 4583b2191bf2b..afacf735bdd43 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp @@ -613,6 +613,7 @@ static std::optional<std::string> describeRegion(const MemRegion *MR) { using Bindings = llvm::SmallVector<std::pair<const MemRegion *, SVal>, 4>; +namespace { class VarBindingsCollector : public StoreManager::BindingsHandler { SymbolRef Sym; Bindings &Result; @@ -633,6 +634,7 @@ class VarBindingsCollector : public StoreManager::BindingsHandler { return true; } }; +} // namespace Bindings getAllVarBindingsForSymbol(ProgramStateManager &Manager, const ExplodedNode *Node, SymbolRef Sym) { diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index eecf04941e429..01ba95a715cd7 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -1186,8 +1186,6 @@ class ReturnVisitor : public TrackingBugReporterVisitor { } }; -} // end of anonymous namespace - //===----------------------------------------------------------------------===// // StoreSiteFinder //===----------------------------------------------------------------------===// @@ -1227,6 +1225,7 @@ class StoreSiteFinder final : public TrackingBugReporterVisitor { BugReporterContext &BRC, PathSensitiveBugReport &BR) override; }; +} // namespace void StoreSiteFinder::Profile(llvm::FoldingSetNodeID &ID) const { static int tag = 0; @@ -2216,6 +2215,7 @@ PathDiagnosticPieceRef StoreHandler::constructNote(StoreInfo SI, return std::make_shared<PathDiagnosticEventPiece>(L, NodeText); } +namespace { class DefaultStoreHandler final : public StoreHandler { public: using StoreHandler::StoreHandler; @@ -2600,6 +2600,7 @@ class PRValueHandler final : public ExpressionHandler { return CombinedResult; } }; +} // namespace Tracker::Tracker(PathSensitiveBugReport &Report) : Report(Report) { // Default expression handlers. diff --git a/clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp b/clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp index f6efde8c90d13..69599d1dc0db9 100644 --- a/clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp +++ b/clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp @@ -24,6 +24,7 @@ using namespace clang::ast_matchers; static const int MAXIMUM_STEP_UNROLLED = 128; +namespace { struct LoopState { private: enum Kind { Normal, Unrolled } K; @@ -56,6 +57,7 @@ struct LoopState { ID.AddInteger(maxStep); } }; +} // namespace // The tracked stack of loops. The stack indicates that which loops the // simulated element contained by. The loops are marked depending if we decided diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp index 294f5f61eb1ea..2049ada7ad9ae 100644 --- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp +++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp @@ -278,6 +278,7 @@ static DebugAggregate getAggregate(const DebugVariable &Var) { return DebugAggregate(Var.getVariable(), Var.getInlinedAt()); } +namespace { /// In dwarf emission, the following sequence /// 1. dbg.value ... Fragment(0, 64) /// 2. dbg.value ... Fragment(0, 32) @@ -1121,6 +1122,7 @@ class AssignmentTrackingLowering { /// true if any variable locations have been added to FnVarLocs. bool run(FunctionVarLocsBuilder *FnVarLocs); }; +} // namespace void AssignmentTrackingLowering::setLocKind(BlockInfo *LiveSet, VariableID Var, LocKind K) { diff --git a/llvm/lib/CodeGen/ExpandLargeDivRem.cpp b/llvm/lib/CodeGen/ExpandLargeDivRem.cpp index f8ffc2bc31b23..057b5311db70e 100644 --- a/llvm/lib/CodeGen/ExpandLargeDivRem.cpp +++ b/llvm/lib/CodeGen/ExpandLargeDivRem.cpp @@ -105,6 +105,7 @@ static bool runImpl(Function &F, const TargetLowering &TLI) { return Modified; } +namespace { class ExpandLargeDivRemLegacyPass : public FunctionPass { public: static char ID; @@ -125,6 +126,7 @@ class ExpandLargeDivRemLegacyPass : public FunctionPass { AU.addPreserved<GlobalsAAWrapperPass>(); } }; +} // namespace char ExpandLargeDivRemLegacyPass::ID = 0; INITIALIZE_PASS_BEGIN(ExpandLargeDivRemLegacyPass, "expand-large-div-rem", diff --git a/llvm/lib/CodeGen/ExpandLargeFpConvert.cpp b/llvm/lib/CodeGen/ExpandLargeFpConvert.cpp index c21fbc127ae2d..ca8056a531397 100644 --- a/llvm/lib/CodeGen/ExpandLargeFpConvert.cpp +++ b/llvm/lib/CodeGen/ExpandLargeFpConvert.cpp @@ -629,6 +629,7 @@ static bool runImpl(Function &F, const TargetLowering &TLI) { return Modified; } +namespace { class ExpandLargeFpConvertLegacyPass : public FunctionPass { public: static char ID; @@ -650,6 +651,7 @@ class ExpandLargeFpConvertLegacyPass : public FunctionPass { AU.addPreserved<GlobalsAAWrapperPass>(); } }; +} // namespace char ExpandLargeFpConvertLegacyPass::ID = 0; INITIALIZE_PASS_BEGIN(ExpandLargeFpConvertLegacyPass, "expand-large-fp-convert", diff --git a/llvm/lib/CodeGen/MachineCycleAnalysis.cpp b/llvm/lib/CodeGen/MachineCycleAnalysis.cpp index 8a6030c488937..0a59aba65518e 100644 --- a/llvm/lib/CodeGen/MachineCycleAnalysis.cpp +++ b/llvm/lib/CodeGen/MachineCycleAnalysis.cpp @@ -54,6 +54,7 @@ void MachineCycleInfoWrapperPass::releaseMemory() { F = nullptr; } +namespace { class MachineCycleInfoPrinterPass : public MachineFunctionPass { public: static char ID; @@ -63,6 +64,7 @@ class MachineCycleInfoPrinterPass : public MachineFunctionPass { bool runOnMachineFunction(MachineFunction &F) override; void getAnalysisUsage(AnalysisUsage &AU) const override; }; +} // namespace char MachineCycleInfoPrinterPass::ID = 0; diff --git a/llvm/lib/CodeGen/SanitizerBinaryMetadata.cpp b/llvm/lib/CodeGen/SanitizerBinaryMetadata.cpp index f9e608fe0f107..dd70a2f23e45f 100644 --- a/llvm/lib/CodeGen/SanitizerBinaryMetadata.cpp +++ b/llvm/lib/CodeGen/SanitizerBinaryMetadata.cpp @@ -24,6 +24,7 @@ using namespace llvm; +namespace { class MachineSanitizerBinaryMetadata : public MachineFunctionPass { public: static char ID; @@ -31,6 +32,7 @@ class MachineSanitizerBinaryMetadata : public MachineFunctionPass { MachineSanitizerBinaryMetadata(); bool runOnMachineFunction(MachineFunction &F) override; }; +} // namespace INITIALIZE_PASS(MachineSanitizerBinaryMetadata, "machine-sanmd", "Machine Sanitizer Binary Metadata", false, false) diff --git a/llvm/lib/MC/SPIRVObjectWriter.cpp b/llvm/lib/MC/SPIRVObjectWriter.cpp index 4a07740e8d143..cb49f5eeca8d9 100644 --- a/llvm/lib/MC/SPIRVObjectWriter.cpp +++ b/llvm/lib/MC/SPIRVObjectWriter.cpp @@ -14,6 +14,7 @@ using namespace llvm; +namespace { class SPIRVObjectWriter : public MCObjectWriter { ::support::endian::Writer W; @@ -38,6 +39,7 @@ class SPIRVObjectWriter : public MCObjectWriter { uint64_t writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override; void writeHeader(const MCAssembler &Asm); }; +} // namespace void SPIRVObjectWriter::writeHeader(const MCAssembler &Asm) { constexpr uint32_t MagicNumber = 0x07230203; diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp index f5f6c07f766ae..9f18159d1d7c7 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp @@ -39,6 +39,7 @@ static cl::opt<unsigned> SVEGatherOverhead("sve-gather-overhead", cl::init(10), static cl::opt<unsigned> SVEScatterOverhead("sve-scatter-overhead", cl::init(10), cl::Hidden); +namespace { class TailFoldingKind { private: uint8_t Bits = 0; // Currently defaults to disabled. @@ -89,6 +90,7 @@ class TailFoldingKind { void add(uint8_t Flag) { Bits |= Flag; } void remove(uint8_t Flag) { Bits &= ~Flag; } }; +} // namespace TailFoldingKind TailFoldingKindLoc; diff --git a/llvm/lib/Target/AMDGPU/GCNVOPDUtils.cpp b/llvm/lib/Target/AMDGPU/GCNVOPDUtils.cpp index 2b203a59160a2..95ea42267ccf3 100644 --- a/llvm/lib/Target/AMDGPU/GCNVOPDUtils.cpp +++ b/llvm/lib/Target/AMDGPU/GCNVOPDUtils.cpp @@ -136,6 +136,7 @@ static bool shouldScheduleVOPDAdjacent(const TargetInstrInfo &TII, return checkVOPDRegConstraints(STII, *FirstMI, SecondMI); } +namespace { /// Adapts design from MacroFusion /// Puts valid candidate instructions back-to-back so they can easily /// be turned into VOPD instructions @@ -177,6 +178,7 @@ struct VOPDPairingMutation : ScheduleDAGMutation { LLVM_DEBUG(dbgs() << "Completed VOPDPairingMutation\n"); } }; +} // namespace std::unique_ptr<ScheduleDAGMutation> llvm::createVOPDPairingMutation() { return std::make_unique<VOPDPairingMutation>(shouldScheduleVOPDAdjacent); diff --git a/llvm/lib/Target/AMDGPU/R600ISelDAGToDAG.cpp b/llvm/lib/Target/AMDGPU/R600ISelDAGToDAG.cpp index 7d2fdf5b3d889..50a90dd03f383 100644 --- a/llvm/lib/Target/AMDGPU/R600ISelDAGToDAG.cpp +++ b/llvm/lib/Target/AMDGPU/R600ISelDAGToDAG.cpp @@ -18,6 +18,7 @@ #include "R600Subtarget.h" #include "llvm/Analysis/ValueTracking.h" +namespace { class R600DAGToDAGISel : public AMDGPUDAGToDAGISel { const R600Subtarget *Subtarget; @@ -47,6 +48,7 @@ class R600DAGToDAGISel : public AMDGPUDAGToDAGISel { // Include the pieces autogenerated from the target description. #include "R600GenDAGISel.inc" }; +} // namespace bool R600DAGToDAGISel::runOnMachineFunction(MachineFunction &MF) { Subtarget = &MF.getSubtarget<R600Subtarget>(); diff --git a/llvm/lib/Target/AMDGPU/R600MCInstLower.cpp b/llvm/lib/Target/AMDGPU/R600MCInstLower.cpp index f81f5122bbc99..6da545659a57b 100644 --- a/llvm/lib/Target/AMDGPU/R600MCInstLower.cpp +++ b/llvm/lib/Target/AMDGPU/R600MCInstLower.cpp @@ -20,6 +20,7 @@ #include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" +namespace { class R600MCInstLower : public AMDGPUMCInstLower { public: R600MCInstLower(MCContext &ctx, const R600Subtarget &ST, @@ -28,6 +29,7 @@ class R600MCInstLower : public AMDGPUMCInstLower { /// Lower a MachineInstr to an MCInst void lower(const MachineInstr *MI, MCInst &OutMI) const; }; +} // namespace R600MCInstLower::R600MCInstLower(MCContext &Ctx, const R600Subtarget &ST, const AsmPrinter &AP) diff --git a/llvm/lib/Target/AMDGPU/R600TargetMachine.cpp b/llvm/lib/Target/AMDGPU/R600TargetMachine.cpp index 506e7b884c858..36840587d219d 100644 --- a/llvm/lib/Target/AMDGPU/R600TargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/R600TargetMachine.cpp @@ -88,6 +88,7 @@ R600TargetMachine::getTargetTransformInfo(const Function &F) const { return TargetTransformInfo(R600TTIImpl(this, F)); } +namespace { class R600PassConfig final : public AMDGPUPassConfig { public: R600PassConfig(LLVMTargetMachine &TM, PassManagerBase &PM) @@ -104,6 +105,7 @@ class R600PassConfig final : public AMDGPUPassConfig { void addPreSched2() override; void addPreEmitPass() override; }; +} // namespace //===----------------------------------------------------------------------===// // R600 Pass Setup diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index db1bd64ec095c..f946225a00906 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -8509,6 +8509,7 @@ static SDValue performTRUNCATECombine(SDNode *N, SelectionDAG &DAG, return SDValue(); } +namespace { // Helper class contains information about comparison operation. // The first two operands of this operation are compared values and the // last one is the operation. @@ -8602,6 +8603,7 @@ class CmpOpInfo { // Returns consition code of comparison operation. ISD::CondCode getCondCode() const { return CCode; } }; +} // namespace // Verifies conditions to apply an optimization. // Returns Reference comparison code and three operands A, B, C. diff --git a/llvm/lib/Target/VE/VERegisterInfo.cpp b/llvm/lib/Target/VE/VERegisterInfo.cpp index dfdddf095e81e..cd3ccd959e80d 100644 --- a/llvm/lib/Target/VE/VERegisterInfo.cpp +++ b/llvm/lib/Target/VE/VERegisterInfo.cpp @@ -126,6 +126,7 @@ static unsigned offsetToDisp(MachineInstr &MI) { return OffDisp; } +namespace { class EliminateFrameIndex { const TargetInstrInfo &TII; const TargetRegisterInfo &TRI; @@ -192,6 +193,7 @@ class EliminateFrameIndex { void processMI(MachineInstr &MI, Register FrameReg, int64_t Offset, int FIOperandNum); }; +} // namespace // Prepare the frame index if it doesn't fit in the immediate field. Use // clobber register to hold calculated address. diff --git a/llvm/lib/Target/VE/VETargetMachine.cpp b/llvm/lib/Target/VE/VETargetMachine.cpp index f12bd0f2f3ade..93fb3d8ef8d59 100644 --- a/llvm/lib/Target/VE/VETargetMachine.cpp +++ b/llvm/lib/Target/VE/VETargetMachine.cpp @@ -69,12 +69,14 @@ static Reloc::Model getEffectiveRelocModel(std::optional<Reloc::Model> RM) { return RM.value_or(Reloc::Static); } +namespace { class VEELFTargetObjectFile : public TargetLoweringObjectFileELF { void Initialize(MCContext &Ctx, const TargetMachine &TM) override { TargetLoweringObjectFileELF::Initialize(Ctx, TM); InitializeELF(TM.Options.UseInitArray); } }; +} // namespace static std::unique_ptr<TargetLoweringObjectFile> createTLOF() { return std::make_unique<VEELFTargetObjectFile>(); diff --git a/llvm/lib/Target/X86/X86ReturnThunks.cpp b/llvm/lib/Target/X86/X86ReturnThunks.cpp index 0107fabeb7514..aaa2045977979 100644 --- a/llvm/lib/Target/X86/X86ReturnThunks.cpp +++ b/llvm/lib/Target/X86/X86ReturnThunks.cpp @@ -43,12 +43,14 @@ using namespace llvm; #define PASS_KEY "x86-return-thunks" #define DEBUG_TYPE PASS_KEY +namespace { struct X86ReturnThunks final : public MachineFunctionPass { static char ID; X86ReturnThunks() : MachineFunctionPass(ID) {} StringRef getPassName() const override { return "X86 Return Thunks"; } bool runOnMachineFunction(MachineFunction &MF) override; }; +} // namespace char X86ReturnThunks::ID = 0; diff --git a/llvm/lib/Transforms/Scalar/LoopFlatten.cpp b/llvm/lib/Transforms/Scalar/LoopFlatten.cpp index d82624ef91435..5a43d373207cf 100644 --- a/llvm/lib/Transforms/Scalar/LoopFlatten.cpp +++ b/llvm/lib/Transforms/Scalar/LoopFlatten.cpp @@ -100,6 +100,7 @@ static cl::opt<bool> cl::desc("Widen the loop induction variables, if possible, so " "overflow checks won't reject flattening")); +namespace { // We require all uses of both induction variables to match this pattern: // // (OuterPHI * InnerTripCount) + InnerPHI @@ -288,6 +289,7 @@ struct FlattenInfo { return true; } }; +} // namespace static bool setLoopComponents(Value *&TC, Value *&TripCount, BinaryOperator *&Increment, diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp index 85e2befce0d10..2dc97a49f367a 100644 --- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp @@ -1272,6 +1272,7 @@ bool LoopIdiomRecognize::processLoopStoreOfLoopLoad(StoreInst *SI, StoreEv, LoadEv, BECount); } +namespace { class MemmoveVerifier { public: explicit MemmoveVerifier(const Value &LoadBasePtr, const Value &StoreBasePtr, @@ -1315,6 +1316,7 @@ class MemmoveVerifier { public: const bool IsSameObject; }; +} // namespace bool LoopIdiomRecognize::processLoopStoreOfLoopLoad( Value *DestPtr, Value *SourcePtr, const SCEV *StoreSizeSCEV, diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index c37c63c1bc28f..6f8550b24c415 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -419,8 +419,10 @@ static std::optional<unsigned> getSmallBestKnownTC(ScalarEvolution &SE, return std::nullopt; } +namespace { // Forward declare GeneratedRTChecks. class GeneratedRTChecks; +} // namespace namespace llvm { @@ -1867,6 +1869,7 @@ class LoopVectorizationCostModel { }; } // end namespace llvm +namespace { /// Helper struct to manage generating runtime checks for vectorization. /// /// The runtime checks are created up-front in temporary blocks to allow better @@ -2131,6 +2134,7 @@ class GeneratedRTChecks { return MemCheckBlock; } }; +} // namespace // Return true if \p OuterLp is an outer loop annotated with hints for explicit // vectorization. The loop needs to be annotated with #pragma omp simd diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp index 9dec820c94bd1..455fb392de4cd 100644 --- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp +++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp @@ -947,6 +947,7 @@ static bool isMemModifiedBetween(BasicBlock::iterator Begin, }); } +namespace { /// Helper class to indicate whether a vector index can be safely scalarized and /// if a freeze needs to be inserted. class ScalarizationResult { @@ -1001,6 +1002,7 @@ class ScalarizationResult { ToFreeze = nullptr; } }; +} // namespace /// Check if it is legal to scalarize a memory access to \p VecTy at index \p /// Idx. \p Idx must access a valid vector element. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits