platform/upstream/llvm.git
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

6 years ago[ThinLTO] Add GraphTraits for FunctionSummaries
Charles Saternos [Sat, 17 Feb 2018 21:39:24 +0000 (21:39 +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.

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

llvm-svn: 325448

6 years ago[MIPS][MSA] Convert vector integer min/max opcodes to use generic implementation
Simon Pilgrim [Sat, 17 Feb 2018 21:29:45 +0000 (21:29 +0000)]
[MIPS][MSA] Convert vector integer min/max opcodes to use generic implementation

Found while investigating D43338

Simon^3 - the LLVM project needs more Simons.

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

llvm-svn: 325447

6 years ago[X86] Add 'sahf' CPU feature to frontend
Dimitry Andric [Sat, 17 Feb 2018 21:04:35 +0000 (21:04 +0000)]
[X86] Add 'sahf' CPU feature to frontend

Summary:
Make clang accept `-msahf` (and `-mno-sahf`) flags to activate the
`+sahf` feature for the backend, for bug 36028 (Incorrect use of
pushf/popf enables/disables interrupts on amd64 kernels).  This was
originally submitted in bug 36037 by Jonathan Looney
<jonlooney@gmail.com>.

As described there, GCC also uses `-msahf` for this feature, and the
backend already recognizes the `+sahf` feature. All that is needed is to
teach clang to pass this on to the backend.

The mapping of feature support onto CPUs may not be complete; rather, it
was chosen to match LLVM's idea of which CPUs support this feature (see
lib/Target/X86/X86.td).

I also updated the affected test case (CodeGen/attr-target-x86.c) to
match the emitted output.

Reviewers: craig.topper, coby, efriedma, rsmith

Reviewed By: craig.topper

Subscribers: emaste, cfe-commits

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

llvm-svn: 325446

6 years agoRemove an unused accessor and simplify the logic a bit. NFC.
Rui Ueyama [Sat, 17 Feb 2018 20:41:38 +0000 (20:41 +0000)]
Remove an unused accessor and simplify the logic a bit. NFC.

llvm-svn: 325445

6 years agoFactor out common code from applySecRel functions.
Rui Ueyama [Sat, 17 Feb 2018 20:28:15 +0000 (20:28 +0000)]
Factor out common code from applySecRel functions.

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

llvm-svn: 325444

6 years ago[ARM] Add LLVM tests for the vcvtr builtins
Sjoerd Meijer [Sat, 17 Feb 2018 19:59:29 +0000 (19:59 +0000)]
[ARM] Add LLVM tests for the vcvtr builtins

Follow up of Clang commit r325351; this adds the LLVM tests, which
were also missing.

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

llvm-svn: 325443

6 years ago[cmake] Fix LLDB_CODESIGN_IDENTITY logic.
Don Hinton [Sat, 17 Feb 2018 19:17:21 +0000 (19:17 +0000)]
[cmake] Fix LLDB_CODESIGN_IDENTITY logic.

Summary:
Consolidate LLDB_CODESIGN_IDENTITY logic in one place and use
SKIP_DEBUGSERVER, which can be set independently, to control
codesigning targets.

Currently, running cmake the first time in a clean directory, without
passing -DLLDB_CODESIGN_IDENTITY='', fails.  However, subsequent runs
succeed.  That's because LLDB_CODESIGN_IDENTITY gets added to the
CACHE after the initial test.  To fix that, the default value must be
set before it's tested.

Here's the error produced on the first run:

CMake Error at tools/lldb/tools/debugserver/source/CMakeLists.txt:215 (add_custom_command):
  No TARGET 'debugserver' has been created in this directory.

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

llvm-svn: 325442

6 years ago[RISCV] Revert r324172 now r323991 was reverted
Alex Bradbury [Sat, 17 Feb 2018 18:17:47 +0000 (18:17 +0000)]
[RISCV] Revert r324172 now r323991 was reverted

This fixes the build, now that r325421 was commited to revert r323991.

llvm-svn: 325441

6 years agoMade test dbg_value_fastisel.ll specific to AArch64 fast-isel.
Sander de Smalen [Sat, 17 Feb 2018 17:43:24 +0000 (17:43 +0000)]
Made test dbg_value_fastisel.ll specific to AArch64 fast-isel.

Some buildbots failed on this test (rL325438) because they don't
build all targets. I set the triple to aarch64 and moved the test
to test/CodeGen/AArch64/fast-isel-dbg-value.ll.

llvm-svn: 325440

6 years ago[X86] Add 'sahf' to getHostCPUFeatures so -march=native will pick it up correctly.
Craig Topper [Sat, 17 Feb 2018 16:52:49 +0000 (16:52 +0000)]
[X86] Add 'sahf' to getHostCPUFeatures so -march=native will pick it up correctly.

Summary: We probably mostly get this right due to family/model/stepping mapping to CPU names. But we should detect it explicitly.

Reviewers: RKSimon, echristo, dim, spatel

Reviewed By: dim

Subscribers: llvm-commits

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

llvm-svn: 325439

6 years ago[DebugInfo][FastISel] Fix dropping dbg.value()
Sander de Smalen [Sat, 17 Feb 2018 16:42:54 +0000 (16:42 +0000)]
[DebugInfo][FastISel] Fix dropping dbg.value()

Summary:
https://llvm.org/PR36263 shows that when compiling at -O0 a dbg.value()
instruction (that remains from an original dbg.declare()) is dropped
by FastISel. Since FastISel selects instructions by iterating a basic
block backwards, it drops the dbg.value if one of its operands is not
yet instantiated by a previously selected instruction.

Instead of calling 'lookUpRegForValue()' we can call 'getRegForValue()'
instead that will insert a placeholder for the operand to be filled in
when continuing the instruction selection.

Reviewers: aprantl, dblaikie, probinson

Reviewed By: aprantl

Subscribers: llvm-commits, dstenb, JDevlieghere

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

llvm-svn: 325438

6 years ago[PatternMatch] enhance m_One() to ignore undef elements in vectors
Sanjay Patel [Sat, 17 Feb 2018 16:00:42 +0000 (16:00 +0000)]
[PatternMatch] enhance m_One() to ignore undef elements in vectors

llvm-svn: 325437

6 years ago[InstSimplify, InstCombine] add tests with vector undef elts; NFC
Sanjay Patel [Sat, 17 Feb 2018 15:55:40 +0000 (15:55 +0000)]
[InstSimplify, InstCombine] add tests with vector undef elts; NFC

These would fold if the m_One pattern matcher accounted for undef elts.

llvm-svn: 325436

6 years ago[X86][3DNow!] Add PFRCP reg-reg disassembler test case (PR21168)
Simon Pilgrim [Sat, 17 Feb 2018 14:58:16 +0000 (14:58 +0000)]
[X86][3DNow!] Add PFRCP reg-reg disassembler test case (PR21168)

llvm-svn: 325435

6 years ago[InstSimplify] move select undef cond fold with other constant cond folds; NFCI
Sanjay Patel [Sat, 17 Feb 2018 14:50:13 +0000 (14:50 +0000)]
[InstSimplify] move select undef cond fold with other constant cond folds; NFCI

llvm-svn: 325434

6 years ago[AArch64] Implement dynamic stack probing for windows
Martin Storsjo [Sat, 17 Feb 2018 14:26:32 +0000 (14:26 +0000)]
[AArch64] Implement dynamic stack probing for windows

This makes sure that alloca() function calls properly probe the
stack as needed.

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

llvm-svn: 325433

6 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Sat, 17 Feb 2018 13:48:23 +0000 (13:48 +0000)]
Fix unused variable warning. NFCI.

