[mlir][Standard] Allow select to use an i1 for vector and tensor values
authorRiver Riddle <riddleriver@gmail.com>
Thu, 23 Apr 2020 11:40:42 +0000 (04:40 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Thu, 23 Apr 2020 11:50:09 +0000 (04:50 -0700)
commit7f85adb54d1956183630eb43c2f3e578f7366276
tree18367cc6497486471c5b06c13be3ded654e197d1
parent2fafe7ff591da8de6454c11c4756cc13a89b1c27
[mlir][Standard] Allow select to use an i1 for vector and tensor values

It currently requires that the condition match the shape of the selected value, but this is only really useful for things like masks. This revision allows for the use of i1 to mean that all of the vector/tensor is selected. This also matches the behavior of LLVM select. A benefit of this change is that transformations that want to generate selects, like those on the CFG, don't have to special case vector/tensor. Previously the only way to generate  a select from an i1 was to use a splat, but that doesn't support dynamically shaped/unranked tensors.

Differential Revision: https://reviews.llvm.org/D78690
llvm/include/llvm/ADT/STLExtras.h
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
mlir/test/Dialect/Standard/canonicalize-cf.mlir
mlir/test/IR/core-ops.mlir
mlir/test/IR/invalid-ops.mlir