[Mlir-commits] [mlir] 39b2cd4 - [mlir] Annotate functions used only in debug mode with LLVM_ATTRIBUTE_UNUSED

Eugene Zhulenev llvmlistbot at llvm.org
Fri Mar 12 11:25:54 PST 2021


Author: Eugene Zhulenev
Date: 2021-03-12T11:25:46-08:00
New Revision: 39b2cd4009964efda4390f84c4c4a5cc0ce3f1e1

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

LOG: [mlir] Annotate functions used only in debug mode with LLVM_ATTRIBUTE_UNUSED

Functions used only in `assert` cause warnings in release mode

Reviewed By: mehdi_amini, dcaballe, ftynse

Differential Revision: https://reviews.llvm.org/D98476

Added: 
    

Modified: 
    mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
index c9285bf42c8d..f13e48e6ba27 100644
--- a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
+++ b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
@@ -26,10 +26,6 @@ using namespace mlir::vector;
 
 using TypePredicate = llvm::function_ref<bool(Type)>;
 
-static bool isF32(Type type) { return type.isF32(); }
-
-static bool isI32(Type type) { return type.isInteger(32); }
-
 // Returns vector width if the element type is matching the predicate (scalars
 // that do match the predicate have width equal to `1`).
 static Optional<int> vectorWidth(Type type, TypePredicate pred) {
@@ -54,11 +50,17 @@ static int vectorWidth(Type type) {
 }
 
 // Returns vector element type. If the type is a scalar returns the argument.
-static Type elementType(Type type) {
+LLVM_ATTRIBUTE_UNUSED static Type elementType(Type type) {
   auto vectorType = type.dyn_cast<VectorType>();
   return vectorType ? vectorType.getElementType() : type;
 }
 
+LLVM_ATTRIBUTE_UNUSED static bool isF32(Type type) { return type.isF32(); }
+
+LLVM_ATTRIBUTE_UNUSED static bool isI32(Type type) {
+  return type.isInteger(32);
+}
+
 //----------------------------------------------------------------------------//
 // Broadcast scalar types and values into vector types and values.
 //----------------------------------------------------------------------------//


        


More information about the Mlir-commits mailing list