[mlir] Update HeapAsmResourceBlob::allocate API to make alignment explicit
authorRiver Riddle <riddleriver@gmail.com>
Tue, 29 Nov 2022 02:48:12 +0000 (18:48 -0800)
committerRiver Riddle <riddleriver@gmail.com>
Thu, 1 Dec 2022 01:02:54 +0000 (17:02 -0800)
This effectively matches the same API changes that were made to
UnmanagedAsmResourceBlob.

mlir/include/mlir/IR/AsmState.h

index 0b00f1f..adec4b7 100644 (file)
@@ -192,18 +192,19 @@ public:
         llvm::deallocate_buffer, dataIsMutable);
   }
   /// Create a new heap allocated blob and copy the provided data into it.
-  static AsmResourceBlob allocateAndCopy(ArrayRef<char> data, size_t align,
-                                         bool dataIsMutable = true) {
+  static AsmResourceBlob allocateAndCopyWithAlign(ArrayRef<char> data,
+                                                  size_t align,
+                                                  bool dataIsMutable = true) {
     AsmResourceBlob blob = allocate(data.size(), align, dataIsMutable);
     std::memcpy(blob.getMutableData().data(), data.data(), data.size());
     return blob;
   }
   template <typename T>
-  static std::enable_if_t<!std::is_same<T, char>::value, AsmResourceBlob>
-  allocateAndCopy(ArrayRef<T> data, bool dataIsMutable = true) {
-    return allocateAndCopy(
+  static AsmResourceBlob allocateAndCopyInferAlign(ArrayRef<T> data,
+                                                   bool dataIsMutable = true) {
+    return allocateAndCopyWithAlign(
         ArrayRef<char>((const char *)data.data(), data.size() * sizeof(T)),
-        alignof(T));
+        alignof(T), dataIsMutable);
   }
 };
 /// This class provides a simple utility wrapper for creating "unmanaged"