[MLIR] Generalize select to arithmetic canonicalization
authorWilliam S. Moses <gh@wsmoses.com>
Fri, 7 Jan 2022 22:26:38 +0000 (17:26 -0500)
committerWilliam S. Moses <gh@wsmoses.com>
Mon, 10 Jan 2022 16:50:17 +0000 (11:50 -0500)
commita02af37560ff5aa22dcef5735ef25eaf58eaaf64
treea00c79ff9e8b86fd5cf2791ff4bb8ed5c67e17fe
parent720c48b58e7a3f56b4798d504a6f0965f0dfb166
[MLIR] Generalize select to arithmetic canonicalization

Given a select whose result is an i1, we can eliminate the conditional in the select completely by adding a few arithmetic operations.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D116839
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
mlir/test/Dialect/Standard/canonicalize.mlir