================
@@ -2884,3 +2884,110 @@ cir::LabelOp
CIRGenModule::lookupBlockAddressInfo(cir::BlockAddrInfoAttr blockInfo) {
return blockAddressInfoToLabel.lookup(blockInfo);
}
+
+mlir::Operation *
+CIRGenModule::getAddrOfGlobalTemporary(const MaterializeTemporaryExpr *mte,
+ const Expr *init) {
+ assert((mte->getStorageDuration() == SD_Static ||
+ mte->getStorageDuration() == SD_Thread) &&
+ "not a global temporary");
+ const auto *varDecl = cast<VarDecl>(mte->getExtendingDecl());
+
+ // If we're not materializing a subobject of the temporary, keep the
+ // cv-qualifiers from the type of the MaterializeTemporaryExpr.
+ QualType materializedType = init->getType();
+ if (init == mte->getSubExpr())
+ materializedType = mte->getType();
+
+ CharUnits align = getASTContext().getTypeAlignInChars(materializedType);
+
+ assert(!cir::MissingFeatures::materializedGlobalTempCache());
----------------
andykaylor wrote:
This seems like more than just an optimization. Won't we create duplicate
globals without this?
https://github.com/llvm/llvm-project/pull/182608
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits