Commit Graph

2398 Commits

Author SHA1 Message Date
Eugene Zelenko
aaf3f0426b Fix some Clang-tidy modernize and Include What You Use warnings.
Differential revision: http://reviews.llvm.org/D19673


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267910 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 18:04:41 +00:00
Nico Weber
87b2f2af11 Use gcc's rules for parsing gcc-style response files
In gcc, \ escapes every character in response files. It is true that this makes
it harder to mention Windows files in rsp files, but not doing this means clang
disagrees with gcc, and also disagrees with the shell (on non-Windows) which
rsp file quoting is supposed to match. clang isn't free to choose what to do
here.

In general, the idea for response files is to take bits of your command line
and write them to a file unchanged, and have things work the same way. Since
the command line would've been interpreted by the shell, things in the rsp file
need to be subject to the same shell quoting rules.

People who want to put Windows-style paths in their response files either need
to do any of:
* escape their backslashes
* or use clang-cl which uses cl.exe/cmd.exe quoting rules
* pass --rsp-quoting=windows to clang to tell it to use
  cl.exe/cmd.exe quoting rules for response files.

Fixes PR27464.
http://reviews.llvm.org/D19417


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267556 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 13:53:56 +00:00
Lang Hames
3869f2a5ab [ORC] clang-format code that was touched in r267457. NFC.
Commit r267457 made a lot of type-substitutions threw off code formatting and
alignment. This patch should tidy those changes up.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267475 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 21:21:20 +00:00
Lang Hames
1ddbb0f0b5 [ORC] Thread Error/Expected through the RPC library.
This replaces use of std::error_code and ErrorOr in the ORC RPC support library
with Error and Expected. This required updating the OrcRemoteTarget API, Client,
and server code, as well as updating the Orc C API.

This patch also fixes several instances where Errors were dropped.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267457 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 19:56:45 +00:00
Lang Hames
30e83b42ab [Support] Fix latent bugs in Expected and ExitOnError that were preventing them
from working with reference types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267448 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 19:21:57 +00:00
Igor Kudrin
3c7ad33b0b [Coverage] Restore the correct count value after processing a nested region in case of combined regions.
If several regions cover the same area of code, we have to restore
the combined value for that area when return from a nested region.

This patch achieves that by combining regions before calling buildSegments.

Differential Revision: http://reviews.llvm.org/D18610


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267390 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 09:43:37 +00:00
Duncan P. N. Exon Smith
de7484036b DebugInfo: Remove MDString-based type references
Eliminate DITypeIdentifierMap and make DITypeRef a thin wrapper around
DIType*.  It is no longer legal to refer to a DICompositeType by its
'identifier:', and DIBuilder no longer retains all types with an
'identifier:' automatically.

Aside from the bitcode upgrade, this is mainly removing logic to resolve
an MDString-based reference to an actualy DIType.  The commits leading
up to this have made the implicit type map in DICompileUnit's
'retainedTypes:' field superfluous.

This does not remove DITypeRef, DIScopeRef, DINodeRef, and
DITypeRefArray, or stop using them in DI-related metadata.  Although as
of this commit they aren't serving a useful purpose, there are patchces
under review to reuse them for CodeView support.

The tests in LLVM were updated with deref-typerefs.sh, which is attached
to the thread "[RFC] Lazy-loading of debug info metadata":

  http://lists.llvm.org/pipermail/llvm-dev/2016-April/098318.html

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23 21:08:00 +00:00
Duncan P. N. Exon Smith
bcf5d1ff20 Add #ifndef NDEBUG markers around EXPECT_DEATH after r267270
http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/36076

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267275 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23 04:34:11 +00:00
Duncan P. N. Exon Smith
20c4466364 BitcodeReader: Avoid referencing unresolved nodes from distinct ones
Each reference to an unresolved MDNode is expensive, since the RAUW
support in MDNode uses a separate allocation and side map.  Since
a distinct MDNode doesn't require its operands on creation (unlike
uniuqed nodes, there's no need to check for structural equivalence),
use nullptr for any of its unresolved operands.  Besides reducing the
burden on MDNode maps, this can avoid allocating temporary MDNodes in
the first place.

We need some way to track operands.  Invent DistinctMDOperandPlaceholder
for this purpose, which is a Metadata subclass that holds an ID and
points at its single user.  DistinctMDOperandPlaceholder::replaceUseWith
is just like RAUW, but its name highlights that there is only ever
exactly one use.

There is no support for moving (or, obviously, copying) these.  Move
support would be possible but expensive; leaving it unimplemented
prevents user error.  In the BitcodeReader I originally considered
allocating on a BumpPtrAllocator and keeping a vector of pointers to
them, and then I realized that std::deque implements exactly this.

A couple of obvious follow-ups:

  - Change ValueEnumerator to emit distinct nodes first to take more
    advantage of this optimization.  (How convenient... I think I might
    have a couple of patches for this.)

  - Change DIBuilder and its consumers (like CGDebugInfo in clang) to
    use something like this when constructing debug info in the first
    place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267270 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23 04:15:56 +00:00
Duncan P. N. Exon Smith
bb8cd1231d Tag the end of an anonymous namespace, NFC
Prevent clang-format from moving the closing branch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267269 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23 04:02:39 +00:00
David Majnemer
fd026c3bc6 Fix some spelling mistakes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267112 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22 06:37:48 +00:00
Rafael Espindola
b18e50cc39 Add a CachedHash structure.
A DenseMap doesn't store the hashes, so it needs to recompute them when
the table is resized.

In some applications the hashing cost is noticeable. That is the case
for example in lld for symbol names (StringRef).

This patch adds a templated structure that can wraps any value that can
go in a DenseMap and caches the hash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266981 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-21 12:16:21 +00:00
Duncan P. N. Exon Smith
d33fbe4f07 IR: Enable debug info type ODR uniquing for forward decls
Add a new method, DICompositeType::buildODRType, that will create or
mutate the DICompositeType for a given ODR identifier, and use it in
LLParser and BitcodeReader instead of DICompositeType::getODRType.

The logic is as follows:

  - If there's no node, create one with the given arguments.
  - Else, if the current node is a forward declaration and the new
    arguments would create a definition, mutate the node to match the
    new arguments.
  - Else, return the old node.

