platform/upstream/llvm.git
5 years agoFix typos throughout the license files that somehow I and my reviewers
Chandler Carruth [Mon, 21 Jan 2019 09:52:34 +0000 (09:52 +0000)]
Fix typos throughout the license files that somehow I and my reviewers
all missed!

Thanks to Alex Bradbury for pointing this out, and the fact that I never
added the intended `legacy` anchor to the developer policy. Add that
anchor too. With hope, this will cause the links to all resolve
successfully.

llvm-svn: 351731

5 years ago[HWASAN] Improve tag mismatch diagnostics
Eugene Leviant [Mon, 21 Jan 2019 09:51:10 +0000 (09:51 +0000)]
[HWASAN] Improve tag mismatch diagnostics

Reports correct size and tags when either size is not power of two
or offset to bad granule is not zero.

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

llvm-svn: 351730

5 years ago[X86] Remove and autoupgrade vpmovqd/vpmovwb intrinsics using trunc+select.
Craig Topper [Mon, 21 Jan 2019 08:16:59 +0000 (08:16 +0000)]
[X86] Remove and autoupgrade vpmovqd/vpmovwb intrinsics using trunc+select.

llvm-svn: 351729

5 years agoTentative fix for r351701 and gcc 6.2 build on ubuntu
Serge Guelton [Mon, 21 Jan 2019 07:44:52 +0000 (07:44 +0000)]
Tentative fix for r351701 and gcc 6.2 build on ubuntu

llvm-svn: 351728

5 years ago[NFC] Make getExpressionSize unsigned short
Max Kazantsev [Mon, 21 Jan 2019 07:36:55 +0000 (07:36 +0000)]
[NFC] Make getExpressionSize unsigned short

llvm-svn: 351727

5 years ago[NFC] Fix warnings in unit test of r351725
Max Kazantsev [Mon, 21 Jan 2019 07:27:47 +0000 (07:27 +0000)]
[NFC] Fix warnings in unit test of r351725

llvm-svn: 351726

5 years ago[SCEV][NFC] Introduces expression sizes estimation
Max Kazantsev [Mon, 21 Jan 2019 06:19:50 +0000 (06:19 +0000)]
[SCEV][NFC] Introduces expression sizes estimation

This patch introduces the field `ExpressionSize` in SCEV. This field is
calculated only once on SCEV creation, and it represents the complexity of
this SCEV from arithmetical point of view (not from the point of the number
of actual different SCEV nodes that are used in the expression). Roughly
saying, it is the number of operands and operations symbols when we print this
SCEV.

A formal definition is following: if SCEV `X` has operands
  `Op1`, `Op2`, ..., `OpN`,
then
  Size(X) = 1 + Size(Op1) + Size(Op2) + ... + Size(OpN).
Size of SCEVConstant and SCEVUnknown is one.

Expression size may be used as a universal way to limit SCEV transformations
for huge SCEVs. Currently, we have a bunch of options that represents various
limits (such as recursion depth limit) that may not make any sense from the
point of view of a LLVM users who is not familiar with SCEV internals, and all
these different options pursue one goal. A more general rule that may
potentially allow us to get rid of this redundancy in options is "do not make
transformations with SCEVs of huge size". It can apply to all SCEV traversals
and transformations that may need to visit a SCEV node more than once, hence
they are prone to combinatorial explosions.

This patch only introduces SCEV sizes calculation as NFC, its utilization will
be introduced in follow-up patches.

Differential Revision: https://reviews.llvm.org/D35989
Reviewed By: reames

llvm-svn: 351725

5 years ago[RISCV] Add R_RISCV_RELAX relocation to all possible relax candidates.
Kito Cheng [Mon, 21 Jan 2019 05:27:09 +0000 (05:27 +0000)]
[RISCV] Add R_RISCV_RELAX relocation to all possible relax candidates.

Summary:
Add R_RISCV_RELAX relocation to all possible relax candidates and
update corresponding testcase.

Reviewers: asb, apazos

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

llvm-svn: 351723

5 years ago[llgo]: fix compilation under current llvm
Kristina Brooks [Mon, 21 Jan 2019 04:36:43 +0000 (04:36 +0000)]
[llgo]: fix compilation under current llvm

Patch rL322965 changed how intrinsics for memset and memzero
were defined. This causes a regression in LLGO making it no
longer buidable. In addition to that one pass was renamed,
so this also addresses the pass naming disparity.

I removed all split stack related bits from this patch as
as asked.

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

llvm-svn: 351722

5 years ago[AVR] Insert unconditional branch when inserting MBBs between blocks with fallthrough
Dylan McKay [Mon, 21 Jan 2019 04:32:02 +0000 (04:32 +0000)]
[AVR] Insert unconditional branch when inserting MBBs between blocks with fallthrough

This updates the AVR Select8/Select16 expansion code so that, when
inserting the two basic blocks for true and false conditions, any
existing fallthrough on the previous block is preserved.

Prior to this patch, if the block before the Select pseudo fell through
to the subsequent block, two new basic blocks would be inserted at the
prior fallthrough point, changing the fallthrough destination.

The predecessor or successor lists were not updated, causing the
BranchFolding pass at -O1 and above the rearrange basic blocks, causing
an infinite loop. Not to mention the unconditional fallthrough to the
true block is incorrect in of itself.

This patch modifies the Select8/16 expansion so that, if inserting true
and false basic blocks at a fallthrough point, the implicit branch is
preserved by means of an explicit, unconditional branch to the previous
fallthrough destination.

Thanks to Carl Peto for reporting this bug.

This fixes avr-rust bug https://github.com/avr-rust/rust/issues/123.

