[Mlir-commits] [mlir] [mlir][IR] Add `isInteger()` (without width) (PR #84467)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Mar 8 04:04:59 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-core
@llvm/pr-subscribers-mlir
Author: Marius Brehler (marbre)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/84467.diff
2 Files Affected:
- (modified) mlir/include/mlir/IR/Types.h (+2-1)
- (modified) mlir/lib/IR/Types.cpp (+2)
``````````diff
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))
``````````
</details>
https://github.com/llvm/llvm-project/pull/84467
More information about the Mlir-commits
mailing list