[clang] [CIR] Fix structors for multidimensional arrrays (PR #159820)

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 19 12:51:04 PDT 2025


================
@@ -727,9 +728,25 @@ void CIRGenFunction::emitArrayDestroy(mlir::Value begin, mlir::Value end,
   mlir::Type cirElementType = convertTypeForMem(elementType);
   cir::PointerType ptrToElmType = builder.getPointerTo(cirElementType);
 
+  uint64_t size = 0;
+
+  // Optimize for a constant array size.
+  if (auto constantCount = numElements.getDefiningOp<cir::ConstantOp>()) {
+    if (auto constIntAttr = constantCount.getValueAttr<cir::IntAttr>()) {
----------------
bcardosolopes wrote:

no need for curlies here

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


More information about the cfe-commits mailing list