[all-commits] [llvm/llvm-project] 5368b8: [MLIR][Arith] Add canonicalization rules for int-t...

Adam Paszke via All-commits all-commits at lists.llvm.org
Wed Mar 11 05:50:20 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5368b8163d50b576490c076df9c9b8e62d7a6ec6
      https://github.com/llvm/llvm-project/commit/5368b8163d50b576490c076df9c9b8e62d7a6ec6
  Author: Adam Paszke <apaszke at google.com>
  Date:   2026-03-11 (Wed, 11 Mar 2026)

  Changed paths:
    M mlir/include/mlir/Dialect/Arith/IR/ArithOps.td
    M mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td
    M mlir/lib/Dialect/Arith/IR/ArithOps.cpp
    M mlir/test/Dialect/Arith/canonicalize.mlir
    M mlir/test/Dialect/Arith/emulate-wide-int-canonicalization.mlir

  Log Message:
  -----------
  [MLIR][Arith] Add canonicalization rules for int-to-float of integer extension (#185386)

Three patterns are valid but were missing:

1. `sitofp(extsi(x)) → sitofp(x)`: extsi preserves the sign and value,
so it represents the same signed integer as x.

2. `uitofp(extui(x)) → uitofp(x)`: same reasoning as above, but for
unsigned extension.

3. `sitofp(extui(x)) → uitofp(x)` extui zero-extends, so the extended
value is always non-negative. For non-negative integers, sitofp and
uitofp produce the same result, meaning we could replace the left
expression by `uitofp(extui(x))`. At this point rule 2. above can be
used to simplify further to `uitofp(x)`.

All three rewrites have been verified with Alive2.



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