diff --git a/llvm/include/llvm/IR/PassInstrumentation.h b/llvm/include/llvm/IR/PassInstrumentation.h index 4e65804179ae7..3172cefe7e8ca 100644 --- a/llvm/include/llvm/IR/PassInstrumentation.h +++ b/llvm/include/llvm/IR/PassInstrumentation.h @@ -216,14 +216,9 @@ class PassInstrumentation { template using has_required_t = decltype(std::declval().isRequired()); - template - static std::enable_if_t::value, bool> - isRequired(const PassT &Pass) { - return Pass.isRequired(); - } - template - static std::enable_if_t::value, bool> - isRequired(const PassT &Pass) { + template static bool isRequired(const PassT &Pass) { + if constexpr (is_detected::value) + return Pass.isRequired(); return false; } diff --git a/llvm/include/llvm/IR/PassManagerInternal.h b/llvm/include/llvm/IR/PassManagerInternal.h index 62bede206da50..2f84ae24383e9 100644 --- a/llvm/include/llvm/IR/PassManagerInternal.h +++ b/llvm/include/llvm/IR/PassManagerInternal.h @@ -102,14 +102,9 @@ struct PassModel : PassConcept { template using has_required_t = decltype(std::declval().isRequired()); - template - static std::enable_if_t::value, bool> - passIsRequiredImpl() { - return T::isRequired(); - } - template - static std::enable_if_t::value, bool> - passIsRequiredImpl() { + template static bool passIsRequiredImpl() { + if constexpr (is_detected::value) + return T::isRequired(); return false; }