Commit Graph

24 Commits

Author SHA1 Message Date
Rafael Espindola daeafb4c2a Add back r201608, r201622, r201624 and r201625
r201608 made llvm corretly handle private globals with MachO. r201622 fixed
a bug in it and r201624 and r201625 were changes for using private linkage,
assuming that llvm would do the right thing.

They all got reverted because r201608 introduced a crash in LTO. This patch
includes a fix for that. The issue was that TargetLoweringObjectFile now has
to be initialized before we can mangle names of private globals. This is
trivially true during the normal codegen pipeline (the asm printer does it),
but LTO has to do it manually.

llvm-svn: 201700
2014-02-19 17:23:20 +00:00
Rafael Espindola 66f273be34 Don't internalize linkonce_odr non constant variables.
llvm-svn: 200983
2014-02-07 19:04:43 +00:00
Rafael Espindola 20fcda7162 Provide a dummy section to fix a crash with inline assembly in LTO.
Fixes pr18508.

llvm-svn: 199843
2014-01-22 22:11:14 +00:00
Yi Jiang f92a574246 Resubmit r196544: Apply transformation on OS X 10.9+ and iOS 7.0+: pow(10, x) ―> __exp10(x)
llvm-svn: 197109
2013-12-12 01:55:04 +00:00
Yi Jiang 53823be49d Add TargetLibraryInfo in LTO passes builder
llvm-svn: 197105
2013-12-12 01:37:39 +00:00
Justin Bogner b10a520c8f Protect user-supplied runtime library functions in LTO
Add user-supplied C runtime and compiler-rt library functions to
llvm.compiler.used to protect them from premature optimization by
passes like -globalopt and -ipsccp.  Calls to (seemingly unused)
runtime library functions can be added by -instcombine and instruction
lowering.

Patch by Duncan Exon Smith, thanks!

Fixes <rdar://problem/14740087>

llvm-svn: 194514
2013-11-12 21:44:01 +00:00
Rafael Espindola 99a3ba7674 A better fix that also works on ppc: add a target tripple.
llvm-svn: 193915
2013-11-02 06:00:09 +00:00
Rafael Espindola 3cd286643d Fix this test to pass on darwin now that llvm-nm is working.
llvm-svn: 193914
2013-11-02 05:29:22 +00:00
Rafael Espindola d7a0e60e8f Use \01 to disable the mangler. Should fix the 32 bit windows bots.
llvm-svn: 193846
2013-11-01 01:14:20 +00:00
Rafael Espindola 57afdc7f09 Relax check line to match what llvm-nm prints for COFF.
llvm-svn: 193810
2013-10-31 22:07:46 +00:00
Rafael Espindola 775ef460c9 XFAIL on ppc64 too.
llvm-svn: 193804
2013-10-31 21:27:02 +00:00
Rafael Espindola cb5bd5e508 XFAIL this for now.
llvm-svn: 193802
2013-10-31 21:22:43 +00:00
Rafael Espindola 282a47037b Use LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN instead of the "dso list".
There are two ways one could implement hiding of linkonce_odr symbols in LTO:
* LLVM tells the linker which symbols can be hidden if not used from native
  files.
* The linker tells LLVM which symbols are not used from other object files,
  but will be put in the dso symbol table if present.

GOLD's API is the second option. It was implemented almost 1:1 in llvm by
passing the list down to internalize.

LLVM already had partial support for the first option. It is also very similar
to how ld64 handles hiding these symbols when *not* doing LTO.

This patch then
* removes the APIs for the DSO list.
* marks LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN all linkonce_odr unnamed_addr
  global values and other linkonce_odr whose address is not used.
* makes the gold plugin responsible for handling the API mismatch.

llvm-svn: 193800
2013-10-31 20:51:58 +00:00
Rafael Espindola 3d7fc25c7c Optimize more linkonce_odr values during LTO.
When a linkonce_odr value that is on the dso list is not unnamed_addr
we can still look to see if anything is actually using its address. If
not, it is safe to hide it.

This patch implements that by moving GlobalStatus to Transforms/Utils
and using it in Internalize.

llvm-svn: 193090
2013-10-21 17:14:55 +00:00
NAKAMURA Takumi 7aaeaa06a0 llvm/test/LTO should run also on cygwin.
llvm-svn: 192262
2013-10-09 01:07:31 +00:00
Rafael Espindola dc9fe0af85 Fix object file writing in llvm-lto on Windows.
We were writing in text mode.

Patch by Greg Bedwell.

llvm-svn: 191985
2013-10-04 21:40:54 +00:00
Rafael Espindola cda2911caa Optimize linkonce_odr unnamed_addr functions during LTO.
Generalize the API so we can distinguish symbols that are needed just for a DSO
symbol table from those that are used from some native .o.

The symbols that are only wanted for the dso symbol table can be dropped if
llvm can prove every other dso has a copy (linkonce_odr) and the address is not
important (unnamed_addr).

llvm-svn: 191922
2013-10-03 18:29:09 +00:00
Rafael Espindola d18b7c1744 Try harder to disable the LTO tests on windows.
llvm-svn: 191836
2013-10-02 15:47:30 +00:00
Rafael Espindola 366296c0ef Disable this test on Win32 for now.
llvm-svn: 191830
2013-10-02 14:48:35 +00:00
Rafael Espindola dafc53dde1 Add a -exported-symbol option to llvm-lto.
Patch by Tom Roeder.

llvm-svn: 191825
2013-10-02 14:12:56 +00:00
Rafael Espindola d38f9af213 Enable building LTO on WIN32.
Enable building the LTO library (.lib and.dll) and llvm-lto.exe on Windows with
MSVC and Mingw as well as re-enabling the associated test.

Patch by Greg Bedwell!

llvm-svn: 191823
2013-10-02 14:04:38 +00:00
Rafael Espindola cbef8e60e3 Revert "Enable building LTO on WIN32."
This reverts commit r191670.

It was causing build failures on the msvc bots:

http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/5166/steps/compile/logs/stdio

llvm-svn: 191679
2013-09-30 16:32:51 +00:00
Rafael Espindola e693181c10 Enable building LTO on WIN32.
Enable building the LTO library (.lib and.dll) and llvm-lto.exe on Windows with
MSVC and Mingw as well as re-enabling the associated test.

Patch by Greg Bedwell!

llvm-svn: 191670
2013-09-30 15:28:14 +00:00
Peter Collingbourne 4ccf0f1bef Move LTO support library to a component, allowing it to be tested
more reliably across platforms.  Patch by Tom Roeder!

llvm-svn: 191343
2013-09-24 23:52:22 +00:00