This adds a missing feature supported by the current DITypeIdentifierMap
(which I'm slowly making redudant).  The only remaining difference is
that the DITypeIdentifierMap has a "the-last-one-wins" rule, whereas
DICompositeType::buildODRType has a "the-first-one-wins" rule.

For now I'm leaving behind DICompositeType::getODRType since it has
obvious, low-level semantics that are convenient for unit testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266786 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-19 18:00:19 +00:00
Lang Hames
18d3f58338 [Orc] Add pthread dependence to the RPCUtilsTest unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266766 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-19 17:13:52 +00:00
Duncan P. N. Exon Smith
d72293fc94 IR: LLVMContextTest => DebugTypeODRUniquingTest, NFC
The second test in this file is actually testing DICompositeType API,
not LLVMContext API (after r266742 moved it to a higher level).  This
really doesn't make sense in an LLVMContextTest.  Rename the tests
before adding more.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266764 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-19 17:11:06 +00:00
Duncan P. N. Exon Smith
511eb032bb IR: getOrInsertODRUniquedType => DICompositeType::getODRType, NFC
Lift the API for debug info ODR type uniquing up a layer.  Instead of
clients managing the map directly on the LLVMContext, add a static
method to DICompositeType called getODRType and handle the map in the
background.  Also adds DICompositeType::getODRTypeIfExists, so far just
for convenience in the unit tests.

This simplifies the logic in LLParser and BitcodeReader.  Because of
argument spam there are actually a few more lines of code now; I'll see
if I come up with a reasonable way to clean that up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266742 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-19 14:55:09 +00:00
Duncan P. N. Exon Smith
ef55fa5ba5 IR: Require DICompositeType for ODR uniquing type map
Tighten up the API for debug info ODR type uniquing in LLVMContext.  The
only reason to allow other DIType subclasses is to make the unit tests
prettier :/.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266737 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-19 14:42:55 +00:00
Lang Hames
3bf6fb9d27 [Orc] Disable RPC callST unit test until the S390 failures encountered during
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/3459 can be
debugged/fixed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266717 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-19 06:01:51 +00:00
Duncan P. N. Exon Smith
2663f35684 IR: Rename API for enabling ODR uniquing of DITypes, NFC
As per David's review, rename everything in the new API for ODR type
uniquing of debug info.

    ensureDITypeMap  => enableDebugTypeODRUniquing
    destroyDITypeMap => disableDebugTypeODRUniquing
    hasDITypeMap     => isODRUniquingDebugTypes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266713 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-19 04:55:25 +00:00
Lang Hames
ffdeef411b [Orc] Tidy up some of the RPC primitives, add a unit-test for the callST
(synchronous call) primitive.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266711 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-19 04:43:09 +00:00
Lang Hames
6320b788a2 [Orc] Re-commit r266581 with fixes for MSVC, and format cleanups.
Fixes:

(1) Removes constexpr (unsupported in MSVC)
(2) Move constructors (remove explicitly defaulted ones)
(3) <future> - Add warning suppression for MSVC.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266663 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 19:55:43 +00:00
Igor Kudrin
66a92f3b19 Reapply "[Coverage] Prevent detection of false instantiations in case of macro expansion."
The root of the problem was that findMainViewFileID(File, Function)
could return some ID for any given file, even though that file
was not the main file for that function.

This patch ensures that the result of this function is conformed
with the result of findMainViewFileID(Function).

This commit reapplies r266436, which was reverted by r266458,
with the .covmapping file serialized in v1 format.

Differential Revision: http://reviews.llvm.org/D18787



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266620 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 15:36:30 +00:00
Eric Liu
dcefe3154e Revert "Replace the use of MaxFunctionCount module flag"
This reverts commit r266477.

This commit introduces cyclic dependency. This commit has "Analysis" depend on "ProfileData",
while "ProfileData" depends on "Object", which depends on "BitCode", which
depends on "Analysis".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266619 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 15:31:11 +00:00
Nico Weber
18061690cb Revert 266581 (and follow-up 266588), it doesn't build on Windows.
Three problems:
1. <future> can't be easily used.  If you must use it, see
   include/Support/ThreadPool.h for how.
2. constexpr problems, even after 266588.
3. Move assignment operators can't be defaulted in MSVC2013.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266615 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 13:57:08 +00:00
Nico Weber
55044047e6 Unbreak building unit tests on Windows after r266595.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266614 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 13:54:50 +00:00
Mehdi Amini
f6071e14c5 [NFC] Header cleanup
Removed some unused headers, replaced some headers with forward class declarations.

Found using simple scripts like this one:
clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap'

Patch by Eugene Kosov <claprix@yandex.ru>

Differential Revision: http://reviews.llvm.org/D19219

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266595 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 09:17:29 +00:00
Lang Hames
bd1968ac09 [ORC] Generalize the ORC RPC utils to support RPC function return values and
asynchronous call/handle. Also updates the ORC remote JIT API to use the new
scheme.

The previous version of the RPC tools only supported void functions, and
required the user to manually call a paired function to return results. This
patch replaces the Procedure typedef (which only supported void functions) with
the Function typedef which supports return values, e.g.:

  Function<FooId, int32_t(std::string)> Foo;

The RPC primitives and channel operations are also expanded. RPC channels must
support four new operations: startSendMessage, endSendMessage,
startRecieveMessage and endRecieveMessage, to handle channel locking. In
addition, serialization support for tuples to RPCChannels is added to enable
multiple return values.

The RPC primitives are expanded from callAppend, call, expect and handle, to:

appendCallAsync - Make an asynchronous call to the given function.

callAsync - The same as appendCallAsync, but calls send on the channel when
            done.

callSTHandling - Blocking call for single-threaded code. Wraps a call to
                 callAsync then waits on the result, using a user-supplied
                 handler to handle any callbacks from the remote.

callST - The same as callSTHandling, except that it doesn't handle
         callbacks - it expects the result to be the first return.

expect and handle - as before.

handleResponse - Handle a response from the remote.

waitForResult - Wait for the response with the given sequence number to arrive.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266581 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 01:06:49 +00:00
Duncan P. N. Exon Smith
9bb5d5d42c IR: Use an explicit map for debug info type uniquing
Rather than relying on the structural equivalence of DICompositeType to
merge type definitions, use an explicit map on the LLVMContext that
LLParser and BitcodeReader consult when constructing new nodes.
Each non-forward-declaration DICompositeType with a non-empty
'identifier:' field is stored/loaded from the type map, and the first
definiton will "win".

This map is opt-in: clients that expect ODR types from different modules
to be merged must call LLVMContext::ensureDITypeMap.

  - Clients that just happen to load more than one Module in the same
    LLVMContext won't magically merge types.

  - Clients (like LTO) that want to continue to merge types based on ODR
    identifiers should opt-in immediately.

I have updated LTOCodeGenerator.cpp, the two "linking" spots in
gold-plugin.cpp, and llvm-link (unless -disable-debug-info-type-map) to
set this.

With this in place, it will be straightforward to remove the DITypeRef
concept (i.e., referencing types by their 'identifier:' string rather
than pointing at them directly).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266549 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-17 03:58:21 +00:00
Mehdi Amini
492acdd450 Remove some unneeded headers and replace some headers with forward class declarations (NFC)
Differential Revision: http://reviews.llvm.org/D19154

Patch by Eugene Kosov <claprix@yandex.ru>

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266524 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16 07:51:28 +00:00
Duncan P. N. Exon Smith
0b11282f08 ValueMapper: Stop memoizing ConstantAsMetadata
Stop memoizing ConstantAsMetadata in ValueMapper::mapMetadata.  Now we
have to recompute it, but these metadata aren't particularly common, and
it restricts the lifetime of the Metadata map unnecessarily.

(The motivation is that I have a patch which uses a single Metadata map
for the lifetime of IRMover.  Mehdi profiled r266446 with the patch
applied and we saw a pretty big speedup in lib/Linker.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266513 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16 03:39:44 +00:00
Davide Italiano
30f743e304 [DebugInfo] Correct the assertion introduced in r266509 + update test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266512 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16 03:23:48 +00:00
Duncan P. N. Exon Smith
1f03619959 Reapply "ValueMapper: Eliminate cross-file co-recursion, NFC"
This reverts commit r266507, reapplying r266503 (and r266505
"ValueMapper: Use API from r266503 in unit tests, NFC") completely
unchanged.

I reverted because of a bot failure here:
  http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/16810/

However, looking more closely, the failure was from a host-compiler
crash (clang 3.7.1) when building:
  lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/DwarfAccelTable.cpp.o

I didn't modify that file, or anything it includes, with that commit.

The next build (which hadn't picked up my revert) got past it:
  http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/16811/

I think this was just unfortunate timing.  I suppose the bot must be
flakey.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266510 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16 02:29:55 +00:00
Duncan P. N. Exon Smith
86a7a5ada2 Revert "ValueMapper: Eliminate cross-file co-recursion, NFC"
This reverts commit r266503, in case it's the root cause of this bot
failure:

  http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/16810

I'm also reverting r266505 -- "ValueMapper: Use API from r266503 in unit
tests, NFC" -- since it's in the way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266507 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16 02:05:33 +00:00
Duncan P. N. Exon Smith
90cac21151 ValueMapper: Use API from r266503 in unit tests, NFC
I'm not in a hurry to migrate all the users, but the unit tests at least
should use the new API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266505 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16 01:40:24 +00:00
Easwaran Raman
b87a1e69c3 Replace the use of MaxFunctionCount module flag
Adds an interface to get ProfileSummary for a module and makes InlineCost use ProfileSummary to get max function count.

Differential Revision: http://reviews.llvm.org/D18622



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266477 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-15 21:39:58 +00:00
Igor Kudrin
665e18d2ac Revert "[Coverage] Prevent detection of false instantiations in case of macro expansion."
This reverts commit r266436 as it broke buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266458 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-15 17:53:48 +00:00
Adrian Prantl
4eeaa0da04 [PR27284] Reverse the ownership between DICompileUnit and DISubprogram.
Currently each Function points to a DISubprogram and DISubprogram has a
scope field. For member functions the scope is a DICompositeType. DIScopes
point to the DICompileUnit to facilitate type uniquing.

Distinct DISubprograms (with isDefinition: true) are not part of the type
hierarchy and cannot be uniqued. This change removes the subprograms
list from DICompileUnit and instead adds a pointer to the owning compile
unit to distinct DISubprograms. This would make it easy for ThinLTO to
strip unneeded DISubprograms and their transitively referenced debug info.

Motivation
----------

Materializing DISubprograms is currently the most expensive operation when
doing a ThinLTO build of clang.

We want the DISubprogram to be stored in a separate Bitcode block (or the
same block as the function body) so we can avoid having to expensively
deserialize all DISubprograms together with the global metadata. If a
function has been inlined into another subprogram we need to store a
reference the block containing the inlined subprogram.

Attached to https://llvm.org/bugs/show_bug.cgi?id=27284 is a python script
that updates LLVM IR testcases to the new format.

http://reviews.llvm.org/D19034
<rdar://problem/25256815>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266446 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-15 15:57:41 +00:00
Igor Kudrin
cfdf5c2193 [Coverage] Prevent detection of false instantiations in case of macro expansion.
The root of the problem was that findMainViewFileID(File, Function)
could return some ID for any given file, even though that file
was not the main file for that function.

This patch ensures that the result of this function is conformed
with the result of findMainViewFileID(Function).

Differential Revision: http://reviews.llvm.org/D18787



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266436 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-15 14:56:50 +00:00
Igor Kudrin
e5d411971a [Coverage] Add support for making test data for more than one function.
Differential Revision: http://reviews.llvm.org/D18758



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266434 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-15 14:46:31 +00:00
Hans Wennborg
9f34fd51ea Option parser: class for consuming a joined arg in addition to all remaining args
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266394 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-15 00:23:30 +00:00
Hans Wennborg
486e8bb53d OptionParsingTest.cpp: reorder EXPECT_EQs to put expectation on the left. NFC.
This provides for better error messages from the framework when the expected
and actual values don't match.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266393 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-15 00:23:15 +00:00
Mehdi Amini
8be7707c14 Remove every uses of getGlobalContext() in LLVM (but the C API)
At the same time, fixes InstructionsTest::CastInst unittest: yes
you can leave the IR in an invalid state and exit when you don't
destroy the context (like the global one), no longer now.

This is the first part of http://reviews.llvm.org/D19094

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266379 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-14 21:59:01 +00:00
Igor Kudrin
77eb420264 [Coverage] Update testing methods to support more than two files
Differential Revision: http://reviews.llvm.org/D18757


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266289 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-14 10:43:37 +00:00
Duncan P. N. Exon Smith
4cd20e7e7d ValueMapper: Resolve cycles on the new nodes
Fix a major bug from r265456.  Although it's now much rarer, ValueMapper
sometimes has to duplicate cycles.  The
might-transitively-reference-a-temporary counts don't decrement on their
own when there are cycles, and you need to call MDNode::resolveCycles to
fix it.

r265456 was checking the input nodes to see if they were unresolved.
This is useless; they should never be unresolved.  Instead we should
check the output nodes and resolve cycles on them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266258 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-13 22:54:01 +00:00
Davide Italiano
0149731869 [DebugInfo] Optimize memory layout of DISubprogram.
A DISubprogram on x86_64 was 48 bytes. During an LTO build we
end up allocating *a lot* of these (see Duncan's numbers on
llvm-dev and/or my numbers in the review link).
This change reduces the size to 40 bytes, with a nice effect
on peak memory usage when LTO'ing clang.
There are more classes in the hierarchy which can be compacted
so more patches will come. DISubprogram was the biggest offender
in my profiling, anyway.

Differential Revision:  http://reviews.llvm.org/D18918

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266241 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-13 20:17:42 +00:00
Matt Arsenault
1dca54625d APInt: Add overload of isMask
This mimics the version in MathExtras.h which isn't testing for a
specific mask size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266101 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-12 18:17:23 +00:00
Xinliang David Li
5cc3ce758d Fix asan test failure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265891 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-10 05:31:29 +00:00
Xinliang David Li
6aa584fdaf [PGO] Fix deserialize bug
Raw function pointer collected by value
profile data may be from external functions
that are not instrumented. They won't have
mapping data to be used by the deserializer.
Force the value to be 0 in this case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265890 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-10 03:32:02 +00:00
Xinliang David Li
72c4075a5e Clean up test case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265887 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-10 02:35:53 +00:00
Duncan P. N. Exon Smith
81361659c5 ValueMapper: Don't memoize metadata when RF_NoModuleLevelChanges
Prevent the Metadata side-table in ValueMap from growing unnecessarily
when RF_NoModuleLevelChanges.  As a drive-by, make ValueMap::hasMD,
which apparently had no users until I used it here for testing, actually
compile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265828 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-08 18:49:36 +00:00