[llvm] Modernize types and constraints (NFC) (PR #97923)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 6 16:27:46 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: AtariDreams (AtariDreams)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/97923.diff


5 Files Affected:

- (modified) llvm/lib/IR/AttributeImpl.h (+2-2) 
- (modified) llvm/lib/IR/ProfDataUtils.cpp (+1-1) 
- (modified) llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h (+2-2) 
- (modified) llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp (+1-1) 
- (modified) llvm/lib/Target/X86/ImmutableGraph.h (+2-2) 


``````````diff
diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h
index b9441729b48c6..5ba24b2e09568 100644
--- a/llvm/lib/IR/AttributeImpl.h
+++ b/llvm/lib/IR/AttributeImpl.h
@@ -145,7 +145,7 @@ class AttributeImpl : public FoldingSetNode {
   }
 };
 
-static_assert(std::is_trivially_destructible<AttributeImpl>::value,
+static_assert(std::is_trivially_destructible_v<AttributeImpl>,
               "AttributeImpl should be trivially destructible");
 
 //===----------------------------------------------------------------------===//
@@ -412,7 +412,7 @@ class AttributeListImpl final
   void dump() const;
 };
 
-static_assert(std::is_trivially_destructible<AttributeListImpl>::value,
+static_assert(std::is_trivially_destructible_v<AttributeListImpl>,
               "AttributeListImpl should be trivially destructible");
 
 } // end namespace llvm
diff --git a/llvm/lib/IR/ProfDataUtils.cpp b/llvm/lib/IR/ProfDataUtils.cpp
index 992ce34e00034..deedf64378a5b 100644
--- a/llvm/lib/IR/ProfDataUtils.cpp
+++ b/llvm/lib/IR/ProfDataUtils.cpp
@@ -67,7 +67,7 @@ bool isTargetMD(const MDNode *ProfData, const char *Name, unsigned MinOps) {
 }
 
 template <typename T,
-          typename = typename std::enable_if<std::is_arithmetic_v<T>>>
+          typename = std::enable_if_t<std::is_arithmetic_v<T>>>
 static void extractFromBranchWeightMD(const MDNode *ProfileData,
                                       SmallVectorImpl<T> &Weights) {
   assert(isBranchWeightMD(ProfileData) && "wrong metadata");
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
index 03cbd272757e7..33f6659f225aa 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
@@ -805,8 +805,8 @@ static inline bool isSVECpyImm(int64_t Imm) {
 /// Returns true if Imm is valid for ADD/SUB.
 template <typename T>
 static inline bool isSVEAddSubImm(int64_t Imm) {
-  bool IsInt8t = std::is_same<int8_t, std::make_signed_t<T>>::value ||
-                 std::is_same<int8_t, T>::value;
+  bool IsInt8t = std::is_same_v<int8_t, std::make_signed_t<T>> ||
+                 std::is_same_v<int8_t, T>;
   return uint8_t(Imm) == Imm || (!IsInt8t && uint16_t(Imm & ~0xff) == Imm);
 }
 
diff --git a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
index 3585b5f4a5c9a..ab1b420c46215 100644
--- a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
+++ b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
@@ -114,7 +114,7 @@ bool parseImmediate(MCInst &MI, uint64_t &Size, ArrayRef<uint8_t> Bytes) {
   T Val =
       support::endian::read<T, llvm::endianness::little>(Bytes.data() + Size);
   Size += sizeof(T);
-  if (std::is_floating_point<T>::value) {
+  if (std::is_floating_point_v<T>) {
     MI.addOperand(
         MCOperand::createDFPImm(bit_cast<uint64_t>(static_cast<double>(Val))));
   } else {
diff --git a/llvm/lib/Target/X86/ImmutableGraph.h b/llvm/lib/Target/X86/ImmutableGraph.h
index b867fa578fc0e..53e2d23c0dcd1 100644
--- a/llvm/lib/Target/X86/ImmutableGraph.h
+++ b/llvm/lib/Target/X86/ImmutableGraph.h
@@ -295,8 +295,8 @@ template <typename GraphT> class ImmutableGraphBuilder {
   using node_value_type = typename GraphT::node_value_type;
   using edge_value_type = typename GraphT::edge_value_type;
   static_assert(
-      std::is_base_of<ImmutableGraph<node_value_type, edge_value_type>,
-                      GraphT>::value,
+      std::is_base_of_v<ImmutableGraph<node_value_type, edge_value_type>,
+                      GraphT>,
       "Template argument to ImmutableGraphBuilder must derive from "
       "ImmutableGraph<>");
   using size_type = typename GraphT::size_type;

``````````

</details>


https://github.com/llvm/llvm-project/pull/97923


More information about the llvm-commits mailing list