[clang] [CIR] Fix address space of string literals (PR #226996)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 28 07:54:19 PDT 2026
================
@@ -1585,6 +1585,11 @@ LValue CIRGenFunction::emitStringLiteralLValue(const StringLiteral *e,
unsigned align = *(globalOp.getAlignment());
mlir::Value addr =
builder.createGetGlobal(getLoc(e->getSourceRange()), globalOp);
+ cir::PointerType destPtrTy =
+ builder.getPointerTo(globalOp.getSymType(),
+ cgm.getTypes().getPointerAddressSpace(e->getType()));
+ if (addr.getType() != destPtrTy)
----------------
Fznamznon wrote:
I wonder if we should compare address spaces rather than types and create `destPtrTy` variable only if there is a mismatch.
https://github.com/llvm/llvm-project/pull/226996
More information about the cfe-commits
mailing list