Commit Graph

2492 Commits

Author SHA1 Message Date
Duncan P. N. Exon Smith
a10355896b ValueMapper: Make LocalAsMetadata match function-local Values
Start treating LocalAsMetadata similarly to function-local members of
the Value hierarchy in MapValue and MapMetadata.

  - Don't memoize them.
  - Return nullptr if they are missing.

This also cleans up ConstantAsMetadata to stop listening to the
RF_IgnoreMissingLocals flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265631 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 01:08:39 +00:00
JF Bastien
b36d1a86f1 NFC: make AtomicOrdering an enum class
Summary:
In the context of http://wg21.link/lwg2445 C++ uses the concept of
'stronger' ordering but doesn't define it properly. This should be fixed
in C++17 barring a small question that's still open.

The code currently plays fast and loose with the AtomicOrdering
enum. Using an enum class is one step towards tightening things. I later
also want to tighten related enums, such as clang's
AtomicOrderingKind (which should be shared with LLVM as a 'C++ ABI'
enum).

This change touches a few lines of code which can be improved later, I'd
like to keep it as NFC for now as it's already quite complex. I have
related changes for clang.

As a follow-up I'll add:
  bool operator<(AtomicOrdering, AtomicOrdering) = delete;
  bool operator>(AtomicOrdering, AtomicOrdering) = delete;
  bool operator<=(AtomicOrdering, AtomicOrdering) = delete;
  bool operator>=(AtomicOrdering, AtomicOrdering) = delete;
This is separate so that clang and LLVM changes don't need to be in sync.

Reviewers: jyknight, reames

Subscribers: jyknight, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265602 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 21:19:33 +00:00
Duncan P. N. Exon Smith
e49dfa7e9a IRMover: Steal arguments when moving functions, NFC
Instead of copying arguments from the source function to the
destination, steal them.  This has a few advantages.

  - The ValueMap doesn't need to be seeded with (or cleared of)
    Arguments.

  - Often the destination function won't have created any arguments yet,
    so this avoids malloc traffic.

  - Argument names don't need to be copied.

Because argument lists are lazy, this required a new
Function::stealArgumentListFrom helper.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265519 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 06:38:15 +00:00
Duncan P. N. Exon Smith
2707ee3256 Revert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes."
This reverts commit r265454 since it broke the build.  E.g.:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/22413/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:45:04 +00:00
Duncan P. N. Exon Smith
15121b5f36 ValueMapper: Rewrite Mapper::mapMetadata without recursion
This commit completely rewrites Mapper::mapMetadata (the implementation
of llvm::MapMetadata) using an iterative algorithm.  The guts of the new
algorithm are in MDNodeMapper::map, the entry function in a new class.

Previously, Mapper::mapMetadata performed a recursive exploration of the
graph with eager "just in case there's a reason" malloc traffic.

The new algorithm has these benefits:

  - New nodes and temporaries are not created eagerly.
  - Uniquing cycles are not duplicated (see new unit test).
  - No recursion.

Given a node to map, it does this:

 1. Use a worklist to perform a post-order traversal of the transitively
    referenced unmapped nodes.

 2. Track which nodes will change operands, and which will have new
    addresses in the mapped scheme.  Propagate the changes through the
    POT until fixed point, to pick up uniquing cycles that need to
    change.

 3. Map all the distinct nodes without touching their operands.  If
    RF_MoveDistinctMetadata, they get mapped to themselves; otherwise,
    they get mapped to clones.

 4. Map the uniqued nodes (bottom-up), lazily creating temporaries for
    forward references as needed.

 5. Remap the operands of the distinct nodes.

Mehdi helped me out by profiling this with -flto=thin.  On his workload
(importing/etc. for opt.cpp), MapMetadata sped up by 15%, contributed
about 50% less to persistent memory, and made about 100x fewer calls to
malloc.  The speedup is less than I'd hoped.  The profile mainly blames
DenseMap lookups; perhaps there's a way to reduce them (e.g., by
disallowing remapping of MDString).

It would be nice to break the strange remaining recursion on the Value
side: MapValue => materializeInitFor => RemapInstruction => MapValue.  I
think we could do this by having materializeInitFor return a worklist of
things to be remapped.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265456 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:23:21 +00:00
Eugene Zelenko
9a7a3bcf29 Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes.
Some Include What You Use suggestions were used too.

Use anonymous namespaces in source files.

Differential revision: http://reviews.llvm.org/D18778


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265454 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 20:19:49 +00:00
Lang Hames
c224d81083 [Support] Add a checked flag to Expected<T>, require checks before access or
destruction.

This makes the Expected<T> class behave like Error, even when in success mode.
Expected<T> values must be checked to see whether they contain an error prior
to being dereferenced, assigned to, or destructed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265446 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 19:57:03 +00:00
Etienne Bergeron
bf3b2ca04c [Support] Fix an invalid character escaping in string literal (unittest).
Summary:
A character within a string literal is not escaped correctly.
In this case, there is no semantic change because the invalid character turn out to be NUL anyway.

note: "\0x12" is equivalent to {0, 'x', '1', '2'} and not { 12 }.

This issue was found by clang-tidy.

Reviewers: rnk

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265376 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05 01:46:26 +00:00
Reid Kleckner
3918651b89 Fix non-determinism in order of LLVM attributes
We were using array_pod_sort on an array of type 'Attribute', which
wraps a pointer to AttributeImpl. For the most part this didn't matter
because the printing code prints enum attributes in a defined order, but
integer attributes such as 'align' and 'dereferenceable' were not
ordered.

Furthermore, AttributeImpl::operator< was broken for integer attributes.
An integer attribute is a kind and an integer value, and both pieces
need to be compared.

By fixing the comparison operator, we can go back to std::sort, and
things look good now.  This should fix clang arm-swiftcall.c test
failures on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265361 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 23:06:05 +00:00
Duncan P. N. Exon Smith
eeb2c7e32c ValueMapper: Add support for seeding metadata with nullptr
Support seeding a ValueMap with nullptr for Metadata entries, a
situation I didn't consider in the Metadata/Value split.

I added a ValueMapper::getMappedMD accessor that returns an
Optional<Metadata*> with the mapped (possibly null) metadata.  IRMover
needs to use this to avoid modifying the map when it's checking for
unneeded subprograms.  I updated a call from bugpoint since I find the
new code clearer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265228 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 17:04:38 +00:00
Duncan P. N. Exon Smith
ec78cb05a0 Document end of anonymous namespaces, NFC
Prevent clang-format from deleting the preceding newline.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265227 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-02 16:45:51 +00:00
Peter Collingbourne
302882987a LowerBitSets: Move declarations to separate namespace.
Should fix modules build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265176 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-01 18:46:50 +00:00
Mehdi Amini
74c634c6b8 Add support for computing SHA1 in LLVM
Provide a class to generate a SHA1 from a sequence of bytes, and
a convenience raw_ostream adaptor.
This will be used to provide a "build-id" by hashing the Module
block when writing bitcode. ThinLTO will use this information for
incremental build.

Reapply r265094 which was reverted in r265102 because it broke
MSVC bots (constexpr is not supported).

http://reviews.llvm.org/D16325

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265107 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-01 04:30:16 +00:00
Mehdi Amini
1fc660ff51 Revert "Add support for computing SHA1 in LLVM"
This reverts commit r265096, r265095, and r265094.
Windows build is broken, and the validation does not pass.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265102 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-01 03:03:21 +00:00
Mehdi Amini
696fe52985 Add support for computing SHA1 in LLVM
Provide a class to generate a SHA1 from a sequence of bytes, and
a convenience raw_ostream adaptor.
This will be used to provide a "build-id" by hashing the Module
block when writing bitcode. ThinLTO will use this information for
incremental build.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265094 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-01 01:29:54 +00:00
Adrian Prantl
39bb84a097 Move the DebugEmissionKind enum from DIBuilder into DICompileUnit.
This mostly cosmetic patch moves the DebugEmissionKind enum from DIBuilder
into DICompileUnit. DIBuilder is not the right place for this enum to live
in — a metadata consumer should not have to include DIBuilder.h.
I also added a Verifier check that checks that the emission kind of a
DICompileUnit is actually legal.

