platform/upstream/llvm.git
8 years agoInclude SmallVector.h header in lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPri...
Eric Liu [Mon, 18 Apr 2016 12:21:59 +0000 (12:21 +0000)]
Include SmallVector.h header in lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.h

llvm-svn: 266606

8 years agoAttempt to fix darwin build after header refactor in llvm (r266595)
Pavel Labath [Mon, 18 Apr 2016 12:18:35 +0000 (12:18 +0000)]
Attempt to fix darwin build after header refactor in llvm (r266595)

llvm-svn: 266605

8 years agoHave getRelExpr handle all cases on x86.
Rafael Espindola [Mon, 18 Apr 2016 12:07:13 +0000 (12:07 +0000)]
Have getRelExpr handle all cases on x86.

This requires adding a few more expression types, but is already a small
simplification. Having Writer.cpp know the exact expression will also
allow further simplifications.

llvm-svn: 266604

8 years ago[ARM] AArch32 v8 NEON is still not IEEE-754 compliant
Renato Golin [Mon, 18 Apr 2016 12:06:47 +0000 (12:06 +0000)]
[ARM] AArch32 v8 NEON is still not IEEE-754 compliant

llvm-svn: 266603

8 years ago[mips][ias] Stream macro expansions to output instead of buffering them. NFC.
Daniel Sanders [Mon, 18 Apr 2016 12:06:15 +0000 (12:06 +0000)]
[mips][ias] Stream macro expansions to output instead of buffering them. NFC.

Summary:
This will allows us to eliminate some magic numbers from the offset operand of
branch instructions in favour of symbols and makes it possible to avoid
double-filling delay slots when clang is given -save-temps.

parseDirectiveCpRestore() is calling isIntegratedAssemblerRequired() for the
moment since correctly pushing the generation of these instructions into the
ELF target streamer is tricky enough to warrant a separate patch.

Reviewers: sdardis, vkalintiris

Subscribers: dsanders, llvm-commits, sdardis

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

llvm-svn: 266602

8 years agoMerge duplicated cases. NFC.
Rafael Espindola [Mon, 18 Apr 2016 11:53:42 +0000 (11:53 +0000)]
Merge duplicated cases. NFC.

llvm-svn: 266601

8 years ago[PowerPC] add comment to test
Strahinja Petrovic [Mon, 18 Apr 2016 11:52:14 +0000 (11:52 +0000)]
[PowerPC] add comment to test

Added comment in test for soft-float operations on ppc architecture.
Test commit.

llvm-svn: 266600

8 years agoclang-format: Improve heuristics to detect function declarations/definitions.
Daniel Jasper [Mon, 18 Apr 2016 11:31:21 +0000 (11:31 +0000)]
clang-format: Improve heuristics to detect function declarations/definitions.

Specifically understand ellipses in parameter lists and treat trailing
reference qualifiers and the "{" as signals.

llvm-svn: 266599

8 years agoFixup r266327
Pavel Labath [Mon, 18 Apr 2016 11:01:41 +0000 (11:01 +0000)]
Fixup r266327

Fix XFAILed tests in TestThreadStates for the new signature of wait_for_running_event.

llvm-svn: 266598

8 years agoAdd missing header (NFC)
Mehdi Amini [Mon, 18 Apr 2016 09:33:41 +0000 (09:33 +0000)]
Add missing header (NFC)

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266597

8 years agoAdd missing header (NFC)
Mehdi Amini [Mon, 18 Apr 2016 09:26:29 +0000 (09:26 +0000)]
Add missing header (NFC)

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266596

8 years ago[NFC] Header cleanup
Mehdi Amini [Mon, 18 Apr 2016 09:17:29 +0000 (09:17 +0000)]
[NFC] Header cleanup

Removed some unused headers, replaced some headers with forward class declarations.

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

Patch by Eugene Kosov <claprix@yandex.ru>

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266595

8 years agoAdd missing include for StringRef (NFC)
Mehdi Amini [Mon, 18 Apr 2016 09:08:59 +0000 (09:08 +0000)]
Add missing include for StringRef (NFC)

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266594

8 years ago[asan] [SystemZ] Add slop for stack address detection.
Marcin Koscielnicki [Mon, 18 Apr 2016 09:01:19 +0000 (09:01 +0000)]
[asan] [SystemZ] Add slop for stack address detection.

On s390, siginfo reports the faulting address with page granularity -
we need to mask off the low bits of sp before comparison.

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

llvm-svn: 266593

8 years agoMark P0152R1 as complete.
Eric Fiselier [Mon, 18 Apr 2016 06:58:50 +0000 (06:58 +0000)]
Mark P0152R1 as complete.

llvm-svn: 266592

8 years agoMark LWG issue 2469 as done. Also simplify try_emplace and insert_or_assign implement...
Eric Fiselier [Mon, 18 Apr 2016 06:51:33 +0000 (06:51 +0000)]
Mark LWG issue 2469 as done. Also simplify try_emplace and insert_or_assign implementations in unordered_map

llvm-svn: 266591

8 years agoImplement LWG issue 2219 - support reference_wrapper in INVOKE
Eric Fiselier [Mon, 18 Apr 2016 06:17:30 +0000 (06:17 +0000)]
Implement LWG issue 2219 - support reference_wrapper in INVOKE

llvm-svn: 266590

8 years ago[LLDB][MIPS] Fix TestConcurrentEvents
Mohit K. Bhakkad [Mon, 18 Apr 2016 05:27:42 +0000 (05:27 +0000)]
[LLDB][MIPS] Fix TestConcurrentEvents

Patch by Nitesh Jain

Reviewers: clayborg
Subscribers: jaydeep, bhushan, mohit.bhakkad, sagar
Differential Revision: http://reviews.llvm.org/D18389

llvm-svn: 266589

8 years ago[Orc] Tweak some of the new RPC code to silence a warning (extraneous ';') and
Lang Hames [Mon, 18 Apr 2016 05:22:32 +0000 (05:22 +0000)]
[Orc] Tweak some of the new RPC code to silence a warning (extraneous ';') and
MSVC errors related to constexpr.

llvm-svn: 266588

8 years agoAdd hash specializations for __int128_t. Fixes LWG issue 2119
Eric Fiselier [Mon, 18 Apr 2016 02:54:00 +0000 (02:54 +0000)]
Add hash specializations for __int128_t. Fixes LWG issue 2119

llvm-svn: 266587

8 years agoAdd tests for LWG issue 2361
Eric Fiselier [Mon, 18 Apr 2016 02:31:05 +0000 (02:31 +0000)]
Add tests for LWG issue 2361

llvm-svn: 266586

8 years agoFix LWG issue 2345 - Add insert(value_type&&)
Eric Fiselier [Mon, 18 Apr 2016 01:40:45 +0000 (01:40 +0000)]
Fix LWG issue 2345 - Add insert(value_type&&)

llvm-svn: 266585

8 years agoDelete the now redundant pointsToLocalDynamicGotEntry.
Rafael Espindola [Mon, 18 Apr 2016 01:34:20 +0000 (01:34 +0000)]
Delete the now redundant pointsToLocalDynamicGotEntry.

llvm-svn: 266584

8 years agoHave getRelExpr return the final values for tls gd.
Rafael Espindola [Mon, 18 Apr 2016 01:29:15 +0000 (01:29 +0000)]
Have getRelExpr return the final values for tls gd.

llvm-svn: 266583

8 years agoBitcodeWriter: WorkList => Worklist, NFC
Duncan P. N. Exon Smith [Mon, 18 Apr 2016 01:24:58 +0000 (01:24 +0000)]
BitcodeWriter: WorkList => Worklist, NFC

I have no idea how I chose two different spellings in the space of a
couple of weeks, but now I can't remember what to use where.  Choose
"Worklist".

llvm-svn: 266582

8 years ago[ORC] Generalize the ORC RPC utils to support RPC function return values and
Lang Hames [Mon, 18 Apr 2016 01:06:49 +0000 (01:06 +0000)]
[ORC] Generalize the ORC RPC utils to support RPC function return values and
asynchronous call/handle. Also updates the ORC remote JIT API to use the new
scheme.

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

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

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

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

appendCallAsync - Make an asynchronous call to the given function.

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

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

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

expect and handle - as before.

handleResponse - Handle a response from the remote.

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

llvm-svn: 266581

8 years agoChange getRelExpr to return the final value for TLSLD. NFC.
Rafael Espindola [Mon, 18 Apr 2016 00:28:57 +0000 (00:28 +0000)]
Change getRelExpr to return the final value for TLSLD. NFC.

llvm-svn: 266580

8 years agoLinker: Share a single Metadata map for the lifetime of IRMover
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 23:30:31 +0000 (23:30 +0000)]
Linker: Share a single Metadata map for the lifetime of IRMover

Cache the result of mapping metadata nodes between instances of IRLinker
(i.e., for the lifetime of IRMover).  There shouldn't be any real
functional change here, but this should give a major speedup.  I had
loaned this to Mehdi when he tested performance of r266446, and the two
patches together gave a 10x speedup in metadata mapping.

llvm-svn: 266579

8 years agoMake CreateTargetMachine as small as possible.
Rafael Espindola [Sun, 17 Apr 2016 23:20:08 +0000 (23:20 +0000)]
Make CreateTargetMachine as small as possible.

It is a pity that we have to create a TargetMachine once per thread,
so at least make that code as small as possible.

llvm-svn: 266578

8 years ago[X86] Be explicit about calls to setOperationAction for AVX2 and AVX512 rather than...
Craig Topper [Sun, 17 Apr 2016 22:49:46 +0000 (22:49 +0000)]
[X86] Be explicit about calls to setOperationAction for AVX2 and AVX512 rather than just looping over all vector types and conditinally matching them. NFC

llvm-svn: 266577

8 years agoRevert "NFC: unify clang / LLVM atomic ordering"
JF Bastien [Sun, 17 Apr 2016 21:29:01 +0000 (21:29 +0000)]
Revert "NFC: unify clang / LLVM atomic ordering"

This reverts commit 537951f2f16d6a8542571c7722fcbae07d4e62c2.

Causes an assert in:
  test/Transforms/AtomicExpand/SPARC/libcalls.ll
  (Ordering2 != AtomicOrdering::NotAtomic && "expect atomic MO")

Bot:
  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_check/21724/testReport/junit/LLVM/Transforms_AtomicExpand_SPARC/libcalls_ll/

I'm not getting this assert on my local debug build, but I'll revert
just to be sure.

llvm-svn: 266576

8 years agoRevert "NFC: unify clang / LLVM atomic ordering"
JF Bastien [Sun, 17 Apr 2016 21:28:50 +0000 (21:28 +0000)]
Revert "NFC: unify clang / LLVM atomic ordering"

This reverts commit b0495df9eae2824bee830cc4c94f5441f0d4cbc9.

Same as for the corresponding LLVM revert, an assert seems to fire.

llvm-svn: 266575

8 years agoNFC: unify clang / LLVM atomic ordering
JF Bastien [Sun, 17 Apr 2016 21:01:09 +0000 (21:01 +0000)]
NFC: unify clang / LLVM atomic ordering

Summary:
Depends on http://reviews.llvm.org/D18875

This makes the C11 / C++11 *ABI* atomic ordering accessible from LLVM, as discussed in http://reviews.llvm.org/D18200#inline-151433

Reviewers: jyknight, reames

Subscribers: cfe-commits

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

llvm-svn: 266574

8 years agoNFC: unify clang / LLVM atomic ordering
JF Bastien [Sun, 17 Apr 2016 21:00:57 +0000 (21:00 +0000)]
NFC: unify clang / LLVM atomic ordering

Summary: This makes the C11 / C++11 *ABI* atomic ordering accessible from LLVM, as discussed in http://reviews.llvm.org/D18200#inline-151433

Reviewers: jyknight, reames

Subscribers: llvm-commits

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

llvm-svn: 266573

8 years agoWhen building with LLVM_ENABLE_MODULES, put the module cache into the build
Richard Smith [Sun, 17 Apr 2016 20:58:01 +0000 (20:58 +0000)]
When building with LLVM_ENABLE_MODULES, put the module cache into the build
directory. This is important for build bots to avoid filling up /tmp.

llvm-svn: 266571

8 years agoTransforms: Try harder to fix bootstrap after r266565
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 20:11:09 +0000 (20:11 +0000)]
Transforms: Try harder to fix bootstrap after r266565

This catches two nullptr insertions into the ValueMap I missed in
r266567.  I missed CloneFunction becuase it never calls RemapInstruction
directly.  Here's one of the still-failing bots:
  http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11496

llvm-svn: 266570

8 years agoLinker: Don't double-schedule appending variables
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 19:40:20 +0000 (19:40 +0000)]
Linker: Don't double-schedule appending variables

Add an assertion to ValueMapper that prevents double-scheduling of
GlobalValues to remap, and fix the one place it happened.  There are
tons of tests that fail with this assertion in place and without the
code change, so I'm not adding another.

Although it looks related, r266563 was, indeed, removing dead code.
AFAICT, this cross-file double-scheduling started in r266510 when the
cross-file recursion was removed.

llvm-svn: 266569

8 years ago[ParallelCG] SmallVector<char> -> SmallString.
Davide Italiano [Sun, 17 Apr 2016 19:38:57 +0000 (19:38 +0000)]
[ParallelCG] SmallVector<char> -> SmallString.

llvm-svn: 266568

8 years agoTransforms: Fix bootstrap after r266565
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 19:26:49 +0000 (19:26 +0000)]
Transforms: Fix bootstrap after r266565

Apparently there isn't test coverage for all of these.  I'd appreciate
if someone with could reproduce and send me something to reduce, but for
now I've just looked for users of RemapInstruction and MapValue and
ensured they don't accidentally insert nullptr.  Here is one of the
bootstraps that caught:

  http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11494

llvm-svn: 266567

8 years agoFix a use after move.
Rafael Espindola [Sun, 17 Apr 2016 18:56:49 +0000 (18:56 +0000)]
Fix a use after move.

llvm-svn: 266566

8 years agoValueMapper: Don't allow explicit null mappings of Values, NFC
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 18:53:24 +0000 (18:53 +0000)]
ValueMapper: Don't allow explicit null mappings of Values, NFC

As a follow-up to r123058, assert that there are no null mappings in the
ValueMap instead of just ignoring them when they are there.  There were
a couple of accidental insertions in CloneFunction so I cleaned those up
(caught by testcases).

llvm-svn: 266565

8 years agoKeep only the splitCodegen version that takes a factory.
Rafael Espindola [Sun, 17 Apr 2016 18:42:27 +0000 (18:42 +0000)]
Keep only the splitCodegen version that takes a factory.

This makes it much easier to see that all created TargetMachines are
equivalent.

llvm-svn: 266564

8 years agoIRMover: Remove dead code, NFC
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 18:21:47 +0000 (18:21 +0000)]
IRMover: Remove dead code, NFC

llvm-svn: 266563

8 years agoDeclare MVT::SimpleValueType as an int8_t sized enum. This removes 400 bytes from...
Craig Topper [Sun, 17 Apr 2016 17:37:33 +0000 (17:37 +0000)]
Declare MVT::SimpleValueType as an int8_t sized enum. This removes 400 bytes from TargetLoweringBase and probably other places.

This required changing several places to print VT enums as strings instead of raw ints since the proper method to use to print became ambiguous. This is probably an improvement anyway.

This also appears to save ~8K from an x86 self host build of llc.

llvm-svn: 266562

8 years agoImplement CWG 941 - explicit specializations of deleted function templates
Faisal Vali [Sun, 17 Apr 2016 17:32:04 +0000 (17:32 +0000)]
Implement CWG 941 - explicit specializations of deleted function templates

  template<class T> void f(T) = delete;
  template<> void f(int); // OK.

  f(3); // OK

Implementation strategy:

When an explicit specialization of a function template, a member function template or a member function of a class template is declared, clang first implicitly instantiates the declaration of a specialization from the templated-entity being explicitly specialized (since their signatures must be the same) and then links the explicit specialization being declared as a redeclaration of the aforementioned specialization.

The problem was that when clang 'implicitly instantiates' the initial specialization, it marks the corresponding FunctionDecl as deleted if the corresponding templated-entity was deleted, rather than waiting to see whether the explicit specialization being declared provides a non-deleted body. (The eager marking of delete has advantages during overload resolution I suppose, where we don't have to try and instantiate a definition of the function to see if it is deleted).

The present fix entails recognizing that when clang knows that an explicit specialization is being declared (for whichever templated-entity), the prior implicit instantiation should not inherit the 'deleted' status, and so we reset it to false.

I suppose an alternative fix (amongst others) could consider creating a new context (ExplicitSpecializationDeclarationSubstitution or some such) that is checked during template-argument-deduction and final substitution, and avoid inheriting the deleted status during declaration substitution.  But while conceptually cleaner, that would be a slightly more involved change (as could be some of the other alternatives: such as avoid tagging implicit specializations as deleted, and check their primary templates for the deleted status where needed), and so I chose a different path.  Hopefully it'll prove to not be a bad choice.

llvm-svn: 266561

8 years ago[X86][SSE] Added 16i8 -> 8i64 sext test
Simon Pilgrim [Sun, 17 Apr 2016 15:10:42 +0000 (15:10 +0000)]
[X86][SSE] Added 16i8 -> 8i64 sext test

Shows poor codegen for AVX2

llvm-svn: 266560

8 years ago[X86] Added TODO comment for target shuffle mask decoding of bitcasted masks
Simon Pilgrim [Sun, 17 Apr 2016 11:34:18 +0000 (11:34 +0000)]
[X86] Added TODO comment for target shuffle mask decoding of bitcasted masks

llvm-svn: 266559

8 years agoFix shared build after r266484
Ismail Donmez [Sun, 17 Apr 2016 09:01:51 +0000 (09:01 +0000)]
Fix shared build after r266484

llvm-svn: 266558

8 years ago[X86] Remove unneeded variables
Asaf Badouh [Sun, 17 Apr 2016 08:28:40 +0000 (08:28 +0000)]
[X86] Remove unneeded variables

no functional change.
ExtraLoad and WrapperKind are been used only if (OpFlags == X86II::MO_GOTPCREL).

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

llvm-svn: 266557

8 years agoDebugInfo: Make DICompositeTypes distinct most of the time
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 07:45:08 +0000 (07:45 +0000)]
DebugInfo: Make DICompositeTypes distinct most of the time

Since elements of most kinds of DICompositeType have back references,
most are involved in uniquing cycles.  Except via the ODR 'identifier:'
field, which doesn't care about the storage type (see r266549),
they have no hope of being uniqued.

Distinct nodes are far more efficient, so use them for most kinds of
DICompositeType definitions (i.e., when DIType::isForwardDecl is false).
The exceptions:

  - DW_TAG_array_type, since their elements never have back-references
    and they never have ODR 'identifier:' fields;

  - DW_TAG_enumeration_type when there is no ODR 'identifier:' field,
    since their elements usually don't have back-references.

This breaks the last major uniquing cycle I'm aware of in the debug info
graph.  The impact won't be enormous for C++ because references to
ODR-uniqued nodes still use string-based DITypeRefs; but this should
prevent a regression in C++ when we drop the string-based references.

This wouldn't have been reasonable until r266549, when composite types
stopped relying on being uniqued by structural equivalence to prevent
blow-ups at LTO time.

llvm-svn: 266556

8 years agoLTO: Merge debug info types when linking bitcode
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 07:35:38 +0000 (07:35 +0000)]
LTO: Merge debug info types when linking bitcode

Make sure lld enables ODR type uniquing for debug info when invoking
LTO, as a follow-up to LLVM r266549.

llvm-svn: 266555

8 years ago[AVX512] ISD::MUL v2i64/v4i64 should only be legal if DQI and VLX features are enabled.
Craig Topper [Sun, 17 Apr 2016 07:25:39 +0000 (07:25 +0000)]
[AVX512] ISD::MUL v2i64/v4i64 should only be legal if DQI and VLX features are enabled.

llvm-svn: 266554

8 years agoIR: Fix type-refs in testcase from r266548
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 06:42:30 +0000 (06:42 +0000)]
IR: Fix type-refs in testcase from r266548

There's a hole in the verifier right now: if a module has no compile
units, it never checks that all the string-based DITypeRefs get
resolved.  As a result, this testcase didn't fail the verifier, even
there were references to `!"has-uuid"` instead of `!"uuid"` (the former
was a composite type's 'name:' field, the latter its 'identifier:'
field).