We were casting to AArch64InstrInfo but only using it for static methods which some compilers complain about.

llvm-svn: 325432

6 years agoRecognize all NetBSD architectures in UBSan
Kamil Rytarowski [Sat, 17 Feb 2018 13:35:09 +0000 (13:35 +0000)]
Recognize all NetBSD architectures in UBSan

Summary:
Use uniform accessors for Program Pointer,
Stack Pointer and Frame Pointer.

Remove CPU check in UBSan supported platforms
and rely only on the OS type.

This adds NetBSD support in GetPcSpBp() for:
 - ARM
 - ARM64
 - HPPA
 - PowerPC/PowerPC64
 - SPARC/SPARC64
 - MIPS
 - DEC Alpha AXP
 - DEC VAX
 - M68K and M68010
 - SH3
 - IA64
 - OR1K
 - RISCV

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, ro

Reviewed By: vitalybuka

Subscribers: aemerson, jyknight, sdardis, kubamracek, arichardson, llvm-commits, kristof.beyls, fedor.sergeev, #sanitizers

Tags: #sanitizers

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

llvm-svn: 325431

6 years ago[dwarfdump] Fix spurious verification errors for DW_AT_location attributes
Jonas Devlieghere [Sat, 17 Feb 2018 13:06:37 +0000 (13:06 +0000)]
[dwarfdump] Fix spurious verification errors for DW_AT_location attributes

Verifying any DWARF file that is optimized and contains at least one tag
with a DW_AT_location with a location list offset as a
DW_AT_form_dataXXX results in dwarfdump spuriously claiming that the
location list is invalid.

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

llvm-svn: 325430

6 years ago[DAGCombiner] Remove simplifyShuffleMask - now handled more generally by SimplifyDema...
Simon Pilgrim [Sat, 17 Feb 2018 12:36:56 +0000 (12:36 +0000)]
[DAGCombiner] Remove simplifyShuffleMask - now handled more generally by SimplifyDemandedVectorElts.

llvm-svn: 325429

6 years agoFix signed/unsigned comparison warning in AsmGenMatcher generated code. NFCI.
Simon Pilgrim [Sat, 17 Feb 2018 12:29:47 +0000 (12:29 +0000)]
Fix signed/unsigned comparison warning in AsmGenMatcher generated code. NFCI.

llvm-svn: 325428

6 years ago[DebugInfo] Removed assert on missing CountVarDIE
Sander de Smalen [Sat, 17 Feb 2018 11:06:53 +0000 (11:06 +0000)]
[DebugInfo] Removed assert on missing CountVarDIE

Summary:
The assert for a DISubrange's CountVarDIE to be available fails
when the dbg.value() has been optimized away for any reason.
Having the assert for that is a little heavy, so instead removing
it now in favor of not generating the 'count' expression.

Addresses http://llvm.org/PR36263 .

Reviewers: aprantl, dblaikie, probinson

Reviewed By: aprantl

Subscribers: JDevlieghere, llvm-commits, dstenb

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

llvm-svn: 325427

6 years agoReport fatal error in the case of out of memory
Serge Pavlov [Sat, 17 Feb 2018 10:21:33 +0000 (10:21 +0000)]
Report fatal error in the case of out of memory

This is partial recommit of r325224, reverted in 325227. The relevant
part of original comment is below.

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.

Usual programming practice does not require checking result of 'operator
new' because it throws 'std::bad_alloc' in the case of allocation error.
However, LLVM is usually built with exceptions turned off, so 'new' can
return null pointer. This change installs custom new handler, which causes
fatal error in the case of out of memory. The handler is installed
automatically prior to call to 'main' during construction of a static
object defined in 'lib/Support/ErrorHandling.cpp'. If the application does
not use this file, the handler may be installed manually by a call to
'llvm::install_out_of_memory_new_handler', declared in
'include/llvm/Support/ErrorHandling.h".

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

llvm-svn: 325426

6 years ago[AMDGPU] Return true in enableMultipleCopyHints().
Jonas Paulsson [Sat, 17 Feb 2018 10:00:28 +0000 (10:00 +0000)]
[AMDGPU]  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: Stanislav Mekhanoshin, Tom Stellard.
llvm-svn: 325425

6 years ago[OMPT] Omissionin in OMPT Formatting
Joachim Protze [Sat, 17 Feb 2018 09:54:10 +0000 (09:54 +0000)]
[OMPT] Omissionin in OMPT Formatting

Applying clang-format to the /runtime/src/ folder

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

llvm-svn: 325424

6 years ago[OMPT] Add interoperability testcase
Joachim Protze [Sat, 17 Feb 2018 09:40:08 +0000 (09:40 +0000)]
[OMPT] Add interoperability testcase

Test whether OMPT-callbacks for two threads that initiate a parallel region are correct.

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

llvm-svn: 325423

6 years ago[OMPT] Update api_calls testcase
Joachim Protze [Sat, 17 Feb 2018 09:40:02 +0000 (09:40 +0000)]
[OMPT] Update api_calls testcase

Only use ompt_ functions when testing OMPT in api_calls testcase.
Add size parameter to print_list.
Fix small bug in implementation of ompt_get_partition_place_nums(): return correct length.

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

llvm-svn: 325422

6 years agoRevert "[MachineCopyPropagation] Extend pass to do COPY source forwarding"
Quentin Colombet [Sat, 17 Feb 2018 03:05:33 +0000 (03:05 +0000)]
Revert "[MachineCopyPropagation] Extend pass to do COPY source forwarding"

This reverts commit r323991.

This commit breaks target that don't model all the register constraints
in TableGen. So far the workaround was to set the
hasExtraXXXRegAllocReq, but it proves that it doesn't cover all the
cases.
For instance, when mutating an instruction (like in the lowering of
COPYs) the isRenamable flag is not properly updated. The same problem
will happen when attaching machine operand from one instruction to
another.

Geoff Berry is working on a fix in https://reviews.llvm.org/D43042.

llvm-svn: 325421

6 years ago[DAG, X86] Revert r324797, r324491, and r324359.
Chandler Carruth [Sat, 17 Feb 2018 02:26:25 +0000 (02:26 +0000)]
[DAG, X86] Revert r324797, r324491, and r324359.

Sadly, r324359 caused at least PR36312. There is a patch out for review
but it seems to be taking a bit and we've already had these crashers in
tree for too long. We're hitting this PR in real code now and are
blocked on shipping new compilers as a consequence so I'm reverting us
back to green.

Sorry for the churn due to the stacked changes that I had to revert. =/

llvm-svn: 325420

6 years ago[InstSimplify] add vector select tests with undef elts in condition; NFC
Sanjay Patel [Sat, 17 Feb 2018 01:18:53 +0000 (01:18 +0000)]
[InstSimplify] add vector select tests with undef elts in condition; NFC

llvm-svn: 325419

6 years ago[WebAssembly] Remove unneeded classifer methods from Symbol class. NFC.
Sam Clegg [Sat, 17 Feb 2018 00:44:21 +0000 (00:44 +0000)]
[WebAssembly] Remove unneeded classifer methods from Symbol class. NFC.

We already have isa<> for this, and these methods were simply
duplicating those redundantly.

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

llvm-svn: 325418

6 years ago[X86] Turn selects with constant condition into vector shuffles during DAG combine
Craig Topper [Sat, 17 Feb 2018 00:30:30 +0000 (00:30 +0000)]
[X86] Turn selects with constant condition into vector shuffles during DAG combine

Summary:
Currently we convert to shuffles during lowering. This moves it to DAG combine so hopefully we can get it done before type legalization has to extend the condition.

I believe in some cases we're creating SHRUNKBLENDs that end up with constant conditions because we see the extended on the condition and think its a dynamic selelect before DAG combine gets a chance to constant fold the extend. We could add combines to turn SHRUNKBLENDs with constant condition back to vselect. But it seemed like it might be better to just send them to shuffles as early as possible so they never get a chance to become SHRUNKBLENDs. This the reason some tests went from blends controlled by a constant pool load to just move.

Some of the constant pool entries changed because the sign_extend introduced by type legalization turned undef elements in select condition into 0s. While the select->shuffle used -1 in the shuffle mask. So now the shuffle lowering can do what it wants with them.

I'll remove the lowering code as a follow up. We might be able to simplify some of the pre-checks for SHRUNKBLEND as the FIXME there says.

Reviewers: spatel, RKSimon, efriedma, zvi, andreadb

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 325417

6 years agoUse toString to print out garbage-collected sections.
Rui Ueyama [Sat, 17 Feb 2018 00:09:49 +0000 (00:09 +0000)]
Use toString to print out garbage-collected sections.

Currently, archive file name is missing in this message. In general,
we should avoid constructing strings in an ad-hoc manner and instead
use toString() to get consistent output strings.

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

llvm-svn: 325416

6 years ago[WebAssembly] Simplify FunctionSymbol::get/set/hasFunctionType. NFC.
Sam Clegg [Fri, 16 Feb 2018 23:50:23 +0000 (23:50 +0000)]
[WebAssembly] Simplify FunctionSymbol::get/set/hasFunctionType. NFC.

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

llvm-svn: 325415

6 years ago[WebAssembly] Remove unneeded Chunk::getFileName() method. NFC.
Sam Clegg [Fri, 16 Feb 2018 23:46:51 +0000 (23:46 +0000)]
[WebAssembly] Remove unneeded Chunk::getFileName() method. NFC.

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

llvm-svn: 325414

6 years agoRemove "--full-shutdown" and instead use an environment variable LLD_IN_TEST.
Rui Ueyama [Fri, 16 Feb 2018 23:41:48 +0000 (23:41 +0000)]
Remove "--full-shutdown" and instead use an environment variable LLD_IN_TEST.

We are running lld tests with "--full-shutdown" option because we don't
want to call _exit() in lld if it is running tests. Regular shutdown
is needed for leak sanitizer.

This patch changes the way how we tell lld that it is running tests.
Now "--full-shutdown" is removed, and LLD_IN_TEST environment variable
is used instead.

This patch enables full shutdown on all ports, e.g. ELF, COFF and wasm.
Previously, we enabled it only for ELF.

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

llvm-svn: 325413

6 years ago[Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Fri, 16 Feb 2018 23:40:07 +0000 (23:40 +0000)]
[Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 325412

6 years ago[ThinLTO] Allow indexing to request backend to ignore the module
Vitaly Buka [Fri, 16 Feb 2018 23:38:22 +0000 (23:38 +0000)]
[ThinLTO] Allow indexing to request backend to ignore the module

Summary:
Gold plugin does not add pass to ThinLTO modules without useful symbols.
In this case ThinLTO can't create corresponding index file and some features, like CFI,
cannot be processes by backed correctly without index.
Given that we don't need the backed output we can request it to avoid
processing the module. This is implemented by this patch using new
"SkipModuleByDistributedBackend" flag.

Reviewers: pcc, tejohnson

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

llvm-svn: 325411

6 years ago[ThinLTO] Ignore object files with no ThinLTO modules if -fthinlto-index= is set
Vitaly Buka [Fri, 16 Feb 2018 23:34:16 +0000 (23:34 +0000)]
[ThinLTO] Ignore object files with no ThinLTO modules if -fthinlto-index= is set

Summary:
ThinLTO compilation may decide not to split module and keep at as regular LTO.
In this can this module already processed during indexing and already a part of
merged object file. So here we can just skip it.

Reviewers: pcc, tejohnson

Reviewed By: tejohnson

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

llvm-svn: 325410

6 years ago[clangd] Rename some protocol field to lower case
Marc-Andre Laperle [Fri, 16 Feb 2018 23:12:26 +0000 (23:12 +0000)]
[clangd] Rename some protocol field to lower case

Summary:
Also fixes a GCC compilation error.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 325409

6 years agoAMDGPU: Remove unused private member of AMDGPUTargetELFStreamer
Konstantin Zhuravlyov [Fri, 16 Feb 2018 23:04:11 +0000 (23:04 +0000)]
AMDGPU: Remove unused private member of AMDGPUTargetELFStreamer

llvm-svn: 325408

6 years agoRun these tests, the errors were old and not valid anymore.
Eric Christopher [Fri, 16 Feb 2018 23:02:28 +0000 (23:02 +0000)]
Run these tests, the errors were old and not valid anymore.

llvm-svn: 325407

6 years agoDo not print out "no input files" twice.
Rui Ueyama [Fri, 16 Feb 2018 22:58:19 +0000 (22:58 +0000)]
Do not print out "no input files" twice.

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

llvm-svn: 325406

6 years agoUse wasm-ld instead of "lld -flavor wasm".
Rui Ueyama [Fri, 16 Feb 2018 22:58:02 +0000 (22:58 +0000)]
Use wasm-ld instead of "lld -flavor wasm".

Invoking lld as ld.lld, ld.ld64, lld-link or wasm-ld is preferred
than invoking lld as lld and pass an -flavor option. We have "lld"
file mostly for historical reasons.

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

llvm-svn: 325405

6 years agoAMDGPU/LLD: Remove the use of binary file from one of the AMDGPU tests
Konstantin Zhuravlyov [Fri, 16 Feb 2018 22:55:36 +0000 (22:55 +0000)]
AMDGPU/LLD: Remove the use of binary file from one of the AMDGPU tests

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

llvm-svn: 325404

6 years agoRemove an unused function.
Eric Christopher [Fri, 16 Feb 2018 22:46:47 +0000 (22:46 +0000)]
Remove an unused function.

llvm-svn: 325403

6 years agoSilence an unsigned vs signed compare warning.
Eric Christopher [Fri, 16 Feb 2018 22:46:45 +0000 (22:46 +0000)]
Silence an unsigned vs signed compare warning.

llvm-svn: 325402

6 years ago[GISel]: Make GlobalISelEmitter rule prioritization compatible with selectionDAG
Aditya Nandakumar [Fri, 16 Feb 2018 22:37:15 +0000 (22:37 +0000)]
[GISel]: Make GlobalISelEmitter rule prioritization compatible with selectionDAG

This patch changes GlobalISelEmitter to rank patterns similar to how the
DAG does it (ie it computes a score for a pattern and adds the added
complexity to it).
This is so that the decision tree for GISelSelector remains compatible
with that of SelectionDAG.

https://reviews.llvm.org/D43270

llvm-svn: 325401

6 years agoAMDGPU: Update elf flags in amdgpu-elf-flags.s
Konstantin Zhuravlyov [Fri, 16 Feb 2018 22:35:36 +0000 (22:35 +0000)]
AMDGPU: Update elf flags in amdgpu-elf-flags.s

This is required after r325399:
  - EF_AMDGPU_ARCH_GCN got removed
  - In the test, EF_AMDGPU_ARCH_GCN is replaced with EF_AMDGPU_MACH_AMDGCN_GFX803

llvm-svn: 325400

6 years agoAMDGPU: Bring elf flags in sync with the spec
Konstantin Zhuravlyov [Fri, 16 Feb 2018 22:33:59 +0000 (22:33 +0000)]
AMDGPU: Bring elf flags in sync with the spec

- Add MACH flags
- Add XNACK flag
- Add reserved flags
- Minor cleanups in docs

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

llvm-svn: 325399

6 years ago[Constant] add floating-point helpers for normal/finite-nz; NFC
Sanjay Patel [Fri, 16 Feb 2018 22:32:54 +0000 (22:32 +0000)]
[Constant] add floating-point helpers for normal/finite-nz; NFC

...and delete the equivalent local functiona from InstCombine.

These might be useful to other InstCombine files or other passes
and makes FP queries more similar to integer constant queries.

llvm-svn: 325398

6 years agoMake sure we invoke ld64.lld and ld-wasm in the build directory.
Rui Ueyama [Fri, 16 Feb 2018 22:19:38 +0000 (22:19 +0000)]
Make sure we invoke ld64.lld and ld-wasm in the build directory.

llvm-svn: 325397

6 years ago[COFF] Add support for ARM64 secrel relocations for add/load instructions
Martin Storsjo [Fri, 16 Feb 2018 22:02:38 +0000 (22:02 +0000)]
[COFF] Add support for ARM64 secrel relocations for add/load instructions

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

llvm-svn: 325396

6 years ago[clangd] Implement textDocument/hover
Marc-Andre Laperle [Fri, 16 Feb 2018 21:38:15 +0000 (21:38 +0000)]
[clangd] Implement textDocument/hover

Summary: Implemention of textDocument/hover as described in LSP definition.

This patch adds a basic Hover implementation.  When hovering a variable,
function, method or namespace, clangd will return a text containing the
declaration's scope, as well as the declaration of the hovered entity.
For example, for a variable:

  Declared in class Foo::Bar

  int hello = 2

For macros, the macro definition is returned.

This patch doesn't include:

- markdown support (the client I use doesn't support it yet)
- range support (optional in the Hover response)
- comments associated to variables/functions/classes

They are kept as future work to keep this patch simpler.

I added tests in XRefsTests.cpp.  hover.test contains one simple
smoketest to make sure the feature works from a black box perspective.

Reviewers: malaperle, krasimir, bkramer, ilya-biryukov

Subscribers: sammccall, mgrang, klimek, rwols, ilya-biryukov, arphaman, cfe-commits

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

Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
Signed-off-by: William Enright <william.enright@polymtl.ca>
llvm-svn: 325395

6 years ago[X86] In lowerVSELECTtoVectorShuffle, don't map undef select condition to undef in...
Craig Topper [Fri, 16 Feb 2018 21:36:29 +0000 (21:36 +0000)]
[X86] In lowerVSELECTtoVectorShuffle, don't map undef select condition to undef in shuffle mask.

Undef in select condition means we should pick the element from one side or the other. An undef in a shuffle mask means pick any element from either source or worse.

I suspect by the time we get here most of the undefs in a constant vector have been removed by other things, but doing this for safety.

llvm-svn: 325394

6 years agoAMDGPU: Bring processors and features in sync with the spec
Konstantin Zhuravlyov [Fri, 16 Feb 2018 21:26:25 +0000 (21:26 +0000)]
AMDGPU: Bring processors and features in sync with the spec

- Remove gfx800
- Make iceland gfx802
- Add xnack to gfx902

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

llvm-svn: 325393

6 years agoRevert an accidental change to where "-flavor GNU" was used by intention.
Rui Ueyama [Fri, 16 Feb 2018 21:24:01 +0000 (21:24 +0000)]
Revert an accidental change to where "-flavor GNU" was used by intention.

llvm-svn: 325392

6 years ago[OPENMP] Do not emit messages for templates in declare target
Alexey Bataev [Fri, 16 Feb 2018 21:23:23 +0000 (21:23 +0000)]
[OPENMP] Do not emit messages for templates in declare target
constructs.

The compiler may emit some extra warnings for functions, that are
implicit specialization of the templates, declared in the target region.

llvm-svn: 325391