[Mlir-commits] [mlir] b98e25b - Make helpers static. NFC.
Benjamin Kramer
llvmlistbot at llvm.org
Wed Aug 19 07:00:20 PDT 2020
Author: Benjamin Kramer
Date: 2020-08-19T16:00:03+02:00
New Revision: b98e25b6d7231798a4d819aae3a93f6f1627931a
URL: https://github.com/llvm/llvm-project/commit/b98e25b6d7231798a4d819aae3a93f6f1627931a
DIFF: https://github.com/llvm/llvm-project/commit/b98e25b6d7231798a4d819aae3a93f6f1627931a.diff
LOG: Make helpers static. NFC.
Added:
Modified:
clang/lib/Tooling/Transformer/RewriteRule.cpp
llvm/lib/ObjectYAML/DWARFEmitter.cpp
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
Removed:
################################################################################
diff --git a/clang/lib/Tooling/Transformer/RewriteRule.cpp b/clang/lib/Tooling/Transformer/RewriteRule.cpp
index 89497f67bbb5..fe33f9cf8b0c 100644
--- a/clang/lib/Tooling/Transformer/RewriteRule.cpp
+++ b/clang/lib/Tooling/Transformer/RewriteRule.cpp
@@ -242,7 +242,7 @@ class ApplyRuleCallback : public MatchFinder::MatchCallback {
} // namespace
template <typename T>
-llvm::Expected<SmallVector<clang::transformer::Edit, 1>>
+static llvm::Expected<SmallVector<clang::transformer::Edit, 1>>
rewriteDescendantsImpl(const T &Node, RewriteRule Rule,
const MatchResult &Result) {
ApplyRuleCallback Callback(std::move(Rule));
diff --git a/llvm/lib/ObjectYAML/DWARFEmitter.cpp b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
index b0d2a8b42b9b..cb2bf16392f2 100644
--- a/llvm/lib/ObjectYAML/DWARFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
@@ -800,9 +800,9 @@ static Expected<uint64_t> writeListEntry(raw_ostream &OS,
}
template <typename EntryType>
-Error writeDWARFLists(raw_ostream &OS,
- ArrayRef<DWARFYAML::ListTable<EntryType>> Tables,
- bool IsLittleEndian, bool Is64BitAddrSize) {
+static Error writeDWARFLists(raw_ostream &OS,
+ ArrayRef<DWARFYAML::ListTable<EntryType>> Tables,
+ bool IsLittleEndian, bool Is64BitAddrSize) {
for (const DWARFYAML::ListTable<EntryType> &Table : Tables) {
// sizeof(version) + sizeof(address_size) + sizeof(segment_selector_size) +
// sizeof(offset_entry_count) = 8
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 77e38236686b..c6017b4fc577 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -3719,7 +3719,7 @@ Value *InstCombinerImpl::foldUnsignedMultiplicationOverflowCheck(ICmpInst &I) {
return Res;
}
-Instruction *foldICmpXNegX(ICmpInst &I) {
+static Instruction *foldICmpXNegX(ICmpInst &I) {
CmpInst::Predicate Pred;
Value *X;
if (!match(&I, m_c_ICmp(Pred, m_NSWNeg(m_Value(X)), m_Deferred(X))))
diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
index 45f6f4d1cf31..23af60be585c 100644
--- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
+++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
@@ -136,8 +136,8 @@ LogicalResult getMemRefAlignment(LLVMTypeConverter &typeConverter, T op,
}
// Helper that returns the base address of a memref.
-LogicalResult getBase(ConversionPatternRewriter &rewriter, Location loc,
- Value memref, MemRefType memRefType, Value &base) {
+static LogicalResult getBase(ConversionPatternRewriter &rewriter, Location loc,
+ Value memref, MemRefType memRefType, Value &base) {
// Inspect stride and offset structure.
//
// TODO: flat memory only for now, generalize
@@ -153,8 +153,9 @@ LogicalResult getBase(ConversionPatternRewriter &rewriter, Location loc,
}
// Helper that returns a pointer given a memref base.
-LogicalResult getBasePtr(ConversionPatternRewriter &rewriter, Location loc,
- Value memref, MemRefType memRefType, Value &ptr) {
+static LogicalResult getBasePtr(ConversionPatternRewriter &rewriter,
+ Location loc, Value memref,
+ MemRefType memRefType, Value &ptr) {
Value base;
if (failed(getBase(rewriter, loc, memref, memRefType, base)))
return failure();
@@ -164,9 +165,9 @@ LogicalResult getBasePtr(ConversionPatternRewriter &rewriter, Location loc,
}
// Helper that returns a bit-casted pointer given a memref base.
-LogicalResult getBasePtr(ConversionPatternRewriter &rewriter, Location loc,
- Value memref, MemRefType memRefType, Type type,
- Value &ptr) {
+static LogicalResult getBasePtr(ConversionPatternRewriter &rewriter,
+ Location loc, Value memref,
+ MemRefType memRefType, Type type, Value &ptr) {
Value base;
if (failed(getBase(rewriter, loc, memref, memRefType, base)))
return failure();
@@ -178,9 +179,10 @@ LogicalResult getBasePtr(ConversionPatternRewriter &rewriter, Location loc,
// Helper that returns vector of pointers given a memref base and an index
// vector.
-LogicalResult getIndexedPtrs(ConversionPatternRewriter &rewriter, Location loc,
- Value memref, Value indices, MemRefType memRefType,
- VectorType vType, Type iType, Value &ptrs) {
+static LogicalResult getIndexedPtrs(ConversionPatternRewriter &rewriter,
+ Location loc, Value memref, Value indices,
+ MemRefType memRefType, VectorType vType,
+ Type iType, Value &ptrs) {
Value base;
if (failed(getBase(rewriter, loc, memref, memRefType, base)))
return failure();
diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index 5d52d09bb191..1b8a22eecc9e 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -735,6 +735,7 @@ static LogicalResult verify(TensorReshapeOp op) {
return success();
}
+namespace {
/// Reshape of a splat constant can be replaced with a constant of the result
/// type.
struct FoldReshapeWithConstant : OpRewritePattern<TensorReshapeOp> {
@@ -752,6 +753,7 @@ struct FoldReshapeWithConstant : OpRewritePattern<TensorReshapeOp> {
return success();
}
};
+} // namespace
void TensorReshapeOp::getCanonicalizationPatterns(
OwningRewritePatternList &results, MLIRContext *context) {
@@ -1288,6 +1290,7 @@ static LogicalResult verifyNamedStructuredOp(NamedStructuredOpType op) {
return verifyGenericOp<NamedStructuredOpType>(op);
}
+namespace {
struct EraseDeadLinalgOp : public RewritePattern {
EraseDeadLinalgOp(PatternBenefit benefit = 1)
: RewritePattern(benefit, MatchAnyOpTypeTag()) {}
@@ -1312,6 +1315,7 @@ struct EraseDeadLinalgOp : public RewritePattern {
return failure();
}
};
+} // namespace
#define CANONICALIZERS_AND_FOLDERS(XXX) \
void XXX::getCanonicalizationPatterns(OwningRewritePatternList &results, \
More information about the Mlir-commits
mailing list