Commit Graph

25 Commits

Author SHA1 Message Date
David Blaikie fc473554a6 [opaque pointer type] update test cases for explicit pointee types on global aliases
llvm-svn: 247380
2015-09-11 03:22:18 +00:00
Sunil Srivastava 3acf6275e6 Changed renaming of local symbols by inserting a dot vefore the numeric suffix
details in http://reviews.llvm.org/D9483
goes with llvm checkin r237150

llvm-svn: 237151
2015-05-12 16:48:43 +00:00
Rafael Espindola 6565e92f3f [pr22293] Don't crash during codegen of a recursive destructor.
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
2015-01-23 05:26:38 +00:00
Rafael Espindola dbee8a7a7a Use a trivial comdat for inline ctor/dtor when not using C5/D5.
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
2015-01-15 21:36:08 +00:00
Rafael Espindola c0f4a30ee7 Update for .ll syntax change.
llvm-svn: 225303
2015-01-06 22:55:40 +00:00
Rafael Espindola 0806f982e0 Don't try to use C5/D5 comdats in COFF.
This should fix the mingw bootstrap.

llvm-svn: 217897
2014-09-16 20:19:43 +00:00
Rafael Espindola 1e4df92f49 Add support for putting constructors and destructos in explicit comdats.
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
2014-09-16 15:18:21 +00:00
Rafael Espindola f7765ac9b9 Cleanup test.
This should make it easier to add more tests to this file.

llvm-svn: 216807
2014-08-30 00:15:37 +00:00
Rafael Espindola 27c60b512a Update for llvm API change.
Aliases in llvm now hold an arbitrary expression.

llvm-svn: 210063
2014-06-03 02:42:01 +00:00
Rafael Espindola b2633b9793 Update for llvm api change.
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
2014-05-16 19:35:48 +00:00
Rafael Espindola 191b95125a Don't produce an alias between destructors with different calling conventions.
Fixes pr19007.

llvm-svn: 203007
2014-03-05 21:04:41 +00:00
Nico Rieck e6a1582595 Fix broken CHECK lines
llvm-svn: 201477
2014-02-16 07:29:41 +00:00
Alp Toker 544bd43624 Remove duplicated -cc1 in tests
llvm-svn: 196728
2013-12-08 18:06:52 +00:00
Joerg Sonnenberger 374c2bb37e Adjust r194296 to not apply the alias replacement for externally
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
2013-11-22 21:34:35 +00:00
Rafael Espindola d967badc64 Don't use alias from derived dtor to base dtor at -O0.
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
2013-11-13 23:20:45 +00:00
Rafael Espindola 129d313c8d Avoid producing mismatched comdats.
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
2013-11-12 22:06:46 +00:00
Rafael Espindola 50e1f0095f Add a testcase where we replace a destructor with an alias.
This is a reduced testcase from a cast to Function failing during bootstrap.

llvm-svn: 194430
2013-11-11 22:55:13 +00:00
Rafael Espindola b15683e635 Fix pr17875.
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
2013-11-11 19:35:06 +00:00
Rafael Espindola 961ba21a47 Don't emit an internal destructor that is identical to an external one.
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
2013-11-09 01:57:21 +00:00
Rafael Espindola 23d3751170 Use rauw for all discardable aliases, not just linkonce_odr.
llvm-svn: 194296
2013-11-08 23:46:20 +00:00
Rafael Espindola e2ec6faa36 If a linkonce_odr dtor/ctor is identical to another one, just rauw.
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
2013-11-08 22:59:46 +00:00
Rafael Espindola 2e2995bf50 Produce direct calls instead of alias to linkonce_odr functions.
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
2013-11-05 21:37:29 +00:00
Rafael Espindola b5ac86865a Revert "Produce direct calls instead of alias to linkonce_odr functions."
This reverts commit r194046.
Debugging a bootstrap issue.

llvm-svn: 194047
2013-11-05 05:29:54 +00:00
Rafael Espindola 5d79a51a45 Produce direct calls instead of alias to linkonce_odr functions.
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
2013-11-05 05:22:36 +00:00
Rafael Espindola 3f643bd124 Use aliases for more constructors and destructors.
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
2013-11-04 18:38:59 +00:00