[Mlir-commits] [mlir] a924da6 - [mlir][IR] Add `isInteger()` (without width) (#84467)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Mar 11 08:47:09 PDT 2024
Author: Marius Brehler
Date: 2024-03-11T08:47:06-07:00
New Revision: a924da6d4b8733e5bf08098b18dd7ad1a5ba5f46
URL: https://github.com/llvm/llvm-project/commit/a924da6d4b8733e5bf08098b18dd7ad1a5ba5f46
DIFF: https://github.com/llvm/llvm-project/commit/a924da6d4b8733e5bf08098b18dd7ad1a5ba5f46.diff
LOG: [mlir][IR] Add `isInteger()` (without width) (#84467)
For the singless and signed integers overloads exist, so that the width
does not need to be specified as an argument. This adds the same for
integers without checking for signedness.
Added:
Modified:
mlir/include/mlir/IR/Types.h
mlir/lib/IR/Types.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/Types.h b/mlir/include/mlir/IR/Types.h
index 46bb733101c127..a89e13b625bf40 100644
--- a/mlir/include/mlir/IR/Types.h
+++ b/mlir/include/mlir/IR/Types.h
@@ -133,7 +133,8 @@ class Type {
bool isF80() const;
bool isF128() const;
- /// Return true if this is an integer type with the specified width.
+ /// Return true if this is an integer type (with the specified width).
+ bool isInteger() const;
bool isInteger(unsigned width) const;
/// Return true if this is a signless integer type (with the specified width).
bool isSignlessInteger() const;
diff --git a/mlir/lib/IR/Types.cpp b/mlir/lib/IR/Types.cpp
index 32dfef9e810495..1d1ba6df4db2f7 100644
--- a/mlir/lib/IR/Types.cpp
+++ b/mlir/lib/IR/Types.cpp
@@ -55,6 +55,8 @@ bool Type::isF128() const { return llvm::isa<Float128Type>(*this); }
bool Type::isIndex() const { return llvm::isa<IndexType>(*this); }
+bool Type::isInteger() const { return llvm::isa<IntegerType>(*this); }
+
/// Return true if this is an integer type with the specified width.
bool Type::isInteger(unsigned width) const {
if (auto intTy = llvm::dyn_cast<IntegerType>(*this))
More information about the Mlir-commits
mailing list