adams381 wrote:

The incubator comment was a deviation note documenting that CIR wasn't yet 
applying the classic CodeGen optimization, not a commitment to omit it 
permanently.  The optimization is necessary: the trivial copy/move operator 
body as currently emitted consists of a save/load sequence LLVM removes at -O1, 
so the store disappears entirely at -O3 on real code — the concrete regression 
was `*++yyvsp = yylval` in yacc/bison stacks (see the `-O3` repro in 
`cxx-special-member-attr.cpp`).

Classic CodeGen handles this identically in 
`EmitCXXMemberOrOperatorMemberCallExpr` — it never emits the call for trivial 
copy/move assignment, it goes straight to `EmitAggregateAssign` at the call 
site.  If a future CIR optimization pass should reason about trivial 
assignment, the prerequisite is fixing the operator body to emit a real copy 
rather than the save/load sequence LLVM eliminates; that's a separate change.

https://github.com/llvm/llvm-project/pull/198918
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to