diff --git a/llvm/include/llvm/CodeGen/MachineValueType.h b/llvm/include/llvm/CodeGen/MachineValueType.h index 7ad782f0b720..3eb4d0b85de4 100644 --- a/llvm/include/llvm/CodeGen/MachineValueType.h +++ b/llvm/include/llvm/CodeGen/MachineValueType.h @@ -161,8 +161,8 @@ namespace llvm { SimpleValueType SimpleTy; - MVT() : SimpleTy((SimpleValueType)(INVALID_SIMPLE_VALUE_TYPE)) {} - MVT(SimpleValueType SVT) : SimpleTy(SVT) { } + LLVM_CONSTEXPR MVT() : SimpleTy(INVALID_SIMPLE_VALUE_TYPE) {} + LLVM_CONSTEXPR MVT(SimpleValueType SVT) : SimpleTy(SVT) { } bool operator>(const MVT& S) const { return SimpleTy > S.SimpleTy; } bool operator<(const MVT& S) const { return SimpleTy < S.SimpleTy; } diff --git a/llvm/include/llvm/CodeGen/ValueTypes.h b/llvm/include/llvm/CodeGen/ValueTypes.h index 4e93940e223e..e1a9fd38290b 100644 --- a/llvm/include/llvm/CodeGen/ValueTypes.h +++ b/llvm/include/llvm/CodeGen/ValueTypes.h @@ -34,10 +34,9 @@ namespace llvm { Type *LLVMTy; public: - EVT() : V((MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE)), - LLVMTy(nullptr) {} - EVT(MVT::SimpleValueType SVT) : V(SVT), LLVMTy(nullptr) { } - EVT(MVT S) : V(S), LLVMTy(nullptr) {} + LLVM_CONSTEXPR EVT() : V(MVT::INVALID_SIMPLE_VALUE_TYPE), LLVMTy(nullptr) {} + LLVM_CONSTEXPR EVT(MVT::SimpleValueType SVT) : V(SVT), LLVMTy(nullptr) {} + LLVM_CONSTEXPR EVT(MVT S) : V(S), LLVMTy(nullptr) {} bool operator==(EVT VT) const { return !(*this != VT); diff --git a/llvm/include/llvm/Support/UnicodeCharRanges.h b/llvm/include/llvm/Support/UnicodeCharRanges.h index 79137bf35363..9f738dff1107 100644 --- a/llvm/include/llvm/Support/UnicodeCharRanges.h +++ b/llvm/include/llvm/Support/UnicodeCharRanges.h @@ -50,9 +50,13 @@ public: /// the UnicodeCharSet instance, and should not change. Array is validated by /// the constructor, so it makes sense to create as few UnicodeCharSet /// instances per each array of ranges, as possible. +#ifdef NDEBUG + LLVM_CONSTEXPR UnicodeCharSet(CharRanges Ranges) : Ranges(Ranges) {} +#else UnicodeCharSet(CharRanges Ranges) : Ranges(Ranges) { assert(rangesAreValid()); } +#endif /// \brief Returns true if the character set contains the Unicode code point /// \p C.