Skip to content

Commit a924da6

Browse files
authored
[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.
1 parent 575ca67 commit a924da6

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

mlir/include/mlir/IR/Types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ class Type {
133133
bool isF80() const;
134134
bool isF128() const;
135135

136-
/// Return true if this is an integer type with the specified width.
136+
/// Return true if this is an integer type (with the specified width).
137+
bool isInteger() const;
137138
bool isInteger(unsigned width) const;
138139
/// Return true if this is a signless integer type (with the specified width).
139140
bool isSignlessInteger() const;

mlir/lib/IR/Types.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ bool Type::isF128() const { return llvm::isa<Float128Type>(*this); }
5555

5656
bool Type::isIndex() const { return llvm::isa<IndexType>(*this); }
5757

58+
bool Type::isInteger() const { return llvm::isa<IntegerType>(*this); }
59+
5860
/// Return true if this is an integer type with the specified width.
5961
bool Type::isInteger(unsigned width) const {
6062
if (auto intTy = llvm::dyn_cast<IntegerType>(*this))

0 commit comments

Comments
 (0)