NFC: Use the free function variants for `dyn_cast/cast/isa/...`.
NFC: Use the free function variants for `dyn_cast/cast/isa/...`.

The member functions in `Type/Attribute/Value/Location/AffineExpr` are [deprecated](https://mlir.llvm.org/deprecation) and will go away.
