[Mlir-commits] [mlir] [mlir][Vector] Add support for poison indices to `Extract/IndexOp` (PR #123488)

Kunwar Grover llvmlistbot at llvm.org
Mon Jan 27 03:11:00 PST 2025


================
@@ -3020,6 +3044,7 @@ void InsertOp::getCanonicalizationPatterns(RewritePatternSet &results,
                                            MLIRContext *context) {
   results.add<InsertToBroadcast, BroadcastFolder, InsertSplatToSplat,
               InsertOpConstantFolder>(context);
+  results.add(foldPoisonIndexInsertExtractOp<InsertOp>);
----------------
Groverkss wrote:

You can make this a folder instead of a canonicalization pattern. You can just return ub::PoisonAttr and the ub dialect will materialize the poison attr if not used. Example:

https://github.com/llvm/llvm-project/blob/43a50deb63453cd3c800f097514d500536f9d436/mlir/lib/Dialect/Affine/IR/AffineOps.cpp#L620

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


More information about the Mlir-commits mailing list