I'm currently working on removing string-based type refs entirely, and
this testcase started failing (because the upgrade script can't resolve
the type refs).  Rather than fixing the (about-to-be-removed) hole in
the verifier, I'm just going to fix the test so that my upgrade script
handles it.

llvm-svn: 266553

8 years agoIR: Use getRawScope() when verifying
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 05:41:09 +0000 (05:41 +0000)]
IR: Use getRawScope() when verifying

Fix a couple of places in the Verifier that call `getScope()` instead of
`getRawScope()`.  Both DIDerivedType::getScope and
DICompositeType::getScope return a DITypeRef right now (which wraps a
Metadata*) so I don't think there's currently an observable bug.  I
found this because a future commit that will change them to cast to
DIScope*.

llvm-svn: 266552

8 years agoFix a typo in rL265762
Sanjoy Das [Sun, 17 Apr 2016 04:30:43 +0000 (04:30 +0000)]
Fix a typo in rL265762

I accidentally replaced `mayBeOverridden` with `!isInterposable`.
Remove the negation and add a test case that would've caught this.

Many thanks to HÃ¥kan Hjort for spotting this!

llvm-svn: 266551

8 years agoRevert "use range loop, try to make comments more meaningful; NFCI"
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 03:59:37 +0000 (03:59 +0000)]
Revert "use range loop, try to make comments more meaningful; NFCI"

This reverts commit r266541 since it introduces a use-after-free:
  http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/11471

llvm-svn: 266550

8 years agoIR: Use an explicit map for debug info type uniquing
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 03:58:21 +0000 (03:58 +0000)]
IR: Use an explicit map for debug info type uniquing

Rather than relying on the structural equivalence of DICompositeType to
merge type definitions, use an explicit map on the LLVMContext that
LLParser and BitcodeReader consult when constructing new nodes.
Each non-forward-declaration DICompositeType with a non-empty
'identifier:' field is stored/loaded from the type map, and the first
definiton will "win".

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

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

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

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

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

llvm-svn: 266549

8 years agoIR: Use ODR to unique DICompositeType members
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 02:30:20 +0000 (02:30 +0000)]
IR: Use ODR to unique DICompositeType members

Merge members that are describing the same member of the same ODR type,
even if other bits differ.  If the file or line differ, we don't care;
if anything else differs, it's an ODR violation (and we still don't
really care).

For DISubprogram declarations, this looks at the LinkageName and Scope.
For DW_TAG_member instances of DIDerivedType, this looks at the Name and
Scope.  In both cases, we know that the Scope follows ODR rules if it
has a non-empty identifier.

llvm-svn: 266548

8 years ago[Target] Reduce size of the LoadExtActions array in TargetLoweringBase by half. Savin...
Craig Topper [Sun, 17 Apr 2016 01:34:37 +0000 (01:34 +0000)]
[Target] Reduce size of the LoadExtActions array in TargetLoweringBase by half. Saving ~18K bytes from the array.

llvm-svn: 266547

8 years ago[Target] Remove checks for Simple VTs before calling routines that can handle Extende...
Craig Topper [Sun, 17 Apr 2016 01:34:35 +0000 (01:34 +0000)]
[Target] Remove checks for Simple VTs before calling routines that can handle Extended VTs too. NFC

llvm-svn: 266546

8 years ago[Target] Fix an assertion that should have been updated when the code below it was...
Craig Topper [Sun, 17 Apr 2016 01:34:32 +0000 (01:34 +0000)]
[Target] Fix an assertion that should have been updated when the code below it was changed in r251033.

llvm-svn: 266545

8 years agoLangRef: Removed some outdated text about DIDerivedType
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 00:45:00 +0000 (00:45 +0000)]
LangRef: Removed some outdated text about DIDerivedType

This text is also incorrect (much like r266540).  It looks like I missed
updating some of what I moved from SourceLevelDebugging.rst in r232566.

llvm-svn: 266544

8 years agoLinker: Clarify test/Linker/type-unique-odr-a.ll, NFC
Duncan P. N. Exon Smith [Sun, 17 Apr 2016 00:26:17 +0000 (00:26 +0000)]
Linker: Clarify test/Linker/type-unique-odr-a.ll, NFC

Split up the long RUN and clarify the CHECK lines:

  - Explicitly confirm there are no other subprograms inside of "A".

  - Remove checks for "bar" and "baz", which were just implicitly
    checking that there were no other subprograms inside of "A".

This prepares for adding a RUN line which links the two files in the
opposite direction.

llvm-svn: 266543

8 years agoIR: Add a configuration point for MDNodeInfo::isEqual, NFC
Duncan P. N. Exon Smith [Sat, 16 Apr 2016 23:42:04 +0000 (23:42 +0000)]
IR: Add a configuration point for MDNodeInfo::isEqual, NFC

This commit has no functionality change, but it adds a configuration
point for MDNodeInfo::isEqual to allow custom uniquing of subclasses of
MDNode, minimizing the diff of a follow-up.

llvm-svn: 266542

8 years agouse range loop, try to make comments more meaningful; NFCI
Sanjay Patel [Sat, 16 Apr 2016 23:26:16 +0000 (23:26 +0000)]
use range loop, try to make comments more meaningful; NFCI

llvm-svn: 266541

8 years agoLangRef: Fix some bugs in debug info descriptions
Duncan P. N. Exon Smith [Sat, 16 Apr 2016 22:46:47 +0000 (22:46 +0000)]
LangRef: Fix some bugs in debug info descriptions

Fix descriptions of DICompositeType and DIDerivedType.

llvm-svn: 266540

8 years agoIR: Remove extra blank line, NFC
Duncan P. N. Exon Smith [Sat, 16 Apr 2016 22:26:04 +0000 (22:26 +0000)]
IR: Remove extra blank line, NFC

llvm-svn: 266539

8 years agoLTO: Use a common LibLTOCodeGenerator::init, NFC
Duncan P. N. Exon Smith [Sat, 16 Apr 2016 22:25:36 +0000 (22:25 +0000)]
LTO: Use a common LibLTOCodeGenerator::init, NFC

llvm-svn: 266538

8 years agoValueMapper: Separate mapping of distinct and uniqued nodes (again)
Duncan P. N. Exon Smith [Sat, 16 Apr 2016 21:44:08 +0000 (21:44 +0000)]
ValueMapper: Separate mapping of distinct and uniqued nodes (again)

Since the result of a mapped distinct node is known up front, it's more
efficient to map them separately from uniqued nodes.  This commit pulls
them out of the post-order traversal and stores them in a worklist to be
remapped at the top-level.

This is essentially reapplying r244181 ("ValueMapper: Rotate distinct
node remapping algorithm") to the new iterative algorithm from r265456
("ValueMapper: Rewrite Mapper::mapMetadata without recursion").

Now that the traversal logic only handles uniqued MDNodes, it's much
simpler to inline it all into MDNodeMapper::createPOT (I've killed the
MDNodeMapper::push and MDNodeMapper::tryToPop helpers and localized the
traversal worklist).

The resulting high-level algorithm for MDNodeMapper::map now looks like
this:

  - Distinct nodes are immediately mapped and added to
    MDNodeMapper::DistinctWorklist using MDNodeMapper::mapDistinctNode.

  - Uniqued nodes are mapped via MDNodeMapper::mapTopLevelUniquedNode,
    which traverses the transitive uniqued subgraph of a node to
    calculate uniqued node mappings in bulk.

      - This is a simplified version of MDNodeMapper::map from before
        this commit (originally r265456) that doesn't traverse through
        any distinct nodes.

      - Distinct nodes are added to MDNodeMapper::DistinctWorklist via
        MDNodeMapper::mapDistinctNode.

      - This uses MDNodeMapper::createPOT to fill a
        MDNodeMapper::UniquedGraph (a post-order traversal and side
        table), UniquedGraph::propagateChanges to track which uniqued
        nodes need to change, and MDNodeMapper::mapNodesInPOT to create
        the uniqued nodes.

      - Placeholders for forward references are now only needed when
        there's a uniquing cycle (a cycle of uniqued nodes unbroken by
        distinct nodes).  This is the key functionality change that
        we're reintroducing (from r244181).  As of r265456, a temporary
        forward reference might be needed for any cycle that involved
        uniqued nodes.

  - After mapping the first node appropriately, MDNodeMapper::map works
    through MDNodeMapper::DistinctWorklist.  For each distinct node, its
    operands are remapped with MDNodeMapper::mapDistinctNode and
    MDNodeMapper::mapTopLevelUniquedNode until all nodes have been
    mapped.

Sadly there's nothing observable I can test here; no real functionality
change, just a compile-time speedup from reduced malloc traffic.

llvm-svn: 266537

8 years agoValueMapper: Only put cyclic nodes into CyclicNodes, NFCI
Duncan P. N. Exon Smith [Sat, 16 Apr 2016 21:09:53 +0000 (21:09 +0000)]
ValueMapper: Only put cyclic nodes into CyclicNodes, NFCI

As a minor fixup to r266258, only track nodes that needed a placeholder
in CyclicNodes in MDNodeMapper::mapUniquedNodes.  There should be no
observable functionality change, just some local memory savings because
CyclicNodes only needs to grow to accommodate nodes that are actually
involved in cycles.  (This was the original intent of r266258, or else
the vector would have been called "ChangedNodes".)

llvm-svn: 266536

8 years ago[X86][AVX] Add shuffle combine tests for MOVDDUP/MOVSHDUP/MOVSLDUP
Simon Pilgrim [Sat, 16 Apr 2016 20:30:59 +0000 (20:30 +0000)]
[X86][AVX] Add shuffle combine tests for MOVDDUP/MOVSHDUP/MOVSLDUP

128, 256 and 512 bit implementations (some not yet supported by combineX86ShuffleChain)

llvm-svn: 266535

8 years ago[X86] Use ternary operator to reduce code slightly. NFC
Craig Topper [Sat, 16 Apr 2016 19:09:32 +0000 (19:09 +0000)]
[X86] Use ternary operator to reduce code slightly. NFC

llvm-svn: 266534

8 years ago[X86][XOP] Added VPPERM constant mask decoding and target shuffle combining support
Simon Pilgrim [Sat, 16 Apr 2016 17:52:07 +0000 (17:52 +0000)]
[X86][XOP] Added VPPERM constant mask decoding and target shuffle combining support

