[Mlir-commits] [mlir] [Vector] Add canonicalization for select(pred, true, false) -> broadcast(pred) (PR #147934)

Andrzej WarzyƄski llvmlistbot at llvm.org
Thu Jul 10 09:08:30 PDT 2025


================
@@ -2913,13 +2913,74 @@ struct BroadcastFolder : public OpRewritePattern<BroadcastOp> {
     return success();
   }
 };
+
+/// true: vector
+/// false: vector
+/// pred: i1
+///
+/// select(pred, true, false) -> broadcast(pred)
+/// select(pred, false, true) -> broadcast(not(pred))
+///
+/// Ideally, this would be a canonicalization pattern on arith::SelectOp, but
+/// we cannot have arith depending on vector. Also, it would implicitly force
+/// users only using arith and vector dialect to use vector dialect. Instead,
----------------
banach-space wrote:

Typo?
```suggestion
/// users only using arith  to use vector dialect. Instead,
```

https://github.com/llvm/llvm-project/pull/147934


More information about the Mlir-commits mailing list