llvm-svn: 351721

5 years ago[AVR] Enable emission of debug information
Dylan McKay [Mon, 21 Jan 2019 04:27:08 +0000 (04:27 +0000)]
[AVR] Enable emission of debug information

Prior to this, the code was missing AVR-specific relocation logic in
RelocVisitor.h.

This patch teaches RelocVisitor about R_AVR_16 and R_AVR_32.

Debug information is emitted in the final object file, and understood by
'avr-readelf --debug-dump' from AVR-GCC.

llvm-dwarfdump is yet to understand how to dump AVR DWARF symbols.

llvm-svn: 351720

5 years agoRevert "[AVR] Insert unconditional branch when inserting MBBs between blocks with...
Dylan McKay [Mon, 21 Jan 2019 02:46:13 +0000 (02:46 +0000)]
Revert "[AVR] Insert unconditional branch when inserting MBBs between blocks with fallthrough"

This reverts commit r351718.

Carl pointed out that the unit test could be improved.

This patch will be recommitted once the test is made more resilient.

llvm-svn: 351719

5 years ago[AVR] Insert unconditional branch when inserting MBBs between blocks with fallthrough
Dylan McKay [Mon, 21 Jan 2019 02:44:09 +0000 (02:44 +0000)]
[AVR] Insert unconditional branch when inserting MBBs between blocks with fallthrough

This updates the AVR Select8/Select16 expansion code so that, when
inserting the two basic blocks for true and false conditions, any
existing fallthrough on the previous block is preserved.

Prior to this patch, if the block before the Select pseudo fell through
to the subsequent block, two new basic blocks would be inserted at the
prior fallthrough point, changing the fallthrough destination.

The predecessor or successor lists were not updated, causing the
BranchFolding pass at -O1 and above the rearrange basic blocks, causing
an infinite loop. Not to mention the unconditional fallthrough to the
true block is incorrect in of itself.

This patch modifies the Select8/16 expansion so that, if inserting true
and false basic blocks at a fallthrough point, the implicit branch is
preserved by means of an explicit, unconditional branch to the previous
fallthrough destination.

Thanks to Carl Peto for reporting this bug.

This fixes avr-rust bug https://github.com/avr-rust/rust/issues/123.

llvm-svn: 351718

5 years ago[fuzzer] Fix test checks broken after license header update
Vitaly Buka [Mon, 21 Jan 2019 02:22:06 +0000 (02:22 +0000)]
[fuzzer] Fix test checks broken after license header update

llvm-svn: 351717

5 years ago[safestack] Remove unsupported platforms
Vitaly Buka [Mon, 21 Jan 2019 02:21:59 +0000 (02:21 +0000)]
[safestack] Remove unsupported platforms

llvm-svn: 351716

5 years ago[safestack] Fix FreeBSD runtime build
Vitaly Buka [Mon, 21 Jan 2019 02:21:51 +0000 (02:21 +0000)]
[safestack] Fix FreeBSD runtime build

llvm-svn: 351715

5 years ago[libFuzzer][MSVC] Make Sanitizer Coverage MSVC-compatible
Jonathan Metzman [Mon, 21 Jan 2019 02:15:29 +0000 (02:15 +0000)]
[libFuzzer][MSVC] Make Sanitizer Coverage MSVC-compatible

Summary:
Make Sanitizer Coverage work when compiled work when compiler-rt
is compiled with MSVC.

The previous solution did not work for MSVC because MSVC tried to
align the .SCOV$CZ section even though we used
__declspec(align(1)) on its only symbol:
__stop___sancov_cntrs.
Because the counter array is composed
of 1 byte elements, it does not always end on an 8 or 4 byte
boundary. This means that padding was sometimes added to
added to align the next section, .SCOV$CZ.
Use a different strategy now: instead of only instructing
the compiler not to align the symbol, make the section
one byte long by making its only symbol a uint8_t, so that
the linker won't try to align it.

Reviewers: morehouse, rnk

Reviewed By: rnk

Subscribers: kubamracek

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

llvm-svn: 351714

5 years ago[ASan] On Darwin record global allocator pointer and size in introspection struct.
Dan Liew [Mon, 21 Jan 2019 01:41:12 +0000 (01:41 +0000)]
[ASan] On Darwin record global allocator pointer and size in introspection struct.

This implements `mi_extra_init(...)` for the ASan allocator on
Darwin and uses the `__lsan::GetAllocatorGlobalRange(...)` function
to retrieve the allocator pointer and size.

rdar://problem/45284065

llvm-svn: 351713

5 years agoOn Darwin add allocator address and size fields to
Dan Liew [Mon, 21 Jan 2019 01:41:08 +0000 (01:41 +0000)]
On Darwin add allocator address and size fields to
`sanitizer_malloc_introspection_t` and initialize them to zero.

We allow sanitizer implementations to perform different initialization
by defining `COMMON_MALLOC_HAS_EXTRA_INTROSPECTION_INIT` to be `1`
and providing an implementation of `mi_extra_init(...)`.

We use these changes in future patches to implement malloc zone enumeration.

rdar://problem/45284065

llvm-svn: 351712

5 years agoOn Darwin allow for sanitizer malloc implementations to provide a zone
Dan Liew [Mon, 21 Jan 2019 01:41:01 +0000 (01:41 +0000)]
On Darwin allow for sanitizer malloc implementations to provide a zone
enumerator.

This is done by defining `COMMON_MALLOC_HAS_ZONE_ENUMERATOR` to `1` and
then by providing an implementation of the `mi_enumerator(...)` function.
If a custom implementation isn't desired the macro is set to `0` which
causes a stub version (that fails) to be used.

Currently all Darwin sanitizers that have malloc implementations define
this to be `0` so there is no functionality change.

rdar://problem/45284065

llvm-svn: 351711

5 years ago[Driver] Don't pass default value to getCompilerRTArgString
Petr Hosek [Mon, 21 Jan 2019 01:34:09 +0000 (01:34 +0000)]
[Driver] Don't pass default value to getCompilerRTArgString

Using static library is already a default.

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

llvm-svn: 351710

5 years ago[CMake][Fuchsia] Drop -DNDEBUG, re-enable modules
Petr Hosek [Mon, 21 Jan 2019 01:06:50 +0000 (01:06 +0000)]
[CMake][Fuchsia] Drop -DNDEBUG, re-enable modules

-DNDEBUG is no longer needed now that we don't enable assertions,
modules should improve build times for the second stage.

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

llvm-svn: 351709

5 years ago[X86] Add missing test cases for some int/fp->fp conversion intrinsics with rounding...
Craig Topper [Sun, 20 Jan 2019 23:49:50 +0000 (23:49 +0000)]
[X86] Add missing test cases for some int/fp->fp conversion intrinsics with rounding mode. Use non-default rounding mode on some tests.

For some reason we were missing tests for several unmasked conversion intrinsics, but had their mask form.

Also use a non-default rounding mode on some tests to provide better coverage for a future patch.

llvm-svn: 351708

5 years agoFix test after AST dump output change
Stephen Kelly [Sun, 20 Jan 2019 23:46:30 +0000 (23:46 +0000)]
Fix test after AST dump output change

llvm-svn: 351707

5 years agoTentative fix for r351701 and gcc 6.2 build on ubuntu
Serge Guelton [Sun, 20 Jan 2019 23:43:37 +0000 (23:43 +0000)]
Tentative fix for r351701 and gcc 6.2 build on ubuntu

llvm-svn: 351706

5 years agoTentative fix for r351701 and gcc 6.2 build on ubuntu
Serge Guelton [Sun, 20 Jan 2019 23:06:45 +0000 (23:06 +0000)]
Tentative fix for r351701 and gcc 6.2 build on ubuntu

llvm-svn: 351705

5 years ago[safestack] Remove Darwin from supported platforms
Vitaly Buka [Sun, 20 Jan 2019 23:03:10 +0000 (23:03 +0000)]
[safestack] Remove Darwin from supported platforms

r339720 already disabled it in the driver

llvm-svn: 351704

5 years agoTry to port tests to AST dump changes
Stephen Kelly [Sun, 20 Jan 2019 22:56:02 +0000 (22:56 +0000)]
Try to port tests to AST dump changes

llvm-svn: 351703

5 years agoAdd missing test file
Serge Guelton [Sun, 20 Jan 2019 21:24:05 +0000 (21:24 +0000)]
Add missing test file

llvm-svn: 351702

5 years agoReplace llvm::isPodLike<...> by llvm::is_trivially_copyable<...>
Serge Guelton [Sun, 20 Jan 2019 21:19:56 +0000 (21:19 +0000)]
Replace llvm::isPodLike<...>  by llvm::is_trivially_copyable<...>

As noted in https://bugs.llvm.org/show_bug.cgi?id=36651, the specialization for
isPodLike<std::pair<...>> did not match the expectation of
std::is_trivially_copyable which makes the memcpy optimization invalid.

This patch renames the llvm::isPodLike trait into llvm::is_trivially_copyable.
Unfortunately std::is_trivially_copyable is not portable across compiler / STL
versions. So a portable version is provided too.

Note that the following specialization were invalid:

    std::pair<T0, T1>
    llvm::Optional<T>

Tests have been added to assert that former specialization are respected by the
standard usage of llvm::is_trivially_copyable, and that when a decent version
of std::is_trivially_copyable is available, llvm::is_trivially_copyable is
compared to std::is_trivially_copyable.

As of this patch, llvm::Optional is no longer considered trivially copyable,
even if T is. This is to be fixed in a later patch, as it has impact on a
long-running bug (see r347004)

Note that GCC warns about this UB, but this got silented by https://reviews.llvm.org/D50296.

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

llvm-svn: 351701

5 years agoAMDGPU: Legalize more bitcasts
Matt Arsenault [Sun, 20 Jan 2019 19:45:18 +0000 (19:45 +0000)]
AMDGPU: Legalize more bitcasts

llvm-svn: 351700

5 years agoGlobalISel: Add isPointer legality predicates
Matt Arsenault [Sun, 20 Jan 2019 19:45:14 +0000 (19:45 +0000)]
GlobalISel: Add isPointer legality predicates

llvm-svn: 351699

5 years agoAMDGPU/GlobalISel: Really legalize exts from i1
Matt Arsenault [Sun, 20 Jan 2019 19:28:20 +0000 (19:28 +0000)]
AMDGPU/GlobalISel: Really legalize exts from i1

There is a combine that was hiding these tests
not actually testing what they should be, although
they were producing the expected end result.

llvm-svn: 351698

5 years ago[X86] Auto upgrade VPCOM/VPCOMU intrinsics to generic integer comparisons
Simon Pilgrim [Sun, 20 Jan 2019 19:27:40 +0000 (19:27 +0000)]
[X86] Auto upgrade VPCOM/VPCOMU intrinsics to generic integer comparisons

This causes a couple of changes in the upgrade tests as signed/unsigned eq/ne are equivalent and we constant fold true/false codes, these changes are the same as what we already do for avx512 cmp/ucmp.

Noticed while cleaning up vector integer comparison costs for PR40376.

llvm-svn: 351697

5 years agoGlobalISel: Implement widenScalar for basic FP ops
Matt Arsenault [Sun, 20 Jan 2019 19:10:31 +0000 (19:10 +0000)]
GlobalISel: Implement widenScalar for basic FP ops

llvm-svn: 351696

5 years agoAMDGPU/GlobalISel: Legalize f32->f16 fptrunc
Matt Arsenault [Sun, 20 Jan 2019 19:10:26 +0000 (19:10 +0000)]
AMDGPU/GlobalISel: Legalize f32->f16 fptrunc

llvm-svn: 351695

5 years ago[X86] Remove the cvtuqq2ps256/cvtqq2ps256 mask builtins. Replace with uitofp/sitofp...
Craig Topper [Sun, 20 Jan 2019 19:04:56 +0000 (19:04 +0000)]
[X86] Remove the cvtuqq2ps256/cvtqq2ps256 mask builtins. Replace with uitofp/sitofp and select.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: kristina, cfe-commits

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

llvm-svn: 351694

5 years agoAMDGPU/GlobalISel: Fix some crashs in g_unmerge_values/g_merge_values
Matt Arsenault [Sun, 20 Jan 2019 18:40:36 +0000 (18:40 +0000)]
AMDGPU/GlobalISel: Fix some crashs in g_unmerge_values/g_merge_values

This was crashing in the predicate function assuming the value
is a vector.

Copy more of what AArch64 uses. This probably needs more refinement
later, but I don't exactly understand what it means in some cases,
particularly since any legalization for these seems to be missing.

llvm-svn: 351693

5 years agoAMDGPU/GlobalISel: Regbank select for fpext
Matt Arsenault [Sun, 20 Jan 2019 18:35:41 +0000 (18:35 +0000)]
AMDGPU/GlobalISel: Regbank select for fpext

llvm-svn: 351692

5 years agoAMDGPU/GlobalISel: Cleanup legality for extensions
Matt Arsenault [Sun, 20 Jan 2019 18:34:24 +0000 (18:34 +0000)]
AMDGPU/GlobalISel: Cleanup legality for extensions

llvm-svn: 351691

5 years ago[X86] Auto upgrade old style VPCOM/VPCOMU intrinsics to generic integer comparisons
Simon Pilgrim [Sun, 20 Jan 2019 17:36:22 +0000 (17:36 +0000)]
[X86] Auto upgrade old style VPCOM/VPCOMU intrinsics to generic integer comparisons

We were upgrading these to the new style VPCOM/VPCOMU intrinsics (which includes the condition code immediate), but we'll be getting rid of those shortly, so convert these to generics first.

This causes a couple of changes in the upgrade tests as signed/unsigned eq/ne are equivalent and we constant fold true/false codes, these changes are the same as what we already do for avx512 cmp/ucmp.

Noticed while cleaning up vector integer comparison costs for PR40376.

llvm-svn: 351690

5 years agoFix bug in `AsanAllocatorASVT` (ASan) and `AllocatorASVT` (LSan) templated alias.
Dan Liew [Sun, 20 Jan 2019 16:57:24 +0000 (16:57 +0000)]
Fix bug in `AsanAllocatorASVT` (ASan) and `AllocatorASVT` (LSan) templated alias.

We forgot to pass `AddressSpaceView` to the `CombinedAllocator`
which meant we would always use `LocalAddressSpaceView` for the
`CombinedAllocator` leading to a static_assert failing when we
tried to do `AsanAllocatorASVT<RemoteAddressSpaceView>` or
`AllocatorASVT<RemoteAddressSpaceView>`.

rdar://problem/45284065

llvm-svn: 351689

5 years ago[X86] Replace VPCOM/VPCOMU with generic integer comparisons (llvm)
Simon Pilgrim [Sun, 20 Jan 2019 16:40:44 +0000 (16:40 +0000)]
[X86] Replace VPCOM/VPCOMU with generic integer comparisons (llvm)

These intrinsics can always be replaced with generic integer comparisons without any regression in codegen, even for -O0/-fast-isel cases.

Noticed while cleaning up vector integer comparison costs for PR40376.

A future commit will remove/autoupgrade the existing VPCOM/VPCOMU llvm intrinsics.

llvm-svn: 351688

5 years ago[X86] Replace VPCOM/VPCOMU with generic integer comparisons (clang)
Simon Pilgrim [Sun, 20 Jan 2019 16:40:33 +0000 (16:40 +0000)]
[X86] Replace VPCOM/VPCOMU with generic integer comparisons (clang)

These intrinsics can always be replaced with generic integer comparisons without any regression in codegen, even for -O0/-fast-isel cases.

Noticed while cleaning up vector integer comparison costs for PR40376.

A future commit will remove/autoupgrade the existing VPCOM/VPCOMU llvm intrinsics.

llvm-svn: 351687

5 years ago[clang-tidy] misc-non-private-member-variables-in-classes: ignore implicit methods
Miklos Vajna [Sun, 20 Jan 2019 14:28:27 +0000 (14:28 +0000)]
[clang-tidy] misc-non-private-member-variables-in-classes: ignore implicit methods

Otherwise we don't warn on a struct containing a single public int, but
we warn on a struct containing a single public std::string, which is
inconsistent.

llvm-svn: 351686

5 years ago[CostModel][X86] Add explicit vector select costs
Simon Pilgrim [Sun, 20 Jan 2019 13:55:01 +0000 (13:55 +0000)]
[CostModel][X86] Add explicit vector select costs

Prior to SSE41 (and sometimes on AVX1), vector select has to be performed as a ((X & C)|(Y & ~C)) bit select.

Exposes a couple of issues with the min/max reduction costs (which only go down to SSE42 for some reason).

The increase pre-SSE41 selection costs also prevent a couple of tests from firing any longer, so I've either tweaked the target or added AVX tests as well to the existing SSE2 tests.

llvm-svn: 351685

5 years ago[CostModel][X86] Add explicit fcmp costs for pre-SSE42 targets
Simon Pilgrim [Sun, 20 Jan 2019 13:21:43 +0000 (13:21 +0000)]
[CostModel][X86] Add explicit fcmp costs for pre-SSE42 targets

Typical throughputs: cmpss/cmpps = 1cy and cmpsd/cmppd = 2cy before the Core2 era

llvm-svn: 351684

5 years ago[TTI][X86] Reordered getCmpSelInstrCost cost tables in descending ISA order. NFCI.
Simon Pilgrim [Sun, 20 Jan 2019 12:28:13 +0000 (12:28 +0000)]
[TTI][X86] Reordered getCmpSelInstrCost cost tables in descending ISA order. NFCI.

Minor tidyup to make it clearer whats going on before adding additional costs.

llvm-svn: 351683

5 years ago[CostModel][X86] Split icmp/fcmp costs tests and test all comparison codes
Simon Pilgrim [Sun, 20 Jan 2019 12:10:42 +0000 (12:10 +0000)]
[CostModel][X86] Split icmp/fcmp costs tests and test all comparison codes

llvm-svn: 351682

5 years ago[CostModel][X86] Add masked load/store/gather/scatter tests for SSE2/SSE42/AVX1 targets
Simon Pilgrim [Sun, 20 Jan 2019 11:23:01 +0000 (11:23 +0000)]
[CostModel][X86] Add masked load/store/gather/scatter tests for SSE2/SSE42/AVX1 targets

llvm-svn: 351681

5 years ago[CostModel][X86] Add non-constant vselect cost tests
Simon Pilgrim [Sun, 20 Jan 2019 11:19:35 +0000 (11:19 +0000)]
[CostModel][X86] Add non-constant vselect cost tests

Also add AVX512 costs at the same time

llvm-svn: 351680

5 years ago[AVR] Remove unneeded XFAILs from the Generic CodeGen tests
Dylan McKay [Sun, 20 Jan 2019 11:16:58 +0000 (11:16 +0000)]
[AVR] Remove unneeded XFAILs from the Generic CodeGen tests

These have been in place for quite a while now.

Several bugs have since been fixed, and these tests now pass.

llvm-svn: 351679

5 years ago[AVR] Allow AVR to be explicitly set as the default target triple
Dylan McKay [Sun, 20 Jan 2019 11:12:39 +0000 (11:12 +0000)]
[AVR] Allow AVR to be explicitly set as the default target triple

This extends the CMake cross compilation logic so that AVR can be set as
the default target triple, and thus the generic codegen tests can be
run.

This used to be possible on AVR; the CMake configuration files have
since been changed.

With this patch, 'cmake -DLLVM_DEFAULT_TARGET_TRIPLE=avr-unknown-unknown' can
be passed on the command line, making the `-mcpu` argument redundant to
'llc' and friends.

llvm-svn: 351678

5 years ago[AVR] Replace two references to ARM's 't2_so_imm' type comments
Dylan McKay [Sun, 20 Jan 2019 03:45:29 +0000 (03:45 +0000)]
[AVR] Replace two references to ARM's 't2_so_imm' type comments

These were originally introduced in a copy-paste committed in r351526.

The reference to 't2_so_imm' have been updated to 'imm_com8' so the
comment is now accurate.

Thanks to Eli Friedman for noticing this.

llvm-svn: 351674

5 years ago[AVR] Fix codegen bug in 16-bit loads
Dylan McKay [Sun, 20 Jan 2019 03:41:08 +0000 (03:41 +0000)]
[AVR] Fix codegen bug in 16-bit loads

Prior to this patch, the AVR::LDWRdPtr instruction was always lowered to
instructions of this pattern:

    ld  $GPR8, [PTR:XYZ]+
    ld  $GPR8, [PTR]+1

This has a problem; the [PTR] is incremented in-place once, but never
decremented.

Future uses of the same pointer will use the now clobbered value,
leading to the pointer being incorrect by an offset of one.

This patch modifies the expansion code of the LDWRdPtr pseudo
instruction so that the pointer variable is not silently clobbered in
future uses in the same live range.

Bug first reported by Keshav Kini.

Patch by Kaushik Phatak.

llvm-svn: 351673

5 years agoRevert "[AVR] Fix codegen bug in 16-bit loads"
Dylan McKay [Sun, 20 Jan 2019 03:41:00 +0000 (03:41 +0000)]
Revert "[AVR] Fix codegen bug in 16-bit loads"

This reverts commit r351544.

In that commit, I had mistakenly misattributed the issue submitter as
the patch author, Kaushik Phatak.

The patch will be recommitted immediately with the correct attribution.

llvm-svn: 351672

5 years ago[ConstantMerge] Factor out check for un-mergeable globals, NFC
Vedant Kumar [Sun, 20 Jan 2019 02:44:43 +0000 (02:44 +0000)]
[ConstantMerge] Factor out check for un-mergeable globals, NFC

llvm-svn: 351671

5 years agoFix aligned allocation availability XFAILs after D56445.
Eric Fiselier [Sun, 20 Jan 2019 01:21:35 +0000 (01:21 +0000)]
Fix aligned allocation availability XFAILs after D56445.

D56445 bumped the minimum Mac OS X version required for aligned
allocation from 10.13 to 10.14. This caused libc++ tests depending
on the old value to break.

This patch updates the XFAILs for those tests to include 10.13.

llvm-svn: 351670

5 years agoRevert "Fix aligned allocation availability XFAILs after D56445."
Eric Fiselier [Sun, 20 Jan 2019 01:12:53 +0000 (01:12 +0000)]
Revert "Fix aligned allocation availability XFAILs after D56445."

This reverts commit r351625.

That fix was incomplete. I'm reverting so I can commit a complete fix
in a single revision.

llvm-svn: 351669

5 years agomake XFAIL, REQUIRES, and UNSUPPORTED support multi-line expressions
Eric Fiselier [Sun, 20 Jan 2019 00:51:02 +0000 (00:51 +0000)]
make XFAIL, REQUIRES, and UNSUPPORTED support multi-line expressions

llvm-svn: 351668

5 years agoImprove docker images and configuration; create compiler-zoo image
Eric Fiselier [Sat, 19 Jan 2019 23:36:06 +0000 (23:36 +0000)]
Improve docker images and configuration; create compiler-zoo image

llvm-svn: 351667

5 years ago[X86] Add masked MCVTSI2P/MCVTUI2P ISD opcodes to model the cvtqq2ps cvtuqq2ps nodes...
Craig Topper [Sat, 19 Jan 2019 21:26:20 +0000 (21:26 +0000)]
[X86] Add masked MCVTSI2P/MCVTUI2P ISD opcodes to model the cvtqq2ps cvtuqq2ps nodes that produce less than 128-bits of results.

These nodes zero the upper half of the result and can't be represented with vselect.

llvm-svn: 351666

5 years ago[FIX] Generalize the expected results for callback clang tests
Johannes Doerfert [Sat, 19 Jan 2019 20:46:10 +0000 (20:46 +0000)]
[FIX] Generalize the expected results for callback clang tests

llvm-svn: 351665

5 years agoFix order of arguments in an lldb type summary in examples
Nathan Lanza [Sat, 19 Jan 2019 20:08:41 +0000 (20:08 +0000)]
Fix order of arguments in an lldb type summary in examples

The format for the -w argument is:

    -w name ( --category name )

Rearrange the flags correctly.

llvm-svn: 351664

5 years ago[llvm-objcopy] [COFF] Implement --only-section
Martin Storsjo [Sat, 19 Jan 2019 19:42:54 +0000 (19:42 +0000)]
[llvm-objcopy] [COFF] Implement --only-section

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

llvm-svn: 351663

5 years ago[llvm-objcopy] [COFF] Implement --only-keep-debug
Martin Storsjo [Sat, 19 Jan 2019 19:42:48 +0000 (19:42 +0000)]
[llvm-objcopy] [COFF] Implement --only-keep-debug

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

llvm-svn: 351662

5 years ago[llvm-objcopy] [COFF] Implement --strip-debug
Martin Storsjo [Sat, 19 Jan 2019 19:42:41 +0000 (19:42 +0000)]
[llvm-objcopy] [COFF] Implement --strip-debug

Also remove sections similarly for --strip-all, --discard-all,
--strip-unneeded.

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

llvm-svn: 351661

5 years ago[llvm-objcopy] [COFF] Add support for removing sections
Martin Storsjo [Sat, 19 Jan 2019 19:42:35 +0000 (19:42 +0000)]
[llvm-objcopy] [COFF] Add support for removing sections

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

llvm-svn: 351660

5 years ago[llvm-objcopy] [COFF] Add a testcase for patching the debug directory. NFC.
Martin Storsjo [Sat, 19 Jan 2019 19:42:27 +0000 (19:42 +0000)]
[llvm-objcopy] [COFF] Add a testcase for patching the debug directory. NFC.

The debug directory contains the rwa file address of itself,
which is updated on write. Add a testcase for this existing
functionality.

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

llvm-svn: 351659

5 years ago[llvm-objcopy] [COFF] Remove a superfluous namespace qualification. NFC.
Martin Storsjo [Sat, 19 Jan 2019 19:42:23 +0000 (19:42 +0000)]
[llvm-objcopy] [COFF] Remove a superfluous namespace qualification. NFC.

llvm-svn: 351658

5 years ago[llvm-objcopy] [COFF] Rename a test from .yaml to .test. NFC.
Martin Storsjo [Sat, 19 Jan 2019 19:42:19 +0000 (19:42 +0000)]
[llvm-objcopy] [COFF] Rename a test from .yaml to .test. NFC.

Tests named .yaml aren't executed by default in this directory
(while they are within e.g. LLD).

llvm-svn: 351657

5 years agoUpdate an example to use the new LLVM file header.
Chandler Carruth [Sat, 19 Jan 2019 11:54:04 +0000 (11:54 +0000)]
Update an example to use the new LLVM file header.

llvm-svn: 351653

5 years agoUpdate the coding standards with the new file header.
Chandler Carruth [Sat, 19 Jan 2019 11:53:58 +0000 (11:53 +0000)]
Update the coding standards with the new file header.

llvm-svn: 351652

5 years agoUpdate the license mentioned in this documentation.
Chandler Carruth [Sat, 19 Jan 2019 11:48:15 +0000 (11:48 +0000)]
Update the license mentioned in this documentation.

llvm-svn: 351651

5 years agoUpdate generator script to use the new license file header.
Chandler Carruth [Sat, 19 Jan 2019 11:38:40 +0000 (11:38 +0000)]
Update generator script to use the new license file header.

llvm-svn: 351650

5 years agoUpdate structured references to the license to the new license.
Chandler Carruth [Sat, 19 Jan 2019 11:30:51 +0000 (11:30 +0000)]
Update structured references to the license to the new license.

Since these are intended to be short and succinct, I've used the SPDX
full name. It's human readable, but formally agreed upon and will be
part of the SPDX spec for licenses.

llvm-svn: 351649

5 years agoUpdate more file headers across all of the LLVM projects in the monorepo
Chandler Carruth [Sat, 19 Jan 2019 10:56:40 +0000 (10:56 +0000)]
Update more file headers across all of the LLVM projects in the monorepo
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351648

5 years ago[ASTDump] NFC: Convert iterative loops to cxx_range_for
Stephen Kelly [Sat, 19 Jan 2019 09:57:59 +0000 (09:57 +0000)]
[ASTDump] NFC: Convert iterative loops to cxx_range_for

This is coming up a lot in reviews. Better just to change them all at
once.

llvm-svn: 351647

5 years ago[ASTDump] NFC: Use `const auto` in cxx_range_for loops
Stephen Kelly [Sat, 19 Jan 2019 09:57:51 +0000 (09:57 +0000)]
[ASTDump] NFC: Use `const auto` in cxx_range_for loops

This is coming up a lot in reviews. Better just to do them all at once.

llvm-svn: 351646

5 years ago[InstCombine] Simplify cttz/ctlz + icmp ugt/ult
Nikita Popov [Sat, 19 Jan 2019 09:56:01 +0000 (09:56 +0000)]
[InstCombine] Simplify cttz/ctlz + icmp ugt/ult

Followup to D55745, this time handling comparisons with ugt and ult
predicates (which are the canonical forms for non-equality predicates).

For ctlz we can convert into a simple icmp, for cttz we can convert
into a mask check.

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

llvm-svn: 351645

5 years ago[NFX] Fix language reference title declaration
Johannes Doerfert [Sat, 19 Jan 2019 09:40:14 +0000 (09:40 +0000)]
[NFX] Fix language reference title declaration

llvm-svn: 351644

5 years ago[FIX] Restrict callback pthreads_create test to linux only
Johannes Doerfert [Sat, 19 Jan 2019 09:40:10 +0000 (09:40 +0000)]
[FIX] Restrict callback pthreads_create test to linux only

llvm-svn: 351643

5 years ago[NFC] Generalize expected output for callback test
Johannes Doerfert [Sat, 19 Jan 2019 09:40:08 +0000 (09:40 +0000)]
[NFC] Generalize expected output for callback test

llvm-svn: 351642

5 years ago[NFC] Fix unused variable warnings in Release builds
Johannes Doerfert [Sat, 19 Jan 2019 09:39:57 +0000 (09:39 +0000)]
[NFC] Fix unused variable warnings in Release builds

llvm-svn: 351641

5 years agoUpdate the license header in this man-page file.
Chandler Carruth [Sat, 19 Jan 2019 09:24:38 +0000 (09:24 +0000)]
Update the license header in this man-page file.

It contains an `$Id$` expansion and so can only be updated from a true
Subversion client.

See the details of this update in r351636.

llvm-svn: 351640

5 years agoRemove a period from CREDITS.TXT (testing email change). NFC
Kristina Brooks [Sat, 19 Jan 2019 09:07:38 +0000 (09:07 +0000)]
Remove a period from CREDITS.TXT (testing email change). NFC

llvm-svn: 351639

5 years agoFix all the bots.
Eric Fiselier [Sat, 19 Jan 2019 09:07:04 +0000 (09:07 +0000)]
Fix all the bots.

The buildbot start scripts hardcode the version string.
Bump it from 8 to 9.

llvm-svn: 351638

5 years agoMove decl context dumping to TextNodeDumper
Stephen Kelly [Sat, 19 Jan 2019 09:05:55 +0000 (09:05 +0000)]
Move decl context dumping to TextNodeDumper

Summary: Only an obscure case is moved.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 351637

5 years agoUpdate the file headers across all of the LLVM projects in the monorepo
Chandler Carruth [Sat, 19 Jan 2019 08:50:56 +0000 (08:50 +0000)]
Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636

5 years agoRemove unnecesasry comment markers.
Chandler Carruth [Sat, 19 Jan 2019 07:02:23 +0000 (07:02 +0000)]
Remove unnecesasry comment markers.

llvm-svn: 351635

5 years agoConvert two more files that were using Windows line endings and remove
Chandler Carruth [Sat, 19 Jan 2019 06:36:08 +0000 (06:36 +0000)]
Convert two more files that were using Windows line endings and remove
a stray single '\r' from one file. These are the last line ending issues
I can find in the files containing parts of LLVM's file headers.

llvm-svn: 351634

5 years agoRemove random windows line endings that snuck into the middle of this
Chandler Carruth [Sat, 19 Jan 2019 06:36:00 +0000 (06:36 +0000)]
Remove random windows line endings that snuck into the middle of this
code.

llvm-svn: 351633

5 years agoUpdate some code used in our visual studio plugins to use linux file
Chandler Carruth [Sat, 19 Jan 2019 06:29:07 +0000 (06:29 +0000)]
Update some code used in our visual studio plugins to use linux file
endings. We already used them in some cases, and this makes things
consistent. This will also simplify updating the licenses in these
files.

llvm-svn: 351632

5 years agoInstall new LLVM license structure and new developer policy.
Chandler Carruth [Sat, 19 Jan 2019 06:14:24 +0000 (06:14 +0000)]
Install new LLVM license structure and new developer policy.

This installs the new developer policy and moves all of the license
files across all LLVM projects in the monorepo to the new license
structure. The remaining projects will be moved independently.

Note that I've left odd formatting and other idiosyncracies of the
legacy license structure text alone to make the diff easier to read.
Critically, note that we do not in any case *remove* the old license
notice or terms, as that remains necessary until we finish the
relicensing process.

I've updated a few license files that refer to the LLVM license to
instead simply refer generically to whatever license the LLVM project is
under, basically trying to minimize confusion.

This is really the culmination of so many people. Chris led the
community discussions, drafted the policy update and organized the
multi-year string of meeting between lawyers across the community to
figure out the strategy. Numerous lawyers at companies in the community
spent their time figuring out initial answers, and then the Foundation's
lawyer Heather Meeker has done *so* much to help refine and get us ready
here. I could keep going on, but I just want to make sure everyone
realizes what a huge community effort this has been from the begining.

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

llvm-svn: 351631

5 years agoCleanup non-UTF8 characters and some types I found in these files.
Chandler Carruth [Sat, 19 Jan 2019 06:02:27 +0000 (06:02 +0000)]
Cleanup non-UTF8 characters and some types I found in these files.

llvm-svn: 351630

5 years agoEmit !callback metadata and introduce the callback attribute
Johannes Doerfert [Sat, 19 Jan 2019 05:36:54 +0000 (05:36 +0000)]
Emit !callback metadata and introduce the callback attribute

  With commit r351627, LLVM gained the ability to apply (existing) IPO
  optimizations on indirections through callbacks, or transitive calls.
  The general idea is that we use an abstraction to hide the middle man
  and represent the callback call in the context of the initial caller.
  It is described in more detail in the commit message of the LLVM patch
  r351627, the llvm::AbstractCallSite class description, and the
  language reference section on callback-metadata.

  This commit enables clang to emit !callback metadata that is
  understood by LLVM. It does so in three different cases:
    1) For known broker functions declarations that are directly
       generated, e.g., __kmpc_fork_call for the OpenMP pragma parallel.
    2) For known broker functions that are identified by their name and
       source location through the builtin detection, e.g.,
       pthread_create from the POSIX thread API.
    3) For user annotated functions that carry the "callback(callee, ...)"
       attribute. The attribute has to include the name, or index, of
       the callback callee and how the passed arguments can be
       identified (as many as the callback callee has). See the callback
       attribute documentation for detailed information.

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

llvm-svn: 351629

5 years agoEnable IPConstantPropagation to work with abstract call sites
Johannes Doerfert [Sat, 19 Jan 2019 05:19:12 +0000 (05:19 +0000)]
Enable IPConstantPropagation to work with abstract call sites

This modification of the currently unused inter-procedural constant
propagation pass (IPConstantPropagation) shows how abstract call sites
enable optimization of callback calls alongside direct and indirect
calls. Through minimal changes, mostly dealing with the partial mapping
of callbacks, inter-procedural constant propagation was enabled for
callbacks, e.g., OpenMP runtime calls or pthreads_create.

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

llvm-svn: 351628

5 years agoAbstractCallSite -- A unified interface for (in)direct and callback calls
Johannes Doerfert [Sat, 19 Jan 2019 05:19:06 +0000 (05:19 +0000)]
AbstractCallSite -- A unified interface for (in)direct and callback calls

  An abstract call site is a wrapper that allows to treat direct,
  indirect, and callback calls the same. If an abstract call site
  represents a direct or indirect call site it behaves like a stripped
  down version of a normal call site object. The abstract call site can
  also represent a callback call, thus the fact that the initially
  called function (=broker) may invoke a third one (=callback callee).
  In this case, the abstract call side hides the middle man, hence the
  broker function. The result is a representation of the callback call,
  inside the broker, but in the context of the original instruction that
  invoked the broker.

  Again, there are up to three functions involved when we talk about
  callback call sites. The caller (1), which invokes the broker
  function. The broker function (2), that may or may not invoke the
  callback callee. And finally the callback callee (3), which is the
  target of the callback call.

  The abstract call site will handle the mapping from parameters to
  arguments depending on the semantic of the broker function. However,
  it is important to note that the mapping is often partial. Thus, some
  arguments of the call/invoke instruction are mapped to parameters of
  the callee while others are not. At the same time, arguments of the
  callback callee might be unknown, thus "null" if queried.

  This patch introduces also !callback metadata which describe how a
  callback broker maps from parameters to arguments. This metadata is
  directly created by clang for known broker functions, provided through
  source code attributes by the user, or later deduced by analyses.

For motivation and additional information please see the corresponding
talk (slides/video)
  https://llvm.org/devmtg/2018-10/talk-abstracts.html#talk20
as well as the LCPC paper
  http://compilers.cs.uni-saarland.de/people/doerfert/par_opt_lcpc18.pdf

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

llvm-svn: 351627

5 years agoReapply "[CGP] Check for existing inttotpr before creating new one"
Roman Tereshin [Sat, 19 Jan 2019 03:37:25 +0000 (03:37 +0000)]
Reapply "[CGP] Check for existing inttotpr before creating new one"

Original commit: r351582

llvm-svn: 351626

5 years agoFix aligned allocation availability XFAILs after D56445.
Eric Fiselier [Sat, 19 Jan 2019 03:27:05 +0000 (03:27 +0000)]
Fix aligned allocation availability XFAILs after D56445.

D56445 bumped the minimum Mac OS X version required for aligned
allocation from 10.13 to 10.14. This caused libc++ tests depending
on the old value to break.

This patch updates the XFAILs for those tests to include 10.13.

llvm-svn: 351625