Commit Graph

478 Commits

Author SHA1 Message Date
Teresa Johnson
63eb7ab316 Ensure non-null ProfileSummaryInfo passed to ModuleSummaryIndex builder
This fixes a ubsan bot failure after r302597, which made getProfileCount
non-static, but ended up invoking it on a null ProfileSummaryInfo object
in some cases from buildModuleSummaryIndex.

Most testing passed because the non-static getProfileCount currently
doesn't access any member variables, but I found this when testing a
follow on patch (D32877) that adds a member variable access.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302705 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 18:52:16 +00:00
Peter Collingbourne
e611018a3f Re-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI."
with a fix for the clang backend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302176 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 18:03:25 +00:00
Eric Liu
1c442aa9b7 Revert "IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI."
This reverts commit r302108. This causes crash in clang bootstrap with LTO.

Contacted the auther in the original commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302140 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 11:49:39 +00:00
Peter Collingbourne
df2206086c IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI.
When profiling a no-op incremental link of Chromium I found that the functions
computeImportForFunction and computeDeadSymbols were consuming roughly 10% of
the profile. The goal of this change is to improve the performance of those
functions by changing the map lookups that they were previously doing into
pointer dereferences.

This is achieved by changing the ValueInfo data structure to be a pointer to
an element of the global value map owned by ModuleSummaryIndex, and changing
reference lists in the GlobalValueSummary to hold ValueInfos instead of GUIDs.
This means that a ValueInfo will take a client directly to the summary list
for a given GUID.

Differential Revision: https://reviews.llvm.org/D32471

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302108 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 03:36:16 +00:00
Peter Collingbourne
10dbf12dd6 Bitcode: Make the summary reader responsible for merging. NFCI.
This is to prepare for an upcoming change which uses pointers instead of
GUIDs to represent references.

Differential Revision: https://reviews.llvm.org/D32469

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301843 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01 22:04:36 +00:00
Peter Collingbourne
6a2cc4c156 Object: Remove ModuleSummaryIndexObjectFile class.
Differential Revision: https://reviews.llvm.org/D32195

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301832 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01 20:42:32 +00:00
Peter Collingbourne
052412f4f5 LTO: Mark undefined module asm symbols as used.
Marking them as used causes them to be considered visible outside of LTO. This
prevents the symbols from being internalized or discarded, either by GlobalDCE
or by summary-based dead stripping in ThinLTO.

This change makes it unnecessary to add these symbols to llvm.compiler.used
in the backend, as the symbols are kept alive by virtue of being external,
so remove the backend code that handles that.

Fixes PR32798.

Differential Revision: https://reviews.llvm.org/D32544

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301438 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 17:53:39 +00:00
Peter Collingbourne
a9b9e013db Object, LTO: Add target triple to irsymtab and LTO API.
Start using it in LLD to avoid needing to read bitcode again just to get the
target triple, and in llvm-lto2 to avoid printing symbol table information
that is inappropriate for the target.

Differential Revision: https://reviews.llvm.org/D32038

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300300 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-14 02:55:06 +00:00
Peter Collingbourne
8b69529e74 Support: Add a VCSRevision.h header file.
This is a magic header file supported by the build system that provides a
single definition, LLVM_REVISION, containing an LLVM revision identifier,
if available. This functionality previously lived in the LTO library, but
I am moving it out to lib/Support because I want to also start using it in
lib/Object to create the IR symbol table.

This change also fixes a bug where LLVM_REVISION was never actually being
used in lib/LTO because the macro HAS_LLVM_REVISION was never defined (it
was misspelled as HAVE_SVN_VERSION_INC in lib/LTO/CMakeLists.txt, and was
only being defined in a non-existent file Version.cpp).

I also changed the code to use "git rev-parse --git-dir" to locate the .git
directory, instead of looking for it in the LLVM source root directory,
which makes this compatible with monorepos as well as git worktrees.

Differential Revision: https://reviews.llvm.org/D31985

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300160 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 01:26:12 +00:00
Bob Haarman
7afeaaf4b7 LTO: call getRealLinkageName on IRNames before feeding to getGUID
Summary: GlobalValue has two getGUID methods: an instance method and a static method. The static method takes a string, which is expected to be what GlobalValue::getRealLinkageName() would return. In LTO.cpp, we were not doing this consistently, sometimes passing an IR name instead. This change makes it so that we call getRealLinkageName() first, making the static getGUID return value consistent with the instance method. Without this change, compiling FileCheck with ThinLTO on Windows fails with numerous undefined symbol errors. With the change, it builds successfully.

Reviewers: pcc, rnk

Reviewed By: pcc

