[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 4 11:16:36 PDT 2023


================
@@ -7304,6 +7382,21 @@ class BufferToAPValueConverter {
     return ArrayValue;
   }
 
+  std::optional<APValue> visit(const VectorType *Ty, CharUnits Offset) {
+    SmallVector<uint8_t, 8> Bytes;
+    if (!Buffer.readObject(Offset, Info.Ctx.getTypeSizeInChars(Ty), Bytes))
+      return std::nullopt;
----------------
zygoloid wrote:

Hm, maybe we need to avoid generating an LLVM `bit_cast` here and go through memory instead?

I think it's best to handle that in a separate PR.

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


More information about the cfe-commits mailing list