[clang] 0439a01 - [llvm] Drop unaligned from calls to llvm::support::endian::{read,write} (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 10 22:41:55 PDT 2023


Author: Kazu Hirata
Date: 2023-10-10T22:41:47-07:00
New Revision: 0439a017ef72effa9681cdb794860cf954de808a

URL: https://github.com/llvm/llvm-project/commit/0439a017ef72effa9681cdb794860cf954de808a
DIFF: https://github.com/llvm/llvm-project/commit/0439a017ef72effa9681cdb794860cf954de808a.diff

LOG: [llvm] Drop unaligned from calls to llvm::support::endian::{read,write} (NFC)

The last template parameter of llvm::support::endian::{read,write}
defaults to unaligned, so we can drop that at call sites.

Added: 
    

Modified: 
    clang/lib/AST/Interp/ByteCodeEmitter.cpp
    clang/lib/AST/Interp/Source.h
    llvm/include/llvm/Object/FaultMapParser.h
    llvm/include/llvm/Object/StackMapParser.h
    llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeEmitter.cpp b/clang/lib/AST/Interp/ByteCodeEmitter.cpp
index 4989b4ba797f2cf..c8abb7c17a38ba2 100644
--- a/clang/lib/AST/Interp/ByteCodeEmitter.cpp
+++ b/clang/lib/AST/Interp/ByteCodeEmitter.cpp
@@ -149,7 +149,7 @@ void ByteCodeEmitter::emitLabel(LabelTy Label) {
       void *Location = Code.data() + Reloc - align(sizeof(int32_t));
       assert(aligned(Location));
       const int32_t Offset = Target - static_cast<int64_t>(Reloc);
-      endian::write<int32_t, llvm::endianness::native, 1>(Location, Offset);
+      endian::write<int32_t, llvm::endianness::native>(Location, Offset);
     }
     LabelRelocs.erase(It);
   }

diff  --git a/clang/lib/AST/Interp/Source.h b/clang/lib/AST/Interp/Source.h
index 70a6b87d031bb85..c28b488ff554d1f 100644
--- a/clang/lib/AST/Interp/Source.h
+++ b/clang/lib/AST/Interp/Source.h
@@ -55,7 +55,7 @@ class CodePtr final {
   template <typename T> std::enable_if_t<!std::is_pointer<T>::value, T> read() {
     assert(aligned(Ptr));
     using namespace llvm::support;
-    T Value = endian::read<T, llvm::endianness::native, 1>(Ptr);
+    T Value = endian::read<T, llvm::endianness::native>(Ptr);
     Ptr += align(sizeof(T));
     return Value;
   }

diff  --git a/llvm/include/llvm/Object/FaultMapParser.h b/llvm/include/llvm/Object/FaultMapParser.h
index 4d1f0397a0dd222..bed2dba154f3c06 100644
--- a/llvm/include/llvm/Object/FaultMapParser.h
+++ b/llvm/include/llvm/Object/FaultMapParser.h
@@ -42,7 +42,7 @@ class FaultMapParser {
 
   template <typename T> static T read(const uint8_t *P, const uint8_t *E) {
     assert(P + sizeof(T) <= E && "out of bounds read!");
-    return support::endian::read<T, support::little, 1>(P);
+    return support::endian::read<T, support::little>(P);
   }
 
 public:

diff  --git a/llvm/include/llvm/Object/StackMapParser.h b/llvm/include/llvm/Object/StackMapParser.h
index 37d0377cf93bca5..8853e3656fca071 100644
--- a/llvm/include/llvm/Object/StackMapParser.h
+++ b/llvm/include/llvm/Object/StackMapParser.h
@@ -436,7 +436,7 @@ template <llvm::endianness Endianness> class StackMapParser {
 private:
   template <typename T>
   static T read(const uint8_t *P) {
-    return support::endian::read<T, Endianness, 1>(P);
+    return support::endian::read<T, Endianness>(P);
   }
 
   static const unsigned HeaderOffset = 0;

diff  --git a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
index e56cb15406aeaa1..ed7757be6615827 100644
--- a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
+++ b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
@@ -109,8 +109,8 @@ template <typename T>
 bool parseImmediate(MCInst &MI, uint64_t &Size, ArrayRef<uint8_t> Bytes) {
   if (Size + sizeof(T) > Bytes.size())
     return false;
-  T Val = support::endian::read<T, llvm::endianness::little, 1>(Bytes.data() +
-                                                                Size);
+  T Val =
+      support::endian::read<T, llvm::endianness::little>(Bytes.data() + Size);
   Size += sizeof(T);
   if (std::is_floating_point<T>::value) {
     MI.addOperand(


        


More information about the cfe-commits mailing list