================ @@ -85,23 +85,24 @@ RValue CIRGenFunction::emitCXXMemberOrOperatorMemberCallExpr( return RValue::get(nullptr); } - bool trivialForCodegen = - md->isTrivial() || (md->isDefaulted() && md->getParent()->isUnion()); - bool trivialAssignment = - trivialForCodegen && - (md->isCopyAssignmentOperator() || md->isMoveAssignmentOperator()) && - !md->getParent()->mayInsertExtraPadding(); - (void)trivialAssignment; + // Note on trivial assignment + // -------------------------- + // Classic codegen avoids generating the trivial copy/move assignment operator + // when it isn't necessary, choosing instead to just produce IR with an + // equivalent effect. We have chosen not to do that in CIR, instead emitting + // trivial copy/move assignment operators and allowing later transformations + // to optimize them away if appropriate. ---------------- erichkeane wrote:
I like this FWIW, and I think we should do MORE of this if we can get away with it. The 'premature optimizations' in the FE are only there because LLVM-IR isn't expressive enough to make it clear it is legal. CIR should make sure it is expressive enough for these situations. https://github.com/llvm/llvm-project/pull/145979 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits