summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/ctor-dtor-alias.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert r337456: [CodeGen] Disable aggressive structor optimizations at -O0, ↵Chandler Carruth2018-07-291-33/+8
| | | | | | | | | | | | | | | | | | | | | | | | take 3 This commit increases the number of sections and overall output size of .o files by 10% and sometimes a bit more. This alone is challenging for some users, but it also appears to trigger an as-yet unexplained behavior in the Gold linker where the memory usage increases considerably more than 10% (we think). The increase is also frustrating because in many (if not all) cases we end up with almost all of the growth coming from the ELF overhead of -ffunction-sections and such, not from actual extra code being emitted. Richard Smith and Eric Christopher are both going to investigate this and try to get to the bottom of what is triggering this and whether the kinds of increases here are sustainable or what options we might have to minimize the impact they have. However, this is currently breaking a pretty large number of our users' builds so reverting it while we sort out how to make progress here. I've seen a longer and more detailed update to the commit thread. llvm-svn: 338209
* [CodeGen] Disable aggressive structor optimizations at -O0, take 3Pavel Labath2018-07-191-8/+33
| | | | | | | | | | | | The previous version of this patch (r332839) was reverted because it was causing "definition with same mangled name as another definition" errors in some module builds. This was caused by an unrelated bug in module importing which it exposed. The importing problem was fixed in r336240, so this recommits the original patch (r332839). Differential Revision: https://reviews.llvm.org/D46685 llvm-svn: 337456
* IRgen: Mark aliases of ctors and dtors as unnamed_addr.Peter Collingbourne2018-06-181-6/+6
| | | | | | | | | This is not only semantically correct but ensures that they will not be marked as address-significant once D48155 lands. Differential Revision: https://reviews.llvm.org/D48206 llvm-svn: 334982
* Revert r332839.Richard Smith2018-05-301-33/+8
| | | | | | | This is causing miscompiles and "definition with same mangled name as another definition" errors. llvm-svn: 333482
* [CodeGen] Disable aggressive structor optimizations at -O0, take 2Pavel Labath2018-05-211-8/+33
| | | | | | | | | | | | | | | | | | | | | | | | | The first version of the patch (r332228) was flawed because it was putting structors into C5/D5 comdats very eagerly. This is correct only if we can ensure the comdat contains all required versions of the structor (which wasn't the case). This version uses a more nuanced approach: - for local structor symbols we use an alias because we don't have to worry about comdats or other compilation units. - linkonce symbols are emitted separately, as we cannot guarantee we will have all symbols we need to form a comdat (they are emitted lazily, only when referenced). - available_externally symbols are also emitted separately, as the code seemed to be worried about emitting an alias in this case. - other linkage types are not affected by the optimization level. They either get put into a comdat (weak) or get aliased (external). Reviewers: rjmccall, aprantl Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46685 llvm-svn: 332839
* Revert "[CodeGen] Disable aggressive structor optimizations at -O0"Pavel Labath2018-05-141-5/+4
| | | | | | | | | It breaks the sanitizer build <http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/23739> This reverts commit r332228. llvm-svn: 332232
* [CodeGen] Disable aggressive structor optimizations at -O0Pavel Labath2018-05-141-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Removing the full structor and replacing all usages with the base one can degrade debug quality as it will leave the debugger unable to locate the full object structor. This is apparent when evaluating an expression in the debugger which requires constructing an object of class which has had this optimization applied to it. When compiling the expression, we pretend that the class and its methods have been defined in another compilation unit, so the expression compiler assumes the structor definition must be available. This didn't use to be the case for structors with internal linkage. Less aggressive optimizations like emitting the full structor as an alias remain in place, as they do not cause the structor symbol to disappear completely. This improves debug quality on non-darwin platforms (darwin does not have -mconstructor-aliases on by default, so it is spared these problems) and enable us to remove some workarounds from LLDB which attempt to mitigate this issue. Reviewers: rjmccall, aprantl Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46685 llvm-svn: 332228
* Fix typos in clangAlexander Kornienko2018-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found via codespell -q 3 -I ../clang-whitelist.txt Where whitelist consists of: archtype cas classs checkk compres definit frome iff inteval ith lod methode nd optin ot pres statics te thru Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few files that have dubious fixes reverted.) Differential revision: https://reviews.llvm.org/D44188 llvm-svn: 329399
* Make '-disable-llvm-optzns' an alias for '-disable-llvm-passes'.Chandler Carruth2016-12-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Much to my surprise, '-disable-llvm-optzns' which I thought was the magical flag I wanted to get at the raw LLVM IR coming out of Clang deosn't do that. It still runs some passes over the IR. I don't want that, I really want the *raw* IR coming out of Clang and I strongly suspect everyone else using it is in the same camp. There is actually a flag that does what I want that I didn't know about called '-disable-llvm-passes'. I suspect many others don't know about it either. It both does what I want and is much simpler. This removes the confusing version and makes that spelling of the flag an alias for '-disable-llvm-passes'. I've also moved everything in Clang to use the 'passes' spelling as it seems both more accurate (*all* LLVM passes are disabled, not just optimizations) and much easier to remember and spell correctly. This is part of simplifying how Clang drives LLVM to make it cleaner to wire up to the new pass manager. Differential Revision: https://reviews.llvm.org/D28047 llvm-svn: 290392
* CodeGen: New vtable group representation: struct of vtable arrays.Peter Collingbourne2016-12-131-1/+1
| | | | | | | | | In a future change, this representation will allow us to use the new inrange annotation on getelementptr to allow the optimizer to split vtable groups. Differential Revision: https://reviews.llvm.org/D22296 llvm-svn: 289584
* [opaque pointer type] update test cases for explicit pointee types on global ↵David Blaikie2015-09-111-1/+1
| | | | | | aliases llvm-svn: 247380
* Changed renaming of local symbols by inserting a dot vefore the numeric suffixSunil Srivastava2015-05-121-6/+6
| | | | | | | details in http://reviews.llvm.org/D9483 goes with llvm checkin r237150 llvm-svn: 237151
* [pr22293] Don't crash during codegen of a recursive destructor.Rafael Espindola2015-01-231-0/+11
| | | | | | | | | | | In ItaniumCXXABI::EmitCXXDestructors we first emit the base destructor and then try to emit the complete one as an alias. If in the base ends up calling the complete destructor, the GD for the complete will be in the list of deferred decl by the time we replace it with an alias and delete the original GV. llvm-svn: 226896
* Use a trivial comdat for inline ctor/dtor when not using C5/D5.Rafael Espindola2015-01-151-5/+8
| | | | | | | When combined with llvm not producing implicit comdats, not doing this would cause code bloat on ELF and link errors on COFF. llvm-svn: 226211
* Update for .ll syntax change.Rafael Espindola2015-01-061-4/+4
| | | | llvm-svn: 225303
* Don't try to use C5/D5 comdats in COFF.Rafael Espindola2014-09-161-0/+5
| | | | | | This should fix the mingw bootstrap. llvm-svn: 217897
* Add support for putting constructors and destructos in explicit comdats.Rafael Espindola2014-09-161-9/+49
| | | | | | | | | | | | | | | | | | There are situations when clang knows that the C1 and C2 constructors or the D1 and D2 destructors are identical. We already optimize some of these cases, but cannot optimize it when the GlobalValue is weak_odr. The problem with weak_odr is that an old TU seeing the same code will have a C1 and a C2 comdat with the corresponding symbols. We cannot suddenly start putting the C2 symbol in the C1 comdat as we cannot guarantee that the linker will not pick a .o with only C1 in it. The solution implemented by GCC is to expand the ABI to have a comdat whose name uses a C5/D5 suffix and always has both symbols. That is what this patch implements. llvm-svn: 217874
* Cleanup test.Rafael Espindola2014-08-301-21/+31
| | | | | | This should make it easier to add more tests to this file. llvm-svn: 216807
* Update for llvm API change.Rafael Espindola2014-06-031-1/+1
| | | | | | Aliases in llvm now hold an arbitrary expression. llvm-svn: 210063
* Update for llvm api change.Rafael Espindola2014-05-161-1/+1
| | | | | | | | | | Now that llvm cannot represent alias cycles, we have to diagnose erros just before trying to close the cycle. This degrades the errors a bit. The real solution is what it was before: if we want to provide good errors for these cases, we have to be able to find a clang level decl given a mangled name and produce the error from Sema. llvm-svn: 209008
* Don't produce an alias between destructors with different calling conventions.Rafael Espindola2014-03-051-2/+18
| | | | | | Fixes pr19007. llvm-svn: 203007
* Fix broken CHECK linesNico Rieck2014-02-161-1/+1
| | | | llvm-svn: 201477
* Remove duplicated -cc1 in testsAlp Toker2013-12-081-1/+1
| | | | llvm-svn: 196728
* Adjust r194296 to not apply the alias replacement for externallyJoerg Sonnenberger2013-11-221-0/+32
| | | | | | | | available always-inline functions. This breaks libc++'s locale implementation. Code generation for this case should be fixed, but this is a stop gap fix for clang 3.4. llvm-svn: 195501
* Don't use alias from derived dtor to base dtor at -O0.Rafael Espindola2013-11-131-1/+7
| | | | | | | | | | This patch disables aliasing (and rauw) of derived dtors to base dtors at -O0. This optimization can have a negative impact on the debug quality. This was a latent bug for some time with local classes, but got noticed when it was generalized and broke gdb's destrprint.exp. llvm-svn: 194618
* Avoid producing mismatched comdats.Rafael Espindola2013-11-121-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | The problem was that given template<typename T> struct foo { ~foo() {} }; template class foo<int>; We would produce a alias, creating a comdat with D0 and D1, since the symbols have to be weak. Another TU is not required to have a explicit template instantiation definition or an explict template instantiation declaration and for template<typename T> struct foo { ~foo() {} }; foo<int> a; we would produce a comdat with only one symbol in it. llvm-svn: 194520
* Add a testcase where we replace a destructor with an alias.Rafael Espindola2013-11-111-0/+16
| | | | | | This is a reduced testcase from a cast to Function failing during bootstrap. llvm-svn: 194430
* Fix pr17875.Rafael Espindola2013-11-111-0/+15
| | | | | | | | The assert this patch deletes was valid only when aliasing D2 to D1, not when looking at a base class. Since the assert was in the path where we had already decided to not produce an alias, just drop it. llvm-svn: 194411
* Don't emit an internal destructor that is identical to an external one.Rafael Espindola2013-11-091-0/+15
| | | | | | | It is not safe to emit alias to undefined (not supported by ELF or COFF), but it is safe to rauw when the alias would have been internal or linkonce_odr. llvm-svn: 194307
* Use rauw for all discardable aliases, not just linkonce_odr.Rafael Espindola2013-11-081-4/+19
| | | | llvm-svn: 194296
* If a linkonce_odr dtor/ctor is identical to another one, just rauw.Rafael Espindola2013-11-081-2/+3
| | | | | | | Unlike an alias a rauw is always safe, so we don't need to avoid this optimization when the replacement is not know to be available in every TU. llvm-svn: 194288
* Produce direct calls instead of alias to linkonce_odr functions.Rafael Espindola2013-11-051-6/+3
| | | | | | | This is a small optimization on linux, but should help more on windows where msvc only outputs one destructor if there would be two identical ones. llvm-svn: 194095
* Revert "Produce direct calls instead of alias to linkonce_odr functions."Rafael Espindola2013-11-051-3/+6
| | | | | | | This reverts commit r194046. Debugging a bootstrap issue. llvm-svn: 194047
* Produce direct calls instead of alias to linkonce_odr functions.Rafael Espindola2013-11-051-6/+3
| | | | | | | This is a small optimization on linux, but should help more on windows where msvc only outputs one destructor if there would be two identical ones. llvm-svn: 194046
* Use aliases for more constructors and destructors.Rafael Espindola2013-11-041-0/+62
With this patch we produce alias for cases like template<typename T> struct foobar { foobar() { } }; template struct foobar<void>; We just have to be careful to produce the same aliases in every TU because of comdats. llvm-svn: 194000
OpenPOWER on IntegriCloud