[all-commits] [llvm/llvm-project] 6668d1: [mlir][arith] Canonicalization patterns for `arith...

peterbell10 via All-commits all-commits at lists.llvm.org
Mon Oct 9 11:08:17 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6668d14931c31d3dd80580930b4154e1eb1721b2
      https://github.com/llvm/llvm-project/commit/6668d14931c31d3dd80580930b4154e1eb1721b2
  Author: peterbell10 <peterbell10 at live.co.uk>
  Date:   2023-10-09 (Mon, 09 Oct 2023)

  Changed paths:
    M mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td
    M mlir/lib/Dialect/Arith/IR/ArithOps.cpp
    M mlir/test/Dialect/Arith/canonicalize.mlir

  Log Message:
  -----------
  [mlir][arith] Canonicalization patterns for `arith.select` (#67809)

This adds the following canonicalization patterns:
- Inverting condition:
  - `select(not(pred), a, b) => select(pred, b, a)`
- Merging consecutive selects with the same predicate
  - `select(pred, select(pred, a, b), c) => select(pred, a, c)`
  - `select(pred, a, select(pred, b, c)) => select(pred, a, c)`
- Merging consecutive selects with a common value:
- `select(predA, select(predB, a, b), b) => select(and(predA, predB), a,
b)`
- `select(predA, select(predB, b, a), b) => select(and(predA,
not(predB)), a, b)`
- `select(predA, a, select(predB, a, b)) => select(or(predA, predB), a,
b)`
- `select(predA, a, select(predB, b, a)) => select(or(predA,
not(predB)), a, b)`




More information about the All-commits mailing list