platform/upstream/llvm.git
6 years ago[X86] Add 512-bit unmasked pmulhrsw/pmulhw/pmulhuw intrinsics. Remove and auto upgrad...
Craig Topper [Tue, 20 Feb 2018 07:28:14 +0000 (07:28 +0000)]
[X86] Add 512-bit unmasked pmulhrsw/pmulhw/pmulhuw intrinsics. Remove and auto upgrade 128/256/512 bit masked pmulhrsw/pmulhw/pmulhuw intrinsics.

The 128 and 256 bit versions were already not used by clang. This adds an equivalent unmasked 512 bit version. Then autoupgrades all sizes to use unmasked intrinsics plus select.

llvm-svn: 325559

6 years agoUse isl::manage_copy to simplify calls to isl::manage(isl_.._copy())
Tobias Grosser [Tue, 20 Feb 2018 07:26:58 +0000 (07:26 +0000)]
Use isl::manage_copy to simplify calls to isl::manage(isl_.._copy())

As part of this cleanup a couple of unnecessary isl::manage(obj.copy()) pattern
are eliminated as well.

We checked for all potential cleanups by scanning for:

  "grep -R isl::manage\( lib/ | grep copy"

llvm-svn: 325558

6 years agoUpdate isl to isl-0.18-1047-g4a20ef8
Tobias Grosser [Tue, 20 Feb 2018 07:26:42 +0000 (07:26 +0000)]
Update isl to isl-0.18-1047-g4a20ef8

This update:

  - Removes several deprecated functions (e.g., isl_band).
  - Improves the pretty-printing of sets by detecting modulos and "false"
    equalities.
  - Minor improvements to coalescing and increased robustness of the isl
    scheduler.

This update does not yet include isl commit isl-0.18-90-gd00cb45
(isl_pw_*_alloc: add missing check for compatible spaces, Wed Sep 6 12:18:04
2017 +0200), as this additional check is too tight and unfortunately causes
two test case failures in Polly. A patch has been submitted to isl and will be
included in the next isl update for Polly.

llvm-svn: 325557

6 years agoFix broken isl-noexceptions.h path in update-isl script
Tobias Grosser [Tue, 20 Feb 2018 07:24:58 +0000 (07:24 +0000)]
Fix broken isl-noexceptions.h path in update-isl script

llvm-svn: 325556

6 years agoUpdate isl C++ bindings to latest version of isl
Tobias Grosser [Tue, 20 Feb 2018 07:24:55 +0000 (07:24 +0000)]
Update isl C++ bindings to latest version of isl

llvm-svn: 325555

6 years agoDo not call band_list().dump()
Tobias Grosser [Tue, 20 Feb 2018 07:24:40 +0000 (07:24 +0000)]
Do not call band_list().dump()

This is in preparation for the removal of band_list from isl.

llvm-svn: 325554

6 years ago[Sema] Fix -Wunused-variable
Sam McCall [Tue, 20 Feb 2018 07:21:56 +0000 (07:21 +0000)]
[Sema] Fix -Wunused-variable

llvm-svn: 325553

6 years ago[X86] Remove GCCBuiltin from a bunch of intrinsics that aren't used by clang and...
Craig Topper [Tue, 20 Feb 2018 05:49:22 +0000 (05:49 +0000)]
[X86] Remove GCCBuiltin from a bunch of intrinsics that aren't used by clang and should be removed.

llvm-svn: 325552

6 years agoReport fatal error in the case of out of memory
Serge Pavlov [Tue, 20 Feb 2018 05:41:26 +0000 (05:41 +0000)]
Report fatal error in the case of out of memory

This is the second part of recommit of r325224. The previous part was
committed in r325426, which deals with C++ memory allocation. Solution
for C memory allocation involved functions `llvm::malloc` and similar.
This was a fragile solution because it caused ambiguity errors in some
cases. In this commit the new functions have names like `llvm::safe_malloc`.

The relevant part of original comment is below, updated for new function
names.

Analysis of fails in the case of out of memory errors can be tricky on
Windows. Such error emerges at the point where memory allocation function
fails, but manifests itself when null pointer is used. These two points
may be distant from each other. Besides, next runs may not exhibit
allocation error.

In some cases memory is allocated by a call to some of C allocation
functions, malloc, calloc and realloc. They are used for interoperability
with C code, when allocated object has variable size and when it is
necessary to avoid call of constructors. In many calls the result is not
checked for null pointer. To simplify checks, new functions are defined
in the namespace 'llvm': `safe_malloc`, `safe_calloc` and `safe_realloc`.
They behave as corresponding standard functions but produce fatal error if
allocation fails. This change replaces the standard functions like 'malloc'
in the cases when the result of the allocation function is not checked
for null pointer.

Finally, there are plain C code, that uses malloc and similar functions. If
the result is not checked, assert statement is added.

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

llvm-svn: 325551

6 years ago[AArch64][GlobalISel] When copying from a gpr32 to an fpr16 reg, convert to fpr32...
Amara Emerson [Tue, 20 Feb 2018 05:11:57 +0000 (05:11 +0000)]
[AArch64][GlobalISel] When copying from a gpr32 to an fpr16 reg, convert to fpr32 first.

This is a follow on commit to r[x] where we fix the other direction of copy.
For this case, after converting the source from gpr32 -> fpr32, we use a
subregister copy, which is essentially what EXTRACT_SUBREG does in SDAG land.

https://reviews.llvm.org/D43444

llvm-svn: 325550

6 years agoDo not create a temporary data structure for relocations.
Rui Ueyama [Tue, 20 Feb 2018 04:26:26 +0000 (04:26 +0000)]
Do not create a temporary data structure for relocations.

This patch removes `OutRelocations` vector from the InputChunk and
directly consume `Relocations` vector instead. This should make the linker
faster because we don't create a temporary data structure, and it matches
the lld's design principle that we don't create temporary data structures
for object files but instead directly consume mmap'ed data whenever possible.

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

llvm-svn: 325549

6 years ago[X86] Mark XOP vpmac* and vpmadc intrinsics as being commutative so that tablegen...
Craig Topper [Tue, 20 Feb 2018 03:58:14 +0000 (03:58 +0000)]
[X86] Mark XOP vpmac* and vpmadc intrinsics as being commutative so that tablegen will generate patterns with the load in operand 0.

This allows loads to be folded during isel without the peephole pass.

llvm-svn: 325548

6 years ago[X86] Make XOP VPCOM instructions commutable to fold loads during isel.
Craig Topper [Tue, 20 Feb 2018 03:58:13 +0000 (03:58 +0000)]
[X86] Make XOP VPCOM instructions commutable to fold loads during isel.

llvm-svn: 325547

6 years ago[X86] Make a helper function for commuting AVX512 VPCMP immediates since we do it...
Craig Topper [Tue, 20 Feb 2018 03:58:11 +0000 (03:58 +0000)]
[X86] Make a helper function for commuting AVX512 VPCMP immediates since we do it in two places.

llvm-svn: 325546

6 years agoFix some -Wexceptions false positives.
Richard Smith [Tue, 20 Feb 2018 02:32:30 +0000 (02:32 +0000)]
Fix some -Wexceptions false positives.

Reimplement the "noexcept function actually throws" warning to properly handle
nested try-blocks. In passing, change 'throw;' handling to treat any enclosing
try block as being sufficient to suppress the warning rather than requiring a
'catch (...)'; the warning is intended to be conservatively-correct.

llvm-svn: 325545

6 years ago[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Tue, 20 Feb 2018 02:16:28 +0000 (02:16 +0000)]
[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 325544

6 years ago[GISel]: Add pattern matchers for G_BITCAST/PTRTOINT/INTTOPTR
Aditya Nandakumar [Mon, 19 Feb 2018 23:11:53 +0000 (23:11 +0000)]
[GISel]: Add pattern matchers for G_BITCAST/PTRTOINT/INTTOPTR

Adds pattern matchers for the above along with unit tests for the same.
https://reviews.llvm.org/D43479

llvm-svn: 325542

6 years ago[InstCombine] use CreateWithCopiedFlags to reduce code; NFCI
Sanjay Patel [Mon, 19 Feb 2018 23:09:03 +0000 (23:09 +0000)]
[InstCombine] use CreateWithCopiedFlags to reduce code; NFCI

Also, move the folds with constants closer to make it easier to follow.

llvm-svn: 325541

6 years agoFix test failure on target where size_t is long long.
Richard Smith [Mon, 19 Feb 2018 22:50:50 +0000 (22:50 +0000)]
Fix test failure on target where size_t is long long.

llvm-svn: 325540

6 years agoRevert "[mem2reg] Use range loops (NFCI)"
Brian Gesiak [Mon, 19 Feb 2018 22:48:51 +0000 (22:48 +0000)]
Revert "[mem2reg] Use range loops (NFCI)"

This reverts commit r325532.

llvm-svn: 325539

6 years agoMerge two small functions and add comments.
Rui Ueyama [Mon, 19 Feb 2018 22:44:18 +0000 (22:44 +0000)]
Merge two small functions and add comments.

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

llvm-svn: 325538

6 years agoRemoved a variable that is used only once.
Rui Ueyama [Mon, 19 Feb 2018 22:39:52 +0000 (22:39 +0000)]
Removed a variable that is used only once.

llvm-svn: 325537

6 years ago[WebAssembly] Expand a lambda that is used only once.
Rui Ueyama [Mon, 19 Feb 2018 22:34:47 +0000 (22:34 +0000)]
[WebAssembly] Expand a lambda that is used only once.

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

llvm-svn: 325536

6 years ago[WebAssembly] Define toString(wasm::InputChunk *) and use that in MarkLive.cpp.
Rui Ueyama [Mon, 19 Feb 2018 22:29:48 +0000 (22:29 +0000)]
[WebAssembly] Define toString(wasm::InputChunk *) and use that in MarkLive.cpp.

Define toString(wasm::InputChunk *) and use that in MarkLive.cpp.

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

llvm-svn: 325535

6 years ago[X86] Use vpmovq2m/vpmovd2m for truncate to vXi1 when possible.
Craig Topper [Mon, 19 Feb 2018 22:07:31 +0000 (22:07 +0000)]
[X86] Use vpmovq2m/vpmovd2m for truncate to vXi1 when possible.

Previously we used vptestmd, but the scheduling data for SKX says vpmovq2m/vpmovd2m is lower latency. We already used vpmovb2m/vpmovw2m for byte/word truncates. So this is more consistent anyway.

llvm-svn: 325534

6 years ago[InstCombine] allow fdiv with constant dividend folds with less than full -ffast...
Sanjay Patel [Mon, 19 Feb 2018 21:46:52 +0000 (21:46 +0000)]
[InstCombine] allow fdiv with constant dividend folds with less than full -ffast-math

It's possible that we could allow this either 'arcp' or 'reassoc' alone, but this
should be conservatively better than what we have right now. GCC allows this with
only -freciprocal-math.

The last test is changed to show a case that is expected to fold, but we need D43398.

llvm-svn: 325533

6 years ago[mem2reg] Use range loops (NFCI)
Brian Gesiak [Mon, 19 Feb 2018 21:44:52 +0000 (21:44 +0000)]
[mem2reg] Use range loops (NFCI)

Summary:
Several for loops in PromoteMemoryToRegister.cpp leave their increment
expression empty, instead incrementing the iterator within the for loop
body. I believe this is because these loops were previously implemented
as while loops; see https://reviews.llvm.org/rL188327.

Incrementing the iterator within the body of the for loop instead of
in its increment expression makes it seem like the iterator will be
modified or conditionally incremented within the loop, but that is not
the case in these loops.

Instead, use range loops.

Test Plan: `check-llvm`

Reviewers: davide, bkramer

Reviewed By: davide, bkramer

Subscribers: llvm-commits

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

llvm-svn: 325532

6 years ago[InstCombine] refactor fdiv with constant dividend folds; NFC
Sanjay Patel [Mon, 19 Feb 2018 21:17:58 +0000 (21:17 +0000)]
[InstCombine] refactor fdiv with constant dividend folds; NFC

The last fold that used to be here was not necessary. That's a
combination of 2 folds (and there's a regression test to show that).

The transforms are guarded by isFast(), but that should be loosened.

llvm-svn: 325531

6 years ago[InstCombine] move fdiv tests; NFC
Sanjay Patel [Mon, 19 Feb 2018 21:13:39 +0000 (21:13 +0000)]
[InstCombine] move fdiv tests; NFC

Also, use vector constants just to prove that already works.

llvm-svn: 325530

6 years ago[Coroutines] Move debug statement before assert
Brian Gesiak [Mon, 19 Feb 2018 20:50:09 +0000 (20:50 +0000)]
[Coroutines] Move debug statement before assert

Summary:
Move a debug statement to above where an assertion is hit, so that the debug
statement can be inspected before a stack trace.

Test Plan: `check-llvm`

llvm-svn: 325529

6 years ago[llvm-objcopy] Use the full filename in --add-gnu-debuglink
Alexander Richardson [Mon, 19 Feb 2018 19:53:44 +0000 (19:53 +0000)]
[llvm-objcopy] Use the full filename in --add-gnu-debuglink

Summary:
The current implementation was writing the file name without the extension
whereas GNU objcopy writes the full filename. With this change GDB will now
load the .debug file instead of silently ignoring it.

Reviewers: jakehehrlich, jhenderson

Reviewed By: jakehehrlich

Subscribers: llvm-commits

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

llvm-svn: 325528

6 years ago[X86] Stop swapping the operands of AVX512 setge.
Craig Topper [Mon, 19 Feb 2018 19:23:35 +0000 (19:23 +0000)]
[X86] Stop swapping the operands of AVX512 setge.

We swapped the operands and used setle, but I don't see any reason to do that. I think this is a holdover from SSE where we swap and the invert to use pcmpgt. But with AVX512 we don't want an invert so we won't use pcmpgt. So there's no need to swap.

llvm-svn: 325527

6 years ago[X86] Reduce the number of isel pattern variations needed for VPTESTM/VPTESTNM matching.
Craig Topper [Mon, 19 Feb 2018 19:23:31 +0000 (19:23 +0000)]
[X86] Reduce the number of isel pattern variations needed for VPTESTM/VPTESTNM matching.

Canonicalize EQ/NE PCMPM to have build vector all zeros on the RHS so we don't have to pattern match it in both locations. This significantly reduces the number of isel patterns needed since we also had to multiply it out with loads being in either operand of the 'and' input node and in the 'and' masking node.

This removes over 24000 bytes from the isel table.

llvm-svn: 325526

6 years agobitcode support change for fast flags compatibility
Steven Wu [Mon, 19 Feb 2018 19:22:28 +0000 (19:22 +0000)]
bitcode support change for fast flags compatibility

Summary: The discussion and as per need, each vendor needs a way to keep the old fast flags and the new fast flags in the auto upgrade path of the IR upgrader.  This revision addresses that issue.

Patched by Michael Berg

Reviewers: qcolombet, hans, steven_wu

Reviewed By: qcolombet, steven_wu

Subscribers: dexonsmith, vsk, mehdi_amini, andrewrk, MatzeB, wristow, spatel

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

llvm-svn: 325525

6 years ago[AMDGPU] Make note of existing waitcnt instrs; this is add-on work related to suppres...
Mark Searles [Mon, 19 Feb 2018 19:19:59 +0000 (19:19 +0000)]
[AMDGPU] Make note of existing waitcnt instrs; this is add-on work related to suppression of redundant waitcnt instrs. It is necessary to make note of these existing waitcnt instrs so that we do not fall into an infinite loop when handling loops. Also, [NFC] some minor code clean-up.

llvm-svn: 325524

6 years ago[clangd] Fixes for #include insertion.
Eric Liu [Mon, 19 Feb 2018 18:48:44 +0000 (18:48 +0000)]
[clangd] Fixes for #include insertion.

Summary:
o Avoid inserting a header include into the header itself.
o Avoid inserting non-header files (by not indexing symbols in main
files at all).
o Canonicalize include paths for symbols in dynamic index.

Reviewers: sammccall, ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, jkorous-apple, cfe-commits

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

llvm-svn: 325523

6 years ago[clangd] Do not reuse preamble if compile args changed
Ilya Biryukov [Mon, 19 Feb 2018 18:18:49 +0000 (18:18 +0000)]
[clangd] Do not reuse preamble if compile args changed

Reviewers: hokein, ioeric, sammccall, simark

Reviewed By: simark

Subscribers: klimek, jkorous-apple, cfe-commits, simark

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

llvm-svn: 325522

6 years ago[SelectionDAG] ComputeKnownBits - add support for SMIN+SMAX clamp patterns
Simon Pilgrim [Mon, 19 Feb 2018 18:08:16 +0000 (18:08 +0000)]
[SelectionDAG] ComputeKnownBits - add support for SMIN+SMAX clamp patterns

If we have a clamp pattern, SMIN(SMAX(X, LO),HI) or SMAX(SMIN(X, HI),LO) then we can deduce that the number of signbits (zeros/ones) will be at least the minimum of the LO and HI constants.

ComputeKnownBits equivalent of D43338.

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

llvm-svn: 325521

6 years agoAdd several more attributes to be parsed in C with [[]] when -fdouble-square-bracket...
Aaron Ballman [Mon, 19 Feb 2018 17:32:07 +0000 (17:32 +0000)]
Add several more attributes to be parsed in C with [[]] when -fdouble-square-bracket-attributes is specified.

Also flags a few attributes that should not be available with the C spelling as they only matter in C++.

llvm-svn: 325520

6 years agoTwo more dosep-paralellization fallout fixes
Pavel Labath [Mon, 19 Feb 2018 17:23:13 +0000 (17:23 +0000)]
Two more dosep-paralellization fallout fixes

The first issue is about the flaky test rerun logic. This was grouping
tests by subdir and passing them into walk_and_invoke in the incorrect
form. This part can be just deleted as its not needed anymore.

The second problem (which I noticed while investigating the first one)
was that the "-p" switch was not working in multiprocessing mode. This
happened because we were returning None from process_file instead of a
tuple full of empty values for tests that did not match the -p regex.

Both of these would be caught earlier if python was a more strongly
typed language. :/

llvm-svn: 325519

6 years ago[AMDGPU] Increased vector length for global/constant loads.
Mark Searles [Mon, 19 Feb 2018 16:42:49 +0000 (16:42 +0000)]
[AMDGPU] Increased vector length for global/constant loads.

Summary: GCN ISA supports instructions that can read 16 consecutive dwords from memory through the scalar data cache; loadstoreVectorizer should take advantage of the wider vector length and pack 16/8 elements of dwords/quadwords.

Author: FarhanaAleen

Reviewed By: rampitec

Subscribers: llvm-commits, AMDGPU

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

llvm-svn: 325518

6 years ago[Dominators] Update DominatorTree compare in case roots are different
David Green [Mon, 19 Feb 2018 16:28:24 +0000 (16:28 +0000)]
[Dominators] Update DominatorTree compare in case roots are different

The compare function, unusually, returns false on same, true on
different. This fixes the conditions for different roots.

Reviewed as a part of D41298.

llvm-svn: 325517

6 years ago[CodeGen] Refactor AppleAccelTable
Pavel Labath [Mon, 19 Feb 2018 16:12:20 +0000 (16:12 +0000)]
[CodeGen] Refactor AppleAccelTable

Summary:
This commit separates the abstract accelerator table data structure
from the code for writing out an on-disk representation of a specific
accelerator table format. The idea is that former (now called
AccelTable<T>) can be reused for the DWARF v5 accelerator tables
as-is, without any further customizations.

Some bits of the emission code (now living in the EmissionContext class)
can be reused for DWARF v5 as well, but the subtle differences in the
layout of various subtables mean the sharing is not always possible.
(Also, the individual emit*** functions are fairly simple so there's a
tradeoff between making a bigger general-purpose function, and two
smaller targeted functions.)

Another advantage of this setup is that more of the serialization logic
can be hidden in the .cpp file -- I have moved declarations of the
header and all the emission functions there.

Reviewers: JDevlieghere, aprantl, probinson, dblaikie

Subscribers: echristo, clayborg, vleschuk, llvm-commits

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

llvm-svn: 325516

6 years ago[TTI CostModel] change default cost of FP ops to 1 (PR36280)
Sanjay Patel [Mon, 19 Feb 2018 16:11:44 +0000 (16:11 +0000)]
[TTI CostModel] change default cost of FP ops to 1 (PR36280)

This change was mentioned at least as far back as:
https://bugs.llvm.org/show_bug.cgi?id=26837#c26
...and I found a real program that is harmed by this:
Himeno running on AMD Jaguar gets 6% slower with SLP vectorization:
https://bugs.llvm.org/show_bug.cgi?id=36280
...but the change here appears to solve that bug only accidentally.

The div/rem costs for x86 look very wrong in some cases, but that's already true,
so we can fix those in follow-up patches. There's also evidence that more cost model
changes are needed to solve SLP problems as shown in D42981, but that's an independent
problem (though the solution may be adjusted after this change is made).

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

llvm-svn: 325515

6 years agoBring back r323297.
Rafael Espindola [Mon, 19 Feb 2018 16:02:38 +0000 (16:02 +0000)]
Bring back r323297.

It was reverted because it broke the grub build. The reason the grub
build broke is because grub does its own relocation processing and was
not handing R_386_PLT32. Since grub has no dynamic linker, the fix is
trivial: handle R_386_PLT32 exactly like R_386_PC32.

On the report it was noted that they are using
-fno-integrated-assembler. The upstream GAS (starting with
451875b4f976a527395e9303224c7881b65e12ed) will already be producing a
R_386_PLT32 anyway, so they have to update their code one way or the
other

Original message:

Don't assume a null GV is local for ELF and MachO.

This is already a simplification, and should help with avoiding a plt
reference when calling an intrinsic with -fno-plt.

With this change we return false for null GVs, so the caller only
needs to check the new metadata to decide if it should use foo@plt or
*foo@got.

llvm-svn: 325514

6 years ago[clang-format] Fix text proto extension scope opening detection
Krasimir Georgiev [Mon, 19 Feb 2018 16:00:21 +0000 (16:00 +0000)]
[clang-format] Fix text proto extension scope opening detection

Summary:
This fixes the detection of scope openers in text proto extensions; previously
they were not detected correctly leading to instances like:
```
msg {
  [aa.bb
] {
key: value
}
}
```

Subscribers: klimek, cfe-commits

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

llvm-svn: 325513

6 years ago[CodeGen] Fix tests breaking after r325505
Francis Visoiu Mistrih [Mon, 19 Feb 2018 15:51:17 +0000 (15:51 +0000)]
[CodeGen] Fix tests breaking after r325505

llvm-svn: 325512

6 years agoFix TestStopReplyContainsThreadPcs on 32-bit x86 (pr36013)
Pavel Labath [Mon, 19 Feb 2018 15:42:48 +0000 (15:42 +0000)]
Fix TestStopReplyContainsThreadPcs on 32-bit x86 (pr36013)

Summary:
The issue was that we were parsing the registers into 64-bit integers
and the calling swapByteOrder without regard for the actual size of the
register. This switches the test to use the RegisterValue class which
tracks the register size, and knows how to initialize itself from a
piece of memory (so we don't need to swap byte order ourselves).

Reviewers: eugene, davide

Subscribers: lldb-commits

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

llvm-svn: 325511

6 years ago[libcxx] Improve accuracy of complex asinh and acosh
Mikhail Maltsev [Mon, 19 Feb 2018 15:41:36 +0000 (15:41 +0000)]
[libcxx] Improve accuracy of complex asinh and acosh

Summary:
Currently std::asinh and std::acosh use std::pow to compute x^2. This
results in a significant error when computing e.g. asinh(i) or
acosh(-1).

This patch expresses x^2 directly via x.real() and x.imag(), like it
is done in libstdc++/glibc, and adds tests that checks the accuracy.

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: christof, cfe-commits

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

llvm-svn: 325510

6 years ago[clang-format] Fixup a case of text proto message attributes
Krasimir Georgiev [Mon, 19 Feb 2018 15:31:25 +0000 (15:31 +0000)]
[clang-format] Fixup a case of text proto message attributes

Summary: This patch fixes a case where a proto message attribute is wrongly identified as an text proto extension.

Subscribers: klimek, cfe-commits

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

llvm-svn: 325509

6 years ago[ThinLTO] Add GraphTraits for FunctionSummaries
Charles Saternos [Mon, 19 Feb 2018 15:14:50 +0000 (15:14 +0000)]
[ThinLTO] Add GraphTraits for FunctionSummaries

Add GraphTraits definitions to the FunctionSummary and ModuleSummaryIndex classes. These GraphTraits will be used to construct find SCC's in ThinLTO analysis passes.

Third attempt - moved function from lambda to static function due to build failures.

llvm-svn: 325506

6 years agoRevert "[CodeGen] Move printing '\n' from MachineInstr::print to MachineBasicBlock...
Francis Visoiu Mistrih [Mon, 19 Feb 2018 15:08:49 +0000 (15:08 +0000)]
Revert "[CodeGen] Move printing '\n' from MachineInstr::print to MachineBasicBlock::print"

This reverts commit r324681.

llvm-svn: 325505

6 years agoAdd SBDebugger::GetBuildConfiguration and use it to skip an XML test
Pavel Labath [Mon, 19 Feb 2018 15:06:28 +0000 (15:06 +0000)]
Add SBDebugger::GetBuildConfiguration and use it to skip an XML test

Summary:
This adds a SBDebugger::GetBuildConfiguration static function, which
returns a SBStructuredData describing the the build parameters of
liblldb. Right now, it just contains one entry: whether we were built
with XML support.

I use the new functionality to skip a test which requires XML support,
but concievably the new function could be useful to other liblldb
clients as well (making sure the library supports the feature they are
about to use).

Reviewers: zturner, jingham, clayborg, davide

Subscribers: lldb-commits

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

llvm-svn: 325504

6 years ago[clangd] Correct the doc, password => Personal Access Token.
Haojian Wu [Mon, 19 Feb 2018 14:26:55 +0000 (14:26 +0000)]
[clangd] Correct the doc, password => Personal Access Token.

llvm-svn: 325503

6 years ago[clangd] Add brief instructions on how to make a release for vscode-clangd extension.
Haojian Wu [Mon, 19 Feb 2018 14:01:52 +0000 (14:01 +0000)]
[clangd] Add brief instructions on how to make a release for vscode-clangd extension.

Reviewers: sammccall

Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 325499

6 years ago[CodeComplete] Avoid name clashes of 'Kind' inside CodeCompletionContext. NFC
Ilya Biryukov [Mon, 19 Feb 2018 13:53:49 +0000 (13:53 +0000)]
[CodeComplete] Avoid name clashes of 'Kind' inside CodeCompletionContext. NFC

CodeCompletionContext had declarations of field and enum inside, both named 'Kind'.
It caused gcc 4.8 to give an incorrent warning when refering to enum as
`enum CodeCompletionContext::Kind`.

Avoid that warning by renaming the private field to CCKind.

llvm-svn: 325496

6 years agoMake gdb-client tests generate binaries in the build tree
Pavel Labath [Mon, 19 Feb 2018 13:53:12 +0000 (13:53 +0000)]
Make gdb-client tests generate binaries in the build tree

These were missed in the great refactor because they were added
concurrently with it. Since we started running tests in a more parallel
fashion they started to be flaky. This should fix it.

Now that we are no longer polluting the source tree, I also delete the
bit of custom cleanup code specific to these tests.

llvm-svn: 325495

6 years ago[X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK down to 64-bit subvectors
Simon Pilgrim [Mon, 19 Feb 2018 13:29:20 +0000 (13:29 +0000)]
[X86][SSE] combineTruncateWithSat - use truncateVectorWithPACK down to 64-bit subvectors

Add support for chaining PACKSS/PACKUS down to 64-bit vectors by using only a single 128-bit input.

llvm-svn: 325494

6 years ago[clangd] Invert return value of fuzzyFind() (fix MemIndex's return value)
Sam McCall [Mon, 19 Feb 2018 13:04:41 +0000 (13:04 +0000)]
[clangd] Invert return value of fuzzyFind() (fix MemIndex's return value)

Have had way too many bugs by converting between "isComplete" and
"isIncomplete". LSP is immovable, so use isIncomplete everywhere.

llvm-svn: 325493

6 years ago[ARM] disable FPU features when using soft floating point.
Keith Walker [Mon, 19 Feb 2018 12:40:26 +0000 (12:40 +0000)]
[ARM] disable FPU features when using soft floating point.

To be compatible with GCC if soft floating point is in effect any FPU
specified is effectively ignored, eg,

  -mfloat-abi=soft -fpu=neon

If any floating point features which require FPU hardware are enabled
they must be disable.

There was some support for doing this for NEON, but it did not handle
VFP, nor did it prevent the backend from emitting the build attribute
Tag_FP_arch describing the generated code as using the floating point
hardware if a FPU was specified (even though soft float does not use
the FPU).

Disabling the hardware floating point features for targets which are
compiling for soft float has meant that some tests which were incorrectly
checking for hardware support also needed to be updated. In such cases,
where appropriate the tests have been updated to check compiling for
soft float and a non-soft float variant (usually softfp). This was
usually because the target specified in the test defaulted to soft float.

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

llvm-svn: 325492

6 years ago[clangd] Attach more information about Sema completion to traces
Ilya Biryukov [Mon, 19 Feb 2018 12:35:57 +0000 (12:35 +0000)]
[clangd] Attach more information about Sema completion to traces

Reviewers: hokein, ioeric, sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits, jkorous-apple

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

llvm-svn: 325491

6 years ago[CodeComplete] Add a helper to print CodeCompletionContext::Kind
Ilya Biryukov [Mon, 19 Feb 2018 12:35:33 +0000 (12:35 +0000)]
[CodeComplete] Add a helper to print CodeCompletionContext::Kind

Summary: Will be used in clangd. See D43377.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ioeric, cfe-commits

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

llvm-svn: 325490

6 years agoclang-format: [JS] fix `of` detection.
Martin Probst [Mon, 19 Feb 2018 12:32:13 +0000 (12:32 +0000)]
clang-format: [JS] fix `of` detection.

Summary:
`of` is only a keyword when after an identifier, but not when after
an actual keyword.

Before:
    return of (a, b, c);
After:
    return of(a, b, c);

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 325489

6 years ago[Transforms] Propagate new-format TBAA tags on simplification of memory-transfer...
Ivan A. Kosarev [Mon, 19 Feb 2018 12:10:20 +0000 (12:10 +0000)]
[Transforms] Propagate new-format TBAA tags on simplification of memory-transfer intrinsics

With this patch in place, when a new-format TBAA tag is available
for a memory-transfer intrinsic call, we prefer propagating that
new-format tag. Otherwise, we fallback to the old approach where
we try to construct a proper TBAA access tag from 'tbaa.struct'
metadata.

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

llvm-svn: 325488

6 years ago[llvm-opt-fuzzer] Add another pack of passes for continuous fuzzing
Igor Laevsky [Mon, 19 Feb 2018 11:57:07 +0000 (11:57 +0000)]
[llvm-opt-fuzzer] Add another pack of passes for continuous fuzzing

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

llvm-svn: 325487

6 years ago[clangd] Mark non-changing fields of CppFile as const. NFC
Ilya Biryukov [Mon, 19 Feb 2018 11:15:33 +0000 (11:15 +0000)]
[clangd] Mark non-changing fields of CppFile as const. NFC

llvm-svn: 325486

6 years agoRename DynamicReloc::getAddend() to computeAddend(). NFC
Alexander Richardson [Mon, 19 Feb 2018 11:00:15 +0000 (11:00 +0000)]
Rename DynamicReloc::getAddend() to computeAddend(). NFC

Summary:
Before the name of the function sounded like it was just a getter for the
private class member Addend. However, it actually calculates the final
value for the r_addend field in Elf_Rela that is used when writing the
.rela.dyn section. I also added a comment to the UseSymVA member to
explain how it interacts with computeAddend().

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

llvm-svn: 325485

6 years ago[clangd] Bump vs-code clangd extension v0.0.3
Haojian Wu [Mon, 19 Feb 2018 10:49:12 +0000 (10:49 +0000)]
[clangd] Bump vs-code clangd extension v0.0.3

Reviewers: sammccall

Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits, ioeric

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

llvm-svn: 325484

6 years ago[AVR] Set the program address space in the data layout
Dylan McKay [Mon, 19 Feb 2018 10:46:16 +0000 (10:46 +0000)]
[AVR] Set the program address space in the data layout

This is accompanied by r325481 in LLVM.

llvm-svn: 325483

6 years ago[clangd] Try to fix build bot failure caused by r325343: escape regex string.
Eric Liu [Mon, 19 Feb 2018 10:45:48 +0000 (10:45 +0000)]
[clangd] Try to fix build bot failure caused by r325343: escape regex string.

llvm-svn: 325482

6 years ago[AVR] Set the program address space in the data layout
Dylan McKay [Mon, 19 Feb 2018 10:40:59 +0000 (10:40 +0000)]
[AVR] Set the program address space in the data layout

This adds the program memory address space setting to the AVR data
layout.

This setting was very recently added under r325479.

At the moment, there are no uses of this setting. In the future, things
such as switch lookup tables should reside there.

llvm-svn: 325481

6 years ago[clangd] Tracing: name worker threads, and enforce naming scheduled async tasks
Sam McCall [Mon, 19 Feb 2018 09:56:28 +0000 (09:56 +0000)]
[clangd] Tracing: name worker threads, and enforce naming scheduled async tasks

Summary:
This has a bit of a blast radius, but I think there's enough value in "forcing"
us to give names to these async tasks for debugging. Guessing about what
multithreaded code is doing is so unfun...

The "file" param attached to the tasks may seem to be redundant with the thread
names, but note that thread names are truncated to 15 chars on linux!
We'll be lucky to get the whole basename...

Reviewers: ilya-biryukov

Subscribers: klimek, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 325480

6 years agoAdd default address space for functions to the data layout (1/3)
Dylan McKay [Mon, 19 Feb 2018 09:56:22 +0000 (09:56 +0000)]
Add default address space for functions to the data layout (1/3)

Summary:
This adds initial support for letting targets specify which address
spaces their functions should reside in by default.

If a function is created by a frontend, it will get the default address space specified in the DataLayout, unless the frontend explicitly uses a more general `llvm::Function` constructor. Function address spaces will become a part of the bitcode and textual IR forms, as we do not have access to a data layout whilst parsing LL.

It will be possible to write IR that explicitly has `addrspace(n)` on a function. In this case, the function will reside in the specified space, ignoring the default in the DL.

This is the first step towards placing functions into the correct
address space for Harvard architectures.

Full patchset
* Add program address space to data layout D37052
* Require address space to be specified when creating functions D37054
* [clang] Require address space to be specified when creating functions D37057

Reviewers: pcc, arsenm, kparzysz, hfinkel, theraven

Reviewed By: theraven

Subscribers: arichardson, simoncook, rengolin, wdng, uabelho, bjope, asb, llvm-commits

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

llvm-svn: 325479

6 years ago[CodeGen] Initialize large arrays by copying from a global
Ivan A. Kosarev [Mon, 19 Feb 2018 09:49:11 +0000 (09:49 +0000)]
[CodeGen] Initialize large arrays by copying from a global

Currently, clang compiles explicit initializers for array
elements into series of store instructions. For large arrays of
built-in types this results in bloated output code and
significant amount of time spent on the instruction selection
phase. This patch fixes the issue by initializing such arrays
with global constants that store the binary image of the
initializer.

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

llvm-svn: 325478

6 years ago[clangd] Add "clangd.trace" VSCode setting to enable tracing.
Sam McCall [Mon, 19 Feb 2018 09:43:46 +0000 (09:43 +0000)]
[clangd] Add "clangd.trace" VSCode setting to enable tracing.

Summary:
Setting the CLANGD_TRACE environment variable directly is awkward with VSCode's
"reload from the command palette" workflow.

Reviewers: ilya-biryukov

Subscribers: klimek, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 325477

6 years ago[clangd] Fix use-after-free in SymbolYAML: strings are owned by yaml::Input!
Sam McCall [Mon, 19 Feb 2018 09:31:26 +0000 (09:31 +0000)]
[clangd] Fix use-after-free in SymbolYAML: strings are owned by yaml::Input!

Summary:
There are a few implementation options here - alternatives are either both
awkward and inefficient, or really inefficient.
This is at least potentially a hot path when used as a reducer for common
symbols.

(Also fix an unused-var that sneaked in)

Reviewers: ioeric

Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits

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

llvm-svn: 325476

6 years ago[cxx_dr_status] Tests for CWG issues 641-687.
Richard Smith [Mon, 19 Feb 2018 09:05:48 +0000 (09:05 +0000)]
[cxx_dr_status] Tests for CWG issues 641-687.

llvm-svn: 325475

6 years ago[AVR] Fix a lowering bug in AVRISelLowering.cpp
Dylan McKay [Mon, 19 Feb 2018 08:28:38 +0000 (08:28 +0000)]
[AVR] Fix a lowering bug in AVRISelLowering.cpp

The parseFunctionArgs() method was directly reading the
arguments from a Function object, but is should have used the
arguments supplied by the SelectionDAGBuilder.

This was causing
the lowering code to only lower one argument, not two in some cases.

Thanks to @brainlag on GitHub for coming up with the working fix!

Patch-by: @brainlag on GitHub
llvm-svn: 325474

6 years agoAdd LanaiMCTargetDesc.h to LanaiInstrInfo.h to make it self contained
Eric Christopher [Mon, 19 Feb 2018 05:26:49 +0000 (05:26 +0000)]
Add LanaiMCTargetDesc.h to LanaiInstrInfo.h to make it self contained
with instruction enum definitions.

llvm-svn: 325473

6 years ago[X86] Correct a typo I made in combineToExtendCMOV recently.
Craig Topper [Sun, 18 Feb 2018 20:41:25 +0000 (20:41 +0000)]
[X86] Correct a typo I made in combineToExtendCMOV recently.

We're accidentally checking that the same node is a constant twice instead of checking the other node.

This isn't a functional problem since we didn't do anything below that explicitly requires constants. It just means we may have introduced a sign_extend or zero_extend that won't fold out.

llvm-svn: 325469

6 years ago[Analyzer] Move UnexploredFirstStack into an anonymous namespace.
Benjamin Kramer [Sun, 18 Feb 2018 19:08:27 +0000 (19:08 +0000)]
[Analyzer] Move UnexploredFirstStack into an anonymous namespace.

No functionality change intended.

llvm-svn: 325468

6 years ago[tidy] Move private ast matchers into anonymous namespaces to avoid ODR conflicts.
Benjamin Kramer [Sun, 18 Feb 2018 19:02:35 +0000 (19:02 +0000)]
[tidy] Move private ast matchers into anonymous namespaces to avoid ODR conflicts.

No functionality change intended.

llvm-svn: 325467

6 years ago[PatternMatch, InstSimplify] enhance m_AllOnes() to ignore undef elements in vectors
Sanjay Patel [Sun, 18 Feb 2018 18:05:08 +0000 (18:05 +0000)]
[PatternMatch, InstSimplify] enhance m_AllOnes() to ignore undef elements in vectors

Loosening the matcher definition reveals a subtle bug in InstSimplify (we should not
assume that because an operand constant matches that it's safe to return it as a result).

So I'm making that change here too (that diff could be independent, but I'm not sure how
to reveal it before the matcher change).

This also seems like a good reason to *not* include matchers that capture the value.
We don't want to encourage the potential misstep of propagating undef values when it's
not allowed/intended.

I didn't include the capture variant option here or in the related rL325437 (m_One),
but it already exists for other constant matchers.

llvm-svn: 325466

6 years ago[InstSimplify] add tests with vector undef elts; NFC
Sanjay Patel [Sun, 18 Feb 2018 17:39:09 +0000 (17:39 +0000)]
[InstSimplify] add tests with vector undef elts; NFC

llvm-svn: 325465

6 years agoFix unused assertion variable warning.
Amara Emerson [Sun, 18 Feb 2018 17:28:34 +0000 (17:28 +0000)]
Fix unused assertion variable warning.

llvm-svn: 325464

6 years ago[AArch64][GlobalISel] Fix an assert fail/miscompile when fp16 types are copied
Amara Emerson [Sun, 18 Feb 2018 17:10:49 +0000 (17:10 +0000)]
[AArch64][GlobalISel] Fix an assert fail/miscompile when fp16 types are copied
to gpr register banks.

PR36345.

rdar://36478867

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

llvm-svn: 325463

6 years ago[AArch64][GlobalISel] Support G_INSERT/G_EXTRACT of types < s32 bits.
Amara Emerson [Sun, 18 Feb 2018 17:03:02 +0000 (17:03 +0000)]
[AArch64][GlobalISel] Support G_INSERT/G_EXTRACT of types < s32 bits.

These are needed for operations on fp16 types in a later patch.

llvm-svn: 325462

6 years ago[PatternMatch] reformatting and comment clean-ups; NFC
Sanjay Patel [Sun, 18 Feb 2018 16:19:22 +0000 (16:19 +0000)]
[PatternMatch] reformatting and comment clean-ups; NFC

llvm-svn: 325461

6 years ago[Support] Replace hand-written scope_exit with make_scope_exit.
Benjamin Kramer [Sun, 18 Feb 2018 16:05:40 +0000 (16:05 +0000)]
[Support] Replace hand-written scope_exit with make_scope_exit.

No functionality change intended.

llvm-svn: 325460

6 years ago[AArch64] Coalesce Copy Zero during instruction selection
Haicheng Wu [Sun, 18 Feb 2018 13:51:33 +0000 (13:51 +0000)]
[AArch64] Coalesce Copy Zero during instruction selection

Add special case for copy of zero to avoid a double copy.

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

llvm-svn: 325459

6 years ago[clangd] Fix link failures for Preprocessor::addCommentHandler
Heejin Ahn [Sun, 18 Feb 2018 10:50:16 +0000 (10:50 +0000)]
[clangd] Fix link failures for Preprocessor::addCommentHandler

Summary:
D42640 adds calls to `Preprocessor::addCommentHandler` in
`unittests/clangd/SymbolCollectorTests.cpp` and
`clangd/global-symbol-builder/GlobalSymbolBuilderMain.cpp` but does not
link `clangLex` library. This causes undefined reference errors when
built with `-DBUILD_SHARED_LIBS=ON`.

Reviewers: ioeric

Subscribers: klimek, mgorny, ilya-biryukov, jkorous-apple, cfe-commits

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

llvm-svn: 325458

6 years ago[BPF] Return true in enableMultipleCopyHints().
Jonas Paulsson [Sun, 18 Feb 2018 10:09:54 +0000 (10:09 +0000)]
[BPF]  Return true in enableMultipleCopyHints().

Enable multiple COPY hints to eliminate more COPYs during register allocation.

Note that this is something all targets should do, see
https://reviews.llvm.org/D38128.

Review: Yonghong Song
llvm-svn: 325457

6 years ago[X86] Make masked pcmpeq commutable during isel so we can fold loads in other operand...
Craig Topper [Sun, 18 Feb 2018 02:37:33 +0000 (02:37 +0000)]
[X86] Make masked pcmpeq commutable during isel so we can fold loads in other operand to the shorter encoding.

Previously we used the immediate encoding if the load was in operand 0 and the short encoding if the load was in operand 1.

This added an insane number of bytes to the size of the isel table. I'm wondering if we should always use the immediate form during isel and change to the short form during emission. This would remove the need to pattern match every combination for both the immediate form and the short form during isel. We could do the same with vpcmpgt

llvm-svn: 325456

6 years ago[X86] Add -show-mc-encoding to the avx512-vec-cmp.ll test and add test case to show...
Craig Topper [Sun, 18 Feb 2018 02:37:32 +0000 (02:37 +0000)]
[X86] Add -show-mc-encoding to the avx512-vec-cmp.ll test and add test case to show that we're failing to use the shorter pcmpeq encoding when the memory arguemnt is the first argument.

This can't be spotted without showing the encodings since they have the same mnemonic.

llvm-svn: 325455

6 years agoRevert: [llvm] r325448 - [ThinLTO] Add GraphTraits for FunctionSummaries
Simon Pilgrim [Sun, 18 Feb 2018 00:01:36 +0000 (00:01 +0000)]
Revert: [llvm] r325448 - [ThinLTO] Add GraphTraits for FunctionSummaries

Add GraphTraits definitions to the FunctionSummary and ModuleSummaryIndex classes. These GraphTraits will be used to construct find SCC's in ThinLTO analysis passes.

Second attempt, since last patch caused stage2 build to fail (now using function_ref rather than std::function).

Reverted due to buildbot failures

llvm-svn: 325454

6 years agoSimplify.
Rui Ueyama [Sat, 17 Feb 2018 23:37:26 +0000 (23:37 +0000)]
Simplify.

llvm-svn: 325453

6 years agoAdd DEBUGSERVER_PATH to the cache so it'll be available for tests.
Don Hinton [Sat, 17 Feb 2018 23:06:15 +0000 (23:06 +0000)]
Add DEBUGSERVER_PATH to the cache so it'll be available for tests.

This fixed a problem caused by r325442.

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

llvm-svn: 325452

6 years agoFix Wparentheses warning. NFCI
Simon Pilgrim [Sat, 17 Feb 2018 22:45:56 +0000 (22:45 +0000)]
Fix Wparentheses warning. NFCI

llvm-svn: 325451

6 years ago[SelectionDAG] ComputeNumSignBits - add support for SMIN+SMAX clamp patterns
Simon Pilgrim [Sat, 17 Feb 2018 22:19:50 +0000 (22:19 +0000)]
[SelectionDAG] ComputeNumSignBits - add support for SMIN+SMAX clamp patterns

If we have a clamp pattern, SMIN(SMAX(X, LO),HI) or SMAX(SMIN(X, HI),LO) then we can deduce that the number of signbits will be at least the minimum of the LO and HI constants.

I haven't bothered with the UMIN/UMAX equivalent as (1) we don't have any current use cases and (2) I wonder if we'd be better off immediately falling back for ComputeKnownBits for UMIN/UMAX which already has optimization patterns useful for unsigned cases.

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

llvm-svn: 325450

6 years ago[SelectionDAG] SimplifyDemandedVectorElts - add support for VECTOR_INSERT_ELT
Simon Pilgrim [Sat, 17 Feb 2018 21:49:40 +0000 (21:49 +0000)]
[SelectionDAG] SimplifyDemandedVectorElts - add support for VECTOR_INSERT_ELT

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

llvm-svn: 325449