platform/upstream/llvm.git
7 years ago[SCEV] Make SCEV or modeling more aggressive.
Eli Friedman [Wed, 19 Apr 2017 20:19:58 +0000 (20:19 +0000)]
[SCEV] Make SCEV or modeling more aggressive.

Use haveNoCommonBitsSet to figure out whether an "or" instruction
is equivalent to addition. This handles more cases than just
checking for a constant on the RHS.

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

llvm-svn: 300746

7 years ago[sanitizer-coverage] remove run-time support for the deprecated -fsanitize-coverage...
Kostya Serebryany [Wed, 19 Apr 2017 20:17:41 +0000 (20:17 +0000)]
[sanitizer-coverage] remove run-time support for the deprecated -fsanitize-coverage=8bit-counters

llvm-svn: 300745

7 years ago[sanitizer-coverage] deprecate -fsanitize-coverage=8bit-counters
Kostya Serebryany [Wed, 19 Apr 2017 20:15:58 +0000 (20:15 +0000)]
[sanitizer-coverage] deprecate -fsanitize-coverage=8bit-counters

llvm-svn: 300744

7 years ago[libc++] Use _LIBCPP_ABI_MICROSOFT instead of _MSC_VER
Shoaib Meenai [Wed, 19 Apr 2017 20:11:04 +0000 (20:11 +0000)]
[libc++] Use _LIBCPP_ABI_MICROSOFT instead of _MSC_VER

_LIBCPP_ABI_MICROSOFT is more appropriate to use here, since the
conditionals are controlling Microsoft mangling. It wasn't used
originally since it didn't exist at the time.

llvm-svn: 300743

7 years agoUsing address range map to speedup finding inline stack for address.
Dehao Chen [Wed, 19 Apr 2017 20:09:38 +0000 (20:09 +0000)]
Using address range map to speedup finding inline stack for address.

Summary:
In the current implementation, to find inline stack for an address incurs expensive linear search in 2 places:

* linear search for the top-level DIE
* recursive linear traverse the DIE tree to find the path to the leaf DIE

In this patch, a map is built from address to its corresponding leaf DIE. The inline stack is built by traversing from the leaf DIE up to the root DIE. This speeds up batch symbolization by ~10X without noticible memory overhead.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 300742

7 years agoParse backend options during thinlto backend compile actions
David Blaikie [Wed, 19 Apr 2017 20:08:21 +0000 (20:08 +0000)]
Parse backend options during thinlto backend compile actions

llvm-svn: 300741

7 years agoUpdate the madd.ll test with utils/update_llc_test_checks.py (NFC)
Dehao Chen [Wed, 19 Apr 2017 20:08:14 +0000 (20:08 +0000)]
Update the madd.ll test with utils/update_llc_test_checks.py (NFC)

llvm-svn: 300740

7 years ago[sanitizer-coverage] deprecate some of the stale coverage variants
Kostya Serebryany [Wed, 19 Apr 2017 19:57:16 +0000 (19:57 +0000)]
[sanitizer-coverage] deprecate some of the stale coverage variants

llvm-svn: 300738

7 years agoPR32710: Disable using PMADDWD for unsigned short.
Dehao Chen [Wed, 19 Apr 2017 19:50:34 +0000 (19:50 +0000)]
PR32710: Disable using PMADDWD for unsigned short.

Summary: PMADDWD can only handle signed short.

Reviewers: mkuper, wmi

Reviewed By: mkuper

Subscribers: andreadb, llvm-commits

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

llvm-svn: 300737

7 years agoAMDGPU: Don't emit amd_kernel_code_t for callable functions
Matt Arsenault [Wed, 19 Apr 2017 19:38:10 +0000 (19:38 +0000)]
AMDGPU: Don't emit amd_kernel_code_t for callable functions

This is inserted directly in the text section. The relocation
for the function ends up resolving to the beginning of the
amd_kernel_code_t header rather than the actual function
entry point.

Also skip some of the comments for initialization
that only makes sense for kernels.

llvm-svn: 300736

7 years ago[tblgen] GCC/MS builtin to target intrisics map.
Aditya Nandakumar [Wed, 19 Apr 2017 19:14:20 +0000 (19:14 +0000)]
[tblgen] GCC/MS builtin to target intrisics map.

Patch by Ettore Speziale

Allow TableGen to generate static functions to perform GCC/MS builtin name to
target specific intrinsic ID mapping.

https://reviews.llvm.org/D31150

llvm-svn: 300735

7 years ago[AMDGPU][mc][tests][NFC] Update bulk ISA tests for Gfx7 and Gfx8
Artem Tamazov [Wed, 19 Apr 2017 19:12:06 +0000 (19:12 +0000)]
[AMDGPU][mc][tests][NFC] Update bulk ISA tests for Gfx7 and Gfx8

Added approx. 1100 gfx7 and 1040 gfx8 test cases.

llvm-svn: 300734

7 years agoAdd CopyDiagnostic to the DiagnosticManager.
Jim Ingham [Wed, 19 Apr 2017 18:56:44 +0000 (18:56 +0000)]
Add CopyDiagnostic to the DiagnosticManager.

From Gregor Milos (gmilos@apple.com), for:

https://reviews.llvm.org/D32078

llvm-svn: 300733