http://reviews.llvm.org/D18612
<rdar://problem/25427165>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265077 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-31 23:56:58 +00:00
Peter Collingbourne
af289e0441 Cloning: Reduce complexity of debug info cloning and fix correctness issue.
Commit r260791 contained an error in that it would introduce a cross-module
reference in the old module. It also introduced O(N^2) complexity in the
module cloner by requiring the entire module to be visited for each function.
Fix both of these problems by avoiding use of the CloneDebugInfoMetadata
function (which is only designed to do intra-module cloning) and cloning
function-attached metadata in the same way that we clone all other metadata.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264935 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-30 22:05:13 +00:00
Hal Finkel
f5526fc013 Add a copy constructor to StringMap
There is code under review that requires StringMap to have a copy constructor,
and this makes StringMap more consistent with our other containers (like
DenseMap) that have copy constructors.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264906 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-30 19:54:56 +00:00
Rong Xu
34be7e62f2 [PGO] Use ArrayRef in annotateValueSite()
Using ArrayRef in annotateValueSite's parameter instead of using an array
and it's size.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264879 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-30 16:56:31 +00:00
Teresa Johnson
402752067f [ThinLTO] Remove post-pass metadata linking support
Since we have moved to a model where functions are imported in bulk from
each source module after making summary-based importing decisions, there
is no longer a need to link metadata as a postpass, and all users have
been removed.

This essentially reverts r255909 and follow-on fixes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264763 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-29 18:24:19 +00:00
Easwaran Raman
418032a1c8 Sample profile summary cleanup
Replace references to MaxHeadSamples with MaxFunctionCount

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264686 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 23:14:29 +00:00
Vedant Kumar
76bf991538 Reapply (2x) "[PGO] Fix name encoding for ObjC-like functions"
Function names in ObjC can have spaces in them. This interacts poorly
with name compression, which uses spaces to separate PGO names. Fix the
issue by using a different separator and update a test.

I chose "\01" as the separator because 1) it's non-printable, 2) we
strip it from PGO names, and 3) it's the next natural choice once "\00"
is discarded (that one's overloaded).

What's changed since the original commit?

- I fixed up the covmap-V2 binary format tests using a linux VM.
- I weakened the CHECK lines in instrprof-comdat.h to account for the
  fact that there have been bugfixes to clang coverage. These will be
  fixed up in a follow-up.
- I added an assert to make sure we don't get bitten by this again.
- I constructed the c-general.profraw file without name compression
  enabled to appease some bots.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264658 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 21:06:42 +00:00
Duncan P. N. Exon Smith
75f9dc9b05 Explicitly test BitstreamReader::setArtificialByteLimit, NFC
Explicitly check that artificial byte limit is rounded correctly by
exposing BitstreamReader::Size through a new accessor, getSizeIfKnown.

The original code for rounding (from r264547) wasn't obviously correct,
and even though r264623 cleaned it up (by calling llvm::alignTo) I think
it's worth testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264650 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 20:39:41 +00:00
Duncan P. N. Exon Smith
2686d302c0 Remove accidentally duplicated test
This was identical to setArtificialByteLimitNotWordBoundary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264646 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 20:30:15 +00:00
Vedant Kumar
0afb669256 Revert "Reapply "[PGO] Fix name encoding for ObjC-like functions""
This reverts commit r264641 to investigate why c-general.test is failing
on the bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264643 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 20:20:40 +00:00
Vedant Kumar
e15d81ae23 Reapply "[PGO] Fix name encoding for ObjC-like functions"
Function names in ObjC can have spaces in them. This interacts poorly
with name compression, which uses spaces to separate PGO names. Fix the
issue by using a different separator and update a test.

I chose "\01" as the separator because 1) it's non-printable, 2) we
strip it from PGO names, and 3) it's the next natural choice once "\00"
is discarded (that one's overloaded).

This reverts the revert commit beaf3d18. What's changed?

- I fixed up the covmap-V2 binary format tests using a linux VM.
- I updated the expected counts in instrprof-comdat.h to account for
  the fact that there have been bugfixes to clang coverage.
- I added an assert to make sure we don't get bitten by this again.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264641 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 20:12:07 +00:00
Vedant Kumar
beaf3d18cf Revert "[PGO] Fix name encoding for ObjC-like functions"
This reverts commit r264587. Reverting to investigate 6 unexpected
failures on the ppc bot:

http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/2822

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264590 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 16:14:07 +00:00
Vedant Kumar
f63fe23e0d [PGO] Fix name encoding for ObjC-like functions
Function names in ObjC can have spaces in them. This interacts poorly
with name compression, which uses spaces to separate PGO names. Fix the
issue by using a different separator and update a test.

I chose "\01" as the separator because 1) it's non-printable, 2) we
strip it from PGO names, and 3) it's the next natural choice once "\00"
is discarded (that one's overloaded).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264587 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 15:52:08 +00:00
Vedant Kumar
ab3787a574 [Coverage] Strip <unknown> from PGO names if no filenames are available
Patch suggested by David Li!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264586 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 15:49:08 +00:00
Vedant Kumar
9c51ac3626 [Coverage] Fix the way we load "<unknown>:func" records
When emitting coverage mappings for functions with local linkage and an
unknown filename, we use "<unknown>:func" for the PGO function name. The
problem is that we don't strip "<unknown>" from the name when loading
coverage data, like we do for other file names. Fix that and add a test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264559 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 01:16:12 +00:00
Duncan P. N. Exon Smith
bd2e7848ab Bitcode: Fix MSVC bot failure from r264549
make_unique => llvm::make_unique

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264553 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-27 23:36:55 +00:00
Duncan P. N. Exon Smith
15b99e0369 BitcodeWriter: Simplify and test writing blobs, NFC
Split helper out of EmitRecordWithAbbrevImpl called emitBlob to reduce
code duplication, and add a few tests for it.

No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264550 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-27 23:04:04 +00:00
Duncan P. N. Exon Smith
fbf768a4d3 Support: Implement StreamingMemoryObject::getPointer
The implementation is fairly obvious.  This is preparation for using
some blobs in bitcode.

For clarity (and perhaps future-proofing?), I moved the call to
JumpToBit in BitstreamCursor::readRecord ahead of calling
MemoryObject::getPointer, since JumpToBit can theoretically (a) read
bytes, which (b) invalidates the blob pointer.

This isn't strictly necessary the two memory objects we have:

  - The return of RawMemoryObject::getPointer is valid until the memory
    object is destroyed.

  - StreamingMemoryObject::getPointer is valid until the next chunk is
    read from the stream.  Since the JumpToBit call is only going ahead
    to a word boundary, we'll never load another chunk.

However, reordering makes it clear by inspection that the blob returned
by BitstreamCursor::readRecord will be valid.

I added some tests for StreamingMemoryObject::getPointer and
BitstreamCursor::readRecord.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264549 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-27 23:00:59 +00:00
Duncan P. N. Exon Smith
b341866e2c Support: Move StreamingMemoryObject{,Test}.cpp, NFC
Change the filename to indicate this is a test, rename the tests, move
them into an anonymous namespace, and rename some variables.  All to
match our usual style before making further changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264548 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-27 22:55:19 +00:00
Duncan P. N. Exon Smith
a115062beb Bitcode: Add SimpleBitstreamCursor::setArtificialByteLimit
Allow users of SimpleBitstreamCursor to limit the number of bytes
available to the cursor.  This is preparation for instantiating a cursor
that isn't allowed to load more bytes from a StreamingMemoryObject (just
move around the ones already-loaded).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264547 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-27 22:49:32 +00:00
Duncan P. N. Exon Smith
2e87e9ef90 Bitcode: Add SimpleBitstreamCursor::getPointerToByte, etc.
Add API to SimpleBitstreamCursor to allow users to translate between
byte addresses and pointers.

  - jumpToPointer: move the bit position to a particular pointer.
  - getPointerToByte: get the pointer for a particular byte.
  - getPointerToBit: get the pointer for the byte of the current bit.
  - getCurrentByteNo: convenience function for assertions and tests.

Mainly adds unit tests (getPointerToBit/Byte already has a use), but
also preparation for eventually using jumpToPointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264546 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-27 22:45:25 +00:00
Lang Hames
bbb35fb68d [Support] Switch to RAII helper for error-as-out-parameter idiom.
As discussed on the llvm-commits thread for r264467.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264479 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 23:54:32 +00:00
Mehdi Amini
64f92384a5 StringMap/DenseMap unittests: use piecewise_construct and ensure no copy occurs.
This makes us no longer relying on move-construction elision by the compiler.
Suggested by D. Blaikie.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264475 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 23:25:06 +00:00
Lang Hames
d65658e8aa [Support] Add Error::errorForOutParameter helper.
This helper method creates a pre-checked Error suitable for use as an out
parameter in a constructor. This avoids the need to have the constructor
check a known-good error before assigning to it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264467 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 21:56:35 +00:00
Jun Bum Lim
cb239ec911 [SetVector] Add erase() method
This is a recommit of r264414 after fixing the buildbot failure caused by
incompatible use of std::vector.erase().

The original message:

Add erase() which returns an iterator pointing to the next element after the
erased one. This makes it possible to erase selected elements while iterating
over the SetVector :
  while (I != E)
    if (test(*I))
      I = SetVector.erase(I);
    else
      ++I;

