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

Diego Caballero llvmlistbot at llvm.org
Tue Jan 28 11:16:59 PST 2025


================
@@ -2257,6 +2295,7 @@ void ExtractOp::getCanonicalizationPatterns(RewritePatternSet &results,
               ExtractOpFromBroadcast, ExtractOpFromCreateMask>(context);
   results.add(foldExtractFromShapeCastToShapeCast);
   results.add(foldExtractFromFromElements);
+  results.add(canonicalizePoisonIndexInsertExtractOp<ExtractOp>);
----------------
dcaballe wrote:

The current state, AFAICT, is that the canonicalizer does not apply foldings as it uses `applyPatternsGreedly` and not `applyPatternsAndFoldGreedly` so foldings are not applied as part of canonicalization. I guess it makes sense as we may not want all the foldings to be part of the canonical form (e.g., foldings that might remove structural information). For this particular case, we don't want poison indices to be part of the canonical form so I think it makes sense to have it in both places.

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


More information about the Mlir-commits mailing list