7 years agoStructurizeCFG: Directly invert cmp instructions
Matt Arsenault [Wed, 19 Apr 2017 18:29:07 +0000 (18:29 +0000)]
StructurizeCFG: Directly invert cmp instructions

The most common case for a branch condition is
a single use compare. Directly invert the branch
predicate rather than adding a lot of xor i1 true
which the DAG will have to fold later.

This produces nicer to read structurizer output.

This produces some random changes in codegen
due to the DAG swapping branch conditions itself,
and then does a poor job of dealing with those
inverts.

llvm-svn: 300732

7 years ago[GVN] Don't coerce non-integral pointers to integers or vice versa
Sanjoy Das [Wed, 19 Apr 2017 18:21:09 +0000 (18:21 +0000)]
[GVN] Don't coerce non-integral pointers to integers or vice versa

Summary:
See http://llvm.org/docs/LangRef.html#non-integral-pointer-type

The NewGVN test does not fail without these changes (perhaps it does
try to coerce pointers <-> integers to begin with?), but I added the
test case anyway.

Reviewers: dberlin

Subscribers: mcrosier, llvm-commits, Prazek

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

llvm-svn: 300730

7 years ago[Utility/StringLexer] Remove dead code.
Davide Italiano [Wed, 19 Apr 2017 18:18:25 +0000 (18:18 +0000)]
[Utility/StringLexer] Remove dead code.

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

llvm-svn: 300729

7 years agoUpdate comment to match r300252.
Richard Smith [Wed, 19 Apr 2017 18:17:51 +0000 (18:17 +0000)]
Update comment to match r300252.

llvm-svn: 300728

7 years agoTeach RenderScriptRuntime about changed context representation.
David Gross [Wed, 19 Apr 2017 18:14:21 +0000 (18:14 +0000)]
Teach RenderScriptRuntime about changed context representation.

Summary:
The runtime discovers contexts through RenderScriptRuntime::Capture*()
methods.  These methods see the low-level context representation.
However, the runtime calls APIs that require the high-level context
representation.  Therefore, it needs to call yet another API to find
the high-level representation associated with a given low-level
representation.

Subscribers: lldb-commits

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

llvm-svn: 300727

7 years agoARM: TLS calling convention doesn't preserve r9 or r12 on Darwin.
Tim Northover [Wed, 19 Apr 2017 18:07:54 +0000 (18:07 +0000)]
ARM: TLS calling convention doesn't preserve r9 or r12 on Darwin.

llvm-svn: 300726

7 years ago[DAG] add splat vector support for 'and' in SimplifyDemandedBits
Sanjay Patel [Wed, 19 Apr 2017 18:05:06 +0000 (18:05 +0000)]
[DAG] add splat vector support for 'and' in SimplifyDemandedBits

The patch itself is simple: stop discriminating against vectors in visitAnd() and again in
SimplifyDemandedBits().

Some notes for reference:

1. We're not consistent about calls to SimplifyDemandedBits in the various visitXXX functions.
   Sometimes, we check if the RHS is a constant first. Other times (like here), we just dive in.
2. I'd like to break the vector shackles in steps for the sake of risk minimization, but we could
    make similar simultaneous changes in other places if we think that would be better.
3. I don't know what the intent of the changed tests in this patch was supposed to be, but since
   they wiggled in a positive way, I'm just going with that. :)
4. In the rotate tests, note that we can see through non-splat constants. This is a result of D24253.
5. My motivation for being here now is to make D31944 look better, so this is step 1 of N towards
   improving the vector codegen in that patch without writing any actual new code.

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

llvm-svn: 300725

7 years agoIR: Remove some comments that are documenting the obvious. NFC.
Peter Collingbourne [Wed, 19 Apr 2017 18:00:05 +0000 (18:00 +0000)]
IR: Remove some comments that are documenting the obvious. NFC.

llvm-svn: 300724

7 years ago[Coverage] Don't emit mappings for functions in dependent contexts (fixes PR32679)
Vedant Kumar [Wed, 19 Apr 2017 17:58:30 +0000 (17:58 +0000)]
[Coverage] Don't emit mappings for functions in dependent contexts (fixes PR32679)

The coverage implementation marks functions which won't be emitted as
'deferred', so that it can emit empty coverage regions for them later
(once their linkages are known).

