platform/upstream/llvm.git
7 years agoFix _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY to always have default visibility.
Eric Fiselier [Mon, 31 Oct 2016 02:07:23 +0000 (02:07 +0000)]
Fix _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY to always have default visibility.

This prevent the symbols from being both externally available and hidden, which
causes them to be linked incorrectly. This is only a problem when the address
of the function is explicitly taken since it will always be inlined otherwise.

This patch fixes the issues that caused r285456 to be reverted, and can
now be reapplied.

llvm-svn: 285531

7 years agoImprove performance of constructing filesystem::path from strings.
Eric Fiselier [Sun, 30 Oct 2016 23:53:50 +0000 (23:53 +0000)]
Improve performance of constructing filesystem::path from strings.

This patch fixes a performance bug when constructing or appending to a path
from a string or c-string. Previously we called 'push_back' to append every
single character. This caused multiple re-allocation and copies when at most
one reallocation is necessary. The new behavior is to simply call
`string::append` so it can correctly handle reallocation.

For large strings this change is a ~4x improvement. This also makes our path
faster to construct than libstdc++'s.

llvm-svn: 285530

7 years ago[SCEV] In CompareValueComplexity, order global values by their name
Sanjoy Das [Sun, 30 Oct 2016 23:52:56 +0000 (23:52 +0000)]
[SCEV] In CompareValueComplexity, order global values by their name

llvm-svn: 285529

7 years ago[SCEV] Use auto for consistency with an upcoming change; NFC
Sanjoy Das [Sun, 30 Oct 2016 23:52:53 +0000 (23:52 +0000)]
[SCEV] Use auto for consistency with an upcoming change; NFC

llvm-svn: 285528

7 years agoClean up test a little bit; NFC
Sanjoy Das [Sun, 30 Oct 2016 23:52:50 +0000 (23:52 +0000)]
Clean up test a little bit; NFC

llvm-svn: 285527

7 years agoRewrite std::filesystem::path iterators and parser
Eric Fiselier [Sun, 30 Oct 2016 23:30:38 +0000 (23:30 +0000)]
Rewrite std::filesystem::path iterators and parser

This patch entirely rewrites the parsing logic for paths. Unlike the previous
implementation this one stores information about the current state; For example
if we are in a trailing separator or a root separator. This avoids the need for
extra lookahead (and extra work) when incrementing or decrementing an iterator.
Roughly this gives us a 15% speedup over the previous implementation.

Unfortunately this implementation is still a lot slower than libstdc++'s.
Because libstdc++ pre-parses and splits the path upon construction their
iterators are trivial to increment/decrement. This makes libc++ lazy parsing
100x slower than libstdc++. However the pre-parsing libstdc++ causes a ton
of extra and unneeded allocations when constructing the string. For example
`path("/foo/bar/")` would require at least 5 allocations with libstdc++
whereas libc++ uses only one. The non-allocating behavior is much preferable
when you consider filesystem usages like 'exists("/foo/bar/")'.

Even then libc++'s path seems to be twice as slow to simply construct compared
to libstdc++. More investigation is needed about this.

llvm-svn: 285526

7 years agoFix clang installed path to handle case where clang is invoked through a symlink
Mehdi Amini [Sun, 30 Oct 2016 23:26:13 +0000 (23:26 +0000)]
Fix clang installed path to handle case where clang is invoked through a symlink

