[PATCH] D98302: Add ConstantDataVector::getRaw() to create a constant data vector from raw data.

Nick Lewycky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 16 11:56:03 PDT 2021


nickwasmer marked an inline comment as done.
nickwasmer added a comment.

> I'm not sure about the intended usage for these APIs, but this looks like a straightforward extension of the existing functionality.

It's broken out of https://github.com/wasmerio/llvm-project/compare/main...wasmerio:feature/parallel-link which is a work in progress (only known issue is that Metadata isn't handled yet). I'm using the API to clone the data of the constant across to a different LLVMContext.



================
Comment at: llvm/include/llvm/IR/Constants.h:706
   /// passed in. Note that this can return a ConstantAggregateZero object.
-  /// ElementTy needs to be one of i8/i16/i32/i64/float/double. Data is the
-  /// buffer containing the elements. Be careful to make sure Data uses the
+  /// ElementTy must be one of i8/i16/i32/i64/half/bfloat/float/double. Data is
+  /// the buffer containing the elements. Be careful to make sure Data uses the
----------------
spatel wrote:
> Does it make sense to assert that the type is one of the expected values inside here?
Yes, I don't see why not. The rule applies to the base class which has a static `isElementTypeCompatible` method we could use. Let me land this first and then I'll try the assert and make sure it works and we can do that in a small separate review.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98302/new/

https://reviews.llvm.org/D98302



More information about the llvm-commits mailing list