Functions in dependent contexts are an exception: if there isn't a full
instantiation of a function, it shouldn't be marked 'deferred'. We've
been breaking that rule without much consequence because we just ended
up with useless, extra, empty coverage mappings. With PR32679, this
behavior finally caused a crash, because clang marked a partial template
specialization as 'deferred', causing the MS mangler to choke in its
delayed-template-parsing mode:

  error: cannot mangle this template type parameter type yet
  (http://bugs.llvm.org/show_bug.cgi?id=32679)

Fix this by checking if a decl's context is a dependent context before
marking it 'deferred'.

Based on a patch by Adam Folwarczny!

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

llvm-svn: 300723

7 years ago[Sema][ObjC] Disallow jumping into ObjC fast enumeration loops.
Akira Hatanaka [Wed, 19 Apr 2017 17:54:08 +0000 (17:54 +0000)]
[Sema][ObjC] Disallow jumping into ObjC fast enumeration loops.

rdar://problem/31635406

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

llvm-svn: 300722

7 years ago[MathExtras] Fix undefined behavior (shift by bit width)
Benjamin Kramer [Wed, 19 Apr 2017 17:46:15 +0000 (17:46 +0000)]
[MathExtras] Fix undefined behavior (shift by bit width)

While there add some unit tests for uint64_t. Found by ubsan.

llvm-svn: 300721

7 years agoAMDGPU: Don't align callable functions to 256
Matt Arsenault [Wed, 19 Apr 2017 17:42:39 +0000 (17:42 +0000)]
AMDGPU: Don't align callable functions to 256

llvm-svn: 300720

7 years agoAMDGPU: Change DivergenceAnalysis for function arguments
Matt Arsenault [Wed, 19 Apr 2017 17:42:34 +0000 (17:42 +0000)]
AMDGPU: Change DivergenceAnalysis for function arguments

Stop assuming all functions are kernels.

llvm-svn: 300719

7 years agoPrefer addAttr(Attribute::AttrKind) over the AttributeList overload
Reid Kleckner [Wed, 19 Apr 2017 17:28:52 +0000 (17:28 +0000)]
Prefer addAttr(Attribute::AttrKind) over the AttributeList overload

This should simplify the call sites, which typically want to tweak one
attribute at a time. It should also avoid creating ephemeral
AttributeLists that live forever.

llvm-svn: 300718

7 years ago[InstCombine] Reduce visitLoadInst() code duplication. NFCI.
Davide Italiano [Wed, 19 Apr 2017 17:26:57 +0000 (17:26 +0000)]
[InstCombine] Reduce visitLoadInst() code duplication. NFCI.

llvm-svn: 300717

7 years agoSkip tests that use 'llvm_xray' for standalone builds.
Keith Wyss [Wed, 19 Apr 2017 17:20:47 +0000 (17:20 +0000)]
Skip tests that use 'llvm_xray' for standalone builds.

Summary:
Tests that generate output with compiler-rt and verify it with the llvm_xray
command (built from the llvm tree) are extremely convenient, but compiler-rt
can be built out of tree and llvm_xray is not built for every target.

This change intends to disable tests for out of tree builds, but does nothing
to detect whether llvm_xray can be found elsewhere on the path, is fresh enough,
or is part of a build target for the in tree build.

Tested:
  Tested that this didn't break check-xray. Haven't reproduced bots or standalone
  builds.

Reviewers: dberris, kcc

Subscribers: llvm-commits

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

llvm-svn: 300716

7 years ago[APInt] Move the 'return *this' from the slow cases of assignment operators inline...
Craig Topper [Wed, 19 Apr 2017 17:01:58 +0000 (17:01 +0000)]
[APInt] Move the 'return *this' from the slow cases of assignment operators inline. We should let the compiler see that the fast/slow cases both return *this.

I don't think we chain assignments together very often so this shouldn't matter much.

llvm-svn: 300715

7 years ago[InstSimplify] fold identity shuffles (recursing if needed)
Sanjay Patel [Wed, 19 Apr 2017 16:48:22 +0000 (16:48 +0000)]
[InstSimplify] fold identity shuffles (recursing if needed)

This patch simplifies the examples from D31509 and D31927 (PR30630) and catches
the basic identity shuffle tests that Zvi recently added.

I'm not sure if we have something like this in DAGCombiner, but we should?

It's worth noting that "MaxRecurse / RecursionLimit" is only 3 on entry at the moment.
We might want to bump that up if there are longer shuffle chains like this in the wild.

For now, we're ignoring shuffles that have undef mask elements because it's not
clear how those should be handled.

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

llvm-svn: 300714

7 years agouse 'auto' with 'dyn_cast' and fix formatting; NFC
Sanjay Patel [Wed, 19 Apr 2017 16:22:19 +0000 (16:22 +0000)]
use 'auto' with 'dyn_cast' and fix formatting; NFC

llvm-svn: 300713

7 years agoAdd #pragma clang attribute support to the external_source_symbol attribute
Alex Lorenz [Wed, 19 Apr 2017 15:52:11 +0000 (15:52 +0000)]
Add #pragma clang attribute support to the external_source_symbol attribute

Prior to this commit the external_source_symbol attribute wasn't supported by
#pragma clang attribute for the following two reasons:

- The Named attribute subject hasn't been supported by TableGen.
- There was no way to specify a subject match rule for #pragma clang attribute
 that could operate on a set of attribute subjects (e.g. the ones that derive
 from NamedDecl).

This commit fixes the two issues and thus adds external_source_symbol support to
#pragma clang attribute.

rdar://31169028

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

llvm-svn: 300712

7 years agoAdd an #include for <climits> for CHAR_BIT.
Zachary Turner [Wed, 19 Apr 2017 15:50:43 +0000 (15:50 +0000)]
Add an #include for <climits> for CHAR_BIT.

llvm-svn: 300711

7 years ago[Support] Add some helpers to generate bitmasks.
Zachary Turner [Wed, 19 Apr 2017 15:45:31 +0000 (15:45 +0000)]
[Support] Add some helpers to generate bitmasks.

Frequently you you want a bitmask consisting of a specified
number of 1s, either at the beginning or end of a word.

The naive way to do this is to write

template<typename T>
T leadingBitMask(unsigned N) {
  return (T(1) << N) - 1;
}

but using this function you cannot produce a word with every
bit set to 1 (i.e. leadingBitMask<uint8_t>(8)) because left
shift is undefined when N is greater than or equal to the
number of bits in the word.

This patch provides an efficient, branch-free implementation
that works for all values of N in [0, CHAR_BIT*sizeof(T)]

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

llvm-svn: 300710

7 years agoRemove eol-style:native from MathExtras.h
Zachary Turner [Wed, 19 Apr 2017 15:43:23 +0000 (15:43 +0000)]
Remove eol-style:native from MathExtras.h

llvm-svn: 300709

7 years agoRevert r300697 which causes buildbot failure.
Dehao Chen [Wed, 19 Apr 2017 15:28:58 +0000 (15:28 +0000)]
Revert r300697 which causes buildbot failure.

llvm-svn: 300708

7 years ago[Hexagon] Generate proper offset in opt-addr-mode
Krzysztof Parzyszek [Wed, 19 Apr 2017 15:15:51 +0000 (15:15 +0000)]
[Hexagon] Generate proper offset in opt-addr-mode

Also, make a few changes to allow using the pass in .mir testcases.
Among other things, change the abbreviation from opt-amode to amode-opt,
because otherwise lit would expand the "opt" part to the full path to
the opt binary.

llvm-svn: 300707

7 years ago[Hexagon] Remove RDefMap, use Liveness:getNearestAliasedRef instead
Krzysztof Parzyszek [Wed, 19 Apr 2017 15:14:30 +0000 (15:14 +0000)]
[Hexagon] Remove RDefMap, use Liveness:getNearestAliasedRef instead

llvm-svn: 300706

7 years ago[RDF] Switch NodeList to SmallVector from std::vector
Krzysztof Parzyszek [Wed, 19 Apr 2017 15:12:44 +0000 (15:12 +0000)]
[RDF] Switch NodeList to SmallVector from std::vector

The list has a single element 75+% of the time, reservation of 4 elements
is sufficient in 95% of cases.

llvm-svn: 300705

7 years ago[RDF] Use faster version of findBlock
Krzysztof Parzyszek [Wed, 19 Apr 2017 15:11:23 +0000 (15:11 +0000)]
[RDF] Use faster version of findBlock

llvm-svn: 300704

7 years agoRemove unnecessary condition as suggested by clang-tidy. NFC
Gabor Horvath [Wed, 19 Apr 2017 15:11:10 +0000 (15:11 +0000)]
Remove unnecessary condition as suggested by clang-tidy. NFC

Patch by: Gergely Angeli!

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

llvm-svn: 300703

7 years ago[RDF] Cache register units for reg masks instead of recalculating them
Krzysztof Parzyszek [Wed, 19 Apr 2017 15:10:09 +0000 (15:10 +0000)]
[RDF] Cache register units for reg masks instead of recalculating them

llvm-svn: 300702

7 years ago[Hexagon] Cache reached blocks in bit tracker instead of scanning list
Krzysztof Parzyszek [Wed, 19 Apr 2017 15:08:31 +0000 (15:08 +0000)]
[Hexagon] Cache reached blocks in bit tracker instead of scanning list

llvm-svn: 300701

7 years ago[PowerPC] add test and auto-generate checks; NFC
Sanjay Patel [Wed, 19 Apr 2017 14:58:09 +0000 (14:58 +0000)]
[PowerPC] add test and auto-generate checks; NFC

llvm-svn: 300700

7 years ago[clang-tidy] misc-misplaced-widening-cast: Disable checking of implicit widening...
Gabor Horvath [Wed, 19 Apr 2017 14:55:58 +0000 (14:55 +0000)]
[clang-tidy] misc-misplaced-widening-cast: Disable checking of implicit widening casts by default.

Patch by Ádám Balogh!

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

llvm-svn: 300699

7 years ago[ARM] add test and auto-generate checks; NFC
Sanjay Patel [Wed, 19 Apr 2017 14:55:50 +0000 (14:55 +0000)]
[ARM] add test and auto-generate checks; NFC

llvm-svn: 300698

7 years agoUsing address range map to speedup finding inline stack for address.
Dehao Chen [Wed, 19 Apr 2017 14:50:57 +0000 (14:50 +0000)]
Using address range map to speedup finding inline stack for address.

Summary:
In the current implementation, to find inline stack for an address incurs expensive linear search in 2 places:

* linear search for the top-level DIE
* recursive linear traverse the DIE tree to find the path to the leaf DIE

In this patch, a map is built from address to its corresponding leaf DIE. The inline stack is built by traversing from the leaf DIE up to the root DIE. This speeds up batch symbolization by ~10X without noticible memory overhead.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 300697

7 years ago[InstSimplify] Deduce correct type for vector GEP.
Davide Italiano [Wed, 19 Apr 2017 14:23:42 +0000 (14:23 +0000)]
[InstSimplify] Deduce correct type for vector GEP.

InstSimplify returned the wrong type when simplifying a vector GEP
and we ended up crashing when trying to replace all uses with the
new value. Fixes PR32697.

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

llvm-svn: 300693

7 years agoLet ubsan search UBSAN_SYMBOLIZER_PATH for llvm-symbolizer
Nico Weber [Wed, 19 Apr 2017 14:03:40 +0000 (14:03 +0000)]
Let ubsan search UBSAN_SYMBOLIZER_PATH for llvm-symbolizer

https://reviews.llvm.org/D27375

llvm-svn: 300692

7 years agoImplement function to get registers from suspended thread on darwin
Francis Ricci [Wed, 19 Apr 2017 14:00:42 +0000 (14:00 +0000)]
Implement function to get registers from suspended thread on darwin

Reviewers: kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300691

7 years agoMove valid caller-pc checks out of platform-specific checks
Francis Ricci [Wed, 19 Apr 2017 14:00:35 +0000 (14:00 +0000)]
Move valid caller-pc checks out of platform-specific checks

Summary:
ProcessPlatformSpecificAllocations for linux leak sanitizer iterated over
memory chunks and ran two checks concurrently:
1) Ensured the pc was valid
2) Checked whether it was a linker allocation

All platforms will need the valid pc check, so it is moved out of the platform-
specific file. To prevent code and logic duplication, the linker allocation
check is moved as well, with the name of the linker supplied by the platform-specific
module. In cases where we don't need to check for linker allocations (ie Darwin),
this name will be a nullptr, and we'll only run the caller pc checks.

Reviewers: kubamracek, alekseyshl, kcc

Subscribers: llvm-commits

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

llvm-svn: 300690

7 years ago[Driver] Unify linking of OpenMP runtime. NFCI.
Jonas Hahnfeld [Wed, 19 Apr 2017 13:55:39 +0000 (13:55 +0000)]
[Driver] Unify linking of OpenMP runtime. NFCI.

While at it, extend test for FreeBSD and check for -lrt iff on Linux.

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

llvm-svn: 300689

7 years ago[DAG] Loop over remaining candidates on successful merge of stores of
Nirav Dave [Wed, 19 Apr 2017 13:52:38 +0000 (13:52 +0000)]
[DAG] Loop over remaining candidates on successful merge of stores of
extracted vectors types. NFCI.

llvm-svn: 300688

7 years ago[ELF] Always use Script::assignAddresses()
Peter Smith [Wed, 19 Apr 2017 12:46:32 +0000 (12:46 +0000)]
[ELF] Always use Script::assignAddresses()

