[clang] [CIR][NFC] Add missing checks in emitForMemory (PR #194646)

Sirui Mu via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 28 07:48:24 PDT 2026


https://github.com/Lancern created https://github.com/llvm/llvm-project/pull/194646

As mentioned at https://github.com/llvm/llvm-project/pull/194239#discussion_r3149409711 :

> Not related to your PR, but it looks like we're missing checks here for bool vectors and BitInt destination types.

This patch adds the missing checks for bool vectors and BitInt types in the `ConstantEmitter::emitForMemory` function.

>From fa70befc37ee32bd2cfaec0e16e766cdb1cf141f Mon Sep 17 00:00:00 2001
From: Sirui Mu <msrlancern at gmail.com>
Date: Tue, 28 Apr 2026 22:45:34 +0800
Subject: [PATCH] [CIR][NFC] Add missing checks in emitForMemory

---
 clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp b/clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
index 490703d9b5052..855b64947a237 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
@@ -1764,6 +1764,16 @@ mlir::Attribute ConstantEmitter::emitForMemory(CIRGenModule &cgm,
     cgm.errorNYI("emitForMemory: tail padding in atomic initializer");
   }
 
+  // In HLSL bool vectors are stored in memory as a vector of i32
+  if (destType->isExtVectorBoolType() &&
+      !destType->isPackedVectorBoolType(cgm.getASTContext())) {
+    cgm.errorNYI("emitForMemory: zero-extend HLSL bool vectors");
+  }
+
+  if (destType->isBitIntType()) {
+    cgm.errorNYI("emitForMemory: _BitInt type");
+  }
+
   return c;
 }
 



More information about the cfe-commits mailing list