platform/upstream/llvm.git
5 years ago[clangd] Clarify and hide -index flag.
Eric Liu [Thu, 13 Sep 2018 12:53:23 +0000 (12:53 +0000)]
[clangd] Clarify and hide -index flag.

Summary:
The wording implies global index support, which is confusing.
As most users shouldn't care about this flag, also make it hidden to avoid
further confusion.

Reviewers: sammccall, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 342134

5 years agoAMDGPU: Fix not preserving alignent in call setups
Matt Arsenault [Thu, 13 Sep 2018 12:14:31 +0000 (12:14 +0000)]
AMDGPU: Fix not preserving alignent in call setups

If an argument was passed on the stack, this
was using the default alignment.

I'm not sure there's an observable change from this. This
was observable due to bugs in expansion of unaligned
loads and stores, but since that is fixed I don't think
this matters much.

llvm-svn: 342133

5 years agoDAG: Fix expansion of unaligned FP loads and stores
Matt Arsenault [Thu, 13 Sep 2018 12:14:23 +0000 (12:14 +0000)]
DAG: Fix expansion of unaligned FP loads and stores

This was trying to scalarizing a scalar FP type,
resulting in an assert.

Fixes unaligned f64 stack stores for AMDGPU.

llvm-svn: 342132

5 years agoAMDGPU: Fix some outdated datalayouts in tests
Matt Arsenault [Thu, 13 Sep 2018 11:56:28 +0000 (11:56 +0000)]
AMDGPU: Fix some outdated datalayouts in tests

llvm-svn: 342131

5 years ago[clangd] Simplify cancellation public API
Sam McCall [Thu, 13 Sep 2018 11:47:48 +0000 (11:47 +0000)]
[clangd] Simplify cancellation public API

Summary:
Task is no longer exposed:
 - task cancellation is hidden as a std::function
 - task creation returns the new context directly
 - checking is via free function only, with no way to avoid the context lookup
The implementation is essentially the same, but a bit terser as it's hidden.

isCancelled() is now safe to use outside any task (it returns false).
This will leave us free to sprinkle cancellation in e.g. TUScheduler without
needing elaborate test setup, and lets callers that don't cancel "just work".

Updated the docs to describe the new expected use pattern.
One thing I noticed: there's nothing async-specific about the cancellation.
Async tasks can be cancelled from any thread (typically the one that created
them), sync tasks can be cancelled from any *other* thread in the same way.
So the docs now refer to "long-running" tasks instead of async ones.

Updated usage in code complete, without any structural changes.
I didn't update all the names of the helpers in ClangdLSPServer (these will
likely be moved to JSONRPCDispatcher anyway).

Reviewers: ilya-biryukov, kadircet

Subscribers: ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits

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

llvm-svn: 342130

5 years ago[docs] Provide pointers to known editor plugins and extensions
Kirill Bobyrev [Thu, 13 Sep 2018 11:40:12 +0000 (11:40 +0000)]
[docs] Provide pointers to known editor plugins and extensions

Many editors provide extensions and plugins with LSP Client
functionality. Many of these are known to work with Clangd, this patch
points users to the relevant resources for better experience.

Reviewed By: ioeric, ilya-biryukov

Differential Revision

llvm-svn: 342129

5 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Thu, 13 Sep 2018 10:54:23 +0000 (10:54 +0000)]
Fix unused variable warning. NFCI.

llvm-svn: 342128

5 years agoARM: align loops to 4 bytes on Cortex-M3 and Cortex-M4.
Tim Northover [Thu, 13 Sep 2018 10:28:05 +0000 (10:28 +0000)]
ARM: align loops to 4 bytes on Cortex-M3 and Cortex-M4.

The Technical Reference Manuals for these two CPUs state that branching
to an unaligned 32-bit instruction incurs an extra pipeline reload
penalty. That's bad.

This also enables the optimization at -Os since it costs on average one
byte per loop in return for 1 cycle per iteration, which is pretty good
going.

llvm-svn: 342127

5 years ago[AArch64] Enable return address signing for static ctors
Oliver Stannard [Thu, 13 Sep 2018 10:25:36 +0000 (10:25 +0000)]
[AArch64] Enable return address signing for static ctors

Functions generated by clang and included in the .init_array section (such as
static constructors) do not follow the usual code path for adding
target-specific function attributes, so we have to add the return address
signing attribute here too, as is currently done for the sanitisers.

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

llvm-svn: 342126

5 years agoFix MSVC "illegal conversion; more than one user-defined conversion has been implicit...
Simon Pilgrim [Thu, 13 Sep 2018 10:10:18 +0000 (10:10 +0000)]
Fix MSVC "illegal conversion; more than one user-defined conversion has been implicitly applied" warning. NFCI.

llvm-svn: 342125

5 years ago[clangd] Don't create child AND and OR iterators with one posting list
Kirill Bobyrev [Thu, 13 Sep 2018 10:02:48 +0000 (10:02 +0000)]
[clangd] Don't create child AND and OR iterators with one posting list

`AND( AND( Child ) ... )` -> `AND( Child ... )`
`AND( OR( Child ) ... )` -> `AND( Child ... )`

This simple optimization results in 5-6% performance improvement in the
benchmark with 2000 serialized `FuzzyFindRequest`s.

Reviewed By: ilya-biryukov

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

llvm-svn: 342124

5 years ago[clangd] Rename global-symbol-builder to clangd-indexer.
Ilya Biryukov [Thu, 13 Sep 2018 09:44:11 +0000 (09:44 +0000)]
[clangd] Rename global-symbol-builder to clangd-indexer.

Summary:
Given that the indexer binary is put directly into ./bin directory
when built, 'clangd-' prefix seems to provide better context to the
reader than 'global-'.

The new name is also shorter and easier to type.

Reviewers: ioeric, sammccall, kadircet

Reviewed By: ioeric, sammccall

Subscribers: kbobyrev, ilya-biryukov, mgorny, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 342123

5 years ago[XRay] Bug fixes for FDR custom event and arg-logging
Dean Michael Berris [Thu, 13 Sep 2018 09:25:42 +0000 (09:25 +0000)]
[XRay] Bug fixes for FDR custom event and arg-logging

Summary:
This change has a number of fixes for FDR mode in compiler-rt along with
changes to the tooling handling the traces in llvm.

In the runtime, we do the following:

- Advance the "last record" pointer appropriately when writing the
  custom event data in the log.

- Add XRAY_NEVER_INSTRUMENT in the rewinding routine.

- When collecting the argument of functions appropriately marked, we
  should not attempt to rewind them (and reset the counts of functions
  that can be re-wound).

In the tooling, we do the following:

- Remove the state logic in BlockIndexer and instead rely on the
  presence/absence of records to indicate blocks.

- Move the verifier into a loop associated with each block.

Reviewers: mboerger, eizan

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 342122

5 years agoRemove byte counting from SourceManager [NFC]
Raphael Isemann [Thu, 13 Sep 2018 09:19:40 +0000 (09:19 +0000)]
Remove byte counting from SourceManager [NFC]

Summary:
Similar to what we did in D50681, we now stop manually byte counting here
in the SourceManager.

Reviewers: #lldb, JDevlieghere

Reviewed By: #lldb, JDevlieghere

Subscribers: JDevlieghere, abidh, lldb-commits

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

llvm-svn: 342121

5 years ago [AMDGPU] Load divergence predicate refactoring
Alexander Timofeev [Thu, 13 Sep 2018 09:06:56 +0000 (09:06 +0000)]
[AMDGPU] Load divergence predicate refactoring

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

    Reviewers: rampitec

llvm-svn: 342120

5 years ago[mips] Enable the mnemonic spell corrector
Simon Atanasyan [Thu, 13 Sep 2018 08:38:03 +0000 (08:38 +0000)]
[mips] Enable the mnemonic spell corrector

This implements suggesting alternative mnemonics when an invalid one is
specified. For example `addru $9, $6, 17767` leads to the following
error message:

error: unknown instruction, did you mean: add, addiu, addu, maddu?

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

llvm-svn: 342119

5 years ago[llvm-exegesis][NFC] Remove dead parameter.
Clement Courbet [Thu, 13 Sep 2018 08:06:29 +0000 (08:06 +0000)]
[llvm-exegesis][NFC] Remove dead parameter.

llvm-svn: 342118

5 years ago[llvm-exegesis][NFC] Split BenchmarkRunner class
Clement Courbet [Thu, 13 Sep 2018 07:40:53 +0000 (07:40 +0000)]
[llvm-exegesis][NFC] Split BenchmarkRunner class

Summary:
The snippet-generation part goes to the SnippetGenerator class.

This will allow benchmarking arbitrary code (see PR38437).

Reviewers: gchatelet

Subscribers: mgorny, tschuett, llvm-commits

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

llvm-svn: 342117

5 years ago[clang-format] Wrapped block after case label should not be merged into one line
Owen Pan [Thu, 13 Sep 2018 07:27:15 +0000 (07:27 +0000)]
[clang-format] Wrapped block after case label should not be merged into one line

PR38854

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

llvm-svn: 342116

5 years ago [AMDGPU] Preliminary patch for divergence driven instruction selection. Load...
Alexander Timofeev [Thu, 13 Sep 2018 06:34:56 +0000 (06:34 +0000)]
[AMDGPU] Preliminary patch for divergence driven instruction selection. Load offset inlining pattern changed.

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

    Reviewers: rampitec

llvm-svn: 342115

5 years ago[X86] Type legalize v2i32 div/rem by scalarizing rather than promoting
Craig Topper [Thu, 13 Sep 2018 06:13:37 +0000 (06:13 +0000)]
[X86] Type legalize v2i32 div/rem by scalarizing rather than promoting

Summary:
Previously we type legalized v2i32 div/rem by promoting to v2i64. But we don't support div/rem of vectors so op legalization would then scalarize it using i64 scalar ops since it doesn't know about the original promotion. 64-bit scalar divides on Intel hardware are known to be slow and in 32-bit mode they require a libcall.

This patch switches type legalization to do the scalarizing itself using i32.

It looks like the division by power of 2 optimization is still kicking in and leaving the code as a vector. The division by other constant optimization doesn't kick in pre type legalization since it ignores illegal types. And previously, after type legalization we scalarized the v2i64 since we don't have v2i64 MULHS/MULHU support.

Another option might be to widen v2i32 to v4i32 so we could do division by constant optimizations, but we'd have to be careful to only do that for constant divisors or we risk scalaring to 4 scalar divides.

Reviewers: RKSimon, spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 342114

5 years agoMaking pstl repository.
Tanya Lattner [Thu, 13 Sep 2018 05:58:33 +0000 (05:58 +0000)]
Making pstl repository.

llvm-svn: 342111

5 years agoARM: correct the relocation type for `bl` on WoA
Saleem Abdulrasool [Thu, 13 Sep 2018 04:55:08 +0000 (04:55 +0000)]
ARM: correct the relocation type for `bl` on WoA

The `IMAGE_REL_ARM_BRANCH20T` applies only to a `b.w` instruction.  A
thumb-2 `bl` should be relocated using a `IMAGE_REL_ARM_BRANCH24T`.
Correct the relocation that we emit in such a case.

Resolves PR38620!  Based on the patch by Jordan Rhee!

llvm-svn: 342109

5 years ago[NFC] Add Requires: asserts where needed
Max Kazantsev [Thu, 13 Sep 2018 04:43:24 +0000 (04:43 +0000)]
[NFC] Add Requires: asserts where needed

llvm-svn: 342108

5 years ago[NFC] Use expensive asserts in relevant LICM tests
Max Kazantsev [Thu, 13 Sep 2018 04:00:39 +0000 (04:00 +0000)]
[NFC] Use expensive asserts in relevant LICM tests

llvm-svn: 342107

5 years agoRemove isAsCheapAsAMove from v128.const
Thomas Lively [Thu, 13 Sep 2018 02:50:57 +0000 (02:50 +0000)]
Remove isAsCheapAsAMove from v128.const

llvm-svn: 342106

5 years agoRemove isAsCheapAsAMove from mem ops
Thomas Lively [Thu, 13 Sep 2018 02:50:57 +0000 (02:50 +0000)]
Remove isAsCheapAsAMove from mem ops

llvm-svn: 342105

5 years ago[WebAssembly] Add missing SIMD instruction attributes
Thomas Lively [Thu, 13 Sep 2018 02:50:56 +0000 (02:50 +0000)]
[WebAssembly] Add missing SIMD instruction attributes

Summary:
These attributes are copied from equivalent instructions in
WebAssemblyInstrInfo.td.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 342104

5 years agoMark LWG#3102 as complete. No code changes, but I updated a test or two
Marshall Clow [Thu, 13 Sep 2018 02:23:52 +0000 (02:23 +0000)]
Mark LWG#3102 as complete. No code changes, but I updated a test or two

llvm-svn: 342103

5 years agoSTLExtras: Add some more algorithm wrappers
David Blaikie [Thu, 13 Sep 2018 00:02:03 +0000 (00:02 +0000)]
STLExtras: Add some more algorithm wrappers

llvm-svn: 342102

5 years agoDebugInfo/PDB: Remove unused member
David Blaikie [Thu, 13 Sep 2018 00:02:02 +0000 (00:02 +0000)]
DebugInfo/PDB: Remove unused member

llvm-svn: 342101

5 years ago[AArch64] Support reserving x1-7 registers.
Tri Vo [Wed, 12 Sep 2018 23:45:04 +0000 (23:45 +0000)]
[AArch64] Support reserving x1-7 registers.

Summary: Reserving registers x1-7 is used to support CONFIG_ARM64_LSE_ATOMICS in Linux kernel. This change adds support for reserving registers x1 through x7.

Reviewers: javed.absar, efriedma, nickdesaulniers, srhines, phosek

Reviewed By: nickdesaulniers

Subscribers: manojgupta, jfb, cfe-commits, kristof.beyls

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

llvm-svn: 342100

5 years agodwarfdump: Improve performance on large DWP files
David Blaikie [Wed, 12 Sep 2018 23:39:51 +0000 (23:39 +0000)]
dwarfdump: Improve performance on large DWP files

llvm-svn: 342099

5 years agoRemove dead code made unnecessary by r342018.
Richard Smith [Wed, 12 Sep 2018 23:37:58 +0000 (23:37 +0000)]
Remove dead code made unnecessary by r342018.

llvm-svn: 342098

5 years agoTrack definition merging on the canonical declaration even when local
Richard Smith [Wed, 12 Sep 2018 23:37:00 +0000 (23:37 +0000)]
Track definition merging on the canonical declaration even when local
submodule visibility is disabled.

Attempting to pick a specific declaration to make visible when the
module containing the merged declaration becomes visible is error-prone,
as we don't yet know which declaration we'll choose to be the definition
when we are informed of the merging.

This reinstates r342019, reverted in r342020. The regression previously
observed after this commit was fixed in r342096.

llvm-svn: 342097

5 years agoWhen we leave a module header, make that header visible in its
Richard Smith [Wed, 12 Sep 2018 23:09:23 +0000 (23:09 +0000)]
When we leave a module header, make that header visible in its
includer's context, even if its overall module is unavailable.

llvm-svn: 342096

5 years ago[DAGCombiner] improve formatting for select+setcc code; NFC
Sanjay Patel [Wed, 12 Sep 2018 23:03:50 +0000 (23:03 +0000)]
[DAGCombiner] improve formatting for select+setcc code; NFC

llvm-svn: 342095

5 years agofix 80-column violation with clang-format
Adrian Prantl [Wed, 12 Sep 2018 22:57:28 +0000 (22:57 +0000)]
fix 80-column violation with clang-format

llvm-svn: 342094

5 years ago[PDB] Remove all clone() methods.
Zachary Turner [Wed, 12 Sep 2018 22:57:03 +0000 (22:57 +0000)]
[PDB] Remove all clone() methods.

These are dead code and encourage poor usage patterns, so I'm
removing them.  They weren't called anywhere anyway.

llvm-svn: 342093

5 years ago[TSan] Update test values
Vlad Tsyrklevich [Wed, 12 Sep 2018 22:16:14 +0000 (22:16 +0000)]
[TSan] Update test values

Similarly to before, D51985 again reduced the number of registers
required for the read/write routines causing this test to fail on
sanitizer-x86_64-linux-autoconf.

llvm-svn: 342092

5 years ago[Hexagon] Use shuffles when lowering "gather" shufflevectors
Krzysztof Parzyszek [Wed, 12 Sep 2018 22:14:52 +0000 (22:14 +0000)]
[Hexagon] Use shuffles when lowering "gather" shufflevectors

Shufflevector instructions in LLVM IR that extract a subset of elements
of a longer input into a shorter vector can be done using VECTOR_SHUFFLEs.
This will avoid expanding them into constly extracts and inserts.

llvm-svn: 342091

5 years ago[Hexagon] Improve the selection algorithm in scalarizeShuffle
Krzysztof Parzyszek [Wed, 12 Sep 2018 22:10:58 +0000 (22:10 +0000)]
[Hexagon] Improve the selection algorithm in scalarizeShuffle

Use topological ordering for newly generated nodes.

llvm-svn: 342090

5 years ago[Support] sys::fs::directory_entry includes the file_type.
Kristina Brooks [Wed, 12 Sep 2018 22:08:10 +0000 (22:08 +0000)]
[Support] sys::fs::directory_entry includes the file_type.

This is available on most platforms (Linux/Mac/Win/BSD) with no extra syscalls.
On other platforms (e.g. Solaris) we stat() if this information is requested.

This will allow switching clang's VFS to efficiently expose (path, type) when
traversing a directory. Currently it exposes an entire Status, but does so by
calling fs::status() on all platforms.
Almost all callers only need the path, and all callers only need (path, type).

Patch by sammccall (Sam McCall)

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

llvm-svn: 342089

5 years ago[llvm-cov] Delete custom JSON serialization code (NFC)
Vedant Kumar [Wed, 12 Sep 2018 21:59:38 +0000 (21:59 +0000)]
[llvm-cov] Delete custom JSON serialization code (NFC)

Teach llvm-cov to use the new llvm JSON library, and remove some
redundant/brittle JSON serialization tests.

llvm-svn: 342088

5 years ago[ORC] Merge ExecutionSessionBase with ExecutionSession by moving a couple of
Lang Hames [Wed, 12 Sep 2018 21:49:02 +0000 (21:49 +0000)]
[ORC] Merge ExecutionSessionBase with ExecutionSession by moving a couple of
template methods in JITDylib out-of-line.

This also splits JITDylib::define into a pair of template methods, one taking an
lvalue reference and the other an rvalue reference. This simplifies the
templates at the cost of a small amount of code duplication.

llvm-svn: 342087

5 years ago[ORC] Add a special 'main' JITDylib that is created on ExecutionSession
Lang Hames [Wed, 12 Sep 2018 21:48:59 +0000 (21:48 +0000)]
[ORC] Add a special 'main' JITDylib that is created on ExecutionSession
construction, a new convenience lookup method, and add-to layer methods.

ExecutionSession now creates a special 'main' JITDylib upon construction. All
subsequently created JITDylibs are added to the main JITDylib's search order by
default (controlled by the AddToMainDylibSearchOrder parameter to
ExecutionSession::createDylib). The main JITDylib's search order will be used in
the future to properly handle cross-JITDylib weak symbols, with the first
definition in this search order selected.

This commit also adds a new ExecutionSession::lookup convenience method that
performs a blocking lookup using the main JITDylib's search order, as this will
be a very common operation for clients.

Finally, new convenience overloads of IRLayer and ObjectLayer's add methods are
introduced that add the given program representations to the main dylib, which
is likely to be the common case.

llvm-svn: 342086

5 years agoCommit my attempt to test the change to ProcessGDBRemote
Jason Molenda [Wed, 12 Sep 2018 21:35:02 +0000 (21:35 +0000)]
Commit my attempt to test the change to ProcessGDBRemote
in r336956.  This test doesn't actually test the change
that was submitted by Venkata, but it's a good one to
add.

llvm-svn: 342085

5 years ago[WebAssembly] Make tied inline asm operands work again
Heejin Ahn [Wed, 12 Sep 2018 21:34:39 +0000 (21:34 +0000)]
[WebAssembly] Make tied inline asm operands work again

Summary:
rL341389 broke code with tied register operands in inline assembly. For
example, `asm("" : "=r"(var) : "0"(var));`
The code above specifies the input operand to be in the same register
with the output operand, tying the two register. This patch makes this
kind of code work again.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, eraman, sunfish, llvm-commits

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

llvm-svn: 342084

5 years agorevert r341288 - [Reassociate] swap binop operands to increase factoring potential
Sanjay Patel [Wed, 12 Sep 2018 21:29:11 +0000 (21:29 +0000)]
revert r341288 - [Reassociate] swap binop operands to increase factoring potential

This causes or exposes indeterminism that is visible in the output of -reassociate.

llvm-svn: 342083

5 years ago[InstCombine] add tests for unsigned add overflow; NFC
Sanjay Patel [Wed, 12 Sep 2018 21:13:37 +0000 (21:13 +0000)]
[InstCombine] add tests for unsigned add overflow; NFC

llvm-svn: 342082

5 years agoGuard FMF context by excluding some FP operators from FPMathOperator
Michael Berg [Wed, 12 Sep 2018 21:09:59 +0000 (21:09 +0000)]
Guard FMF context by excluding some FP operators from FPMathOperator

Summary:
Some FPMathOperators succeed and the retrieve FMF context when they never have it, we should omit these cases to keep from removing FMF context.

For instance when we visit some FPMathOperator mapped Instructions which never have FMF flags and a Node was associated which does have FMF flags, that Node today will have all its flags cleared via the intersect operation.  With this change, we exclude associating Nodes that never have FPMathOperator status under FMF.

Reviewers: spatel, wristow, arsenm, hfinkel, aemerson

Reviewed By: spatel

Subscribers: llvm-commits, wdng

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

llvm-svn: 342081

5 years ago[PDB] Emit old fpo data to the PDB file.
Zachary Turner [Wed, 12 Sep 2018 21:02:01 +0000 (21:02 +0000)]
[PDB] Emit old fpo data to the PDB file.

r342003 added support for emitting FPO data from the
DEBUG_S_FRAMEDATA subsection of the .debug$S section to the PDB
file.  However, that is not the end of the story.  FPO can end
up in two different destinations in a PDB, each corresponding to
a different FPO data source.

The case handled by r342003 involves copying data from the
DEBUG_S_FRAMEDATA subsection of the .debug$S section to the
"New FPO" stream in the PDB, which is then referred to by the
DBI stream.  The case handled by this patch involves copying
records from the .debug$F section of an object file to the "FPO"
stream (or perhaps more aptly, the "Old FPO" stream) in the PDB
file, which is also referred to by the DBI stream.

The formats are largely similar, and the difference is mostly
only visible in masm generated object files, such as some of the
low-level CRT object files like memcpy.  MASM doesn't appear to
support writing the DEBUG_S_FRAMEDATA subsection, and instead
just writes these records to the .debug$F section.

Although clang-cl does not emit a .debug$F section ever, lld still
needs to support it so we have good debugging for CRT functions.

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

llvm-svn: 342080

5 years ago[Hexagon] Use legalized type for extracted elements in scalarizeShuffle
Krzysztof Parzyszek [Wed, 12 Sep 2018 20:58:48 +0000 (20:58 +0000)]
[Hexagon] Use legalized type for extracted elements in scalarizeShuffle

Scalarization of a shuffle will break up the source vectors into individual
elements, and use them to assemble the resulting vector. An element type of
a legal vector type may not necessarily be a legal scalar type, so make
sure that the extracted values are extended to a legal scalar type.

llvm-svn: 342079

5 years ago[Hexagon] Remove fp-contract=fast setting for at O3
Brendon Cahoon [Wed, 12 Sep 2018 20:35:56 +0000 (20:35 +0000)]
[Hexagon] Remove fp-contract=fast setting for at O3

Change Hexagon so that the setting for fp-contract is the default setting.
This makes Hexagon consistent with all other targets.

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

llvm-svn: 342078

5 years agoAMDGPU: Print all kernel descriptor directives (including the ones with default values)
Konstantin Zhuravlyov [Wed, 12 Sep 2018 20:25:39 +0000 (20:25 +0000)]
AMDGPU: Print all kernel descriptor directives (including the ones with default values)

Change by Tony Tye

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

llvm-svn: 342077

5 years ago[NFC][InstCombine] Drop newly-added interference-tests-for-high-bit-check.ll
Roman Lebedev [Wed, 12 Sep 2018 20:06:46 +0000 (20:06 +0000)]
[NFC][InstCombine] Drop newly-added interference-tests-for-high-bit-check.ll

Now that i have actually double-checked, no,
there is no such interference possible...

llvm-svn: 342076

5 years agoDo not create new terminals when launching process on Windows with --no-stdio
David Bolvansky [Wed, 12 Sep 2018 19:50:45 +0000 (19:50 +0000)]
Do not create new terminals when launching process on Windows with --no-stdio

Summary: Partially fixes PR38222

Reviewers: teemperor, zturner, stella.stamenova

Reviewed By: zturner, stella.stamenova

Subscribers: JDevlieghere, clayborg, labath, abidh, lldb-commits

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

llvm-svn: 342075

5 years ago[NFC][InstCombine] R38708 - inefficient pattern for high-bits checking.
Roman Lebedev [Wed, 12 Sep 2018 19:44:26 +0000 (19:44 +0000)]
[NFC][InstCombine] R38708 - inefficient pattern for high-bits checking.

More complicated, canonical pattern:
https://rise4fun.com/Alive/uhA
https://godbolt.org/z/o4RB8D

Also, we need to be careful not to skip some patters...

https://bugs.llvm.org/show_bug.cgi?id=38708

llvm-svn: 342074

5 years agoImplement the infrastructure for feature-test macros. Very few actual feature test...
Marshall Clow [Wed, 12 Sep 2018 19:41:40 +0000 (19:41 +0000)]
Implement the infrastructure for feature-test macros. Very few actual feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955

llvm-svn: 342073

5 years agoIf we fail to get an armv7em-- disassembler from llvm, skip the
Jason Molenda [Wed, 12 Sep 2018 19:30:03 +0000 (19:30 +0000)]
If we fail to get an armv7em-- disassembler from llvm, skip the
tests and don't mark this as a failure.  This happens when we've
linked against an llvm without the ARM target built in.  Davide
added some cmake conditionals to avoid building this test when the
target was absent from llvm's build, but we're still finding some
bots that manage to get in this situation.

<rdar://problem/44270082>

llvm-svn: 342072

5 years agoActually mark LWG#2953, don't just say you've done so in r342070
Marshall Clow [Wed, 12 Sep 2018 18:53:02 +0000 (18:53 +0000)]
Actually mark LWG#2953, don't just say you've done so in r342070

llvm-svn: 342071

5 years agomark LWG#2953 as complete. No code changes required, but added a couple of extra...
Marshall Clow [Wed, 12 Sep 2018 18:51:12 +0000 (18:51 +0000)]
mark LWG#2953 as complete. No code changes required, but added a couple of extra tests.

llvm-svn: 342070

5 years agoAMDGPU: Re-apply r341982 after fixing the layering issue
Konstantin Zhuravlyov [Wed, 12 Sep 2018 18:50:47 +0000 (18:50 +0000)]
AMDGPU: Re-apply r341982 after fixing the layering issue

Move isa version determination into TargetParser.

Also switch away from target features to CPU string when
determining isa version. This fixes an issue when we
output wrong isa version in the object code when features
of a particular CPU are altered (i.e. gfx902 w/o xnack
used to result in gfx900).

llvm-svn: 342069

5 years ago[Diagnostic] Fix a warning typo. NFC.
Matt Davis [Wed, 12 Sep 2018 18:27:21 +0000 (18:27 +0000)]
[Diagnostic] Fix a warning typo. NFC.

s/aligment/alignment/

llvm-svn: 342068

5 years ago[InstCombine] Inefficient pattern for high-bits checking (PR38708)
Roman Lebedev [Wed, 12 Sep 2018 18:19:43 +0000 (18:19 +0000)]
[InstCombine] Inefficient pattern for high-bits checking (PR38708)

Summary:
It is sometimes important to check that some newly-computed value
is non-negative and only `n` bits wide (where `n` is a variable.)
There are **many** ways to check that:
https://godbolt.org/z/o4RB8D
The last variant seems best?
(I'm sure there are some other variations i haven't thought of..)

Let's handle the second variant first, since it is much simpler.
https://rise4fun.com/Alive/LYjY

https://bugs.llvm.org/show_bug.cgi?id=38708

Reviewers: spatel, craig.topper, RKSimon

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 342067

5 years agoAdd compatibility version to liblldb in framework builds
Alex Langford [Wed, 12 Sep 2018 18:10:22 +0000 (18:10 +0000)]
Add compatibility version to liblldb in framework builds

Summary:
Building LLDB with xcodebuild sets the compatibility version of liblldb
in LLDB.framework. Building the framework with cmake does not set the
compatibility version, and so it defaults to 0.0.0. This is a discrepency in the
difference between the xcode build and the cmake build.

I tested this change by building without this patch. From the build tree I ran
`otool -L Library/Frameworks/LLDB.framework/Versions/A/LLDB` and got this:
```
@rpath/LLDB.framework/Versions/A/LLDB (compatibility version 0.0.0, current version 8.0.0)
```

Did the same with this patch and the output contained this:
```
@rpath/LLDB.framework/Versions/A/LLDB (compatibility version 1.0.0, current version 8.0.0)
```

Reviewers: clayborg, labath

Subscribers: mgorny, lldb-commits

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

llvm-svn: 342066

5 years ago[objcopy] make objcopy follow program header standards
Julie Hockett [Wed, 12 Sep 2018 17:56:31 +0000 (17:56 +0000)]
[objcopy] make objcopy follow program header standards

Submitted on behalf of Armando Montanez (amontanez@google.com).

Objects with unused program headers copied by objcopy would always have
nonzero values for program header offset and program header entry size.
While technically valid, this atypical behavior triggers warnings in some
tools. This change sets the two fields to zero when the program header is
unused, better fitting the general expectations for unused program header
data.

Section headers behaved somewhat similarly (though only with the entry size),
and are fixed in this revision as well.

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

llvm-svn: 342065

5 years ago[WebAssembly] SIMD comparisons
Thomas Lively [Wed, 12 Sep 2018 17:56:00 +0000 (17:56 +0000)]
[WebAssembly] SIMD comparisons

Summary:
Match the ordering semantics of non-vector comparisons. For
floating point comparisons that do not correspond to instructions, the
tests check that some vector comparison instruction was emitted but do
not care about the full implementation.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 342064

5 years agoUpdate the failure annotations for the uncaught_exceptions test. The underlying abi...
Marshall Clow [Wed, 12 Sep 2018 16:59:09 +0000 (16:59 +0000)]
Update the failure annotations for the uncaught_exceptions test. The underlying abi library on some Mac OS versions does not support the plural uncaught_exceptions, so libc++ emulates it from the singlar; this means it will only return 0 or 1.

llvm-svn: 342063

5 years ago[OPENMP] Fix PR38902: support ADL for declare reduction constructs.
Alexey Bataev [Wed, 12 Sep 2018 16:31:59 +0000 (16:31 +0000)]
[OPENMP] Fix PR38902: support ADL for declare reduction constructs.

Added support for argument-dependent lookup when trying to find the
required declare reduction decl.

llvm-svn: 342062

5 years ago[ARM] Tighten f64<->f16 conversion requirements
Diogo N. Sampaio [Wed, 12 Sep 2018 16:24:43 +0000 (16:24 +0000)]
[ARM] Tighten f64<->f16 conversion requirements

Fix missing Requires fields.

Patch by Bernard Ogden (bogden)

Reviewers: SjoerdMeijer, javed.absar, t.p.northover

Reviewed By: t.p.northover

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

llvm-svn: 342061

5 years ago[RISCV] Explicitly set an empty --sysroot in the test
Roger Ferrer Ibanez [Wed, 12 Sep 2018 15:55:14 +0000 (15:55 +0000)]
[RISCV] Explicitly set an empty --sysroot in the test

In rL341655 we added additional behaviour to the Driver for riscv32-unknown-elf
when the sysroot is empty.

The new tests that check the new behaviour expect that the absence of --sysroot
in the command-line implies that the sysroot empty. This doesn't hold if clang
is built with a non-empty DEFAULT_SYSROOT in cmake. When this is the case, this
test fails.

Since the new behaviour is triggered when the sysroot is empty, pass an empty
--sysroot to avoid using the default (if any).

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

llvm-svn: 342060

5 years ago[X86] Remove isel patterns for ADCX instruction
Craig Topper [Wed, 12 Sep 2018 15:47:34 +0000 (15:47 +0000)]
[X86] Remove isel patterns for ADCX instruction

There's no advantage to this instruction unless you need to avoid touching other flag bits. It's encoding is longer, it can't fold an immediate, it doesn't write all the flags.

I don't think gcc will generate this instruction either.

Fixes PR38852.

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

llvm-svn: 342059

5 years ago[PatternMatch] Use generic One,Two,ThreeOps_match classes (NFC).
Florian Hahn [Wed, 12 Sep 2018 14:52:38 +0000 (14:52 +0000)]
[PatternMatch] Use generic One,Two,ThreeOps_match classes (NFC).

Currently we have a few duplicated matcher classes, which all do pretty
much the same thing. This patch introduces generic
One,Tow,ThreeOps_match classes which take the opcode the match as
template argument.

Reviewers: SjoerdMeijer, dneilson, spatel, arsenm

Reviewed By: SjoerdMeijer

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

llvm-svn: 342058

5 years agoImplement LWG #3017. list splice functions should use addressof
Marshall Clow [Wed, 12 Sep 2018 14:46:17 +0000 (14:46 +0000)]
Implement LWG #3017. list splice functions should use addressof

llvm-svn: 342057

5 years agoReverting r342048, which caused UBSan failures in dsymutil.
Wolfgang Pieb [Wed, 12 Sep 2018 14:40:04 +0000 (14:40 +0000)]
Reverting r342048, which caused UBSan failures in dsymutil.

llvm-svn: 342056

5 years ago[GVNHoist] computeInsertionPoints() miscalculates IDF
Alexandros Lamprineas [Wed, 12 Sep 2018 14:28:23 +0000 (14:28 +0000)]
[GVNHoist] computeInsertionPoints() miscalculates IDF

Fix for https://bugs.llvm.org/show_bug.cgi?id=38912.

In GVNHoist::computeInsertionPoints() we iterate over the Value
Numbers and calculate the Iterated Dominance Frontiers without
clearing the IDFBlocks vector first. IDFBlocks ends up accumulating
an insane number of basic blocks, which bloats the compilation time
of SemaChecking.cpp with ubsan enabled.

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

llvm-svn: 342055

5 years ago[NFC][InstCombine] R38708 - inefficient pattern for high-bits checking.
Roman Lebedev [Wed, 12 Sep 2018 14:11:37 +0000 (14:11 +0000)]
[NFC][InstCombine] R38708 - inefficient pattern for high-bits checking.

The simplest pattern for now:
https://rise4fun.com/Alive/LYjY
https://godbolt.org/z/o4RB8D

https://bugs.llvm.org/show_bug.cgi?id=38708

llvm-svn: 342054

5 years ago[CodeGen] Align rtti and vtable data
David Green [Wed, 12 Sep 2018 14:09:06 +0000 (14:09 +0000)]
[CodeGen] Align rtti and vtable data

Previously the alignment on the newly created rtti/typeinfo data was largely
not set, meaning that DataLayout::getPreferredAlignment was free to overalign
it to 16 bytes. This causes unnecessary code bloat.

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

llvm-svn: 342053

5 years agoFix MSVC "not all control paths return a value" warnings. NFCI.
Simon Pilgrim [Wed, 12 Sep 2018 12:56:58 +0000 (12:56 +0000)]
Fix MSVC "not all control paths return a value" warnings. NFCI.

llvm-svn: 342052

5 years agoFix two issues in PDBASTParser
Pavel Labath [Wed, 12 Sep 2018 12:26:11 +0000 (12:26 +0000)]
Fix two issues in PDBASTParser

- gcc warning about using binary or for or-ing two comparisons (a == b | a == c)
- llvm style prefers static functions to functions in an anonymous namespace

llvm-svn: 342051

5 years agoMove SafeMachO from Utility to Host
Pavel Labath [Wed, 12 Sep 2018 12:26:05 +0000 (12:26 +0000)]
Move SafeMachO from Utility to Host

Summary:
One of the conclusions of the discussion on D49740 was that SafeMachO is better
off in the Host module (as that's the only place which should include
mach/machine.h, which is what this header is working around). Also, Utility,
which is the only module which cannot include Host, should not be doing
anything with object file formats.

This patch implements that move, and also removes any unneded includes of that
file.

I've verified that MacOS still compiles after this.

Reviewers: jingham, zturner, teemperor

Subscribers: fedor.sergeev, lldb-commits

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

llvm-svn: 342050

5 years ago[AArch64] Implement aarch64_vector_pcs codegen support.
Sander de Smalen [Wed, 12 Sep 2018 12:10:22 +0000 (12:10 +0000)]
[AArch64] Implement aarch64_vector_pcs codegen support.

This patch adds codegen support for the saving/restoring
V8-V23 for functions specified with the aarch64_vector_pcs
calling convention attribute, as added in patch D51477.

Reviewers: t.p.northover, gberry, thegameg, rengolin, javed.absar, MatzeB

Reviewed By: thegameg

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

llvm-svn: 342049

5 years ago[DWARF] Refactoring range list dumping to fold DWARF v4 functionality into v5 handling
Wolfgang Pieb [Wed, 12 Sep 2018 12:01:19 +0000 (12:01 +0000)]
[DWARF] Refactoring range list dumping to fold DWARF v4 functionality into v5 handling

Eliminating some duplication of rangelist dumping code at the expense of
some version-dependent code in dump and extract routines.

Reviewer: dblaikie, JDevlieghere, vleschuk

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

llvm-svn: 342048

5 years agoRemove another unused mislayered include.
Benjamin Kramer [Wed, 12 Sep 2018 11:31:18 +0000 (11:31 +0000)]
Remove another unused mislayered include.

llvm-svn: 342047

5 years agoRemove unused include that's also a layering violation.
Benjamin Kramer [Wed, 12 Sep 2018 11:27:10 +0000 (11:27 +0000)]
Remove unused include that's also a layering violation.

llvm-svn: 342046

5 years ago[ADT] Made numerous methods of ImmutableList const
Kristof Umann [Wed, 12 Sep 2018 11:20:15 +0000 (11:20 +0000)]
[ADT] Made numerous methods of ImmutableList const

Also added ImmutableList<T>::iterator::operator->.

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

llvm-svn: 342045

5 years agoRemove manual byte counting from internal Stream methods.
Raphael Isemann [Wed, 12 Sep 2018 10:20:41 +0000 (10:20 +0000)]
Remove manual byte counting from internal Stream methods.

Summary:
This patch removes the manual byte counting in all internal Stream methods.
This is now done by the automatic byte counting provided by calling `GetWrittenBytes()`
before and after writing the data (which is automatically done for us by the `ByteDelta`
utility class).

Reviewers: #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, labath, lldb-commits

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

llvm-svn: 342044

5 years ago[CGP] Ensure splitgep gives deterministic output
David Green [Wed, 12 Sep 2018 10:19:10 +0000 (10:19 +0000)]
[CGP] Ensure splitgep gives deterministic output

The output of splitLargeGEPOffsets does not appear to be deterministic because
of the way that we iterate over a DenseMap. I've changed it to a MapVector for
consistent output.

The test here isn't particularly great, only showing a consmetic difference in
output. The original reproducer is much larger but show a diffierence in
instruction ordering, leading to different codegen.

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

llvm-svn: 342043

5 years agoAdd a basic test for 'memory region'
Raphael Isemann [Wed, 12 Sep 2018 10:04:25 +0000 (10:04 +0000)]
Add a basic test for 'memory region'

Summary:
The 'memory region' command is at the moment not tested at all by our test suite.
This patch just adds a basic test that at least provides some basic testing.

Reviewers: #lldb, davide

Reviewed By: #lldb, davide

Subscribers: vsk, davide, lldb-commits

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

llvm-svn: 342042

5 years ago[clang-tidy] Abseil: Add more directories that are slated for future absl expansion.
Benjamin Kramer [Wed, 12 Sep 2018 10:04:16 +0000 (10:04 +0000)]
[clang-tidy] Abseil: Add more directories that are slated for future absl expansion.

llvm-svn: 342041

5 years ago[ARM] Follow-up to rL342033
Sam Parker [Wed, 12 Sep 2018 09:58:56 +0000 (09:58 +0000)]
[ARM] Follow-up to rL342033

Fixed typo which can cause segfault.

llvm-svn: 342040

5 years ago[SimplifyCFG] Put an alignment on generated switch tables
David Green [Wed, 12 Sep 2018 09:54:17 +0000 (09:54 +0000)]
[SimplifyCFG] Put an alignment on generated switch tables

Previously the alignment on the newly created switch table data was not set,
meaning that DataLayout::getPreferredAlignment was free to overalign it to 16
bytes. This causes unnecessary code bloat.

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

llvm-svn: 342039

5 years ago[AArch64] NFC: Refactoring to prepare for vector PCS.
Sander de Smalen [Wed, 12 Sep 2018 09:44:46 +0000 (09:44 +0000)]
[AArch64] NFC: Refactoring to prepare for vector PCS.

This patch refactors several parts of AArch64FrameLowering
so that it can be easily extended to support saving/restoring
of FPR128 (Q) registers.

Reviewers: t.p.northover, gberry, thegameg, rengolin, javed.absar

Reviewed By: thegameg

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

llvm-svn: 342038

5 years ago[clangd] Add missing clangBasic target_link_libraries
Heejin Ahn [Wed, 12 Sep 2018 09:40:13 +0000 (09:40 +0000)]
[clangd] Add missing clangBasic target_link_libraries

Without this, builds with `-DSHARED_LIB=ON` fail.

llvm-svn: 342037

5 years agoFix buildbots after r342027
Kirill Bobyrev [Wed, 12 Sep 2018 09:27:55 +0000 (09:27 +0000)]
Fix buildbots after r342027

llvm-svn: 342036

5 years ago[llvm-exegesis][NFC]Remove dead function parameter
Clement Courbet [Wed, 12 Sep 2018 09:26:32 +0000 (09:26 +0000)]
[llvm-exegesis][NFC]Remove dead function parameter

llvm-svn: 342035

5 years ago[CodeGen][ARM] Coerce FP16 vectors to integer vectors when needed
Mikhail Maltsev [Wed, 12 Sep 2018 09:19:19 +0000 (09:19 +0000)]
[CodeGen][ARM] Coerce FP16 vectors to integer vectors when needed

Summary:
On targets that do not support FP16 natively LLVM currently legalizes
vectors of FP16 values by scalarizing them and promoting to FP32. This
causes problems for the following code:

  void foo(int, ...);

  typedef __attribute__((neon_vector_type(4))) __fp16 float16x4_t;
  void bar(float16x4_t x) {
    foo(42, x);
  }

According to the AAPCS (appendix A.2) float16x4_t is a containerized
vector fundamental type, so 'foo' expects that the 4 16-bit FP values
are packed into 2 32-bit registers, but instead bar promotes them to
4 single precision values.

Since we already handle scalar FP16 values in the frontend by
bitcasting them to/from integers, this patch adds similar handling for
vector types and homogeneous FP16 vector aggregates.

One existing test required some adjustments because we now generate
more bitcasts (so the patch changes the test to target a machine with
native FP16 support).

Reviewers: eli.friedman, olista01, SjoerdMeijer, javed.absar, efriedma

Reviewed By: javed.absar, efriedma

Subscribers: efriedma, kristof.beyls, cfe-commits, chrib

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

llvm-svn: 342034

5 years ago[ARM] Exchange MAC operands in ARMParallelDSP
Sam Parker [Wed, 12 Sep 2018 09:17:44 +0000 (09:17 +0000)]
[ARM] Exchange MAC operands in ARMParallelDSP

SMLAD and SMLALD instructions also come in the form of SMLADX and
SMLALDX which perform an exchange on their second operand. To support
this, more of the loads in the MAC candidates are compared for
sequential access and a boolean value has been added to BinOpChain.

AddMACCandiate has been refactored into a small pattern matching
state machine to reduce the amount of duplicated code, but also to
enable the matching to be more flexible. CreateParallelMACPairs now
iterates through all the candidates to find parallel ones.

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

llvm-svn: 342033

5 years ago[ARM] Allow bitcasts in ARMCodeGenPrepare
Sam Parker [Wed, 12 Sep 2018 09:11:48 +0000 (09:11 +0000)]
[ARM] Allow bitcasts in ARMCodeGenPrepare

Allow bitcasts in the use-def chains, treating them as sources.

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

llvm-svn: 342032