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

Christian Ulmann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 07:52:39 PDT 2023


Dinistro 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();
----------------
zero9178 wrote:
> 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!
I forgot about the `if constexpr` construct, thanks for the suggestion.


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