This change fabricates linker script commands for the case where there is
no linker script SECTIONS to control address assignment. This permits us
to have a single Script->assignAddresses() function.

There is a small change in user-visible-behavior with respect to the
handling of .tbss SHT_NOBITS, SHF_TLS as the Script->assignAddresses()
requires setDot() to be called with monotically increasing addresses.
The tls-offset.s test has been updated so that the script and non-script
results match.

This change should make the non-script behavior of lld closer to an
equivalent linker script.

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

llvm-svn: 300687

7 years agoAvoid assert when a non-static member function is qualified with __unaligned
Roger Ferrer Ibanez [Wed, 19 Apr 2017 12:23:28 +0000 (12:23 +0000)]
Avoid assert when a non-static member function is qualified with __unaligned

Under -fms-extensions __unaligned is a type-qualifier that can be applied to a
non-static member function declaration.

This causes an assertion when mangling the name under Itanium, where that
qualifier is not mangled.

This patch justs makes the minimal change to avoid the crash and avoid mangling
__unaligned, as it currently happens with non-member functions.

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

llvm-svn: 300686

7 years agoWrite multiple REQUIRES in one line.
Rui Ueyama [Wed, 19 Apr 2017 12:21:46 +0000 (12:21 +0000)]
Write multiple REQUIRES in one line.

llvm-svn: 300685

7 years ago[AVR] Remove the 'multibyte' asm test
Dylan McKay [Wed, 19 Apr 2017 12:13:45 +0000 (12:13 +0000)]
[AVR] Remove the 'multibyte' asm test

It tests registers which are not actually used on AVR.

llvm-svn: 300684

7 years agoRegenerate test. NFCI.
Simon Pilgrim [Wed, 19 Apr 2017 12:06:40 +0000 (12:06 +0000)]
Regenerate test. NFCI.

llvm-svn: 300683

7 years ago[AVR] Fix the test suite
Dylan McKay [Wed, 19 Apr 2017 12:02:52 +0000 (12:02 +0000)]
[AVR] Fix the test suite

A bunch of tests failed because memory operations have been reordered.

I am unsure which commit changed this behaviour as the AVR build was
failing at that point with an unrelated error.

This commit just reoders some of the CHECK lines in some tests to suit
current llc output.

llvm-svn: 300682

7 years agoFix buildbot failure.
Rui Ueyama [Wed, 19 Apr 2017 11:58:59 +0000 (11:58 +0000)]
Fix buildbot failure.

llvm-svn: 300681

7 years agoRename a test file so that it matches with the option name it is testing.
Rui Ueyama [Wed, 19 Apr 2017 11:42:12 +0000 (11:42 +0000)]
Rename a test file so that it matches with the option name it is testing.

llvm-svn: 300679

7 years ago[GlobalIsel][X86] support G_TRUNC selection.
Igor Breger [Wed, 19 Apr 2017 11:34:59 +0000 (11:34 +0000)]
[GlobalIsel][X86] support G_TRUNC selection.

Summary:
[GlobalIsel][X86] support G_TRUNC selection.
Add regbank-select and legalizer tests. Currently legalization of trunc i64 on 32bit platform not supported.

Reviewers: ab, zvi, rovka

Reviewed By: zvi

