[all-commits] [llvm/llvm-project] 5ed852: [mlir][arith] Add `arith::ConstantIntOp` construct...

Skrai Pardus via All-commits all-commits at lists.llvm.org
Tue Jul 1 14:51:00 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5ed852f7f72855710eeff53179e6a6f2271a3c2a
      https://github.com/llvm/llvm-project/commit/5ed852f7f72855710eeff53179e6a6f2271a3c2a
  Author: Skrai Pardus <84874402+ashjeong at users.noreply.github.com>
  Date:   2025-07-01 (Tue, 01 Jul 2025)

  Changed paths:
    M mlir/include/mlir/Dialect/Arith/IR/Arith.h
    M mlir/lib/Dialect/Arith/IR/ArithOps.cpp

  Log Message:
  -----------
  [mlir][arith] Add `arith::ConstantIntOp` constructor (#144638)

This PR adds a `build()` constructor for `ConstantIntOp` that takes in
an `APInt`.


Creating an `arith` constant value with an `APInt` currently requires a
structure like the following:
```c
b.create<arith::ConstantOp>(IntegerAttr::get(apintValue, 5));
```
In comparison, the`ConstantFloatOp` already has an `APFloat` constructor
which allows for the following:
```c
b.create<arith::ConstantFloatOp>(floatType, apfloatValue);
```
Thus, intuitively, it makes sense that a similar `ConstantIntOp`
constructor is made for `APInts` like so:
```c
b.create<arith::ConstantIntOp>(intType, apintValue);
```

Depends on https://github.com/llvm/llvm-project/pull/144636



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list