[Mlir-commits] [clang] [mlir] [CIR] Lower pointer const_array globals without insertvalue chains (PR #198427)
Erich Keane
llvmlistbot at llvm.org
Wed May 20 06:52:24 PDT 2026
================
@@ -2510,6 +2509,25 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite(
cir::ConstComplexAttr, cir::GlobalViewAttr,
cir::TypeInfoAttr, cir::UndefAttr, cir::PoisonAttr,
cir::VTableAttr, cir::ZeroAttr>(init.value())) {
+ if (auto constArr = mlir::dyn_cast<cir::ConstArrayAttr>(init.value())) {
+ if (!hasTrailingZeros(constArr)) {
+ mlir::Type elTy = constArr.getType();
+ while (auto arrTy = mlir::dyn_cast<cir::ArrayType>(elTy))
+ elTy = arrTy.getElementType();
+ if (mlir::isa<cir::PointerType>(elTy)) {
----------------
erichkeane wrote:
I was chasing down a similar issue in self build and noticed that it seems to skip this? I'm still debugging, but why is this limited to pointer types, and not extended to other trivially copyable types?
https://github.com/llvm/llvm-project/pull/198427
More information about the Mlir-commits
mailing list