Subscribers: dberris, kristof.beyls, llvm-commits

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

llvm-svn: 300678

7 years agoRemove a redundant test.
Rui Ueyama [Wed, 19 Apr 2017 11:34:55 +0000 (11:34 +0000)]
Remove a redundant test.

We already have compress-debug-output.s, and that test should suffice
for the -compressed-debug-section option.

llvm-svn: 300677

7 years agoUpdate comment.
Rui Ueyama [Wed, 19 Apr 2017 11:32:27 +0000 (11:32 +0000)]
Update comment.

llvm-svn: 300676

7 years agoRename CompressedHeader ZDebugHeader.
Rui Ueyama [Wed, 19 Apr 2017 11:32:13 +0000 (11:32 +0000)]
Rename CompressedHeader ZDebugHeader.

`CompressedHeader` is a header for compressed data, and the header
itself is not compressed. So the previous name was confusing.

llvm-svn: 300675

7 years agoSimplify createHeader and inline it.
Rui Ueyama [Wed, 19 Apr 2017 11:31:58 +0000 (11:31 +0000)]
Simplify createHeader and inline it.

createHeader didn't use data members of Elf_Chdr type and write
directly to a given buffer. That is not a good practice because
the function had a knowledge of the struct layout.

llvm-svn: 300674

7 years agoFallthrough to reduce code a bit. NFC.
Rui Ueyama [Wed, 19 Apr 2017 11:31:45 +0000 (11:31 +0000)]
Fallthrough to reduce code a bit. NFC.

llvm-svn: 300673

7 years ago[X86] Add D32039/PR31357 tests to show current BSWAP codegen
Simon Pilgrim [Wed, 19 Apr 2017 11:06:22 +0000 (11:06 +0000)]
[X86] Add D32039/PR31357 tests to show current BSWAP codegen

llvm-svn: 300672

7 years ago[X86][SSE] Add scheduling latency/throughput tests for (most) SSE2 instructions
Simon Pilgrim [Wed, 19 Apr 2017 10:52:09 +0000 (10:52 +0000)]
[X86][SSE] Add scheduling latency/throughput tests for (most) SSE2 instructions

llvm-svn: 300671

7 years agoFix TestRegisterVariables for clang/arm
Pavel Labath [Wed, 19 Apr 2017 10:13:29 +0000 (10:13 +0000)]
Fix TestRegisterVariables for clang/arm

Clang rejects __attribute__((regparm)) when targetting arm. The default
calling convention passes arguments in registers anyway, so we can just
remove them in this case.

llvm-svn: 300670

7 years agoRevert yesterdays IPv6 patches
Pavel Labath [Wed, 19 Apr 2017 10:13:22 +0000 (10:13 +0000)]
Revert yesterdays IPv6 patches

The break the linux bots (and probably any other machine which would
run the test suite in a massively parallel way). The problem is that it
can happen that we only successfully create an IPv6 listening socket
(because the relevant IPv4 port is used by another process) and then the
connecting side attempts to connect to the IPv4 port and fails.

It's not very obvious how to fix this problem, so I am reverting this
until we come up with a solution.

llvm-svn: 300669

7 years agoRevert "ARMFrameLowering: Reserve emergency spill slot for large arguments"
Renato Golin [Wed, 19 Apr 2017 09:02:52 +0000 (09:02 +0000)]
Revert "ARMFrameLowering: Reserve emergency spill slot for large arguments"

This reverts commit r300639, as it broke self-hosting on ARM. PR32709.

llvm-svn: 300668

7 years agoAdd support for editor placeholders to Clang
Alex Lorenz [Wed, 19 Apr 2017 08:58:56 +0000 (08:58 +0000)]
Add support for editor placeholders to Clang

This commit teaches Clang to recognize editor placeholders that are produced
when an IDE like Xcode inserts a code-completion result that includes a
placeholder. Now when the lexer sees a placeholder token, it emits an
'editor placeholder in source file' error and creates an identifier token
that represents the placeholder. The parser/sema can now recognize the
placeholders and can suppress the diagnostics related to the placeholders. This
ensures that live issues in an IDE like Xcode won't get spurious diagnostics
related to placeholders.

This commit also adds a new compiler option named '-fallow-editor-placeholders'
that silences the 'editor placeholder in source file' error. This is useful
for an IDE like Xcode as we don't want to display those errors in live issues.

rdar://31581400

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

llvm-svn: 300667

7 years ago[GlobalISel][X86] Split select tests. NFC.
Igor Breger [Wed, 19 Apr 2017 08:40:44 +0000 (08:40 +0000)]
[GlobalISel][X86] Split select tests. NFC.

llvm-svn: 300666

7 years ago[ARM] GlobalISel: Add support for G_MUL
Diana Picus [Wed, 19 Apr 2017 07:29:46 +0000 (07:29 +0000)]
[ARM] GlobalISel: Add support for G_MUL

Support G_MUL, very similar to G_ADD and G_SUB. The only difference is
in the instruction selector, where we have to select either MUL or MULv5
depending on the target.

llvm-svn: 300665

7 years ago[GlobalISel] Support vector-of-pointers in LLT
Kristof Beyls [Wed, 19 Apr 2017 07:23:57 +0000 (07:23 +0000)]
[GlobalISel] Support vector-of-pointers in LLT

This fixes PR32471.

As comment 10 on that bug report highlights
(https://bugs.llvm.org//show_bug.cgi?id=32471#c10), there are quite a
few different defendable design tradeoffs that could be made, including
not representing pointers at all in LLT.

I decided to go for representing vector-of-pointer as a concept in LLT,
while keeping the size of the LLT type 64 bits (this is an increase from
48 bits before). My rationale for keeping pointers explicit is that on
some targets probably it's very handy to have the distinction between
pointer and non-pointer (e.g. 68K has a different register bank for
pointers IIRC). If we keep a scalar pointer, it probably is easiest to
also have a vector-of-pointers to keep LLT relatively conceptually clean
and orthogonal, while we don't have a very strong reason to break that
orthogonality.  Once we gain more experience on the use of LLT, we can
of course reconsider this direction.

Rejecting vector-of-pointer types in the IRTranslator is also an option
to avoid the crash reported in PR32471, but that is only a very
short-term solution; also needs quite a bit of code tweaks in places,
and is probably fragile. Therefore I didn't consider this the best
option.

llvm-svn: 300664

7 years ago[GlobalISel] Remove non-determinism from IRTranslator.
Kristof Beyls [Wed, 19 Apr 2017 06:38:37 +0000 (06:38 +0000)]
[GlobalISel] Remove non-determinism from IRTranslator.

This showed up in r300535/r300537, which were reverted in r300538 due to
some of the introduced tests in there failing on some bots, due to the
non-determinism fixed in this commit.

Re-committing r300535/r300537 will add 2 tests for the change in this
commit.

llvm-svn: 300663

7 years agoRevert r300657 due to crashes in stage2 of bootstraps:
Chandler Carruth [Wed, 19 Apr 2017 06:23:20 +0000 (06:23 +0000)]
Revert r300657 due to crashes in stage2 of bootstraps:
http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/2476/steps/build-stage2-LLVMgold.so/logs/stdio
http://bb.pgr.jp/builders/clang-3stage-x86_64-linux/builds/15036/steps/build_llvmclang/logs/stdio

I've updated the commit thread, reverting to get the bots back to green.

Original commit summary:
[JumpThread] We want to fold (not thread) when all predecessor go to single BB's successor.

llvm-svn: 300662

7 years agoclang-format: Properly match parens of macro parameter lists.
Daniel Jasper [Wed, 19 Apr 2017 06:06:38 +0000 (06:06 +0000)]
clang-format: Properly match parens of macro parameter lists.

No tests yet, but this will be tested by the upcoming:
https://reviews.llvm.org/D28462

llvm-svn: 300661

7 years ago[XRay][compiler-rt] Fix up CFI annotations and stack alignment
Dean Michael Berris [Wed, 19 Apr 2017 05:37:14 +0000 (05:37 +0000)]
[XRay][compiler-rt] Fix up CFI annotations and stack alignment

Summary:
Previously, we had been very undisciplined about CFI annotations with
the XRay trampolines. This leads to runtime crashes due to mis-alined
stack pointers that some function implementations may run into (i.e.
those using instructions that require properly aligned addresses coming
from the stack). This patch attempts to clean that up, as well as more
accurately use the correct amounts of space on the stack for stashing
and un-stashing registers.

Reviewers: eugenis, kcc

Subscribers: kpw, llvm-commits

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

llvm-svn: 300660

7 years agoRevert r300653 and r300650. The underlying commit fixes one issue with
Chandler Carruth [Wed, 19 Apr 2017 05:25:13 +0000 (05:25 +0000)]
Revert r300653 and r300650. The underlying commit fixes one issue with
modules but exposes much more widespread issues. Example and more
information is on the review thread for r300650.

Original commit summary:
[modules] Properly look up the owning module for an instantiation of a merged template.

llvm-svn: 300659

7 years ago[CodeGen] Use APInt::lshrInPlace instead of APInt::lshr. NFC
Craig Topper [Wed, 19 Apr 2017 05:17:33 +0000 (05:17 +0000)]
[CodeGen] Use APInt::lshrInPlace instead of APInt::lshr. NFC

llvm-svn: 300658

7 years ago[JumpThread] We want to fold (not thread) when all predecessor go to single BB's...
Xin Tong [Wed, 19 Apr 2017 05:15:57 +0000 (05:15 +0000)]
[JumpThread] We want to fold (not thread) when all predecessor go to single BB's successor. .

Summary: In case all predecessor go to a single successor of current BB. We want to fold (not thread).

Reviewers: efriedma, sanjoy

Reviewed By: sanjoy

Subscribers: dberlin, majnemer, llvm-commits

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

llvm-svn: 300657

7 years agoCleanup some GraphTraits iteration code
Tim Shen [Wed, 19 Apr 2017 03:22:50 +0000 (03:22 +0000)]
Cleanup some GraphTraits iteration code

Use children<> and nodes<> in appropriate places to cleanup the code.

Also, as part of the cleanup,
change the signature of DominatorTreeBase's Split.
It is a protected non-virtual member function called only twice,
both from within the class,
and the removed passed argument in both cases is '*this'.
The reason for the existence of that argument seems to be that
back before r43115 Split was a free function,
so an argument to get '*this' was needed - but now that is no longer the
case.

Patch by Yoav Ben-Shalom!

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

llvm-svn: 300656

7 years agoARM: Use methods to access data stored with frame instructions
Serge Pavlov [Wed, 19 Apr 2017 03:12:05 +0000 (03:12 +0000)]
ARM: Use methods to access data stored with frame instructions

In r300196 several methods were added to TarfetInstrInfo to access
data stored with call frame setup/destroy instructions. This change
replaces calls to getOperand with calls to such special methods in
ARM target.

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

llvm-svn: 300655

7 years ago[CMake] Add configure check for sys/event.h
Chris Bieneman [Wed, 19 Apr 2017 02:53:53 +0000 (02:53 +0000)]
[CMake] Add configure check for sys/event.h

This enables the kqueue path in MainLoop for Darwin and BSD.

llvm-svn: 300654

7 years agoFix member function call with null 'this' pointer.
Richard Smith [Wed, 19 Apr 2017 02:19:21 +0000 (02:19 +0000)]
Fix member function call with null 'this' pointer.

llvm-svn: 300653

7 years agoFix tests for extended noexcept in the container adaptors tests
Eric Fiselier [Wed, 19 Apr 2017 02:07:12 +0000 (02:07 +0000)]
Fix tests for extended noexcept in the container adaptors tests

llvm-svn: 300652

7 years agoRemove buggy 'addAttributes(unsigned, AttrBuilder)' overload
Reid Kleckner [Wed, 19 Apr 2017 01:51:13 +0000 (01:51 +0000)]
Remove buggy 'addAttributes(unsigned, AttrBuilder)' overload

The 'addAttributes(unsigned, AttrBuilder)' overload delegated to 'get'
instead of 'addAttributes'.

Since we can implicitly construct an AttrBuilder from an AttributeSet,
just standardize on AttrBuilder.

llvm-svn: 300651

7 years ago[modules] Properly look up the owning module for an instantiation of a merged template.
Richard Smith [Wed, 19 Apr 2017 01:36:43 +0000 (01:36 +0000)]
[modules] Properly look up the owning module for an instantiation of a merged template.

When looking for the template instantiation pattern of a templated entity,
consistently select the definition of the pattern if there is one. This means
we'll pick the same owning module when we start instantiating a template that
we'll later pick when determining which modules are visible during that
instantiation.

llvm-svn: 300650

7 years agoCleanup usages of _LIBCPP_HAS_NO_<c++11-feature> in <exception>
Eric Fiselier [Wed, 19 Apr 2017 01:35:58 +0000 (01:35 +0000)]
Cleanup usages of _LIBCPP_HAS_NO_<c++11-feature> in <exception>

llvm-svn: 300649

7 years agoCleanup usages of _LIBCPP_HAS_NO_<c++11-feature> in <bitset>, <ios>, <locale>, and...
Eric Fiselier [Wed, 19 Apr 2017 01:34:08 +0000 (01:34 +0000)]
Cleanup usages of _LIBCPP_HAS_NO_<c++11-feature> in <bitset>, <ios>, <locale>, and <iterator>

llvm-svn: 300648

7 years agoOne more attempt and Windows
Chris Bieneman [Wed, 19 Apr 2017 01:32:08 +0000 (01:32 +0000)]
One more attempt and Windows

This is the last Windows compile error, so... Hit me with your best shot.

llvm-svn: 300647

7 years agoCleanup remaining usages of _LIBCPP_HAS_NO_<c++11-feature> in the functional library
Eric Fiselier [Wed, 19 Apr 2017 01:28:47 +0000 (01:28 +0000)]
Cleanup remaining usages of _LIBCPP_HAS_NO_<c++11-feature> in the functional library

llvm-svn: 300646

7 years agoCleanup remaining usages of _LIBCPP_HAS_NO_<c++11-feature> in tuple and utility
Eric Fiselier [Wed, 19 Apr 2017 01:23:39 +0000 (01:23 +0000)]
Cleanup remaining usages of _LIBCPP_HAS_NO_<c++11-feature> in tuple and utility

llvm-svn: 300644

7 years agoCleanup remaining _LIBCPP_HAS_NO_<c++11-feature> usages in container headers
Eric Fiselier [Wed, 19 Apr 2017 01:23:04 +0000 (01:23 +0000)]
Cleanup remaining _LIBCPP_HAS_NO_<c++11-feature> usages in container headers

llvm-svn: 300643

7 years ago[libFuzzer] update -help: mention -exact_artifact_path in help for -minimize_crash...
Kostya Serebryany [Wed, 19 Apr 2017 01:22:04 +0000 (01:22 +0000)]
[libFuzzer] update -help: mention -exact_artifact_path in help for -minimize_crash and -cleanse_crash

llvm-svn: 300642

7 years ago[AVR] Migrate to new MCAsmInfo CodePointerSize
Leslie Zhai [Wed, 19 Apr 2017 01:20:43 +0000 (01:20 +0000)]
[AVR] Migrate to new MCAsmInfo CodePointerSize

Reviewers: dylanmckay, rengolin, kzhuravl, jroelofs

Reviewed By: kzhuravl, jroelofs

Subscribers: kzhuravl, llvm-commits

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

llvm-svn: 300641

7 years agoAnother netbsd build failure...
Chris Bieneman [Wed, 19 Apr 2017 01:17:29 +0000 (01:17 +0000)]
Another netbsd build failure...

llvm-svn: 300640