Added additional test that peeks through bitcast to v16i8 mask

llvm-svn: 266533

8 years agoAdd missing #include to fix build
Vedant Kumar [Sat, 16 Apr 2016 17:39:40 +0000 (17:39 +0000)]
Add missing #include to fix build

Failing bot:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/23112/

llvm-svn: 266532

8 years ago[X86][XOP] More VPPERM shuffle mask decode tests
Simon Pilgrim [Sat, 16 Apr 2016 16:37:21 +0000 (16:37 +0000)]
[X86][XOP] More VPPERM shuffle mask decode tests

As requested by D18441

llvm-svn: 266531

8 years agoFix cmake build after r266524.
Oleksiy Vyalov [Sat, 16 Apr 2016 16:29:17 +0000 (16:29 +0000)]
Fix cmake build after r266524.

llvm-svn: 266530

8 years agoValueMapper: Fix unused var warning. NFC
Simon Atanasyan [Sat, 16 Apr 2016 11:49:40 +0000 (11:49 +0000)]
ValueMapper: Fix unused var warning. NFC

llvm-svn: 266529

8 years agoRemove links to deleted TODOs.
Simon Atanasyan [Sat, 16 Apr 2016 11:11:56 +0000 (11:11 +0000)]
Remove links to deleted TODOs.

llvm-svn: 266528

8 years ago[ELF] Include Twine.h header to restore LLD build after r266524. NFC
Simon Atanasyan [Sat, 16 Apr 2016 10:58:45 +0000 (10:58 +0000)]
[ELF] Include Twine.h header to restore LLD build after r266524. NFC

llvm-svn: 266527

8 years agoRecommitted 266457 with fix:
George Rimar [Sat, 16 Apr 2016 10:10:32 +0000 (10:10 +0000)]
Recommitted 266457 with fix:
* Do script driven layout only if SECTIONS section exist.

Initial commit message:

[ELF] - Implemented basic location counter support.

This patch implements location counter support.
It also separates assign addresses for sections to assignAddressesScript() if it scipt exists.

Main testcase is test/ELF/linkerscript-locationcounter.s, It contains some work with location counter. It is basic now.
Implemented location counter assignment and '+' operations.

Patch by myself with LOTS of comments and design suggestions from Rui Ueyama.

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

llvm-svn: 266526

8 years agoAdd missing headers (fix build after headers cleanup in LLVM)
Mehdi Amini [Sat, 16 Apr 2016 08:14:10 +0000 (08:14 +0000)]
Add missing headers (fix build after headers cleanup in LLVM)

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266525

8 years agoRemove some unneeded headers and replace some headers with forward class declarations...
Mehdi Amini [Sat, 16 Apr 2016 07:51:28 +0000 (07:51 +0000)]
Remove some unneeded headers and replace some headers with forward class declarations (NFC)

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

Patch by Eugene Kosov <claprix@yandex.ru>

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266524

8 years agoAdd SVN version to libLLVMLTO
Mehdi Amini [Sat, 16 Apr 2016 07:33:14 +0000 (07:33 +0000)]
Add SVN version to libLLVMLTO

Summary: For Incremental LTO, we need to make sure that an old
cache entry is not used when incrementally re-linking with a new
libLTO.
Adding a global LLVM_REVISION in llvm-config.h would for to
rebuild/relink the world for every "git pull"/"svn update".
So instead only libLTO is made dependent on the VCS and will
be rebuilt (and the dependent binaries relinked, i.e. as of
today: libLTO.dylib and llvm-lto).

Reviewers: beanz

Subscribers: llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266523

8 years agoReplace hardcoded comment at 'lit.site.cfg.in'
Alex Denisov [Sat, 16 Apr 2016 07:14:05 +0000 (07:14 +0000)]
Replace hardcoded comment at 'lit.site.cfg.in'

At the moment almost every lit.site.cfg.in contains two lines comment:

  ## Autogenerated by LLVM/Clang configuration.
  # Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from
configure_lit_site_cfg with the note and some useful information.

llvm-svn: 266522

8 years agoReplace hardcoded comment at 'lit.site.cfg.in'
Alex Denisov [Sat, 16 Apr 2016 07:09:39 +0000 (07:09 +0000)]
Replace hardcoded comment at 'lit.site.cfg.in'

At the moment almost every lit.site.cfg.in contains two lines comment:

  ## Autogenerated by LLVM/Clang configuration.
  # Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from
configure_lit_site_cfg with the note and some useful information.

llvm-svn: 266521

8 years agoReplace hardcoded comment at 'lit.site.cfg.in'
Alex Denisov [Sat, 16 Apr 2016 07:03:45 +0000 (07:03 +0000)]
Replace hardcoded comment at 'lit.site.cfg.in'

At the moment almost every lit.site.cfg.in contains two lines comment:

  ## Autogenerated by LLVM/Clang configuration.
  # Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from
configure_lit_site_cfg with the note and some useful information.

llvm-svn: 266520

8 years agoThinLTO: Move the ODR resolution to be based purely on the summary.
Mehdi Amini [Sat, 16 Apr 2016 07:02:16 +0000 (07:02 +0000)]
ThinLTO: Move the ODR resolution to be based purely on the summary.

This is a requirement for the cache handling in D18494

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266519

8 years agoReplace hardcoded comment at 'lit.site.cfg.in'
Alex Denisov [Sat, 16 Apr 2016 07:01:42 +0000 (07:01 +0000)]
Replace hardcoded comment at 'lit.site.cfg.in'

At the moment almost every lit.site.cfg.in contains two lines comment:

  ## Autogenerated by LLVM/Clang configuration.
  # Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from
configure_lit_site_cfg with the note and some useful information.

llvm-svn: 266518

8 years agoThinLTO: Make aliases explicit in the summary
Mehdi Amini [Sat, 16 Apr 2016 06:56:44 +0000 (06:56 +0000)]
ThinLTO: Make aliases explicit in the summary

To be able to work accurately on the reference graph when taking
decision about internalizing, promoting, renaming, etc. We need
to have the alias information explicit.

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266517

8 years agoReplace hardcoded comment at 'lit.site.cfg.in'
Alex Denisov [Sat, 16 Apr 2016 06:54:46 +0000 (06:54 +0000)]
Replace hardcoded comment at 'lit.site.cfg.in'

At the moment almost every lit.site.cfg.in contains two lines comment:

  ## Autogenerated by LLVM/Clang configuration.
  # Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from
configure_lit_site_cfg with the note and some useful information.

llvm-svn: 266516

8 years agoReplace hardcoded comment at 'lit.site.cfg.in'
Alex Denisov [Sat, 16 Apr 2016 06:47:41 +0000 (06:47 +0000)]
Replace hardcoded comment at 'lit.site.cfg.in'

At the moment almost every lit.site.cfg.in contains two lines comment:

## Autogenerated by LLVM/Clang configuration.
# Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from
configure_lit_site_cfg with the note and some useful information.

llvm-svn: 266515

8 years agoDo not modify a cl::opt programmatically, global mutable state is evil.
Mehdi Amini [Sat, 16 Apr 2016 04:58:30 +0000 (04:58 +0000)]
Do not modify a cl::opt programmatically, global mutable state is evil.

Found by TSAN on ThinLTO.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266514

8 years agoValueMapper: Stop memoizing ConstantAsMetadata
Duncan P. N. Exon Smith [Sat, 16 Apr 2016 03:39:44 +0000 (03:39 +0000)]
ValueMapper: Stop memoizing ConstantAsMetadata

Stop memoizing ConstantAsMetadata in ValueMapper::mapMetadata.  Now we
have to recompute it, but these metadata aren't particularly common, and
it restricts the lifetime of the Metadata map unnecessarily.

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

llvm-svn: 266513

8 years ago[DebugInfo] Correct the assertion introduced in r266509 + update test.
Davide Italiano [Sat, 16 Apr 2016 03:23:48 +0000 (03:23 +0000)]
[DebugInfo] Correct the assertion introduced in r266509 + update test.

llvm-svn: 266512

8 years agoAdd missing override keyword to silence -Winconsistent-missing-override. NFC
Craig Topper [Sat, 16 Apr 2016 02:42:03 +0000 (02:42 +0000)]
Add missing override keyword to silence -Winconsistent-missing-override. NFC

llvm-svn: 266511

8 years agoReapply "ValueMapper: Eliminate cross-file co-recursion, NFC"
Duncan P. N. Exon Smith [Sat, 16 Apr 2016 02:29:55 +0000 (02:29 +0000)]
Reapply "ValueMapper: Eliminate cross-file co-recursion, NFC"

This reverts commit r266507, reapplying r266503 (and r266505
"ValueMapper: Use API from r266503 in unit tests, NFC") completely
unchanged.

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

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

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

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

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

llvm-svn: 266510

8 years ago[DebugInfo] Reduce size of DILocalVariable from 40 to 32 bytes.
Davide Italiano [Sat, 16 Apr 2016 02:27:56 +0000 (02:27 +0000)]
[DebugInfo] Reduce size of DILocalVariable from 40 to 32 bytes.

This significantly contributes to peak memory usage during a
LTO Release+DebugInfo build of clang. In my profile the peak usage
is around 164MB before this change and ~130MB after.

llvm-svn: 266509

8 years agoAMDGPU: Enable LocalStackSlotAllocation pass
Matt Arsenault [Sat, 16 Apr 2016 02:13:37 +0000 (02:13 +0000)]
AMDGPU: Enable LocalStackSlotAllocation pass

This resolves more frame indexes early and folds
the immediate offsets into the scratch mubuf instructions.

This cleans up a lot of the mess that's currently emitted,
such as emitting add 0s and repeatedly initializing the same
register to 0 when spilling.

llvm-svn: 266508

8 years agoRevert "ValueMapper: Eliminate cross-file co-recursion, NFC"
Duncan P. N. Exon Smith [Sat, 16 Apr 2016 02:05:33 +0000 (02:05 +0000)]
Revert "ValueMapper: Eliminate cross-file co-recursion, NFC"

This reverts commit r266503, in case it's the root cause of this bot
failure:

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

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

llvm-svn: 266507

8 years agoAMDGPU: Use s_addk_i32 / s_mulk_i32
Matt Arsenault [Sat, 16 Apr 2016 01:46:49 +0000 (01:46 +0000)]
AMDGPU: Use s_addk_i32 / s_mulk_i32

llvm-svn: 266506