This code path is used when generating the path to libLTO.dylib, which
is passed to the linker as `-lto_library'.
Without this, if clang is invoked through a symlink, libLTO is
searched in a path relative to where the symlink is instead of
where clang is actually installed.

Fix PR30811.

Patch by: Jack Howarth

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

llvm-svn: 285525

7 years agoAdd start of filesystem benchmarks
Eric Fiselier [Sun, 30 Oct 2016 22:53:00 +0000 (22:53 +0000)]
Add start of filesystem benchmarks

llvm-svn: 285524

7 years agoMark thread exit test as unsupported w/o threads
Eric Fiselier [Sun, 30 Oct 2016 20:05:52 +0000 (20:05 +0000)]
Mark thread exit test as unsupported w/o threads

llvm-svn: 285523

7 years ago[DAG] x | x --> x
Sanjay Patel [Sun, 30 Oct 2016 18:19:35 +0000 (18:19 +0000)]
[DAG] x | x --> x

llvm-svn: 285522

7 years ago[DAG] x & x --> x
Sanjay Patel [Sun, 30 Oct 2016 18:13:30 +0000 (18:13 +0000)]
[DAG] x & x --> x

llvm-svn: 285521

7 years ago[x86] add tests for basic logic op folds
Sanjay Patel [Sun, 30 Oct 2016 18:04:19 +0000 (18:04 +0000)]
[x86] add tests for basic logic op folds

llvm-svn: 285520

7 years agoFixing "type" issue for (epi32)
Michael Zuckerman [Sun, 30 Oct 2016 14:54:05 +0000 (14:54 +0000)]
Fixing "type" issue for (epi32)
and replaceing hardcoded inf with clang builtin inf "__builtin_inff()" for float ({max|min}_{pd|ps})

llvm-svn: 285519

7 years agoRevert r285517 due to build failures.
Dorit Nuzman [Sun, 30 Oct 2016 14:34:57 +0000 (14:34 +0000)]
Revert r285517 due to build failures.

llvm-svn: 285518

7 years ago[LoopVectorize] Make interleaved-accesses analysis less conservative about
Dorit Nuzman [Sun, 30 Oct 2016 12:23:26 +0000 (12:23 +0000)]
[LoopVectorize] Make interleaved-accesses analysis less conservative about
possible pointer-wrap-around concerns, in some cases.

Before this patch, collectConstStridedAccesses (part of interleaved-accesses
analysis) called getPtrStride with [Assume=false, ShouldCheckWrap=true] when
examining all candidate pointers. This is too conservative. Instead, this
patch makes collectConstStridedAccesses use an optimistic approach, calling
getPtrStride with [Assume=true, ShouldCheckWrap=false], and then, once the
candidate interleave groups have been formed, revisits the pointer-wrapping
analysis but only where it matters: namely, in groups that have gaps, and where
the gaps are not at the very end of the group (in which case the loop is
peeled). This second time getPtrStride is called with [Assume=false,
ShouldCheckWrap=true], but this could further be improved to using Assume=true,
once we also add the logic to track that we are not going to meet the scev
runtime checks threshold.

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

llvm-svn: 285517

7 years ago[AVX-512] Remove masked 128/256-bit builtins for vpmaddwd and vpmaddubsw. Replace...
Craig Topper [Sun, 30 Oct 2016 07:11:34 +0000 (07:11 +0000)]
[AVX-512] Remove masked 128/256-bit builtins for vpmaddwd and vpmaddubsw. Replace with unmasked builtins and select.

llvm-svn: 285516

7 years ago[X86] Use intrinsics table for PMADDUBSW and PMADDWD so that we can use the legacy...
Craig Topper [Sun, 30 Oct 2016 06:56:16 +0000 (06:56 +0000)]
[X86] Use intrinsics table for PMADDUBSW and PMADDWD so that we can use the legacy intrinsics to select EVEX encoded instructions when available.

This removes a couple tablegen classes that become unused after this change. Another class gained an additional parameter to allow PMADDUBSW to specify a different result type from its input type.

llvm-svn: 285515

7 years ago [Polly] Remove the unused POLLY_LINK_LIBS for linking polly into
Hongbin Zheng [Sun, 30 Oct 2016 06:07:59 +0000 (06:07 +0000)]
[Polly] Remove the unused POLLY_LINK_LIBS for linking polly into
tools

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

llvm-svn: 285514

7 years ago[ThinLTO] Use per-summary flag to prevent exporting locals used in inline asm
Teresa Johnson [Sun, 30 Oct 2016 05:40:44 +0000 (05:40 +0000)]
[ThinLTO] Use per-summary flag to prevent exporting locals used in inline asm

Summary:
Instead of using the workaround of suppressing the entire index for
modules that call inline asm that may reference locals, use the
NoRename flag on the summary for any locals in the llvm.used set, and
add a reference edge from any functions containing inline asm.

This avoids issues from having no summaries despite the module defining
global values, which was preventing more aggressive index-based
optimization. It will be followed by a subsequent patch to make a
similar fix for local references in module level asm (to fix PR30610).

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 285513

7 years ago[ThinLTO] Correctly resolve linkonce when importing aliasee
Teresa Johnson [Sun, 30 Oct 2016 05:15:23 +0000 (05:15 +0000)]
[ThinLTO] Correctly resolve linkonce when importing aliasee

Summary:
When we have an aliasee that is linkonce, while we can't convert
the non-prevailing copies to available_externally, we still need to
convert the prevailing copy to weak. If a reference to the aliasee
is exported, not converting a copy to weak will result in undefined
references when the linkonce is removed in its original module.

Add a new test and update existing tests.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 285512

7 years agoclang/test/Driver/openmp-offload.c: Relax expressions if "ld.exe" exists, like mingw.
NAKAMURA Takumi [Sun, 30 Oct 2016 02:58:48 +0000 (02:58 +0000)]
clang/test/Driver/openmp-offload.c: Relax expressions if "ld.exe" exists, like mingw.

llvm-svn: 285511

7 years ago[X86] Don't use loadv2i64 on SSE version of PMULHRSW. Use memopv2i64 instead.
Craig Topper [Sun, 30 Oct 2016 00:02:55 +0000 (00:02 +0000)]
[X86] Don't use loadv2i64 on SSE version of PMULHRSW. Use memopv2i64 instead.

This bug was introduced in r285501.

llvm-svn: 285510

7 years agoNativeFormatting.cpp: Fix build for mingw. Where would writePadding() be?
NAKAMURA Takumi [Sat, 29 Oct 2016 23:14:18 +0000 (23:14 +0000)]
NativeFormatting.cpp: Fix build for mingw. Where would writePadding() be?

llvm-svn: 285509

7 years ago[ThinLTO] Rename doPromoteLocalToGlobal to shouldPromoteLocalToGlobal (NFC)
Teresa Johnson [Sat, 29 Oct 2016 21:52:23 +0000 (21:52 +0000)]
[ThinLTO] Rename doPromoteLocalToGlobal to shouldPromoteLocalToGlobal (NFC)

Rename as suggested in code review for D26063.

llvm-svn: 285508

7 years ago[ThinLTO] Use NoPromote flag in summary during promotion
Teresa Johnson [Sat, 29 Oct 2016 21:31:48 +0000 (21:31 +0000)]
[ThinLTO] Use NoPromote flag in summary during promotion

Summary:
Replace the check of whether a GV has a section with the flag check
in the summary. This is in preparation for using the NoPromote flag
to convey other situations when we can't promote (e.g. locals used in
inline asm).

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 285507

7 years agoIR: Remove a no longer needed assert.
Peter Collingbourne [Sat, 29 Oct 2016 20:57:12 +0000 (20:57 +0000)]
IR: Remove a no longer needed assert.

This assert was checking for a miscompile in a version of GCC that
we no longer support.

llvm-svn: 285506

7 years ago[AVX-512] Remove 128/256-bit masked pmulhrsw/pmulhuw/pmulhw builtins and use unmasked...
Craig Topper [Sat, 29 Oct 2016 19:02:14 +0000 (19:02 +0000)]
[AVX-512] Remove 128/256-bit masked pmulhrsw/pmulhuw/pmulhw builtins and use unmasked builtins and select instead.

llvm-svn: 285505

7 years ago[AVX-512] Remove masked 128/256-bit sqrt builtins and replace them with unmasked...
Craig Topper [Sat, 29 Oct 2016 19:02:10 +0000 (19:02 +0000)]
[AVX-512] Remove masked 128/256-bit sqrt builtins and replace them with unmasked builtins and a select.

llvm-svn: 285504

7 years ago[AVX-512] Remove masked 128/256-bit pmuludq/pmuldq builtins and replace them with...
Craig Topper [Sat, 29 Oct 2016 19:02:07 +0000 (19:02 +0000)]
[AVX-512] Remove masked 128/256-bit pmuludq/pmuldq builtins and replace them with unmasked builtins and a select.

llvm-svn: 285503

7 years ago[AVX-512] Remove masked 128/256-bit floating point max/min builtins. Use unmasked...
Craig Topper [Sat, 29 Oct 2016 19:02:03 +0000 (19:02 +0000)]
[AVX-512] Remove masked 128/256-bit floating point max/min builtins. Use unmasked builtins with select instead.

llvm-svn: 285502

7 years ago[X86] Use intrinsics table for VPMULHRSW intrincis so that the legacy intrinsics...
Craig Topper [Sat, 29 Oct 2016 18:41:45 +0000 (18:41 +0000)]
[X86] Use intrinsics table for VPMULHRSW intrincis so that the legacy intrinsics can select EVEX encoded instructions when available.

This requires a minor rename of the instructions due to the use of different tablegen classes and how the names are concatenated.

llvm-svn: 285501

7 years agoFactor finding of libc++ include path out of building -cc1 arguments.
Richard Smith [Sat, 29 Oct 2016 17:28:48 +0000 (17:28 +0000)]
Factor finding of libc++ include path out of building -cc1 arguments.

llvm-svn: 285500

7 years ago[ValueTracking] recognize more variants of smin/smax
Sanjay Patel [Sat, 29 Oct 2016 16:21:19 +0000 (16:21 +0000)]
[ValueTracking] recognize more variants of smin/smax

Try harder to detect obfuscated min/max patterns: the initial pattern was added with D9352 / rL236202.
There was a bug fix for PR27137 at rL264996, but I think we can do better by folding the corresponding
smax pattern and commuted variants.

The codegen tests demonstrate the effect of ValueTracking on the backend via SelectionDAGBuilder. We
can't expose these differences minimally in IR because we don't have smin/smax intrinsics for IR.

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

llvm-svn: 285499

7 years ago[x86] add tests for smin/smax matchSelPattern (D26091)
Sanjay Patel [Sat, 29 Oct 2016 16:02:57 +0000 (16:02 +0000)]
[x86] add tests for smin/smax matchSelPattern (D26091)

llvm-svn: 285498

7 years ago[Devirtualization] Decorate vfunction load with invariant.load
Piotr Padlewski [Sat, 29 Oct 2016 15:28:30 +0000 (15:28 +0000)]
[Devirtualization] Decorate vfunction load with invariant.load

Summary:
This patch was introduced one year ago, but because my google account
was disabled, I didn't get email with failing buildbot and I missed
revert of this commit. There was small but in test regex.
I am back.

Reviewers: rsmith, rengolin

Subscribers: nlewycky, rjmccall, cfe-commits

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

llvm-svn: 285497

7 years agoNFC small format
Piotr Padlewski [Sat, 29 Oct 2016 15:28:25 +0000 (15:28 +0000)]
NFC small format

llvm-svn: 285496

7 years ago[InstCombine] re-use bitcasted compare operands in selects (PR28001)
Sanjay Patel [Sat, 29 Oct 2016 15:22:04 +0000 (15:22 +0000)]
[InstCombine] re-use bitcasted compare operands in selects (PR28001)

These mixed bitcast patterns show up with SSE/AVX intrinsics because we bitcast function parameters to <2 x i64>.

The bitcasts obfuscate the expected min/max forms as shown in PR28001:
https://llvm.org/bugs/show_bug.cgi?id=28001#c6

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

llvm-svn: 285495

7 years ago[DAGCombiner] (REAPPLIED) Add vector demanded elements support to computeKnownBits
Simon Pilgrim [Sat, 29 Oct 2016 11:29:39 +0000 (11:29 +0000)]
[DAGCombiner] (REAPPLIED) Add vector demanded elements support to computeKnownBits

Currently computeKnownBits returns the common known zero/one bits for all elements of vector data, when we may only be interested in one/some of the elements.

This patch adds a DemandedElts argument that allows us to specify the elements we actually care about. The original computeKnownBits implementation calls with a DemandedElts demanding all elements to match current behaviour. Scalar types set this to 1.

The approach was found to be easier than trying to add a per-element known bits solution, for a similar usefulness given the combines where computeKnownBits is typically used.

I've only added support for a few opcodes so far (the ones that have proven straightforward to test), all others will default to demanding all elements but can be updated in due course.

DemandedElts support could similarly be added to computeKnownBitsForTargetNode in a future commit.

This looked like this had caused compile time regressions on some buildbots (and was reverted in rL285381), but appears to have just been a harmless bystander!

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

llvm-svn: 285494

7 years ago[X86][AVX512][Clang][Intrinsics][reduce] Adding missing reduce (max|min) intrinsics...
Michael Zuckerman [Sat, 29 Oct 2016 10:29:20 +0000 (10:29 +0000)]
[X86][AVX512][Clang][Intrinsics][reduce] Adding missing reduce (max|min) intrinsics to Clang .

After LGTM and Check-all

Vector-reduction arithmetic accepts vectors as inputs and produces
scalars as outputs.This class of vector operation forms the basis
of many scientific computations. In vector-reduction arithmetic,
the evaluation off is independent of the order of the input elements of V.

Reviewer: 1. craig.topper
          2. igorb

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

llvm-svn: 285493

7 years agoFixed FMA + FNEG combine.
Elena Demikhovsky [Sat, 29 Oct 2016 08:44:46 +0000 (08:44 +0000)]
Fixed FMA + FNEG combine.
Masked form of FMA should be omitted in this optimization.

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

llvm-svn: 285492

7 years ago[ScopDetect] Use SCEVRewriteVisitor to simplify SCEVRemoveSMax rewriter
Tobias Grosser [Sat, 29 Oct 2016 06:19:34 +0000 (06:19 +0000)]
[ScopDetect] Use SCEVRewriteVisitor to simplify SCEVRemoveSMax rewriter

ScalarEvolution got at some pointer a SCEVRewriteVisitor. Use it to simplify
our SCEVRemoveSMax visitor.

llvm-svn: 285491

7 years agoAMDGPU: Use 1/2pi inline imm on VI
Matt Arsenault [Sat, 29 Oct 2016 04:05:06 +0000 (04:05 +0000)]
AMDGPU: Use 1/2pi inline imm on VI

I'm guessing at how it is supposed to be printed

llvm-svn: 285490

7 years agoAttempt to fix a buildbot really this time.
Rui Ueyama [Sat, 29 Oct 2016 01:28:06 +0000 (01:28 +0000)]
Attempt to fix a buildbot really this time.

llvm-svn: 285489

7 years agoAArch64DeadRegisterDefinitionsPass: Cleanup; NFC
Matthias Braun [Sat, 29 Oct 2016 01:03:41 +0000 (01:03 +0000)]
AArch64DeadRegisterDefinitionsPass: Cleanup; NFC

- Fix doxygen file comment
- reduce indentation in loop
- Factor out some common subexpressions
- Move independent helper function out of class
- Fix Changed flag (this is not strictly NFC but a bugfix, but the flag
  seems ignored anyway)

llvm-svn: 285488

7 years agoDefine calculateDbgStreamSize for consistency.
Rui Ueyama [Sat, 29 Oct 2016 00:56:44 +0000 (00:56 +0000)]
Define calculateDbgStreamSize for consistency.

llvm-svn: 285487

7 years ago[APFloat] Remove the redundent function body of uninitialized ctor, which should...
Tim Shen [Sat, 29 Oct 2016 00:51:41 +0000 (00:51 +0000)]
[APFloat] Remove the redundent function body of uninitialized ctor, which should be done in r285468

llvm-svn: 285486

7 years agoRevert "Added 'inline' attribute to basic_string's destructor"
Mehdi Amini [Sat, 29 Oct 2016 00:50:02 +0000 (00:50 +0000)]
Revert "Added 'inline' attribute to basic_string's destructor"

This reverts commit r285456, which broke LTO bootstrap on Darwin.

llvm-svn: 285485

7 years agoLimit LLDB_EXPORT_ALL_SYMBOLS to lldb symbols
Todd Fiala [Sat, 29 Oct 2016 00:29:15 +0000 (00:29 +0000)]
Limit LLDB_EXPORT_ALL_SYMBOLS to lldb symbols

LLDB_EXPORT_ALL_SYMBOLS used to instruct the build to export all
the symbols in liblldb on CMake builds.  This change limits the
CMake define to only add in the lldb_private namespace to the
symbols that normally get exported, such that we export all the
symbols in the public lldb namespace and the lldb_private namespace.

This is a fix for:
https://llvm.org/bugs/show_bug.cgi?id=30822

Reviewers: labath, beanz

Subscribers: lldb-commits

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

llvm-svn: 285484

7 years agoResubmit "Add support for advanced number formatting."
Zachary Turner [Sat, 29 Oct 2016 00:27:22 +0000 (00:27 +0000)]
Resubmit "Add support for advanced number formatting."

This resubmits r284436 and r284437, which were reverted in
r284462 as they were breaking the AArch64 buildbot.

The breakage on AArch64 turned out to be a miscompile which is
still not fixed, but is actively tracked at llvm.org/pr30748.

This resubmission re-writes the code in a way so as to make the
miscompile not happen.

llvm-svn: 285483

7 years ago[asan] Set the darwin deployment target for the dead-strip test
Anna Zaks [Sat, 29 Oct 2016 00:27:07 +0000 (00:27 +0000)]
[asan] Set the darwin deployment target for the dead-strip test

ASan dead-strip support relies on a linker option that only exists
in 10.11 and later, so the LLVM instrumentation checks for the deployment
target. This test does not pass when clang is built to choose lower
deployment target by default but runs on newer host.

(Note, the REQUIRES: osx-ld64-live_support clause only checks the host
and not the target OS.)

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

llvm-svn: 285482

7 years agoDo not print out Flags field twice.
Rui Ueyama [Fri, 28 Oct 2016 23:57:37 +0000 (23:57 +0000)]
Do not print out Flags field twice.

llvm-svn: 285481

7 years ago[DAGCombiner] Fix a crash visiting `AND` nodes.
Davide Italiano [Fri, 28 Oct 2016 23:55:32 +0000 (23:55 +0000)]
[DAGCombiner] Fix a crash visiting `AND` nodes.

Instead of asserting that the shift count is != 0 we just bail out
as it's not profitable trying to optimize a node which will be
removed anyway.

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

llvm-svn: 285480

7 years agoAMDGPU/SI: Don't use non-0 waitcnt values when waiting on Flat instructions
Tom Stellard [Fri, 28 Oct 2016 23:53:48 +0000 (23:53 +0000)]
AMDGPU/SI: Don't use non-0 waitcnt values when waiting on Flat instructions

Summary:
Flat instruction can return out of order, so we need always need to wait
for all the outstanding flat operations.

Reviewers: tony-tye, arsenm

Subscribers: kzhuravl, wdng, nhaehnle, llvm-commits, yaxunl

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

llvm-svn: 285479

7 years agobuild: give aliases the same visibility
Saleem Abdulrasool [Fri, 28 Oct 2016 23:37:50 +0000 (23:37 +0000)]
build: give aliases the same visibility

ARM EABI also uses function aliases.  Ensure that those aliased functions are
given proper visibility annotations.

llvm-svn: 285478

7 years agobuiltins: ensure that VISIBILITY_HIDDEN is defined properly
Saleem Abdulrasool [Fri, 28 Oct 2016 23:19:03 +0000 (23:19 +0000)]
builtins: ensure that VISIBILITY_HIDDEN is defined properly

The CMake build system had missed this macro as part of the build of the
builtins.  This would result in the builtins exporting symbols which are
implemented in assembly with global visibility.  Ensure that the assembly
optimized routines are given the same visibility as the C routines.

llvm-svn: 285477

7 years agoAMDGPU: Fix instruction flags for s_endpgm
Matt Arsenault [Fri, 28 Oct 2016 23:00:38 +0000 (23:00 +0000)]
AMDGPU: Fix instruction flags for s_endpgm

Set isReturn, remove hasSideEffects. Also remove
hasCtrlDep, I'm not really sure what that does.

llvm-svn: 285476

7 years agoRefactor DW_LNE_* into Dwarf.def
Adrian Prantl [Fri, 28 Oct 2016 22:57:02 +0000 (22:57 +0000)]
Refactor DW_LNE_* into Dwarf.def

llvm-svn: 285475

7 years agoRefactor DW_LNS_* into Dwarf.def
Adrian Prantl [Fri, 28 Oct 2016 22:56:59 +0000 (22:56 +0000)]
Refactor DW_LNS_* into Dwarf.def

llvm-svn: 285474

7 years agoRefactor DW_APPLE_PROPERTY_* into Dwarf.def
Adrian Prantl [Fri, 28 Oct 2016 22:56:56 +0000 (22:56 +0000)]
Refactor DW_APPLE_PROPERTY_* into Dwarf.def

llvm-svn: 285473

7 years agoRefactor DW_CFA_* into Dwarf.def
Adrian Prantl [Fri, 28 Oct 2016 22:56:53 +0000 (22:56 +0000)]
Refactor DW_CFA_* into Dwarf.def

llvm-svn: 285472

7 years agoRemove whitespace
Adrian Prantl [Fri, 28 Oct 2016 22:56:50 +0000 (22:56 +0000)]
Remove whitespace

llvm-svn: 285471

7 years agoRefactor all DW_FORM_* constants into Dwarf.def
Adrian Prantl [Fri, 28 Oct 2016 22:56:45 +0000 (22:56 +0000)]
Refactor all DW_FORM_* constants into Dwarf.def

llvm-svn: 285470

7 years agoRemove files missed in r285466
Eric Fiselier [Fri, 28 Oct 2016 22:54:24 +0000 (22:54 +0000)]
Remove files missed in r285466

llvm-svn: 285469

7 years ago[APFloat] Fix memory bugs revealed by MSan
Tim Shen [Fri, 28 Oct 2016 22:45:33 +0000 (22:45 +0000)]
[APFloat] Fix memory bugs revealed by MSan

Reviewers: eugenis, hfinkel, kbarton, iteratee, echristo

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 285468

7 years agoSDAG: Make sure we use an allocatable reg class when we create this vreg
Justin Bogner [Fri, 28 Oct 2016 22:42:54 +0000 (22:42 +0000)]
SDAG: Make sure we use an allocatable reg class when we create this vreg

As per the discussion on r280783, if constrainRegClass fails we need
to call getAllocatableClass like we did before that commit.

llvm-svn: 285467

7 years agoRevert addition of __libcpp_library_version
Eric Fiselier [Fri, 28 Oct 2016 22:37:24 +0000 (22:37 +0000)]
Revert addition of __libcpp_library_version

llvm-svn: 285466

7 years ago[libFuzzer] mention one more trophie
Kostya Serebryany [Fri, 28 Oct 2016 22:03:54 +0000 (22:03 +0000)]
[libFuzzer] mention one more trophie

llvm-svn: 285465

7 years agoAdd missing lit.local.cfg to llvm/test/Transforms/CodeGenPrepare/NVPTX.
Justin Lebar [Fri, 28 Oct 2016 21:56:07 +0000 (21:56 +0000)]
Add missing lit.local.cfg to llvm/test/Transforms/CodeGenPrepare/NVPTX.

llvm-svn: 285464

7 years agoAMDGPU: Add definitions for scalar store instructions
Matt Arsenault [Fri, 28 Oct 2016 21:55:15 +0000 (21:55 +0000)]
AMDGPU: Add definitions for scalar store instructions

Also add glc bit to the scalar loads since they exist on VI
and change the caching behavior.

This currently has an assembler bug where the glc bit is incorrectly
accepted on SI/CI which do not have it.

llvm-svn: 285463

7 years agoAMDGPU: Rename glc operand type
Matt Arsenault [Fri, 28 Oct 2016 21:55:08 +0000 (21:55 +0000)]
AMDGPU: Rename glc operand type

While trying to add the glc bit to SMEM instructions on VI
with the new refactoring I ran into some kind of shadowing
problem for the glc operand when using the pseudoinstruction
as a multiclass parameter.

Everywhere that currently uses it defines the operand to have the same
name as its type, i.e. glc:$glc which works. For some reason now it
conflicts, and its up evaluating to the wrong thing. For the
real encoding classes,

let Inst{16} = !if(ps.has_glc, glc, ?); was not being evaluated
and still visible in the Inst initializer in the expanded td file.
In other cases I got a a different error about an illegal operand
where this was using { 0 } initializer from the bits<1> glc initializer
instead of evaluating it as false in the if.

For consistency all of the operand types should probably
be captialized to avoid conflicting with the variable names
unless somebody has a better idea of how to fix this.

llvm-svn: 285462

7 years ago[NVPTX] Compute 'rem' using the result of 'div', if possible.
Justin Lebar [Fri, 28 Oct 2016 21:44:00 +0000 (21:44 +0000)]
[NVPTX] Compute 'rem' using the result of 'div', if possible.

Summary:
In isel, transform

  Num % Den

into

  Num - (Num / Den) * Den

if the result of Num / Den is already available.

Reviewers: tra

Subscribers: hfinkel, llvm-commits, jholewinski

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

llvm-svn: 285461

7 years agoDon't leave unused divs/rems sitting around in BypassSlowDivision.
Justin Lebar [Fri, 28 Oct 2016 21:43:54 +0000 (21:43 +0000)]
Don't leave unused divs/rems sitting around in BypassSlowDivision.

Summary:
This "pass" eagerly creates div and rem instructions even when only one
is needed -- it relies on a later pass (machine DCE?) to clean them up.

This is problematic not just from a cleanliness perspective (this pass
is running during CodeGenPrepare, so should leave the IR in a better
state), but it also creates a problem for instruction selection.  If we
always have a div+rem, isel will always select a divrem instruction (if
possible), even when a single div or rem would do.

Specifically, in NVPTX, we want to compute rem from the output of div,
if available.  But if a div is not available, we want to leave the rem
alone.  This transformation is overeager if div is always available.

Because this code runs as part of CodeGenPrepare, it's nontrivial to
write a test for this change.  But this will effectively be tested by
a later patch which adds the aforementioned change to NVPTX isel.

Reviewers: tra

Subscribers: llvm-commits

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

llvm-svn: 285460

7 years agoDon't claim the udiv created in BypassSlowDivision is exact.
Justin Lebar [Fri, 28 Oct 2016 21:43:51 +0000 (21:43 +0000)]
Don't claim the udiv created in BypassSlowDivision is exact.

Summary:
In BypassSlowDivision's short-dividend path, we would create e.g.

  udiv exact i32 %a, %b

"exact" here means that we are asserting that %a is a multiple of %b.
But we have no reason to believe this must be true -- this is just a
bug, as far as I can tell.

Reviewers: tra

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 285459

7 years agoMake a function static. NFC.
George Burgess IV [Fri, 28 Oct 2016 21:42:06 +0000 (21:42 +0000)]
Make a function static. NFC.

llvm-svn: 285458

7 years ago[Sema] Delay partial availability diagnostics, just like deprecated
Erik Pilkington [Fri, 28 Oct 2016 21:39:27 +0000 (21:39 +0000)]
[Sema] Delay partial availability diagnostics, just like deprecated

This is done so that the following compiles with no warnings:
int fn(type_10_12) __attribute__((availability(macos, introduced=10.12)));

Differential revision: https://reviews.llvm.org/D25284

llvm-svn: 285457

7 years agoAdded 'inline' attribute to basic_string's destructor
Aditya Kumar [Fri, 28 Oct 2016 21:27:24 +0000 (21:27 +0000)]
Added 'inline' attribute to basic_string's destructor

Author: laxmansole

Reviewers: howard.hinnant
           mclow.lists
Subscribers: EricWF, flyingforyou, evandro

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

Reapplying the patch as the bug https://llvm.org/bugs/show_bug.cgi?id=30341 is fixed.

Currently basic_string's destructor is not getting inlined. So adding 'inline' attribute to ~basic_string().
Worked in collaboration with Aditya Kumar.

llvm-svn: 285456

7 years agotsan: add a hook to obtain number of reports
Dmitry Vyukov [Fri, 28 Oct 2016 21:25:37 +0000 (21:25 +0000)]
tsan: add a hook to obtain number of reports

Requested in:
https://github.com/golang/go/issues/15972
Will help to fail individual test cases with races.

llvm-svn: 285455

7 years agotsan: round Go shadow to page boundary
Dmitry Vyukov [Fri, 28 Oct 2016 21:24:29 +0000 (21:24 +0000)]
tsan: round Go shadow to page boundary

There is a corner case reported in Go issue tracker:
https://github.com/golang/go/issues/17065
On darwin data/bss segments may not be aligned to page bounary
and mmap seems to be behaving differently than on linux
(shrinks instead of enlarge unaligned regions).

Explicitly round shadow to page bounary before mapping
to avoid any such problems.

llvm-svn: 285454

7 years agoAttempt to fix a buildbot.
Rui Ueyama [Fri, 28 Oct 2016 21:09:56 +0000 (21:09 +0000)]
Attempt to fix a buildbot.

llvm-svn: 285453

7 years agoConsolidate BumpPtrAllocators.
Rui Ueyama [Fri, 28 Oct 2016 20:57:25 +0000 (20:57 +0000)]
Consolidate BumpPtrAllocators.

Previously, we have a lot of BumpPtrAllocators, but all these
allocators virtually have the same lifetime because they are
not freed until the linker finishes its job. This patch aggregates
them into a single allocator.

Differential revision: https://reviews.llvm.org/D26042

llvm-svn: 285452

7 years agotsan: set disable_coredump=0 by default for Go
Dmitry Vyukov [Fri, 28 Oct 2016 20:52:22 +0000 (20:52 +0000)]
tsan: set disable_coredump=0 by default for Go

Go maps shadow memory lazily, so we don't have the huge multi-TB mapping.
Virtual memory consumption is proportional to normal memory usage.
Also in Go core dumps are enabled explicitly with GOTRACEBACK=crash,
if user explicitly requests a core that must be on purpose.

So don't disable core dumps by default.

llvm-svn: 285451

7 years agocmake: Enable the lto cache when building with -flto=thin on darwin
Justin Bogner [Fri, 28 Oct 2016 20:48:47 +0000 (20:48 +0000)]
cmake: Enable the lto cache when building with -flto=thin on darwin

llvm-svn: 285450

7 years agoAMDGPU: Change check prefix in test
Matt Arsenault [Fri, 28 Oct 2016 20:33:01 +0000 (20:33 +0000)]
AMDGPU: Change check prefix in test

llvm-svn: 285449

7 years agoFix a copy&paste error in the macro definition for HANDLE_DW_MACRO and
Adrian Prantl [Fri, 28 Oct 2016 20:32:17 +0000 (20:32 +0000)]
Fix a copy&paste error in the macro definition for HANDLE_DW_MACRO and
HANDLE_DE_RLE. Caught by the LLDB build bot.

llvm-svn: 285448

7 years agoAMDGPU: Diagnose using too many SGPRs
Matt Arsenault [Fri, 28 Oct 2016 20:31:47 +0000 (20:31 +0000)]
AMDGPU: Diagnose using too many SGPRs

This is possible when using inline asm.

llvm-svn: 285447

7 years agoFix handling of constructor inherited through multiple levels of virtual base class.
Richard Smith [Fri, 28 Oct 2016 20:20:58 +0000 (20:20 +0000)]
Fix handling of constructor inherited through multiple levels of virtual base class.

llvm-svn: 285446

7 years agoFix Clang 3.6 build error
Eric Fiselier [Fri, 28 Oct 2016 20:19:36 +0000 (20:19 +0000)]
Fix Clang 3.6 build error

llvm-svn: 285445

7 years agoRemove redundant prefixes from constants and unbreak the LLDB bots.
Adrian Prantl [Fri, 28 Oct 2016 20:18:26 +0000 (20:18 +0000)]
Remove redundant prefixes from constants and unbreak the LLDB bots.

llvm-svn: 285444

7 years agotsan: always define SANITIZER_GO
Dmitry Vyukov [Fri, 28 Oct 2016 20:14:18 +0000 (20:14 +0000)]
tsan: always define SANITIZER_GO

Currently we either define SANITIZER_GO for Go or don't define it at all for C++.
This works fine with preprocessor (ifdef/ifndef/defined), but does not work
for C++ if statements (e.g. if (SANITIZER_GO) {...}). Also this is different
from majority of SANITIZER_FOO macros which are always defined to either 0 or 1.

Always define SANITIZER_GO to either 0 or 1.
This allows to use SANITIZER_GO in expressions and in flag default values.

Also remove kGoMode and kCppMode, which were meant to be used in expressions,
but they are not defined in sanitizer_common code, so SANITIZER_GO become prevalent.

Also convert some preprocessor checks to C++ if's or ternary expressions.

Majority of this change is done mechanically with:
sed "s#ifdef SANITIZER_GO#if SANITIZER_GO#g"
sed "s#ifndef SANITIZER_GO#if \!SANITIZER_GO#g"
sed "s#defined(SANITIZER_GO)#SANITIZER_GO#g"

llvm-svn: 285443

7 years ago[APFloat] Use std::move() in move assignment operator
Tim Shen [Fri, 28 Oct 2016 20:13:06 +0000 (20:13 +0000)]
[APFloat] Use std::move() in move assignment operator

llvm-svn: 285442

7 years agoRename DWARF 5 constants to adapt to change in LLVM
Adrian Prantl [Fri, 28 Oct 2016 20:11:27 +0000 (20:11 +0000)]
Rename DWARF 5 constants to adapt to change in LLVM

llvm-svn: 285441

7 years agoHandle non-~0 lane masks on live-in registers in LivePhysRegs
Krzysztof Parzyszek [Fri, 28 Oct 2016 20:06:37 +0000 (20:06 +0000)]
Handle non-~0 lane masks on live-in registers in LivePhysRegs

When LivePhysRegs adds live-in registers, it recognizes ~0 as a special
lane mask indicating the entire register. If the lane mask is not ~0,
it will only add the subregisters that overlap the specified lane mask.

The problem is that if a live-in register does not have subregisters,
and the lane mask is not ~0, it will not be added to the live set.
(The given lane mask may simply be the lane mask of its register class.)

If a register does not have subregisters, add it to the live set if
the lane mask is non-zero.

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

llvm-svn: 285440

7 years ago[PPC] add float and double overloads for vec_orc and vec_nand in altivec.h
Nemanja Ivanovic [Fri, 28 Oct 2016 20:04:53 +0000 (20:04 +0000)]
[PPC] add float and double overloads for vec_orc and vec_nand in altivec.h

This patch corresponds to review https://reviews.llvm.org/D25950.
Committing on behalf of Sean Fertile.

llvm-svn: 285439

7 years agoSpeculativeExecution: Allow speculating more inst types
Matt Arsenault [Fri, 28 Oct 2016 20:00:33 +0000 (20:00 +0000)]
SpeculativeExecution: Allow speculating more inst types

Partial step towards removing the whitelist and only
using TTI's cost.

llvm-svn: 285438

7 years agoPR30831: Teach template type diffing to cope with TemplateSpecializationTypes
Richard Smith [Fri, 28 Oct 2016 19:54:43 +0000 (19:54 +0000)]
PR30831: Teach template type diffing to cope with TemplateSpecializationTypes
that desugar to non-TSTs (such as injected-class-names).

llvm-svn: 285437

7 years agoImplement vector count leading/trailing bytes with zero lsb and vector parity
Nemanja Ivanovic [Fri, 28 Oct 2016 19:49:03 +0000 (19:49 +0000)]
Implement vector count leading/trailing bytes with zero lsb and vector parity
builtins - clang portion

This patch corresponds to review: https://reviews.llvm.org/D26002
Committing on behalf of Zaara Syeda.

llvm-svn: 285436

7 years agoAMDGPU: Fix using incorrect private resource with no allocation
Matt Arsenault [Fri, 28 Oct 2016 19:43:31 +0000 (19:43 +0000)]
AMDGPU: Fix using incorrect private resource with no allocation

It's possible to have a use of the private resource descriptor or
scratch wave offset registers even though there are no allocated
stack objects. This would result in continuing to use the maximum
number reserved registers. This could go over the number of SGPRs
available on VI, or violate the SGPR limit requested by
the function attributes.

llvm-svn: 285435

7 years agoImplement vector count leading/trailing bytes with zero lsb and vector parity
Nemanja Ivanovic [Fri, 28 Oct 2016 19:38:24 +0000 (19:38 +0000)]
Implement vector count leading/trailing bytes with zero lsb and vector parity
builtins - llvm portion

This patch corresponds to review https://reviews.llvm.org/D26003.
Committing on behalf of Zaara Syeda.

llvm-svn: 285434

7 years ago[ThinLTO] Use flags from summary when writing variable summary (NFC)
Teresa Johnson [Fri, 28 Oct 2016 19:36:00 +0000 (19:36 +0000)]
[ThinLTO] Use flags from summary when writing variable summary (NFC)

We already read the flags out of the summary when writing the summary
records for functions and aliases, do the same for variables.

This is an NFC change for now since the flags computed on the fly from
the GlobalValue currently will always match those in the summary
already, but once I send a follow-on patch to set the NoRename flag for
locals in the llvm.used set this becomes a necessary change.

llvm-svn: 285433

7 years ago[MemorySSA] Add const to getClobberingMemoryAccess.
George Burgess IV [Fri, 28 Oct 2016 19:22:46 +0000 (19:22 +0000)]
[MemorySSA] Add const to getClobberingMemoryAccess.

Thanks to bryant for the patch!

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

llvm-svn: 285432