Reviewers: qcolombet, mcrosier, MatzeB, dblaikie

Subscribers: dberlin, dblaikie, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264450 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 19:28:08 +00:00
Jun Bum Lim
16303e867d Revert "[SetVector] Add erase() method"
This reverts commit r264414.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264420 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 16:49:16 +00:00
Mehdi Amini
ff9b2316f1 Improve StringMap unittests: reintroduce move count, but shield against std::pair internals
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264418 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 16:36:00 +00:00
Mehdi Amini
df98afd142 Ensure that the StringMap does not grow during the test for pre-allocation/reserve
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264416 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 16:09:34 +00:00
Jun Bum Lim
c9a0644f8a [SetVector] Add erase() method
Summary:
Add erase() which returns an iterator pointing to the next element after the
erased one. This makes it possible to erase selected elements while iterating
over the SetVector :
  while (I != E)
    if (test(*I))
      I = SetVector.erase(I);
    else
      ++I;

Reviewers: qcolombet, mcrosier, MatzeB, dblaikie

Subscribers: dberlin, dblaikie, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264414 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 16:04:43 +00:00
Mehdi Amini
4f6a396142 Disable counting the number of move in the unittest, it seems to rely on move-construction elision
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264412 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 15:46:14 +00:00
Mehdi Amini
256567583d Query the StringMap only once when creating MDString (NFC)
Summary:
Loading IR with debug info improves MDString::get() from 19ms to 10ms.
This is a rework of D16597 with adding an "emplace" method on the StringMap
to avoid requiring the MDString move ctor to be public.

Reviewers: dexonsmith

Subscribers: llvm-commits

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264386 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 05:58:04 +00:00
Mehdi Amini
bf941ea066 Adjust initial size in StringMap constructor to guarantee no grow()
Summary:
StringMap ctor accepts an initialize size, but expect it to be
rounded to the next power of 2. The ctor can handle that directly
instead of expecting clients to round it. Also, since the map will
resize itself when 75% full, take this into account an initialize
a larger initial size to avoid any growth.

Reviewers: dblaikie

Subscribers: llvm-commits

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264385 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 05:57:57 +00:00
Mehdi Amini
9ed5a8271e Fix DenseMap::reserve(): the formula was wrong
Summary:
Just running the loop in the unittests for a few more iterations
(till 48) exhibit that the condition on the limit was not handled
properly in r263522.
Rewrite the test to use a class to count move/copies that happens
when inserting into the map.
Also take the opportunity to refactor the logic to compute the
number of buckets required for a given number of entries in the map.
Use this when constructing a DenseMap with a desired size given to
the constructor (and add a tests for this).

Reviewers: dblaikie

Subscribers: llvm-commits

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264384 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25 05:57:52 +00:00
Reid Kleckner
c68f3d4c8d Try to fix ODR violation of ErrorInfo::ID
This implements my suggestion to Lang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264360 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 23:49:34 +00:00
David Blaikie
1825f4d513 [ADT] C++11ify SmallVector::erase's arguments from iterator to const_iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264330 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 20:25:51 +00:00
NAKAMURA Takumi
89b695a240 ErrorTest.cpp: Move instantiations out of anonymous namespace. gcc didn't complain.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264297 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 15:40:46 +00:00
NAKAMURA Takumi
389c434b57 Define ErrorInfo::ID explicitly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264293 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 15:26:43 +00:00
NAKAMURA Takumi
f043736d85 ErrorTest.cpp: Fix an expression, possibly typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264290 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 15:19:22 +00:00
Lang Hames
d1800c2b1c [Support] Add conversions between Expected<T> and ErrorOr<T>.
More utilities to help with std::error_code -> Error transitions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264238 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 02:00:10 +00:00
Lang Hames
d34f785662 [Support] Make all Errors convertible to std::error_code.
This is a temporary crutch to enable code that currently uses std::error_code
to be incrementally moved over to Error. Requiring all Error instances be
convertible enables clients to call errorToErrorCode on any error (not just
ECErrors created by conversion *from* an error_code).

This patch also moves code for Error from ErrorHandling.cpp into a new
Error.cpp file.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264221 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-23 23:57:28 +00:00
Matt Arsenault
b883372896 APFloat: Fix signalling nans for scalbn
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264219 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-23 23:51:45 +00:00
Pete Cooper
552f3d8472 StringRef::copy shouldn't allocate anything for length 0 strings.
The BumpPtrAllocator currently doesn't handle zero length allocations well.
The discussion for how to fix that is ongoing.  However, there's no need
for StringRef::copy to actually allocate anything here anyway, so just
return StringRef() when we get a zero length copy.

Reviewed by David Blaikie

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264201 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-23 21:49:31 +00:00
Easwaran Raman
e34db46356 Add getBlockProfileCount method to BlockFrequencyInfo
Differential Revision: http://reviews.llvm.org/D18233



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264179 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-23 18:18:26 +00:00
Vedant Kumar
a9e82b41a3 [unittests] clang-format a line, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264059 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-22 15:14:18 +00:00
Mehdi Amini
d4501fffa8 Fix unittests: resize() -> reserve()
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264029 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-22 07:35:51 +00:00
Lang Hames
43f3f60fb4 [Orc] Switch RPC Procedure to take a function type, rather than an arg list.
No functional change, just a little more readable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263951 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-21 16:56:25 +00:00
Matt Arsenault
7c9226fea8 APFloat: Add frexp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263950 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-21 16:49:16 +00:00
Matt Arsenault
23f7a82592 Implement constant folding for bitreverse
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263945 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-21 15:00:35 +00:00
Easwaran Raman
af640bffc2 Interface to get/set profile summary metadata to module
Differential Revision: http://reviews.llvm.org/D17894


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263835 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-18 21:29:30 +00:00
Lang Hames
ec1cb3a98d [Support] Refactor Error unit tests to avoid duplicating work.
Suggested by Dave Blaikie in review for r263749. Thanks Dave!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263768 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-18 00:12:37 +00:00
Mike Aizatsky
779c414f55 Revert "allow lambdas in mapped_iterator"
MSVC as usual:

C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\include\llvm/ADT/STLExtras.h(120):
error C2100: illegal indirection
C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\include\llvm/IR/Instructions.h(3966):
note: see reference to class template instantiation
'llvm::mapped_iterator<llvm::User::op_iterator,llvm::CatchSwitchInst::DerefFnTy>'
being compiled

This reverts commit e091dd63f1f34e043748e28ad160d3bc17731168.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263760 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-17 23:32:20 +00:00
Mike Aizatsky
4408c622ad allow lambdas in mapped_iterator
Differential Revision: http://reviews.llvm.org/D17311

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263759 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-17 23:22:22 +00:00
Lang Hames
0583c9334d [Support] Add ExitOnError utility to support tools that use the exit-on-error
idiom.

Most LLVM tool code exits immediately when an error is encountered and prints an
error message to stderr. The ExitOnError class supports this by providing two
call operators - one for Errors, and one for Expected<T>s. Calls to code that
can return Errors (or Expected<T>s) can use these calls to bail out on error,
and otherwise continue as if the operation had succeeded. E.g.

Error foo();
Expected<int> bar();

