[clang] [CIR] Implement lowering for const-emitted global compound literals (PR #201152)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 2 15:52:59 PDT 2026
================
@@ -447,6 +447,19 @@ class CIRGenModule : public CIRGenTypeCache {
llvm::DenseMap<mlir::Attribute, cir::GlobalOp> constantStringMap;
llvm::DenseMap<const UnnamedGlobalConstantDecl *, cir::GlobalOp>
unnamedGlobalConstantDeclMap;
+ llvm::DenseMap<const CompoundLiteralExpr *, cir::GlobalOp>
+ emittedCompoundLiterals;
+
+ cir::GlobalOp
+ getAddrOfConstantCompoundLiteralIfEmitted(const CompoundLiteralExpr *e) {
+ return emittedCompoundLiterals.lookup(e);
+ }
+ void setAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *e,
+ cir::GlobalOp gv) {
+ bool ok = emittedCompoundLiterals.insert({e, gv}).second;
+ (void)ok;
----------------
andykaylor wrote:
```suggestion
[[maybe_unused]] bool ok = emittedCompoundLiterals.insert({e, gv}).second;
```
https://github.com/llvm/llvm-project/pull/201152
More information about the cfe-commits
mailing list