[mlir] Return null from DenseElementsAttr::get on unsupported attribute types (#181159)
`DenseElementsAttr::get(ShapedType, ArrayRef<Attribute>)` crashed with an unconditional `cast<IntegerAttr>` when encountering attribute types that are neither `FloatAttr` nor `IntegerAttr` (e.g. `ub.poison`). This can happen when folding ops like `tensor.from_elements` whose operands include poison values.
This patch fixes the issue at the `DenseElementsAttr::get` level rather than in individual op folders. The `cast<IntegerAttr>` is replaced with `dyn_cast<IntegerAttr>`, and when the attribute is neither `FloatAttr` nor `IntegerAttr`, a null `DenseElementsAttr` is returned. This is a more robust fix because it prevents the same class of crashes in any caller that passes unsupported attributes to `DenseElementsAttr::get`.
Fixes #178209.
---------
Co-authored-by: rebel-jueonpark <jueonpark@rebellions.ai>