[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
This commit is contained in:
Eugene Zhulenev 2021-03-12 10:39:16 -08:00
parent 5ae949a927
commit 39b2cd4009
1 changed files with 7 additions and 5 deletions

View File

@ -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.
//----------------------------------------------------------------------------//