[PATCH] D125391: [Target] use getSubtarget<> instead of static_cast<>(getSubtarget())

Zixuan Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 01:09:46 PDT 2022


zixuan-wu added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/SelectionDAG.h:455
   const TargetSubtargetInfo &getSubtarget() const { return MF->getSubtarget(); }
+  template <typename STC> const STC &getSubtarget() const {
+    return MF->getSubtarget<STC>();
----------------
As we don't prefer to use static_cast, then why not delete original getSubtarget. Or it can't replace all places with template one?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125391/new/

https://reviews.llvm.org/D125391



More information about the llvm-commits mailing list