llvm-project
5661ed60 - [mlir][vector] Fix crashes in MaskOp::fold and CanonializeEmptyMaskOp (#183781)

Commit
60 days ago
[mlir][vector] Fix crashes in MaskOp::fold and CanonializeEmptyMaskOp (#183781) Two related crashes were fixed in vector.mask handling: 1. MaskOp::fold() crashes with a null pointer dereference when the mask is all-true and the mask body has no maskable operation (only a vector.yield). getMaskableOp() returns nullptr in this case, and the fold was calling nullptr->dropAllUses(). Fixed by returning failure() when there is no maskable op, deferring to the canonicalizer. 2. CanonializeEmptyMaskOp creates an invalid arith.select when the mask type is a vector (e.g., vector<1xi1>) but the result type is a scalar (e.g., i32). arith.select with a vector condition requires the value types to be vectors of the same shape. Fixed by bailing out when any result type doesn't match the mask shape. Regression tests are added for both cases. Fixes #177833
Author
Parents
Loading