[clang] [CIR] Keep CIR global types visible across lowering replacements (PR #238698)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 5 01:53:49 PST 2026


================
@@ -0,0 +1,25 @@
+// RUN: cir-opt %s --cir-to-llvm -o - | FileCheck %s
+
+!void = !cir.void
+!arr_ty = !cir.array<!cir.ptr<!void> x 100>
+!bulk_ty = !cir.array<!cir.ptr<!cir.array<!cir.ptr<!void> x 100>> x 2>
+
+module attributes {cir.triple = "x86_64-unknown-linux-gnu"} {
+  // Region-initialized, so its LLVM type is adjusted (grouped struct).
+  cir.global external dso_local @arr = #cir.const_array<[
+      #cir.global_view<@arr, [5 : i32]> : !cir.ptr<!void>,
+      #cir.global_view<@arr, [7 : i32]> : !cir.ptr<!void>
+  ], trailing_zeros> : !arr_ty
+
+  // Unindexed views of @arr: bulk lowering must see the CIR array type
+  // via the stash, not the adjusted LLVM struct type.
----------------
xlauko wrote:

There is no stash anymore. Maybe “from the pre-conversion map, not the adjusted LLVM struct type”.

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


More information about the cfe-commits mailing list