llvm-project
3ebb3ef5 - [mlir][bytecode] Fix crash when reading DenseIntOrFPElementsAttr with unsupported element type (#184773)

Commit
30 days ago
[mlir][bytecode] Fix crash when reading DenseIntOrFPElementsAttr with unsupported element type (#184773) When a bytecode type callback substitutes a type that does not implement DenseElementTypeInterface (e.g., \!test.i32 replacing i32), the bytecode reader attempted to reconstruct a DenseIntOrFPElementsAttr with that type. This unconditionally called getDenseElementBitWidth() which hit an llvm_unreachable on unsupported types. Fix this by validating the element type implements DenseElementTypeInterface in readDenseIntOrFPElementsAttr before proceeding. If the check fails, a proper diagnostic is emitted and reading fails gracefully instead of crashing. Fixes #128317
Author
Parents
Loading