int main(int argc, char *argv[]) {
  ExitOnError ExitOnErr;

  ExitOnErr.setBanner(std::string("Error in ") + argv[0] + ":");

  // Exit if foo returns an error. No need to manually check error return.
  ExitOnErr(foo());

  // Exit if bar returns an error, otherwise unwrap the contained int and
  // continue.
  int X = ExitOnErr(bar());

  // ...

  return 0;
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263749 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-17 21:28:49 +00:00
Lang Hames
3d86278890 [Support] Make Error::isA<T>() works on success values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263745 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-17 20:35:00 +00:00
Lang Hames
9d837c98d3 [Support] Update Error unit test to remove implementation specific behaviour.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263610 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-16 01:20:54 +00:00
Lang Hames
b92213233c [Support] Add the 'Error' class for structured error handling.
This patch introduces the Error classs for lightweight, structured,
recoverable error handling. It includes utilities for creating, manipulating
and handling errors. The scheme is similar to exceptions, in that errors are
described with user-defined types. Unlike exceptions however, errors are
represented as ordinary return types in the API (similar to the way
std::error_code is used).

For usage notes see the LLVM programmer's manual, and the Error.h header.
Usage examples can be found in unittests/Support/ErrorTest.cpp.

Many thanks to David Blaikie, Mehdi Amini, Kevin Enderby and others on the
llvm-dev and llvm-commits lists for lots of discussion and review.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263609 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-16 01:02:46 +00:00
Fiona Glaser
33ae313f2a DenseMap: make .resize() do the intuitive thing
In some places, like InstCombine, we resize a DenseMap to fit the elements
we intend to put in it, then insert those elements (to avoid continual
reallocations as it grows). But .resize(foo) doesn't actually do what
people think; it resizes to foo buckets (which is really an
implementation detail the user of DenseMap probably shouldn't care about),
not the space required to fit foo elements. DenseMap grows if 3/4 of its
buckets are full, so this actually causes one forced reallocation every
time instead of avoiding a reallocation.

This patch makes .resize(foo) do the intuitive thing: it grows to the size
necessary to fit foo elements without new allocations.

Also include a test to verify that .resize() actually does what we think it
does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263522 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-15 01:50:46 +00:00
NAKAMURA Takumi
0440e817b9 MathExtrasTest.cpp: Use EXPECT_DOUBLE_EQ here, instead of EXPECT_FLOAT_EQ.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263508 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-14 23:11:28 +00:00
Easwaran Raman
ab6fe18987 Remove code added for debugging purposes. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263500 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-14 22:23:28 +00:00
Quentin Colombet
b7448a08dd [ADT] Add a pop_back_val method to the SparseSet container.
The next commit will use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263455 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-14 18:10:41 +00:00
David Blaikie
e7546cafab Remove some unused variables
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263396 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-13 22:00:18 +00:00
Mehdi Amini
f1f0a1f064 Remove PreserveNames template parameter from IRBuilder
This reapplies r263258, which was reverted in r263321 because
of issues on Clang side.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263393 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-13 21:05:13 +00:00
Amjad Aboud
031194de74 Fixed DIBuilder to verify that same imported entity will not be added twice to the "imports" list of the DICompileUnit.
Differential Revision: http://reviews.llvm.org/D17884

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263379 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-13 11:11:39 +00:00
Matt Arsenault
499f78c4e0 APFloat: Fix ilogb for denormals
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263370 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-13 05:12:32 +00:00
Matt Arsenault
2ef9469788 APFloat: Fix scalbn handling of denormals
This was incorrect for denormals, and also failed
on longer exponent ranges.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263369 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-13 05:11:51 +00:00
Eric Christopher
3529ae09b5 Temporarily revert:
commit ae14bf6488
Author: Mehdi Amini <mehdi.amini@apple.com>
Date:   Fri Mar 11 17:15:50 2016 +0000

    Remove PreserveNames template parameter from IRBuilder

    Summary:
    Following r263086, we are now relying on a flag on the Context to
    discard Value names in release builds.

    Reviewers: chandlerc

    Subscribers: mzolotukhin, llvm-commits

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

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

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263258
    91177308-0d34-0410-b5e6-96231b3b80d8

until we can figure out what to do about clang and Release build testing.

This reverts commit 263258.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263321 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-12 01:47:22 +00:00
Michael Zolotukhin
150be6b78b [LoopUnroll] Convert some existing tests to unit-tests.
Summary: As we now have unit-tests for UnrollAnalyzer, we can convert some existing tests to this format. It should make the tests more robust.

Reviewers: chandlerc, sanjoy

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263318 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-12 01:28:56 +00:00
Mehdi Amini
ae14bf6488 Remove PreserveNames template parameter from IRBuilder
Summary:
Following r263086, we are now relying on a flag on the Context to
discard Value names in release builds.

Reviewers: chandlerc

Subscribers: mzolotukhin, llvm-commits

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263258 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11 17:15:50 +00:00
Marianne Mailhot-Sarrasin
07ef9b6010 More UTF string conversion wrappers
Added new string conversion wrappers that convert between `std::string` (of UTF-8 bytes) and `std::wstring`, which is particularly useful for Win32 interop. Also fixed a missing string conversion for `getenv` on Win32, using these new wrappers.
The motivation behind this is to provide the support functions required for LLDB to work properly on Windows with non-ASCII data; however, the functions are not LLDB specific.

Patch by cameron314

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263247 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11 15:59:32 +00:00
Chandler Carruth
8e27cb2f34 [PM] Make the AnalysisManager parameter to run methods a reference.
This was originally a pointer to support pass managers which didn't use
AnalysisManagers. However, that doesn't realistically come up much and
the complexity of supporting it doesn't really make sense.

In fact, *many* parts of the pass manager were just assuming the pointer
was never null already. This at least makes it much more explicit and
clear.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263219 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11 11:05:24 +00:00
Chandler Carruth
18e9a2b623 [PM] Rename the CRTP mixin base classes for the new pass manager to
clarify their purpose.

Firstly, call them "...Mixin" types so it is clear that there is no
type hierarchy being formed here. Secondly, use the term 'Info' to
clarify that they aren't adding any interesting *semantics* to the
passes or analyses, just exposing APIs used by the management layer to
get information about the pass or analysis.

Thanks to Manuel for helping pin down the naming confusion here and come
up with effective names to address it.

In case you already have some out-of-tree stuff, the following should be
roughly what you want to update:

  perl -pi -e 's/\b(Pass|Analysis)Base\b/\1InfoMixin/g'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263217 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11 10:33:22 +00:00
Chandler Carruth
e95015f4c9 [PM] Implement the final conclusion as to how the analysis IDs should
work in the face of the limitations of DLLs and templated static
variables.

This requires passes that use the AnalysisBase mixin provide a static
variable themselves. So as to keep their APIs clean, I've made these
private and befriended the CRTP base class (which is the common
practice).

I've added documentation to AnalysisBase for why this is necessary and
at what point we can go back to the much simpler system.

This is clearly a better pattern than the extern template as it caught
*numerous* places where the template magic hadn't been applied and
things were "just working" but would eventually have broken
mysteriously.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263216 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11 10:22:49 +00:00
Quentin Colombet
cbd4dbb999 [AsmParser] Expose an API to parse a string starting with a type.
Without actually parsing a type it is difficult to perdict where
the type definition ends. In other words, instead of expecting
the user of the parser API to hand over only the relevant bits
of the string being parsed, take the whole string, parse the type,
and get back the number of characters that have been read.

This will be used by the MIR testing infrastructure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262884 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-08 00:37:07 +00:00
Quentin Colombet
2ba0323edd [AsmParser] Add a function to parse a standalone type.
This is useful for MIR serialization. Indeed generic machine instructions
must have a type and we don't want to duplicate the logic in the MIParser.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262868 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-07 22:09:05 +00:00
Saleem Abdulrasool
88e2967579 unitests: add some ARM TargetParser tests
The ARM TargetParser would construct invalid StringRefs.  This would cause
asserts to trigger.  Add some tests in LLVM to ensure that we dont regress on
this in the future.  Although there is a test for this in clang, this ensures
that the changes would get caught in the same repository.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262790 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-06 04:50:55 +00:00
Easwaran Raman
ea7d2ce29b Fix memory leak in tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262674 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03 23:55:41 +00:00
Lang Hames
9ab9fd58bd [RuntimeDyld] Fix '_' stripping in RTDyldMemoryManager::getSymbolAddressInProcess.
The RTDyldMemoryManager::getSymbolAddressInProcess method accepts a
linker-mangled symbol name, but it calls through to dlsym to do the lookup (via
DynamicLibrary::SearchForAddressOfSymbol), and dlsym expects an unmangled
symbol name.

Historically we've attempted to "demangle" by removing leading '_'s on all
platforms, and fallen back to an extra search if that failed. That's broken, as
it can cause symbols to resolve incorrectly on platforms that don't do mangling
if you query '_foo' and the process also happens to contain a 'foo'.

Fix this by demangling conditionally based on the host platform. That's safe
here because this function is specifically for symbols in the host process, so
the usual cross-process JIT looking concerns don't apply.

M    unittests/ExecutionEngine/ExecutionEngineTest.cpp
M    lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262657 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03 21:23:15 +00:00
Sanjoy Das
45385bf7d9 [ConstantRange] Rename test; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262640 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03 18:31:33 +00:00
Sanjoy Das
1d754782e0 [ConstantRange] Generalize makeGuaranteedNoWrapRegion to work on ranges
This will be used in a later patch to ScalarEvolution.  Right now only
the unit tests exercise the newly added code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262637 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03 18:31:16 +00:00
Dehao Chen
5c299caf16 Use LineLocation instead of CallsiteLocation to index callsite profile.
Summary: With discriminator, LineLocation can uniquely identify a callsite without the need to specifying callee name. Remove Callee function name from the key, and put it in the value (FunctionSamples).

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262634 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03 18:09:32 +00:00
Daniel Berlin
a60047277d Really fix ASAN leak/etc issues with MemorySSA unittests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262519 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 21:16:28 +00:00
Daniel Berlin
459c79ef7d Revert "Fix ASAN detected errors in code and test" (it was not meant to be committed yet)
This reverts commit 890bbccd600ba1eb050353d06a29650ad0f2eb95.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262512 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 20:36:22 +00:00
Daniel Berlin
2bc88b7640 Fix ASAN detected errors in code and test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262511 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 20:27:29 +00:00
Chandler Carruth
cf88e9244e [AA] Hoist the logic to reformulate various AA queries in terms of other
parts of the AA interface out of the base class of every single AA
result object.

Because this logic reformulates the query in terms of some other aspect
of the API, it would easily cause O(n^2) query patterns in alias
analysis. These could in turn be magnified further based on the number
of call arguments, and then further based on the number of AA queries
made for a particular call. This ended up causing problems for Rust that
were actually noticable enough to get a bug (PR26564) and probably other
places as well.

When originally re-working the AA infrastructure, the desire was to
regularize the pattern of refinement without losing any generality.
While I think it was successful, that is clearly proving to be too
costly. And the cost is needless: we gain no actual improvement for this
generality of making a direct query to tbaa actually be able to
re-use some other alias analysis's refinement logic for one of the other
APIs, or some such. In short, this is entirely wasted work.

To the extent possible, delegation to other API surfaces should be done
at the aggregation layer so that we can avoid re-walking the
aggregation. In fact, this significantly simplifies the logic as we no
longer need to smuggle the aggregation layer into each alias analysis
(or the TargetLibraryInfo into each alias analysis just so we can form
argument memory locations!).

However, we also have some delegation logic inside of BasicAA and some
of it even makes sense. When the delegation logic is baking in specific
knowledge of aliasing properties of the LLVM IR, as opposed to simply
reformulating the query to utilize a different alias analysis interface
entry point, it makes a lot of sense to restrict that logic to
a different layer such as BasicAA. So one aspect of the delegation that
was in every AA base class is that when we don't have operand bundles,
we re-use function AA results as a fallback for callsite alias results.
This relies on the IR properties of calls and functions w.r.t. aliasing,
and so seems a better fit to BasicAA. I've lifted the logic up to that
point where it seems to be a natural fit. This still does a bit of
redundant work (we query function attributes twice, once via the
callsite and once via the function AA query) but it is *exactly* twice
here, no more.

The end result is that all of the delegation logic is hoisted out of the
base class and into either the aggregation layer when it is a pure
retargeting to a different API surface, or into BasicAA when it relies
on the IR's aliasing properties. This should fix the quadratic query
pattern reported in PR26564, although I don't have a stand-alone test
case to reproduce it.

It also seems general goodness. Now the numerous AAs that don't need
target library info don't carry it around and depend on it. I think
I can even rip out the general access to the aggregation layer and only
expose that in BasicAA as it is the only place where we re-query in that
manner.

However, this is a non-trivial change to the AA infrastructure so I want
to get some additional eyes on this before it lands. Sadly, it can't
wait long because we should really cherry pick this into 3.8 if we're
going to go this route.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262490 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 15:56:53 +00:00
Daniel Berlin
dee2eabd02 Fix SHARED_LIBS build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262439 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 00:58:48 +00:00
Rafael Espindola
18903ff9fb Move ObjectYAML code to a new library.
It is only ever used by obj2yaml and yaml2obj. No point in linking it
everywhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262368 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 19:15:06 +00:00
Daniel Berlin
1627603e25 Add the beginnings of an update API for preserving MemorySSA
Summary:
This adds the beginning of an update API to preserve MemorySSA.  In particular,
this patch adds a way to remove memory SSA accesses when instructions are
deleted.

It also adds relevant unit testing infrastructure for MemorySSA's API.

(There is an actual user of this API, i will make that diff dependent on this one.  In practice, a ton of opt passes remove memory instructions, so it's hopefully an obviously useful API :P)

Reviewers: hfinkel, reames, george.burgess.iv

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262362 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 18:46:54 +00:00
Easwaran Raman
1283c1d7af Metadata support for profile summary.
This adds support to convert ProfileSummary object to Metadata and create a
ProfileSummary object from metadata. This would allow attaching profile summary
information to Module allowing optimization passes to use it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262360 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 18:30:58 +00:00
Rafael Espindola
93ed620d27 Refactor duplicated code for linking with pthread.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262344 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 15:54:40 +00:00
Philip Reames
fcd97ccb03 [ConstantRange] Add umin/smin operators
This was split off from http://reviews.llvm.org/D17184.

Reviewed by: Sanjoy



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262080 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 22:08:18 +00:00
Chandler Carruth
adb60a3a11 [PM] Introduce CRTP mixin base classes to help define passes and
analyses in the new pass manager.

These just handle really basic stuff: turning a type name into a string
statically that is nice to print in logs, and getting a static unique ID
for each analysis.

Sadly, the format of passes in anonymous namespaces makes using their
names in tests really annoying so I've customized the names of the no-op
passes to keep tests sane to read.

This is the first of a few simplifying refactorings for the new pass
manager that should reduce boilerplate and confusion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262004 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 11:44:45 +00:00
Michael Zolotukhin
79c196414f [LoopUnrollAnalyzer] Check that we're using SCEV for the same loop we're simulating.
Summary: Check that we're using SCEV for the same loop we're simulating. Otherwise, we might try to use the iteration number of the current loop in SCEV expressions for inner/outer loops IVs, which is clearly incorrect.

Reviewers: chandlerc, hfinkel

Subscribers: sanjoy, llvm-commits, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261958 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 02:57:05 +00:00
Michael Zolotukhin
30deba6b59 [UnitTests] UnrollAnalyzer: make unit-test more general so that it can cover more cases in future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261954 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 01:44:04 +00:00
Hongbin Zheng
5d7472e863 Introduce analysis pass to compute PostDominators in the new pass manager. NFC
Differential Revision: http://reviews.llvm.org/D17537

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261902 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 17:54:07 +00:00
Hongbin Zheng
9137eb3ff8 Revert "Introduce analysis pass to compute PostDominators in the new pass manager. NFC"
This reverts commit a3e5cc6a51ab5ad88d1760c63284294a4e34c018.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261891 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 16:45:53 +00:00
Hongbin Zheng
e2c0114367 Introduce analysis pass to compute PostDominators in the new pass manager. NFC
Differential Revision: http://reviews.llvm.org/D17537

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261882 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 16:33:06 +00:00
Justin Bogner
da5e92486c PM: Implement a basic loop pass manager
This creates the new-style LoopPassManager and wires it up with dummy
and print passes.

This version doesn't support modifying the loop nest at all. It will
be far easier to discuss and evaluate the approaches to that with this
in place so that the boilerplate is out of the way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261831 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 07:23:08 +00:00
Chandler Carruth
0e5b32301d [Support] Add a fancy helper function to get a static name for a type.
This extracts the type name from __PRETTY_FUNCTION__ for compilers that
support it (I've opted Clang, GCC, and ICC into this as I've tested that
they work) and from __FUNCSIG__ which is very similar on MSVC. The
routine falls back gracefully on a stub "UNKNOWN_TYPE" string with
compilers or formats it doesn't understand.

This should be enough for a lot of common cases in LLVM where the real
goal is just to log or print a type name as a debugging aid, and save
a ton of boilerplate in the process. Notably, I'm planning to use this
to remove all the getName() boiler plate from the new pass manager.

The design and implementation is based on a bunch of advice and
discussion with Richard Smith and experimenting with most versions of
Clang and GCC. David Majnemer also provided excellent advice on how best
to do this with MSVC. Richard also checked that ICC does something
reasonable and I'll watch the build bots for other compilers. It'd be
great if someone could contribute logic for xlC and/or other toolchains.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261819 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 03:58:21 +00:00
Chandler Carruth
e648c53c5c [PM] Remove an overly aggressive assert now that I can actually test the
pattern that triggers it. This essentially requires an immutable
function analysis, as that will survive anything we do to invalidate it.
When we have such patterns, the function analysis manager will not get
cleared between runs of the proxy.

If we actually need an assert about how things are queried, we can add
more elaborate machinery for computing it, but so far I'm not aware of
significant value provided.

Thanks to Justin Lebar for noticing this when he made a (seemingly
innocuous) change to FunctionAttrs that is enough to trigger it in one
test there. Now it is covered by a direct test of the pass manager code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261627 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-23 10:47:57 +00:00
Chandler Carruth
3530d284cd [PM] Add a unittest for the CGSCC pass manager in the new pass manager
system.

Previously, this was only being tested with larger integration tests.
That makes it hard to isolated specific issues with it, and makes the
APIs themselves less well tested. Add a unittest based around the same
patterns used for testing the general pass manager.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261624 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-23 10:02:02 +00:00
Sanjoy Das
e9d736f57c [ConstantRange] Rename a method and add more doc
Rename makeNoWrapRegion to a more obvious makeGuaranteedNoWrapRegion,
and add a comment about the counter-intuitive aspects of the function.
This is to help prevent cases like PR26628.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261532 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-22 16:13:02 +00:00
Tobias Grosser
dae2e1d530 Use EXPECT_EQ in the unittests instead of plain assert
This addresses post-review comments from Duncan P. N. Exon Smith to r261485.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261514 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-22 07:20:40 +00:00
Tobias Grosser
bbe882c52c ScalarEvolution: Do not keep temporary PHI values in ValueExprMap
Before this patch simplified SCEV expressions for PHI nodes were only returned
the very first time getSCEV() was called, but later calls to getSCEV always
returned the non-simplified value, which had "temporarily" been stored in the
ValueExprMap, but was never removed and consequently blocked the caching of the
simplified PHI expression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261485 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-21 17:42:10 +00:00
Chandler Carruth
89a08aa76a [PM/AA] Port alias analysis evaluator to the new pass manager, and use
it to actually test the new pass manager AA wiring.

This patch was extracted from the (somewhat too large) D12357 and
rebosed on top of the slightly different design of the new pass manager
AA wiring that I just landed. With this we can start testing the AA in
a thorough way with the new pass manager.

Some minor cleanups to the code in the pass was necessitated here, but
otherwise it is a very minimal change.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261403 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 03:46:03 +00:00
Easwaran Raman
448784058c Add profile summary support for sample profile.
Differential Revision: http://reviews.llvm.org/D17178



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261304 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 03:15:33 +00:00
Jordan Rose
a0c4c2189d [ADT] Fix PointerEmbeddedInt when the underlying type is uintptr_t.
...and when you try to store negative values in it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261259 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 21:00:08 +00:00
Zachary Turner
2b17201ca7 [DebugInfoPDB] Add source / line number accessors for PDB.
This patch adds a variety of different methods to query source
and line number information from PDB files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261239 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 18:47:29 +00:00
Chandler Carruth
67a41f0919 [PM/AA] Teach the new pass manager to use pass-by-lambda for registering
analysis passes, support pre-registering analyses, and use that to
implement parsing and pre-registering a custom alias analysis pipeline.

With this its possible to configure the particular alias analysis
pipeline used by the AAManager from the commandline of opt. I've updated
the test to show this effectively in use to build a pipeline including
basic-aa as part of it.

My big question for reviewers are around the APIs that are used to
expose this functionality. Are folks happy with pass-by-lambda to do
pass registration? Are folks happy with pre-registering analyses as
a way to inject customized instances of an analysis while still using
the registry for the general case?

Other thoughts of course welcome. The next round of patches will be to
add the rest of the alias analyses into the new pass manager and wire
them up here so that they can be used from opt. This will require
extending the (somewhate limited) functionality of AAManager w.r.t.
module passes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261197 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 09:45:17 +00:00
NAKAMURA Takumi
20dee1f1c0 Make a stub version of MITests, instead of reverting.
Lit tends to find out-of-date unittests in the build tree.

FIXME: It may be reverted several days after.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261194 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 07:37:17 +00:00
Matthias Braun
5270f4212b Revert "LiveIntervalAnalysis: Remove LiveVariables requirement" and LiveIntervalTest
The commit breaks stage2 compilation on PowerPC. Reverting for now while
this is analyzed. I also have to revert the LiveIntervalTest for now as
that depends on this commit.

Revert "LiveIntervalAnalysis: Remove LiveVariables requirement"
This reverts commit r260806.
Revert "Remove an unnecessary std::move to fix -Wpessimizing-move warning."
This reverts commit r260931.
Revert "Fix typo in LiveIntervalTest"
This reverts commit r260907.
Revert "Add unittest for LiveIntervalAnalysis::handleMove()"
This reverts commit r260905.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261189 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18 05:21:43 +00:00
Easwaran Raman
233e7d3773 Add a profile summary class specific to instrumentation profiles.
Modify ProfileSummary class to make it not instrumented profile specific.
Add a new InstrumentedProfileSummary class that inherits from ProfileSummary.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261119 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 18:18:47 +00:00
Chandler Carruth
a59e5882a0 [LCG] Construct an actual call graph with call-edge SCCs nested inside
reference-edge SCCs.

This essentially builds a more normal call graph as a subgraph of the
"reference graph" that was the old model. This allows both to exist and
the different use cases to use the aspect which addresses their needs.
Specifically, the pass manager and other *ordering* constrained logic
can use the reference graph to achieve conservative order of visit,
while analyses reasoning about attributes and other properties derived
from reachability can reason about the direct call graph.

Note that this isn't necessarily complete: it doesn't model edges to
declarations or indirect calls. Those can be found by scanning the
instructions of the function if desirable, and in fact every user
currently does this in order to handle things like calls to instrinsics.
If useful, we could consider caching this information in the call graph
to save the instruction scans, but currently that doesn't seem to be
important.

An important realization for why the representation chosen here works is
that the call graph is a formal subset of the reference graph and thus
both can live within the same data structure. All SCCs of the call graph
are necessarily contained within an SCC of the reference graph, etc.

The design is to build 'RefSCC's to model SCCs of the reference graph,
and then within them more literal SCCs for the call graph.

The formation of actual call edge SCCs is not done lazily, unlike
reference edge 'RefSCC's. Instead, once a reference SCC is formed, it
directly builds the call SCCs within it and stores them in a post-order
sequence. This is used to provide a consistent platform for mutation and
update of the graph. The post-order also allows for very efficient
updates in common cases by bounding the number of nodes (and thus edges)
considered.

There is considerable common code that I'm still looking for the best
way to factor out between the various DFS implementations here. So far,
my attempts have made the code harder to read and understand despite
reducing the duplication, which seems a poor tradeoff. I've not given up
on figuring out the right way to do this, but I wanted to wait until
I at least had the system working and tested to continue attempting to
factor it differently.

This also requires introducing several new algorithms in order to handle
all of the incremental update scenarios for the more complex structure
involving two edge colorings. I've tried to comment the algorithms
sufficiently to make it clear how this is expected to work, but they may
still need more extensive documentation.

I know that there are some changes which are not strictly necessarily
coupled here. The process of developing this started out with a very
focused set of changes for the new structure of the graph and
algorithms, but subsequent changes to bring the APIs and code into
consistent and understandable patterns also ended up touching on other
aspects. There was no good way to separate these out without causing
*massive* merge conflicts. Ultimately, to a large degree this is
a rewrite of most of the core algorithms in the LCG class and so I don't
think it really matters much.

Many thanks to the careful review by Sanjoy Das!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261040 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 00:18:16 +00:00
Craig Topper
86b7e4c701 Remove an unnecessary std::move to fix -Wpessimizing-move warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260931 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-16 04:17:42 +00:00
Vedant Kumar
9ae3e2ceaa [ADT] Add StringRef::{l,r}trim(char) overloads (NFC)
Add support for trimming a single kind of character from a StringRef.
This makes the common case of trimming null bytes much neater. It's also
probably a bit speedier too, since it avoids creating a std::bitset in
find_{first,last}_not_of.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260925 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-16 01:48:39 +00:00
Amaury Sechet
d0aed13e56 Kill LLVMAddTargetData
Summary: It's red, it's dead.

Reviewers: joker.eph, Wallbraker, echristo

Subscribers: llvm-commits, axw

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260919 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-16 00:22:02 +00:00
NAKAMURA Takumi
d964cf3e68 MITests: Update libdeps. llvm/Target/TargetOptions.h depends on MC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260918 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-16 00:17:56 +00:00
Matthias Braun
5cdb7d1d3d unittests/MI: Add Core library reference
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260915 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-15 22:09:38 +00:00
Matthias Braun
1ff5bf6bbb Fix typo in LiveIntervalTest
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260907 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-15 19:30:11 +00:00
Matthias Braun
d9ede1ac1f Add unittest for LiveIntervalAnalysis::handleMove()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260905 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-15 19:25:34 +00:00
Keno Fischer
11adcc4de0 [Cloning] Clone every Function's Debug Info
Summary:
Export the CloneDebugInfoMetadata utility, which clones all debug info
associated with a function into the first module. Also use this function
in CloneModule on each function we clone (the CloneFunction entrypoint
already does this).

Without this, cloning a module will lead to DI quality regressions,
especially since r252219 reversed the Function <-> DISubprogram edge
(before we could get lucky and have this edge preserved if the
DISubprogram itself was, e.g. due to location metadata).

This was verified to fix missing debug information in julia and
a unittest to verify the new behavior is included.

Patch by Yichao Yu! Thanks!

Reviewers: loladiro, pcc
Differential Revision: http://reviews.llvm.org/D17165

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260791 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-13 02:04:29 +00:00
Matt Arsenault
e31b74e98b Add AMDGPU related triple vendors/OSes
As support expands to more runtimes, we'll need to
distinguish between more than just HSA and unknown.
This also lets us stop using unknown everywhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260790 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-13 01:56:21 +00:00
Rong Xu
2ee5bb8ea1 [PGO] Add another interface for annotateValueSite
Add another interface to function annotateValueSite() which directly uses the
VauleData array.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260741 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 21:36:17 +00:00
Argyrios Kyrtzidis
f365222ef2 [ADT] Revert the llvm/ADT/OptionSet.h header and unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260714 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 19:47:35 +00:00
Rafael Espindola
9234391598 Delete the deprecated LLVMLinkModules.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260683 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 15:28:45 +00:00
Argyrios Kyrtzidis
c305a2458d [unittests/ADT] OptionSetTest: ifdef out for now a specific test that fails on MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260663 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 07:50:01 +00:00
Argyrios Kyrtzidis
6ca1d413cb [unittests/ADT] OptionSetTest: ifdef out a part that fails to compile on MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260655 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 05:52:37 +00:00
Argyrios Kyrtzidis
ac79468ce8 [ADT] Introduce ‘OptionSet’ in llvm/ADT headers, which is a utility class that makes it convenient to work with enumerators representing bit options.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260652 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 02:48:26 +00:00
Tim Northover
aee93e78d1 ARMv7k: use Cortex-A7 by default even for tvOS
Also actually test the default CPU from those triples.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 23:49:08 +00:00
Jacques Pienaar
9a9aa40b09 [lanai] Add Lanai triple.
Add triple for the Lanai backend.

General Lanai backend discussion on llvm-dev thread "[RFC] Lanai backend".

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260545 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 17:16:20 +00:00
Rong Xu
2465700839 [PGO] Make the number of records for each value site metada adjustable
The patch adds a parameter in annotateValueSite() to control the max number
of records written to the value profile meta data for each value site. The
default is kept as the current value of 3.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260450 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 22:19:43 +00:00
Reid Kleckner
3833b9b8d1 Fix a -Wsign-compare in Support Path unittests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260418 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 19:29:01 +00:00
Reid Kleckner
6f306397f3 Silence some MSVC warnings about zero extending unsigned to void*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260413 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 19:11:15 +00:00
Xinliang David Li
ebbb19e4e2 [PGO] fix prof symbol lookup bug
Patch by Rong Xu

The problem is exposed by intra-module indirect call promotion where
prof symtab is created from module which does not contain all symbols
from the program. With partial symtab, the result needs to be checked
more strictly.
 





git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260361 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 06:36:55 +00:00
Lang Hames
db7e3d1e5c [Orc] Add lazy-JITting support for i386.
This patch adds a new class, OrcI386, which contains the hooks needed to
support lazy-JITing on i386 (currently only for Pentium 2 or above, as the JIT
re-entry code uses the FXSAVE/FXRSTOR instructions).

Support for i386 is enabled in the LLI lazy JIT and the Orc C API, and
regression and unit tests are enabled for this architecture.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260338 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 01:02:33 +00:00
Peter Collingbourne
40cd497a24 WholeProgramDevirt: introduce.
This pass implements whole program optimization of virtual calls in cases
where we know (via bitset information) that the list of callees is fixed. This
includes the following:

- Single implementation devirtualization: if a virtual call has a single
  possible callee, replace all calls with a direct call to that callee.

- Virtual constant propagation: if the virtual function's return type is an
  integer <=64 bits and all possible callees are readnone, for each class and
  each list of constant arguments: evaluate the function, store the return
  value alongside the virtual table, and rewrite each virtual call as a load
  from the virtual table.

- Uniform return value optimization: if the conditions for virtual constant
  propagation hold and each function returns the same constant value, replace
  each virtual call with that constant.

- Unique return value optimization for i1 return values: if the conditions
  for virtual constant propagation hold and a single vtable's function
  returns 0, or a single vtable's function returns 1, replace each virtual
  call with a comparison of the vptr against that vtable's address.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260312 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 22:50:34 +00:00
Xinliang David Li
a55dfdc22c Add comments to some tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260200 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 05:47:08 +00:00
Xinliang David Li
e8571877c4 Further reduce test overhead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260198 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 05:36:57 +00:00
Nick Lewycky
3775b63f3e Use std::forward to make ErrorOr<T> constructible from a value that has a user-defined conversion to T. No functionality change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260196 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 04:47:58 +00:00
Richard Smith
749e602ac0 Remove TrailingObjects::operator delete. It's still suffering from
compiler-specific issues. Instead, repeat an 'operator delete' definition in
each derived class that is actually deleted, and give up on the static type
safety of an error when sized delete is accidentally used on a type derived
from TrailingObjects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260190 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 02:09:16 +00:00
Richard Smith
bca133d0bb Re-commit r259942 (reverted in r260053) with a different workaround for the MSVC bug.
This fixes undefined behavior in C++14 due to the size of the object being
deleted being different from sizeof(dynamic type) when it is allocated with
trailing objects.

MSVC seems to have several bugs around using-declarations changing the access
of a member inherited from a base class, so use forwarding functions instead of
using-declarations to make TrailingObjects::operator delete accessible where
desired.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260180 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 01:03:42 +00:00
David Blaikie
9f15b40ef7 Simplify some expressions involving unique_ptr and ErrorOr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260179 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 01:02:24 +00:00
Michael Zolotukhin
08d1cff7c6 Factor out UnrollAnalyzer to Analysis, and add unit tests for it.
Summary:
Unrolling Analyzer is already pretty complicated, and it becomes harder and harder to exercise it with usual IR tests, as with them we can only check the final decision: whether the loop is unrolled or not. This change factors this framework out from LoopUnrollPass to analyses, which allows to use unit tests.
The change itself is supposed to be NFC, except adding a couple of tests.

I plan to add more tests as I add new functionality and find/fix bugs.

Reviewers: chandlerc, hfinkel, sanjoy

Subscribers: zzheng, sanjoy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260169 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-08 23:03:59 +00:00
Adrian Prantl
4ebe0588be Simplify this unittest.
Thanks to dblaikie for the suggestion!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260125 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-08 19:13:15 +00:00
Adrian Prantl
c44fb84ad0 Add a unit test for r259973.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260111 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-08 17:02:34 +00:00
Nico Weber
732c5d90b7 Revert 259942, r259943, r259948.
The Windows bots have been failing for the last two days, with:

FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe -c LLVMContextImpl.cpp
D:\buildslave\clang-x64-ninja-win7\llvm\lib\IR\LLVMContextImpl.cpp(137) :
    error C2248: 'llvm::TrailingObjects<llvm::AttributeSetImpl,
                                        llvm::IndexAttrPair>::operator delete' :
        cannot access private member declared in class 'llvm::AttributeSetImpl'
    TrailingObjects.h(298) : see declaration of
        'llvm::TrailingObjects<llvm::AttributeSetImpl,
                               llvm::IndexAttrPair>::operator delete'
    AttributeImpl.h(213) : see declaration of 'llvm::AttributeSetImpl'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260053 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-07 20:09:18 +00:00
Richard Smith
2597d07f15 More workarounds for undefined behavior exposed when compiling in C++14 with
-fsized-deallocation. Disable sized deallocation for all objects derived from
TrailingObjects, as we expect the storage allocated for these objects to be
larger than the size of their dynamic type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259942 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-05 22:32:52 +00:00
Xinliang David Li
f45c13d3a1 [PGO] Add interfaces to annotate instr with VP data
Add interfaces to do value profile data IR annnotation
  and read. Needed by both FE and IR based PGO.





git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259813 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-04 19:11:43 +00:00
Xinliang David Li
730d9343ca [PGO] Profile interface cleanup
- Remove unused valuemapper parameter
  - add totalcount optional parameter





git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259756 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-04 05:29:51 +00:00
Reid Kleckner
0e6e9b9748 [unittests] Move TargetRegistry test from Support to MC
This removes the dependency from SupportTests to all of the LLVM
backends, and makes it link faster.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259705 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-03 21:41:24 +00:00
Reid Kleckner
a58e071c71 Silence -Wsign-conversion issue in ProgramTest.cpp
Unfortunately, ProgramInfo::ProcessId is signed on Unix and unsigned on
Windows, breaking the standard fix of using '0U' in the gtest
expectation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259704 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-03 21:41:12 +00:00
Joseph Tremoulet
d73c4ec417 [Unittest] Clean up formatting, NFC
Summary:
Use an early return to reduce indentation.
Remove unused local.

Reviewers: dblaikie, lhames

Subscribers: lhames, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259663 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-03 17:11:24 +00:00
Xinliang David Li
8fd9cfb481 [PGO] Profile summary reader/writer support
With this patch, the profile summary data will be available in indexed
profile data file so that profiler reader/compiler optimizer can start
to make use of.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259626 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-03 04:08:18 +00:00
Chandler Carruth
d3ec736574 [LCG] Build an edge abstraction for the LazyCallGraph and use it to
differentiate between indirect references to functions an direct calls.

This doesn't do a whole lot yet other than change the print out produced
by the analysis, but it lays the groundwork for a very major change I'm
working on next: teaching the call graph to actually be a call graph,
modeling *both* the indirect reference graph and the call graph
simultaneously. More details on that in the next patch though.

The rest of this is essentially a bunch of over-engineering that won't
be interesting until the next patch. But this also isolates essentially
all of the churn necessary to introduce the edge abstraction from the
very important behavior change necessary in order to separately model
the two graphs. So it should make review of the subsequent patch a bit
easier at the cost of making this patch seem poorly motivated. ;]

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259463 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-02 03:57:13 +00:00
Frederic Riss
f87dc438fd [MCDwarf] Fix encoding of line tables with weird custom parameters
With poorly chosen custom parameters, the line table encoding logic would
sometimes end up generating a special opcode bigger than 255, which is wrong.
The set of default parameters that LLVM uses isn't subject to this bug.

When carefully chosing the line table parameters, it's impossible to fall into the
corner case that this patch fixes. The standard however doesn't require that these
parameters be carefully chosen. And even if it did, we shouldn't generate broken
encoding.

Add a unittest for this specific encoding bug, and while at it, create some unit
tests for the encoding logic using different sets of parameters.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259334 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-31 22:06:35 +00:00
Xinliang David Li
958f45c5b1 Further reduce test time
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259285 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-30 01:37:32 +00:00
Vedant Kumar
0c94d7d441 [Profiling] Add a -sparse mode to llvm-profdata merge
Add an option to llvm-profdata merge for writing out sparse indexed
profiles. These profiles omit InstrProfRecords for functions which are
never executed.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259258 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 22:54:45 +00:00
Xinliang David Li
d127388ad8 Improve test speed/trial 2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259253 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 22:29:15 +00:00
Xinliang David Li
1626c62205 Revert 259242, 259243 -- irrelvante changes pulled in
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259244 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 21:26:31 +00:00
Xinliang David Li
0964903e2c Use range for loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259243 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 21:23:47 +00:00
Xinliang David Li
fd32fbe9a5 Improve test speed (interchange loop, reducing padding)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259242 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 21:13:55 +00:00
Matthias Braun
13a0516b3c SmallPtrSetTest: More checks for the swap() testing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259152 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 03:34:36 +00:00
Matthias Braun
2f0c787077 SmallPtrSetTest: Check that iterators are still valid after erase()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259151 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 03:34:34 +00:00
Reid Kleckner
1689efb4d2 Reland "[CodeView] Use assembler directives for line tables"
This reverts commit r259126 and relands r259117.

This time with updated library dependencies.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259130 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 00:49:42 +00:00
Reid Kleckner
ae8e13919a Revert "[CodeView] Use assembler directives for line tables"
This reverts commit r259117.

The LineInfo constructor is defined in the codeview library and we have
to link against it now. Doing that isn't trivial, so reverting for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259126 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 00:13:28 +00:00
Reid Kleckner
200dc330a0 [CodeView] Use assembler directives for line tables
Adds a new family of .cv_* directives to LLVM's variant of GAS syntax:

- .cv_file: Similar to DWARF .file directives

- .cv_loc: Similar to the DWARF .loc directive, but starts with a
  function id. CodeView line tables are emitted by function instead of
  by compilation unit, so we needed an extra field to communicate this.
  Rather than overloading the .loc direction further, we decided it was
  better to have our own directive.

- .cv_stringtable: Emits the codeview string table at the current
  position. Currently this just contains the filenames as
  null-terminated strings.

- .cv_filechecksums: Emits the file checksum table for all files used
  with .cv_file so far. There is currently no support for emitting
  actual checksums, just filenames.

This moves the line table emission code down into the assembler.  This
is in preparation for implementing the inlined call site line table
format. The inline line table format encoding algorithm requires knowing
the absolute code offsets, so it must run after the assembler has laid
out the code.

David Majnemer collaborated on this patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259117 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 23:31:52 +00:00
Elena Demikhovsky
4f18fcd7a4 Fixed compilation issue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259087 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 20:36:46 +00:00
Kevin Enderby
6bc5c395e1 Fix identify_magic() to check that a file that starts with MH_MAGIC is
at least as big as the mach header to be identified as a Mach-O file and
make sure smaller files are not identified as a Mach-O files but as
unknown files. Also fix identify_magic() so it looks at all 4 bytes of
the filetype field when determining the type of the Mach-O file.
Then fix the macho-invalid-header test case to check that it is an
unknown file and make sure it does not get the error for
object_error::parse_failed.  And also update the unit tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258883 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 23:43:37 +00:00
Reid Kleckner
dc8eb983e7 Handle more edge cases in intrinsic name binary search
I tried to make the AMDGPU intrinsic info table use this instead of
another StringMatcher, and some issues arose.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258871 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 22:33:19 +00:00
Chris Bieneman
caeade4234 Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened."
- Obi Wan Kenobi

Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark

Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258861 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 21:29:08 +00:00
Eugene Zelenko
51ecde1f0a Fix Clang-tidy modernize-use-nullptr and modernize-use-override warnings; other minor fixes.
Differential revision: reviews.llvm.org/D16568


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258831 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 18:48:36 +00:00
Rafael Espindola
859d998768 Add a test showing we can write a vector of floats.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258701 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-25 19:02:20 +00:00
NAKAMURA Takumi
d755861f7e ObjectTransformLayerTest.cpp: Rework r258633. [-Winconsistent-missing-override]
Sorry for the noise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258635 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-23 20:48:50 +00:00
NAKAMURA Takumi
3dd226c84b ObjectTransformLayerTest.cpp: Fix a warning. [-Wredundant-move]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258634 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-23 20:45:55 +00:00
NAKAMURA Takumi
550eae18a9 ObjectTransformLayerTest.cpp: Fix a warning. [-Winconsistent-missing-override]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258633 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-23 20:45:50 +00:00
Joseph Tremoulet
88a19038a7 [ORC] Update ObjectTransformLayer signature
Summary:
Update ObjectTransformLayer::addObjectSet to take the object set by
value rather than reference and pass it to the base layer with move
semantics rather than copy, to match r258185's changes to
ObjectLinkingLayer.

Update the unit test to verify that ObjectTransformLayer's signature stays
in sync with ObjectLinkingLayer's.


Reviewers: lhames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258630 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-23 18:36:01 +00:00
Xinliang David Li
8c37fa8006 Revert 258486 -- for a better fix coming soon
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258538 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 19:53:31 +00:00
Rafael Espindola
e18fd52053 Add ArrayRef support to EndianStream.
Using an array instead of ArrayRef would allow type inference, but
(short of using C99) one would still need to write

    typedef uint16_t VT[];
    LE.write(VT{0x1234, 0x5678});

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258535 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 19:44:46 +00:00
Xinliang David Li
0f05a462e0 [PGO] add an interface needed by icall promotion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258509 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 18:13:34 +00:00
Xinliang David Li
860ed4e8ad [PGO] eliminate use of static variable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258486 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 05:48:40 +00:00
Lang Hames
8b56868097 [Orc] Try to turn Orc execution unit tests back on for Linux.
The fix in r258324 (plus r258354) should allow Orc execution tests to run on
Linux.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258358 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 22:16:14 +00:00
Xinliang David Li
728b07f28e Fix a bug in test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258276 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 02:49:53 +00:00
Xinliang David Li
6d3068a6fb [PGO] Add a new interface to be used by Indirect Call Promotion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258271 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 01:26:34 +00:00
Lang Hames
1665b573d9 [Orc] Refactor ObjectLinkingLayer::addObjectSet to defer loading objects until
they're needed.

Prior to this patch objects were loaded (via RuntimeDyld::loadObject) when they
were added to the ObjectLinkingLayer, but were not relocated and finalized until
a symbol address was requested. In the interim, another object could be loaded
and finalized with the same memory manager, causing relocation/finalization of
the first object to fail (as the first finalization call may have marked the
allocated memory for the first object read-only).

By deferring the loadObject call (and subsequent memory allocations) until an
object file is needed we can avoid prematurely finalizing memory.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258185 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 21:06:38 +00:00
Lang Hames
9bbd5f24d3 [Orc] Revert r258031 - it broke the builders.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258034 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 01:51:51 +00:00
Lang Hames
1f0b665b9d [Orc] Expand a comment explaining a unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258032 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 01:00:19 +00:00