[mlir][shape] Don't crash on poison operands in folders (#226671)
Several shape folders used an unchecked `llvm::cast` on their folded
operands, assuming any non-null attribute was a `DenseIntElementsAttr`
(or `IntegerAttr`). A `ub.poison` operand folds to `#ub.poison`, so
these casts asserted.
The folders now check attribute types before accessing their values and
propagate poison where appropriate.
- `ConcatOp`, `NumElementsOp`, `SplitAtOp` and `ToExtentTensorOp` fold
to poison when an operand is poison.
- `CstrBroadcastableOp` (and its `hasAtMostSingleNonScalar` helper) no
longer crashes; poison is treated like a non-constant operand there.
`NumElementsOp`, `SplitAtOp` and `ToExtentTensorOp` weren't in the
issue; I found them while fixing the reported ones.
Part of #226067 (the affine and scf cases are not addressed here).
Assisted-by: Claude