[Mlir-commits] [mlir] b444705 - Make helpers static. NFC.

Benjamin Kramer llvmlistbot at llvm.org
Thu Jul 9 04:52:07 PDT 2020


Author: Benjamin Kramer
Date: 2020-07-09T13:48:56+02:00
New Revision: b44470547e2ec8a52abb67c3f538ecc49ee27970

URL: https://github.com/llvm/llvm-project/commit/b44470547e2ec8a52abb67c3f538ecc49ee27970
DIFF: https://github.com/llvm/llvm-project/commit/b44470547e2ec8a52abb67c3f538ecc49ee27970.diff

LOG: Make helpers static. NFC.

Added: 
    

Modified: 
    clang/lib/AST/ASTImporter.cpp
    clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
    llvm/lib/IR/AutoUpgrade.cpp
    llvm/lib/MC/MCDisassembler/MCDisassembler.cpp
    llvm/lib/Target/X86/X86ISelLowering.cpp
    llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
    llvm/lib/Transforms/Vectorize/VectorCombine.cpp
    mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
    mlir/lib/Dialect/Affine/IR/AffineOps.cpp
    mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
    mlir/test/lib/Transforms/TestLinalgTransforms.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index 8ec6db622f0a..fa2421ee826e 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -3655,9 +3655,9 @@ struct FriendCountAndPosition {
 };
 
 template <class T>
-FriendCountAndPosition getFriendCountAndPosition(
+static FriendCountAndPosition getFriendCountAndPosition(
     const FriendDecl *FD,
-    std::function<T(const FriendDecl *)> GetCanTypeOrDecl) {
+    llvm::function_ref<T(const FriendDecl *)> GetCanTypeOrDecl) {
   unsigned int FriendCount = 0;
   llvm::Optional<unsigned int> FriendPosition;
   const auto *RD = cast<CXXRecordDecl>(FD->getLexicalDeclContext());
@@ -3679,7 +3679,7 @@ FriendCountAndPosition getFriendCountAndPosition(
   return {FriendCount, *FriendPosition};
 }
 
-FriendCountAndPosition getFriendCountAndPosition(const FriendDecl *FD) {
+static FriendCountAndPosition getFriendCountAndPosition(const FriendDecl *FD) {
   if (FD->getFriendType())
     return getFriendCountAndPosition<QualType>(FD, [](const FriendDecl *F) {
       if (TypeSourceInfo *TSI = F->getFriendType())

diff  --git a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
index 29393c2ca02b..8b575f4f4759 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -726,7 +726,8 @@ StdLibraryFunctionsChecker::findFunctionSummary(const CallEvent &Call,
   return findFunctionSummary(FD, C);
 }
 
-llvm::Optional<QualType> lookupType(StringRef Name, const ASTContext &ACtx) {
+static llvm::Optional<QualType> lookupType(StringRef Name,
+                                           const ASTContext &ACtx) {
   IdentifierInfo &II = ACtx.Idents.get(Name);
   auto LookupRes = ACtx.getTranslationUnitDecl()->lookup(&II);
   if (LookupRes.size() == 0)

diff  --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 3179cb5b4e36..1e8fdb506619 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -4167,7 +4167,7 @@ void llvm::UpgradeSectionAttributes(Module &M) {
   }
 }
 
-
+namespace {
 // Prior to LLVM 10.0, the strictfp attribute could be used on individual
 // callsites within a function that did not also have the strictfp attribute.
 // Since 10.0, if strict FP semantics are needed within a function, the
@@ -4185,7 +4185,7 @@ struct StrictFPUpgradeVisitor : public InstVisitor<StrictFPUpgradeVisitor> {
   void visitCallBase(CallBase &Call) {
     if (!Call.isStrictFP())
       return;
-    if (dyn_cast<ConstrainedFPIntrinsic>(&Call))
+    if (isa<ConstrainedFPIntrinsic>(&Call))
       return;
     // If we get here, the caller doesn't have the strictfp attribute
     // but this callsite does. Replace the strictfp attribute with nobuiltin.
@@ -4193,6 +4193,7 @@ struct StrictFPUpgradeVisitor : public InstVisitor<StrictFPUpgradeVisitor> {
     Call.addAttribute(AttributeList::FunctionIndex, Attribute::NoBuiltin);
   }
 };
+} // namespace
 
 void llvm::UpgradeFunctionAttributes(Function &F) {
   // If a function definition doesn't have the strictfp attribute,

diff  --git a/llvm/lib/MC/MCDisassembler/MCDisassembler.cpp b/llvm/lib/MC/MCDisassembler/MCDisassembler.cpp
index 9cdacb64c4f4..a58e8f6d9bcc 100644
--- a/llvm/lib/MC/MCDisassembler/MCDisassembler.cpp
+++ b/llvm/lib/MC/MCDisassembler/MCDisassembler.cpp
@@ -47,7 +47,7 @@ void MCDisassembler::setSymbolizer(std::unique_ptr<MCSymbolizer> Symzer) {
   case XCOFF::XMC_##A:                                                         \
     return P;
 
-uint8_t getSMCPriority(XCOFF::StorageMappingClass SMC) {
+static uint8_t getSMCPriority(XCOFF::StorageMappingClass SMC) {
   switch (SMC) {
     SMC_PCASE(PR, 1)
     SMC_PCASE(RO, 1)

diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 017bfba94b61..9f3321922d6a 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -42429,7 +42429,7 @@ static SDValue PromoteMaskArithmetic(SDNode *N, SelectionDAG &DAG,
   }
 }
 
-unsigned convertIntLogicToFPLogicOpcode(unsigned Opcode) {
+static unsigned convertIntLogicToFPLogicOpcode(unsigned Opcode) {
   unsigned FPOpcode;
   switch (Opcode) {
   default: llvm_unreachable("Unexpected input node for FP logic conversion");

diff  --git a/llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp b/llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
index 05db70c787bb..0fe7dd9cfb39 100644
--- a/llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
@@ -55,8 +55,8 @@ static cl::opt<uint32_t> UnlikelyBranchWeight(
     "unlikely-branch-weight", cl::Hidden, cl::init(1),
     cl::desc("Weight of the branch unlikely to be taken (default = 1)"));
 
-std::tuple<uint32_t, uint32_t> getBranchWeight(Intrinsic::ID IntrinsicID,
-                                               CallInst *CI, int BranchCount) {
+static std::tuple<uint32_t, uint32_t>
+getBranchWeight(Intrinsic::ID IntrinsicID, CallInst *CI, int BranchCount) {
   if (IntrinsicID == Intrinsic::expect) {
     // __builtin_expect
     return std::make_tuple(LikelyBranchWeight.getValue(),

diff  --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index 32332ed5b02d..64b41bf9cefa 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -50,6 +50,7 @@ static cl::opt<bool> DisableBinopExtractShuffle(
 
 static const unsigned InvalidIndex = std::numeric_limits<unsigned>::max();
 
+namespace {
 class VectorCombine {
 public:
   VectorCombine(Function &F, const TargetTransformInfo &TTI,
@@ -80,6 +81,7 @@ class VectorCombine {
   bool scalarizeBinopOrCmp(Instruction &I);
   bool foldExtractedCmps(Instruction &I);
 };
+} // namespace
 
 static void replaceValue(Value &Old, Value &New) {
   Old.replaceAllUsesWith(&New);

diff  --git a/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp b/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
index 52fa2091389e..6d0028b38ec2 100644
--- a/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
+++ b/mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
@@ -71,7 +71,7 @@ static unsigned getLLVMTypeBitWidth(LLVM::LLVMType type) {
 }
 
 /// Creates `IntegerAttribute` with all bits set for given type
-IntegerAttr minusOneIntegerAttribute(Type type, Builder builder) {
+static IntegerAttr minusOneIntegerAttribute(Type type, Builder builder) {
   if (auto vecType = type.dyn_cast<VectorType>()) {
     auto integerType = vecType.getElementType().cast<IntegerType>();
     return builder.getIntegerAttr(integerType, -1);

diff  --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index 3f10e744f419..4367fa39789c 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -1690,7 +1690,7 @@ void mlir::extractForInductionVars(ArrayRef<AffineForOp> forInsts,
 /// Builds an affine loop nest, using "loopCreatorFn" to create individual loop
 /// operations.
 template <typename BoundListTy, typename LoopCreatorTy>
-void buildAffineLoopNestImpl(
+static void buildAffineLoopNestImpl(
     OpBuilder &builder, Location loc, BoundListTy lbs, BoundListTy ubs,
     ArrayRef<int64_t> steps,
     function_ref<void(OpBuilder &, Location, ValueRange)> bodyBuilderFn,

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
index 6cbe947657a0..6a1d00fe620c 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
@@ -609,8 +609,8 @@ mlir::createConvertLinalgToAffineLoopsPass() {
 
 // TODO: gradually remove this layer as more ops become "named".
 template <typename LoopTy>
-Optional<LinalgLoops> linalgOpToLoopsImplSwitch(Operation *op,
-                                                OpBuilder &builder) {
+static Optional<LinalgLoops> linalgOpToLoopsImplSwitch(Operation *op,
+                                                       OpBuilder &builder) {
   assert(isa<LinalgOp>(op) && "LinalgOp expected");
   if (isa<CopyOp>(op))
     return linalgOpToLoopsImpl<LoopTy, CopyOp>(op, builder);

diff  --git a/mlir/test/lib/Transforms/TestLinalgTransforms.cpp b/mlir/test/lib/Transforms/TestLinalgTransforms.cpp
index 44a0e8cbdb14..f93cd9faa504 100644
--- a/mlir/test/lib/Transforms/TestLinalgTransforms.cpp
+++ b/mlir/test/lib/Transforms/TestLinalgTransforms.cpp
@@ -244,8 +244,8 @@ static LogicalResult copyCallBackFn(OpBuilder &b, Value src, Value dst,
   return success();
 }
 
-void fillPromotionCallBackPatterns(MLIRContext *ctx,
-                                   OwningRewritePatternList &patterns) {
+static void fillPromotionCallBackPatterns(MLIRContext *ctx,
+                                          OwningRewritePatternList &patterns) {
   patterns.insert<LinalgTilingPattern<MatmulOp>>(
       ctx, LinalgTilingOptions().setTileSizes({16, 16, 16}),
       LinalgMarker(Identifier::get("START", ctx),


        


More information about the Mlir-commits mailing list