Subscribers: tejohnson, mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D31444


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299268 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 21:56:30 +00:00
Peter Collingbourne
957cbf8cf7 Re-apply r299168 and r299169 now that the libdeps are fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299184 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 04:47:07 +00:00
Peter Collingbourne
8dc921e4a6 Move llvm::emitLinkerFlagsForGlobalCOFF() to Mangler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299183 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 04:46:50 +00:00
Peter Collingbourne
537523b656 Move llvm::canBeOmittedFromSymbolTable() to Analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299182 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 04:46:31 +00:00
Peter Collingbourne
bfb6d1adc0 Revert r299168 and r299169 due to library dependency issues.
http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux/builds/25073/steps/build_llvmclang/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299171 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 02:44:50 +00:00
Peter Collingbourne
9f482fc3fc LTO: Reduce memory consumption by creating an in-memory symbol table for InputFiles. NFCI.
Introduce symbol table data structures that can be potentially written to
disk, have the LTO library build those data structures using temporarily
constructed modules and redirect the LTO library implementation to go through
those data structures. This allows us to remove the LLVMContext and Modules
owned by InputFile.

With this change I measured a peak memory consumption decrease from 5.4GB to
2.8GB in a no-op incremental ThinLTO link of Chromium on Linux. The impact on
memory consumption is larger in COFF linkers where we are currently forced
to materialize all metadata in order to read linker options. Peak memory
consumption linking a large piece of Chromium for Windows with full LTO and
debug info decreases from >64GB (OOM) to 15GB.

Part of PR27551.

Differential Revision: https://reviews.llvm.org/D31364

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299168 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 02:28:30 +00:00
Peter Collingbourne
14ecedfe4c More accurate header inclusions. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298960 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-28 23:35:34 +00:00
Peter Collingbourne
aba00eee42 LTO: Replace InputFile::Symbol::getFlags() with predicate accessors. NFC.
This makes the predicates independent of the flag representation
and makes the code a little easier to read.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298951 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-28 22:31:35 +00:00
Mehdi Amini
e4c5b69aa3 Add support for -fno-builtin to LTO and ThinLTO to libLTO
Reviewers: tejohnson, pcc

Subscribers: Prazek, dexonsmith, llvm-commits

Differential Revision: https://reviews.llvm.org/D30791

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298936 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-28 18:55:44 +00:00
Joerg Sonnenberger
3d72b70842 Split the SimplifyCFG pass into two variants.
The first variant contains all current transformations except
transforming switches into lookup tables. The second variant
contains all current transformations.

The switch-to-lookup-table conversion results in code that is more
difficult to analyze and optimize by other passes. Most importantly,
it can inhibit Dead Code Elimination. As such it is often beneficial to
only apply this transformation very late. A common example is inlining,
which can often result in range restrictions for the switch expression.

Changes in execution time according to LNT:
SingleSource/Benchmarks/Misc/fp-convert +3.03%
MultiSource/Benchmarks/ASC_Sequoia/CrystalMk/CrystalMk -11.20%
MultiSource/Benchmarks/Olden/perimeter/perimeter -10.43%
and a couple of smaller changes. For perimeter it also results 2.6%
a smaller binary.

Differential Revision: https://reviews.llvm.org/D30333


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298799 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-26 06:44:08 +00:00
Peter Collingbourne
e53e585ce9 IPO: Const correctness for summaries passed into passes.
Pass const qualified summaries into importers and unqualified summaries into
exporters. This lets us const-qualify the summary argument to thinBackend.

Differential Revision: https://reviews.llvm.org/D31230

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298534 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 18:22:59 +00:00
Peter Collingbourne
3cd1f18f47 Try using llvm::errc, should hopefully fix version mismatch problem on clang-s390x-linux bot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298285 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-20 18:19:41 +00:00
Peter Collingbourne
22910652da Support, LTO: When pruning a directory, ignore files matching a prefix.
This is a safeguard against data loss if the user specifies a directory
that is not a cache directory. Teach the existing cache pruning clients
to create files with appropriate names.

Differential Revision: https://reviews.llvm.org/D31109

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298271 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-20 16:41:57 +00:00
Peter Collingbourne
dcae6caf46 LTO: Work around libstdc++ version mismatch bug, see D31063 review thread.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298127 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 21:49:09 +00:00
Peter Collingbourne
ec179d780b LTO: Fix a potential race condition in the caching API.
After the call to sys::fs::exists succeeds, indicating a cache hit, we call
AddFile and the client will open the file using the supplied path. If the
client is using cache pruning, there is a potential race between the pruner
and the client. To avoid this, change the caching API so that it provides
a MemoryBuffer to the client, and have clients use that MemoryBuffer where
possible.

