[all-commits] [llvm/llvm-project] b0e515: [mlir][arith] Fold `andi x, not(x)` to zero

zero9178 via All-commits all-commits at lists.llvm.org
Wed Aug 24 04:10:22 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b0e515c9a00c25b6606d784fea6feca1e8705891
      https://github.com/llvm/llvm-project/commit/b0e515c9a00c25b6606d784fea6feca1e8705891
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2022-08-24 (Wed, 24 Aug 2022)

  Changed paths:
    M mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp
    M mlir/test/Dialect/Arithmetic/canonicalize.mlir

  Log Message:
  -----------
  [mlir][arith] Fold `andi x, not(x)` to zero

A bitwise and with the bitwise negate of itself is always 0, regardless of the integer type. This patch adds detection of such a pattern in `arith.andi`s `fold` method.

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




More information about the All-commits mailing list