[SLP][NFC] Simplify range/type accessors
Use the range-friendly llvm::accumulate() overload instead of the
two-iterator std::accumulate() form, drop redundant cast<>/dyn_cast<>
calls where the source already provides a typed accessor.
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/192811