diff options
author | Fehr Mathieu <mathieu.fehr@gmail.com> | 2024-03-13 21:59:34 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-13 22:59:34 +0100 |
commit | 7bdba956efae81f111f0cc6c7aaa92f9712444ba (patch) | |
tree | b8873d75558fe09677410f1360f3c7977db7205c /llvm/lib/Support/CommandLine.cpp | |
parent | 207e45fb67ee3dbec9590d9303eebf4f720c8a40 (diff) | |
download | llvm-7bdba956efae81f111f0cc6c7aaa92f9712444ba.zip llvm-7bdba956efae81f111f0cc6c7aaa92f9712444ba.tar.gz llvm-7bdba956efae81f111f0cc6c7aaa92f9712444ba.tar.bz2 |
[mlir][arith] Fix `arith.select` canonicalization patterns (#84685)
Because `arith.select` does not propagate poison of the second or third
operand depending on the condition, some canonicalization patterns are
currently incorrect. This patch removes these incorrect patterns, and
adds a new pattern to fix the case of `i1` select with constants.
Patterns that are removed:
* select(predA, select(predB, x, y), y) => select(and(predA, predB), x,
y)
* select(predA, select(predB, y, x), y) => select(and(predA,
not(predB)), x, y)
* select(predA, x, select(predB, x, y)) => select(or(predA, predB), x,
y)
* select(predA, x, select(predB, y, x)) => select(or(predA, not(predB)),
x, y)
* arith.select %arg, %x, %y : i1 => and(%arg, %x) or and(!%arg, %y)
Pattern that is added:
* select(pred, false, true) => not(pred) for i1
The first two patterns are incorrect when `predB` is poison and `predA`
is false, as a non-poison `y` gets compiled to `poison`. The next two
patterns are incorrect when `predB` is poison and `predA` is true, as a
non-poison `x` gets compiled to `poison`. The last pattern is incorrect
as it propagates poison from all operands afer compilation.
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
0 files changed, 0 insertions, 0 deletions