================ @@ -21,6 +21,88 @@ using namespace clang; using namespace clang::CIRGen; +/// Checks whether the given constructor is a valid subject for the +/// complete-to-base constructor delgation optimization, i.e. emitting the +/// complete constructor as a simple call to the base constructor. ---------------- andykaylor wrote:
It's not clear to me what the "optimization" is. The code I'm adding in this PR emits the C1 constructor as a call to the C2 constructor. When we upstream support for constructor aliases, there will be an option to omit the C1 constructor and call the C2 constructor directly (which seems like an optimization). Experimenting with the incubator and classic codegen, I find that even when I use `-mno-constructor-aliases` when this function returns false, the C1 constructor is omitted. https://godbolt.org/z/5obc7fbnW Given the current state of the upstream CIR implementation, we can't handle code with virtual bases. I will try a variadic constructor to see what happens. The relevant case for what I've got implemented in this PR is the `ctor->isDelegatingConstructor()` case (which seems to have the opposite meaning of what I would expect). In theory, if this function returns `false` we should emit the full constructor body for both C1 and C2 constructors. In practice, the incubator and classic codegen don't seem to do that. https://github.com/llvm/llvm-project/pull/143639 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits