platform/upstream/llvm.git
5 years ago[X86] Fix register resizings for inline assembly register operands.
Nirav Dave [Thu, 13 Sep 2018 20:33:56 +0000 (20:33 +0000)]
[X86] Fix register resizings for inline assembly register operands.

When replacing a named register input to the appropriately sized
sub/super-register. In the case of a 64-bit value being assigned to a
register in 32-bit mode, match GCC's assignment.

Reviewers: eli.friedman, craig.topper

Subscribers: nickdesaulniers, llvm-commits, hiraditya

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

llvm-svn: 342175

5 years ago[X86] Cleanup pair returns. NFCI.
Nirav Dave [Thu, 13 Sep 2018 20:33:27 +0000 (20:33 +0000)]
[X86] Cleanup pair returns. NFCI.

llvm-svn: 342174

5 years ago[InstCombine] Inefficient pattern for high-bits checking 2 (PR38708)
Roman Lebedev [Thu, 13 Sep 2018 20:33:12 +0000 (20:33 +0000)]
[InstCombine] Inefficient pattern for high-bits checking 2 (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..)

More complicated, canonical pattern:
https://rise4fun.com/Alive/uhA

We do need to have two `switch()`'es like this,
to not mismatch the swappable predicates.

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/D52001

llvm-svn: 342173

5 years ago[PartiallyInlineLibCalls] Add DebugCounter support
George Burgess IV [Thu, 13 Sep 2018 20:33:04 +0000 (20:33 +0000)]
[PartiallyInlineLibCalls] Add DebugCounter support

This adds DebugCounter support to the PartiallyInlineLibCalls pass,
which should make debugging/automated bisection easier in the future.

Patch by Zhizhou Yang!

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

llvm-svn: 342172

5 years ago[NFC][InstCombine] Test what happens if 'unefficient high bit check' pattern is on...
Roman Lebedev [Thu, 13 Sep 2018 20:33:02 +0000 (20:33 +0000)]
[NFC][InstCombine] Test what happens if 'unefficient high bit check' pattern is on both sides.

Came up in https://reviews.llvm.org/D52001#1233827
While we don't do a good job here, we at least want to make
sure that we don't have any inf-loops.

llvm-svn: 342171

5 years ago[DCE] Add DebugCounter support
George Burgess IV [Thu, 13 Sep 2018 20:29:50 +0000 (20:29 +0000)]
[DCE] Add DebugCounter support

Patch by Zhizhou Yang!

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

llvm-svn: 342170

5 years agoRevert "[cmake] Fix a unittest when `LLVM_LINK_LLVM_DYLIB` is requested."
Volodymyr Sapsai [Thu, 13 Sep 2018 20:24:36 +0000 (20:24 +0000)]
Revert "[cmake] Fix a unittest when `LLVM_LINK_LLVM_DYLIB` is requested."

This reverts commit r342150 as it caused test failure

    LLVM-Unit :: Passes/./PluginsTests/PluginsTests.LoadPlugin

on multiple bots.

llvm-svn: 342169

5 years agoAdd flag to llvm-profdata to allow symbols in profile data to be remapped, and
Richard Smith [Thu, 13 Sep 2018 20:22:02 +0000 (20:22 +0000)]
Add flag to llvm-profdata to allow symbols in profile data to be remapped, and
add a tool to generate symbol remapping files.

Summary:
The new tool llvm-cxxmap builds a symbol mapping table from a file containing
a description of partial equivalences to apply to mangled names and files
containing old and new symbol tables.

Reviewers: davidxl

Subscribers: mgorny, llvm-commits

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

llvm-svn: 342168

5 years agoNativeProcessProtocol: Sink ReadMemoryWithoutTrap into base class
Pavel Labath [Thu, 13 Sep 2018 20:17:40 +0000 (20:17 +0000)]
NativeProcessProtocol: Sink ReadMemoryWithoutTrap into base class

The two existing implementations have the function implemented
identically, and there's no reason to believe that this would be
different for other implementations.

llvm-svn: 342167

5 years agoFix a couple of mangling canonicalizer corner case bugs.
Richard Smith [Thu, 13 Sep 2018 20:00:21 +0000 (20:00 +0000)]
Fix a couple of mangling canonicalizer corner case bugs.

Summary:
The hash computed for an ArrayType was different when first constructed
versus when later profiled due to the constructor default argument, and
we were not tracking constructor / destructor variant as part of the
mangled name AST, leading to incorrect equivalences.

Reviewers: erik.pilkington

Subscribers: llvm-commits

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

llvm-svn: 342166

5 years agoSupport -fno-omit-frame-pointer with -pg.
Stephen Hines [Thu, 13 Sep 2018 19:50:02 +0000 (19:50 +0000)]
Support -fno-omit-frame-pointer with -pg.

Summary:
Previously, any instance of -fomit-frame-pointer would make it such that
-pg was an invalid flag combination. If -fno-omit-frame-pointer is
passed later on the command line (such that it actually takes effect),
-pg should be allowed.

Reviewers: nickdesaulniers

Reviewed By: nickdesaulniers

Subscribers: manojgupta, nickdesaulniers, cfe-commits, kongyi, chh, pirama

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

llvm-svn: 342165

5 years ago[hwasan] use a single Printf per line when printing a report (more friendly to androi...
Kostya Serebryany [Thu, 13 Sep 2018 19:14:22 +0000 (19:14 +0000)]
[hwasan] use a single Printf per line when printing a report (more friendly to android logging)

llvm-svn: 342164

5 years ago[InstCombine] Fold (xor (min/max X, Y), -1) -> (max/min ~X, ~Y) when X and Y are...
Craig Topper [Thu, 13 Sep 2018 18:52:58 +0000 (18:52 +0000)]
[InstCombine] Fold (xor (min/max X, Y), -1) -> (max/min ~X, ~Y) when X and Y are freely invertible.

This allows the xor to be removed completely.

This might help with recomitting r341674, but seems good regardless.

Coincidentally fixes PR38915.

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

llvm-svn: 342163

5 years ago[InstCombine] Add test cases for D51964. NFC
Craig Topper [Thu, 13 Sep 2018 18:52:56 +0000 (18:52 +0000)]
[InstCombine] Add test cases for D51964. NFC

llvm-svn: 342162

5 years agoCommon infrastructure for reading a profile remapping file and building
Richard Smith [Thu, 13 Sep 2018 18:51:44 +0000 (18:51 +0000)]
Common infrastructure for reading a profile remapping file and building
a mangling remapper from it.

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

llvm-svn: 342161

5 years ago [RISCV][MC] Reject bare symbols for the simm6 and simm6nonzero operand types
Ana Pazos [Thu, 13 Sep 2018 18:37:23 +0000 (18:37 +0000)]
 [RISCV][MC] Reject bare symbols for the simm6 and simm6nonzero operand types

Summary:
Fixed assertions due to invalid fixup when encoding compressed instructions
 (c.addi, c.addiw, c.li, c.andi) with bare symbols with/without modifiers.
  This matches GAS behavior as well.

This bug was uncovered by a LLVM MC Disassembler Protocol Buffer Fuzzer
for the RISC-V assembly language.

Reviewers: asb

Reviewed By: asb

Subscribers: rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, asb

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

llvm-svn: 342160

5 years ago[RISCV] Fix decoding of invalid instruction with C extension enabled.
Ana Pazos [Thu, 13 Sep 2018 18:21:19 +0000 (18:21 +0000)]
[RISCV] Fix decoding of invalid instruction with C extension enabled.

Summary:
The illegal instruction 0x00 0x00 is being wrongly decoded as
c.addi4spn with 0 immediate.

The invalid instruction 0x01 0x61 is being wrongly decoded as
c.addi16sp with 0 immediate.

This bug was uncovered by a LLVM MC Disassembler Protocol Buffer Fuzzer
for the RISC-V assembly language.

Reviewers: asb

Reviewed By: asb

Subscribers: rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, asb

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

llvm-svn: 342159

5 years agolld-link: For nonexisting inputs, omit follow-on diagnostics
Nico Weber [Thu, 13 Sep 2018 18:13:21 +0000 (18:13 +0000)]
lld-link: For nonexisting inputs, omit follow-on diagnostics

For lld-link missing.obj, lld-link currently prints:

  lld-link: error: could not open foo.obj: No such file or directory
  lld-link: warning: /machine is not specified. x64 is assumed
  lld-link: error: subsystem must be defined

The 2nd and 3rd diagnostics are consequences of the input not existing and are
not interesting. If input files are missing, the best thing we can do is point
that out and then return.

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

llvm-svn: 342158

5 years ago[WebAssembly] Fix signature of `main` in FixFunctionBitcasts
Sam Clegg [Thu, 13 Sep 2018 17:13:10 +0000 (17:13 +0000)]
[WebAssembly] Fix signature of `main` in FixFunctionBitcasts

Also, add a check to ensure that when main has the expected signature
we do not create a wrapper.

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

llvm-svn: 342157

5 years ago[AArch64] Add integer abs testcases for D51873.
Simon Pilgrim [Thu, 13 Sep 2018 17:11:25 +0000 (17:11 +0000)]
[AArch64] Add integer abs testcases for D51873.

llvm-svn: 342156

5 years ago[clangd] Introduce PostingList interface
Kirill Bobyrev [Thu, 13 Sep 2018 17:11:03 +0000 (17:11 +0000)]
[clangd] Introduce PostingList interface

This patch abstracts `PostingList` interface and reuses existing
implementation. It will be used later to test different `PostingList`
representations.

No functionality change is introduced, this patch is mostly refactoring
so that the following patches could focus on functionality while not
being too hard to review.

Reviewed By: sammccall, ioeric

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

llvm-svn: 342155

5 years ago[cmake] Fix missing DEPENDS.
Richard Diamond [Thu, 13 Sep 2018 17:10:44 +0000 (17:10 +0000)]
[cmake] Fix missing DEPENDS.

Not sure how I didn't catch this.

llvm-svn: 342154

5 years ago[LLDB] - Improved DWARF5 support.
George Rimar [Thu, 13 Sep 2018 17:06:47 +0000 (17:06 +0000)]
[LLDB] - Improved DWARF5 support.

This patch improves the support of DWARF5.
Particularly the reporting of source code locations.

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

llvm-svn: 342153

5 years ago[NFC]Refactor MultiVersion Resolver Emission to combine types
Erich Keane [Thu, 13 Sep 2018 16:58:24 +0000 (16:58 +0000)]
[NFC]Refactor MultiVersion Resolver Emission to combine types

Previously, both types (plus the future target-clones) of
multiversioning had a separate ResolverOption structure and emission
function.  This patch combines the two, at the expense of a slightly
more expensive sorting function.

llvm-svn: 342152

5 years ago[OPENMP] Fix PR38903: Crash on instantiation of the non-dependent
Alexey Bataev [Thu, 13 Sep 2018 16:54:05 +0000 (16:54 +0000)]
[OPENMP] Fix PR38903: Crash on instantiation of the non-dependent
declare reduction.

If the declare reduction construct with the non-dependent type is
defined in the template construct, the compiler might crash on the
template instantition. Reworked the whole instantiation scheme for the
declare reduction constructs to fix this problem correctly.

llvm-svn: 342151

5 years ago[cmake] Fix a unittest when `LLVM_LINK_LLVM_DYLIB` is requested.
Richard Diamond [Thu, 13 Sep 2018 16:39:52 +0000 (16:39 +0000)]
[cmake] Fix a unittest when `LLVM_LINK_LLVM_DYLIB` is requested.

llvm-svn: 342150

5 years ago[InstCombine] remove checks for IsFreeToInvert()
Sanjay Patel [Thu, 13 Sep 2018 16:18:12 +0000 (16:18 +0000)]
[InstCombine] remove checks for IsFreeToInvert()

I accidentally committed this diff with rL342147 because
I had applied D51964. We probably do need those checks,
but D51964 has tests and more discussion/motivation,
so they should be re-added with that patch.

llvm-svn: 342149

5 years agoRenovate CMake files in the `llvm-(cfi-verify|exegesis|mca)` tools.
Richard Diamond [Thu, 13 Sep 2018 16:15:03 +0000 (16:15 +0000)]
Renovate CMake files in the `llvm-(cfi-verify|exegesis|mca)` tools.

llvm-svn: 342148

5 years ago[InstCombine] reorder folds to reduce chance of infinite loops
Sanjay Patel [Thu, 13 Sep 2018 16:04:06 +0000 (16:04 +0000)]
[InstCombine] reorder folds to reduce chance of infinite loops

I don't have a test case for this, but it's motivated by
the discussion in D51964, and I've added TODO comments for
the better fix - move simplifications into instsimplify
because that's more efficient and reduces risk of infinite
loops in instcombine caused by transforms trying to do the
opposite folds.

In this case, we know that the transform that tries to move
'not' through min/max can be fooled by the multiple uses
of a value in another min/max, so try to squash the
foldSPFofSPF() patterns first.

llvm-svn: 342147

5 years ago[ELF] Guard --fix-cortex-a53-843419 against --just-syms
Peter Smith [Thu, 13 Sep 2018 15:49:13 +0000 (15:49 +0000)]
[ELF] Guard --fix-cortex-a53-843419 against --just-syms

If --just-syms is used the mapping symbols from the ELF file will be
absolute symbols with no section. The code to process mapping symbols in
--fix-cortex-a53-843419 assumes that these symbols have a defining section
so a crash will result when --just-syms is used. The simple fix is to not
process the symbol when it doesn't have a section.

Fixes PR37971

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

llvm-svn: 342146

5 years agoAdd missing REQUIRES x86 to test/COFF/icf-safe.s
Azharuddin Mohammed [Thu, 13 Sep 2018 15:40:19 +0000 (15:40 +0000)]
Add missing REQUIRES x86 to test/COFF/icf-safe.s

Reviewers: ruiu, pcc

Reviewed By: ruiu

Subscribers: llvm-commits

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

llvm-svn: 342145

5 years agoFix typo in error message. NFC.
Azharuddin Mohammed [Thu, 13 Sep 2018 15:37:13 +0000 (15:37 +0000)]
Fix typo in error message. NFC.

Summary: It should be "wasm-ld", not "wasm-lld".

Reviewers: ruiu

Reviewed By: ruiu

Subscribers: aheejin, sunfish, llvm-commits

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

llvm-svn: 342144

5 years ago[clangd] Fix Dexp build
Kirill Bobyrev [Thu, 13 Sep 2018 15:35:55 +0000 (15:35 +0000)]
[clangd] Fix Dexp build

%s/MaxCandidateCount/Limit/g after rL342138.

llvm-svn: 342143

5 years ago[DWARFExpression] Read literars as unsigned values.
Jonas Devlieghere [Thu, 13 Sep 2018 15:18:39 +0000 (15:18 +0000)]
[DWARFExpression] Read literars as unsigned values.

After landing r341457, we started seeing a failure on the swift-lldb
bots. The change was correct and pretty straightforward, a DW_OP_constu
was replaced with DW_OP_lit23, the value remaining identical.

  0x000000f4: DW_TAG_variable
DW_AT_location    (0x00000000
  [0x0000000100000a51,  0x0000000100000d47): DW_OP_lit23, DW_OP_stack_value)
DW_AT_name        ("number")

However, this broke LLDB.

  (Int) number = <extracting data from value failed>

The value was read correctly, but apparently the value's type was different.
When reading a constu it was reading a uint64 (m_type = e_ulonglong) while for
the literal, it got a signed int (m_type = e_sint). This change makes sure we
read the value as an unsigned.

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

llvm-svn: 342142

5 years ago[ARM] Allow truncs as sources in ARM CGP
Sam Parker [Thu, 13 Sep 2018 15:14:12 +0000 (15:14 +0000)]
[ARM] Allow truncs as sources in ARM CGP

We previously only allowed truncs as sinks, but now allow them as
sources too. We do this by checking that the result type is the
narrow type that we're trying to optimise for.

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

llvm-svn: 342141

5 years ago[ARM] Fix FixConst for ARMCodeGenPrepare
Sam Parker [Thu, 13 Sep 2018 14:48:10 +0000 (14:48 +0000)]
[ARM] Fix FixConst for ARMCodeGenPrepare

Part of FixConsts wrongly assumes either a 8- or 16-bit constant
which can result in the wrong constants being generated during
promotion.

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

llvm-svn: 342140

5 years agoPrint correctly dependency paths on Windows
David Bolvansky [Thu, 13 Sep 2018 14:27:32 +0000 (14:27 +0000)]
Print correctly dependency paths on Windows

Summary:
Before:
main.o: main.c ../include/lib\test.h

After:
main.o: main.c ../include/lib/test.h

Fixes PR38877

Reviewers: zturner

Subscribers: xbolva00, cfe-commits

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

llvm-svn: 342139

5 years ago[clangd] Cleanup FuzzyFindRequest filtering limit semantics
Kirill Bobyrev [Thu, 13 Sep 2018 14:27:03 +0000 (14:27 +0000)]
[clangd] Cleanup FuzzyFindRequest filtering limit semantics

As discussed during D51860 review, it is better to use `llvm::Optional`
here as it has clear semantics which reflect intended behavior.

Reviewed By: sammccall

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

llvm-svn: 342138

5 years ago[clangd] Use JSON format in benchmark requests reader
Kirill Bobyrev [Thu, 13 Sep 2018 14:21:50 +0000 (14:21 +0000)]
[clangd] Use JSON format in benchmark requests reader

After `FuzzyFindRequest` JSON (de)serialization was introduced, it
should replace ad-hoc fuzzy-find request parsing implemented in the
IndexBenchmark driver.

Reviewed By: ilya-biryukov

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

llvm-svn: 342137

5 years ago[MC/Dwarf] Unclamp DWARF linetables format on Darwin.
Jonas Devlieghere [Thu, 13 Sep 2018 13:13:50 +0000 (13:13 +0000)]
[MC/Dwarf] Unclamp DWARF linetables format on Darwin.

In r319995, we fixed the line table format to version 2 on Darwin
because dsymutil didn't yet understand the new format which caused test
failures for the LLDB bots. This has been resolved in the meantime so
there's no reason to keep this limitation.

rdar://problem/35968332

llvm-svn: 342136

5 years ago[clangd] Allow all LSP methods to signal cancellation via $/cancelRequest
Sam McCall [Thu, 13 Sep 2018 12:58:36 +0000 (12:58 +0000)]
[clangd] Allow all LSP methods to signal cancellation via $/cancelRequest

Summary:
The cancelable scopes are managed by JSONRPCDispatcher so that all Handlers
run in cancelable contexts.
(Previously ClangdServer did this, for code completion only).

Cancellation request processing is therefore also in JSONRPCDispatcher.
(Previously it was in ClangdLSPServer).

This doesn't actually make any new commands *respect* cancellation - they'd
need to check isCancelled() and bail out. But it opens the door to doing
this incrementally, and putting such logic in common machinery like TUScheduler.

I also rewrote the ClangdServer class/threading comments because I wanted to
add to it and I got carried away.

Reviewers: ilya-biryukov, kadircet

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

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

llvm-svn: 342135

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