[mlir][tensor|memref] Harden the checks on dim op
Prior to this patch it was possible to use the dim operation on a 0-D
memref/tensor.
Unless we want to change the semantic of a 0-D shape, this doesn't make
sense because, paraphrasing the dim op semantic, this is guaranteed to
produce something that is undefined. (The requested index is guaranteed
to be equal to or greater than the rank.)
Harden the type requirements for the dim op by disallowing 0-D shaped
types.
This "fixes" llvm.org/PR60195 by rejecting dim op on 0-D shapes instead of
crashing during LLVM conversion.
Differential Revision: https://reviews.llvm.org/D142445