[PATCH] D148504: [LoopInfo] SFINAE mechanism for hoist into check

Markus Böck via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 01:48:38 PDT 2023


zero9178 added inline comments.


================
Comment at: llvm/include/llvm/Support/GenericLoopInfoImpl.h:185
+std::enable_if_t<detect_has_hoist_check<BlockT>::value, bool>
+isLegalToHoistInto(BlockT *Block) {
+  return Block->isLegalToHoistInto();
----------------
Somewhat small nit, but this can probably be implemented nicer using `if constexpr`
```
template <class BlockT>
bool isLegalToHoistInto(BlockT *Block) {
   if constexpr (detect_has_hoist_check<BlockT>::value)
       return Block->isLegalToHoistInto();
   else
       return false;
}
```
Less SFINAE magic!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148504



More information about the llvm-commits mailing list