[all-commits] [llvm/llvm-project] 3620af: [mlir][index] Mark certain ops as Commutative

Jeff Niu via All-commits all-commits at lists.llvm.org
Mon Jun 26 11:49:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3620af84d2ae577c7a12f83192c6dad2ce85e00c
      https://github.com/llvm/llvm-project/commit/3620af84d2ae577c7a12f83192c6dad2ce85e00c
  Author: Jeff Niu <jeff at modular.com>
  Date:   2023-06-26 (Mon, 26 Jun 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/Index/IR/IndexOps.td

  Log Message:
  -----------
  [mlir][index] Mark certain ops as Commutative

Mark the relevant index dialect operations as Commutative. Specifically,
this allows the folder to move constant operands to the RHS.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D153731


  Commit: 962f71be5a2b65d75e1f42c36bb134448f6e3a0d
      https://github.com/llvm/llvm-project/commit/962f71be5a2b65d75e1f42c36bb134448f6e3a0d
  Author: Jeff Niu <jeff at modular.com>
  Date:   2023-06-26 (Mon, 26 Jun 2023)

  Changed paths:
    M mlir/lib/Dialect/Index/IR/IndexOps.cpp
    M mlir/test/Dialect/Index/index-canonicalize.mlir

  Log Message:
  -----------
  [mlir][index] Fold `cmp(max/min(x, cstA), cstB)`

This is a case that is not picked up by integer range inference and
suggests a weakness with integer range inference on the index dialect.
The problem is that when `[1, SMAX_64]` is truncated to 32 bits, the
resulting range could be `[SMIN_32, SMAX_32]`, making the subsequent
comparison worthless. This is because integer range inference doesn't
know that the result of the max/min inference also changes based on the
bitwidth, and doing the truncation locally at the input of the
comparison op loses that information.

This also was a pattern that frequently showed up in our code, so adding
it as a folder allows dead code to be pruned more frequently.

Depends on D153731

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D153732


  Commit: 42092c071a848ea1864314ae0a740ed7c83d521d
      https://github.com/llvm/llvm-project/commit/42092c071a848ea1864314ae0a740ed7c83d521d
  Author: Jeff Niu <jeff at modular.com>
  Date:   2023-06-26 (Mon, 26 Jun 2023)

  Changed paths:
    M mlir/lib/Dialect/Index/IR/IndexOps.cpp
    M mlir/test/Dialect/Index/index-canonicalize.mlir

  Log Message:
  -----------
  [mlir][index] Add `index.mul` identity folders

Fold `mul(x, 1)` and `mul(x, 0)`.

Depends on D153736

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D153736


  Commit: 8aa16d1921f15a80be5890a8b4bf7f5d3ec8fa00
      https://github.com/llvm/llvm-project/commit/8aa16d1921f15a80be5890a8b4bf7f5d3ec8fa00
  Author: Jeff Niu <jeff at modular.com>
  Date:   2023-06-26 (Mon, 26 Jun 2023)

  Changed paths:
    M mlir/lib/Dialect/Index/IR/IndexOps.cpp
    M mlir/test/Dialect/Index/index-canonicalize.mlir

  Log Message:
  -----------
  [mlir][index] Add identity folders for add and sub

Depends on D153736

Reviewed By: rriddle, jpienaar

Differential Revision: https://reviews.llvm.org/D153780


Compare: https://github.com/llvm/llvm-project/compare/afa1fc47b669...8aa16d1921f1


More information about the All-commits mailing list