Open Alcaro opened 3 months ago
I think this is relevant:
https://blog.llvm.org/2017/03/devirtualization-in-llvm-and-clang.html
llvm has WholeProgramDevirtPass, but only used in lto/thinlto
I think this is relevant:
That it is, but it's also seven years old. Clang and LLVM have learned a lot since then, and I feel it's safe to revisit every 'can't optimize' from back then.
llvm has WholeProgramDevirtPass, but only used in lto/thinlto
Can't reproduce, it's not devirtualized with LTO either. https://godbolt.org/z/r6hP9Mzhc
Expected: Release() should see that the_impl is the only child class that's used, and devirtualize its dtor (then inline it and just call operator delete). GCC performs this optimization.
Actual: It calls into the vtable.
https://godbolt.org/z/vbYY4ezqE