This scheme won't work with the gold plugin because the plugin API expects a
file path. So we have the gold plugin use the buffer identifier as a path and
live with the race for now. (Note that the gold plugin isn't actually affected
by the problem at the moment because it doesn't support cache pruning.)

This effectively reverts r279883 modulo the change to use the existing path
in the gold plugin.

Differential Revision: https://reviews.llvm.org/D31063

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298020 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 00:34:07 +00:00
Peter Collingbourne
aad0d391c9 LTO: Create temporary cache files in the cache directory instead of $TMPDIR.
This fixes a race condition where another linker process can observe a
partially written file if we copy it from another file system, and allows
the link to be independent of the amount of free disk space in $TMPDIR.

Differential Revision: https://reviews.llvm.org/D31045

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297970 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-16 18:20:06 +00:00
Peter Collingbourne
2edabdec2a Support: Simplify the CachePruning API. NFCI.
Change the function that implements the pruning into a free function that
takes the policy as a struct argument.

Differential Revision: https://reviews.llvm.org/D31009

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297907 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 22:54:18 +00:00
Peter Collingbourne
a58d2a9027 LTO: Hash type identifier resolutions for WholeProgramDevirt.
Differential Revision: https://reviews.llvm.org/D30555

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297514 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-10 21:37:10 +00:00
Peter Collingbourne
a354228e67 LTO: Hash type identifier resolutions for LowerTypeTests.
Differential Revision: https://reviews.llvm.org/D30553

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297513 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-10 21:35:17 +00:00
Teresa Johnson
611bafa4c4 Perform symbol binding for .symver versioned symbols
Summary:
In a .symver assembler directive like:
.symver name, name2@@nodename
"name2@@nodename" should get the same symbol binding as "name".

While the ELF object writer is updating the symbol binding for .symver
aliases before emitting the object file, not doing so when the module
inline assembly is handled by the RecordStreamer is causing the wrong
behavior in *LTO mode.

E.g. when "name" is global, "name2@@nodename" must also be marked as
global. Otherwise, the symbol is skipped when iterating over the LTO
InputFile symbols (InputFile::Symbol::shouldSkip). So, for example,
when performing any *LTO via the gold-plugin, the versioned symbol
definition is not recorded by the plugin and passed back to the
linker. If the object was in an archive, and there were no other symbols
needed from that object, the object would not be included in the final
link and references to the versioned symbol are undefined.

The llvm-lto2 tests added will give an error about an unused symbol
resolution without the fix.

Reviewers: rafael, pcc

Reviewed By: pcc

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D30485

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297332 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-09 00:19:49 +00:00
Peter Collingbourne
059abefa09 LTO: Hash the set of imported symbols for each module.
This set may affect code generation and is sensitive to link order (and
possibly in the future to the linker's choice of prevailing symbol), so we
need to include it.

Differential Revision: https://reviews.llvm.org/D30586

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296907 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-03 20:25:30 +00:00
Peter Collingbourne
cc5ba4427e LTO: When creating a local cache, create the cache directory if it does not already exist.
Differential Revision: https://reviews.llvm.org/D30519

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296726 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-02 02:02:38 +00:00
Tobias Edler von Koch
01c2fdec03 [LTO] Add ability to emit assembly to new LTO API
Summary:
Add a field to LTO::Config, CGFileType, to select the file type to emit (object
or assembly). This is useful for testing and to implement -save-temps.

Reviewers: tejohnson, mehdi_amini, pcc

Reviewed By: mehdi_amini

Subscribers: davide, llvm-commits

Differential Revision: https://reviews.llvm.org/D29475

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295226 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-15 20:36:36 +00:00
Mehdi Amini
9053d357ba [ThinLTO] Make a copy of buffer identifier in ThinLTOCodeGenerator
We can't assume that the `const char *` provided through libLTO has a
lifetime that expands beyond the codegenerator itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295018 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-14 02:20:51 +00:00
Davide Italiano
92b9c72ccb [LTO] Make sure we flush buffers to work around linker shenanigans.
lld, at least, doesn't call global destructors by default (unless
--full-shutdown is passed) because it's, allegedly, expensive.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294953 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-13 14:39:51 +00:00
Davide Italiano
9c7400c731 [lib/LTO] Initial support for optimization remarks in the new API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294882 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-12 03:31:30 +00:00
Davide Italiano
6e2d3e35b7 [LTO] Share the optimization remarks setup between Thin/Full LTO.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294807 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 23:49:38 +00:00
Davide Italiano
54c3fcaeb1 [lib/LTO] Rework optimization remarkers setup.
This makes this code much more similar to what ThinLTO is
using (also API wise), so now we can probably use a single
code path instead of copying stuff around.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294792 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 22:16:17 +00:00
Bob Haarman
447e81d4e2 fix nullptr Mangler in LTOModule
Reviewers: kcc, pcc

Subscribers: mehdi_amini

Differential Revision: https://reviews.llvm.org/D29523



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294079 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-04 01:28:44 +00:00
Peter Collingbourne
a06bb017cf IRMover: Merge flags LinkModuleInlineAsm and IsPerformingImport.
Currently these flags are always the inverse of each other, so there is
no need to keep them separate.

Differential Revision: https://reviews.llvm.org/D29471

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294016 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-03 17:01:14 +00:00
Mehdi Amini
38fd8b4c14 Revert "[ThinLTO] Add an auto-hide feature"
This reverts commit r293970.

After more discussion, this belongs to the linker side and
there is no added value to do it at this level.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293993 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-03 07:41:43 +00:00
Mehdi Amini
bd57345762 [ThinLTO] Add an auto-hide feature
When a symbol is not exported outside of the
DSO, it is can be hidden. Usually we try to internalize
as much as possible, but it is not always possible, for
instance a symbol can be referenced outside of the LTO
unit, or there can be cross-module reference in ThinLTO.

This is a recommit of r293912 after fixing build failures,
and a recommit of r293918 after fixing LLD tests.

Differential Revision: https://reviews.llvm.org/D28978

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293970 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-03 00:32:38 +00:00
Mehdi Amini
5674a467ef Revert "[ThinLTO] Add an auto-hide feature"
This reverts commit r293918, one lld test does not pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293961 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 23:20:36 +00:00
Bob Haarman
ea59150166 [lto] add getLinkerOpts()
Summary: Some compilers, including MSVC and Clang, allow linker options to be specified in source files. In the legacy LTO API, there is a getLinkerOpts() method that returns linker options for the bitcode module being processed. This change adds that method to the new API, so that the COFF linker can get the right linker options when using the new LTO API.

Reviewers: pcc, ruiu, mehdi_amini, tejohnson

Reviewed By: pcc

Differential Revision: https://reviews.llvm.org/D29207



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293950 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 23:00:49 +00:00
Mehdi Amini
20af8a7bb3 [ThinLTO] Add an auto-hide feature
When a symbol is not exported outside of the
DSO, it is can be hidden. Usually we try to internalize
as much as possible, but it is not always possible, for
instance a symbol can be referenced outside of the LTO
unit, or there can be cross-module reference in ThinLTO.

This is a recommit of r293912 after fixing build failures.

Differential Revision: https://reviews.llvm.org/D28978

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293918 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 18:31:35 +00:00
Mehdi Amini
416bf90086 Revert "[ThinLTO] Add an auto-hide feature"
This reverts r293912, bots are broken.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293914 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 18:24:37 +00:00
Mehdi Amini
73efdef798 [ThinLTO] Add an auto-hide feature
When a symbol is not exported outside of the
DSO, it is can be hidden. Usually we try to internalize
as much as possible, but it is not always possible, for
instance a symbol can be referenced outside of the LTO
unit, or there can be cross-module reference in ThinLTO.

Differential Revision: https://reviews.llvm.org/D28978

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293912 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 18:13:46 +00:00
Peter Collingbourne
d69c1efa38 LTO: Link non-prevailing weak_odr or linkonce_odr globals into the combined module with available_externally linkage.
These linkages mean that the ultimately prevailing symbol will have the same
semantics as any non-prevailing copy of the symbol, so we are free to ignore
the linker's resolution.

Differential Revision: https://reviews.llvm.org/D29367

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293865 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 05:22:42 +00:00
Peter Collingbourne
e482a05c06 Linker: Move special casing for available_externally in IRMover to clients. NFCI.
The goal is to simplify the semantic model for clients of IRMover.

Differential Revision: https://reviews.llvm.org/D29435

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293864 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 05:12:15 +00:00
Davide Italiano
fa5f3e4eeb [LTO] Teach lib/LTO about the new pass manager.
Differential Revision:  https://reviews.llvm.org/D28997

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292864 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24 00:58:24 +00:00
David L. Jones
32028c8f08 [Analysis] Add LibFunc_ prefix to enums in TargetLibraryInfo. (NFC)
Summary:
The LibFunc::Func enum holds enumerators named for libc functions.
Unfortunately, there are real situations, including libc implementations, where
function names are actually macros (musl uses "#define fopen64 fopen", for
example; any other transitively visible macro would have similar effects).

Strictly speaking, a conforming C++ Standard Library should provide any such
macros as functions instead (via <cstdio>). However, there are some "library"
functions which are not part of the standard, and thus not subject to this
rule (fopen64, for example). So, in order to be both portable and consistent,
the enum should not use the bare function names.

The old enum naming used a namespace LibFunc and an enum Func, with bare
enumerators. This patch changes LibFunc to be an enum with enumerators prefixed
with "LibFFunc_". (Unfortunately, a scoped enum is not sufficient to override
macros.)

There are additional changes required in clang.

Reviewers: rsmith

Subscribers: mehdi_amini, mzolotukhin, nemanjai, llvm-commits

Differential Revision: https://reviews.llvm.org/D28476

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292848 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-23 23:16:46 +00:00