[clang] [C] Disable use of NRVO (PR #101038)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 10:31:29 PDT 2024


zygoloid wrote:

NRVO vs not-NRVO is not an ABI difference, just a behavior difference -- it doesn't change the calling convention, and different choices here are link-compatible (in C++ we can make different choices for different emissions of the same inline function even).

This is also not a potentially breaking change in the sense that it was always an optional optimization. But it's breaking in the sense that it's an observable behavior change in our default mode.

Instead of forcing this off for C compilations, how would you feel about instead changing the default for `-felide-constructors` to be off for C, so people can still re-enable the optimization to avoid performance / stack usage regressions? (Weird flag name for C, I know; maybe we should also think about adding an alias such as `-felide-return-copies`.)

https://github.com/llvm/llvm-project/pull/101038


More information about the cfe-commits mailing list