Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mlir/include/mlir/Dialect/Arith/IR/Arith.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class ConstantIntOp : public arith::ConstantOp {
static void build(OpBuilder &builder, OperationState &result, Type type,
int64_t value);

/// Build a constant int op that produces an integer from an APInt
static void build(OpBuilder &builder, OperationState &result, Type type,
const APInt &value);
Comment on lines +69 to +70
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the order between type and value in this constructor with respect to other constructors is highly confusing. Please revise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I requested in a previous PR to change the order of type/value for the other constructors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


inline int64_t value() {
return cast<IntegerAttr>(arith::ConstantOp::getValue()).getInt();
}
Expand Down
6 changes: 6 additions & 0 deletions mlir/lib/Dialect/Arith/IR/ArithOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ void arith::ConstantIntOp::build(OpBuilder &builder, OperationState &result,
builder.getIntegerAttr(type, value));
}

void arith::ConstantIntOp::build(OpBuilder &builder, OperationState &result,
Type type, const APInt &value) {
arith::ConstantOp::build(builder, result, type,
builder.getIntegerAttr(type, value));
}

bool arith::ConstantIntOp::classof(Operation *op) {
if (auto constOp = dyn_cast_or_null<arith::ConstantOp>(op))
return constOp.getType().isSignlessInteger();
Expand Down