[clang] [CIR] Lower global ConstArrayAttr with string elements to LLVM string constant (PR #194988)
David Rivera via cfe-commits
cfe-commits at lists.llvm.org
Mon May 4 06:53:58 PDT 2026
================
@@ -2469,11 +2496,21 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite(
op.emitError() << "unsupported initializer '" << init.value() << "'";
return mlir::failure();
}
- } else if (mlir::isa<cir::ConstArrayAttr, cir::ConstVectorAttr,
- cir::ConstRecordAttr, cir::ConstPtrAttr,
- cir::ConstComplexAttr, cir::GlobalViewAttr,
- cir::TypeInfoAttr, cir::UndefAttr, cir::PoisonAttr,
- cir::VTableAttr, cir::ZeroAttr>(init.value())) {
+ } else if (mlir::isa<cir::ConstArrayAttr>(init.value())) {
----------------
RiverDave wrote:
Took a look at 3ce74c3b4026473a0e3855598bf6dc98aac081a9 and agree this patch is at the wrong layer. (you might correct me if I'm wrong) The intended model seems to be that string-backed `#cir.const_array` uses a typed `StringAttr` as the compact byte payload, while the enclosing `ConstArrayAttr` carries the full array type plus trailing zero count.
I'll make sure the globals emitted from the CUDA side carry the right type then. Thanks!
https://github.com/llvm/llvm-project/pull/194988
More information about the cfe-commits
mailing list