================
@@ -98,8 +98,22 @@ CIRGenFunction::emitAutoVarAlloca(const VarDecl &d,
if (const RecordDecl *rd = ty->getAsRecordDecl()) {
if (const auto *cxxrd = dyn_cast<CXXRecordDecl>(rd);
(cxxrd && !cxxrd->hasTrivialDestructor()) ||
- rd->isNonTrivialToPrimitiveDestroy())
- cgm.errorNYI(d.getSourceRange(), "emitAutoVarAlloca: set NRVO flag");
+ rd->isNonTrivialToPrimitiveDestroy()) {
+ // In LLVM: Create a flag that is used to indicate when the NRVO was
+ // applied to this variable. Set it to zero to indicate that NRVO was
+ // not applied. For now, use the same approach for CIRGen until we
can
+ // be sure it's worth doing something more aggressive.
+ cir::ConstantOp falseNVRO = builder.getFalse(loc);
+ Address nrvoFlag = createTempAlloca(falseNVRO.getType(),
+ CharUnits::One(), loc, "nrvo",
+ /*ArraySize=*/nullptr, &address);
----------------
AmrDeveloper wrote:
```suggestion
/*arraySize=*/nullptr, &address);
```
https://github.com/llvm/llvm-project/pull/170569
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits