llvm-project
b3be782c - [mlir][affine] Fix crash in linearize_index fold when multi-index is ub.poison (#183816)

Commit
61 days ago
[mlir][affine] Fix crash in linearize_index fold when multi-index is ub.poison (#183816) `AffineLinearizeIndexOp::fold` guarded the constant-folding path with `llvm::is_contained(adaptor.getMultiIndex(), nullptr)`, which only catches operands that have not been evaluated at all. When an operand folds to `ub.PoisonAttr`, the attribute is non-null so the guard passed, and the subsequent `cast<IntegerAttr>(indexAttr)` call crashed with an assertion failure. Fix by replacing the null-only check with one that requires every multi-index attribute to be a concrete `IntegerAttr`, returning `nullptr` for any other attribute (including null and PoisonAttr). Fixes #178204
Author
Parents
Loading