platform/upstream/llvm.git
6 years agoFix remote tests broken by r325690
Pavel Labath [Wed, 21 Feb 2018 17:55:22 +0000 (17:55 +0000)]
Fix remote tests broken by r325690

The patch added an extra argument to the append_to_process_working_directory
function. I have somehow missed updating this test, and it did not show up
because the code was only run in remote mode.

llvm-svn: 325702

6 years agollgs-tests: Fix r325511 for debugserver
Pavel Labath [Wed, 21 Feb 2018 17:38:38 +0000 (17:38 +0000)]
llgs-tests: Fix r325511 for debugserver

Debugserver sends the thread-pcs field with leading zeroes omitted. Teach
parseRegisterValue to pad these as necessary.

llvm-svn: 325701

6 years agoHandle IMAGE_REL_AMD64_ADDR32NB in RuntimeDyldCOFF
Frederich Munch [Wed, 21 Feb 2018 17:18:20 +0000 (17:18 +0000)]
Handle IMAGE_REL_AMD64_ADDR32NB in RuntimeDyldCOFF

Summary:
IMAGE_REL_AMD64_ADDR32NB relocations are currently set to zero in all cases.
This patch sets the relocation to the correct value when possible and shows an error when not.

Reviewers: enderby, lhames, compnerd

Reviewed By: compnerd

Subscribers: LepelTsmok, compnerd, martell, llvm-commits

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

llvm-svn: 325700

6 years ago[LV] Fix test checks, NFC
Alexey Bataev [Wed, 21 Feb 2018 16:48:23 +0000 (16:48 +0000)]
[LV] Fix test checks, NFC

llvm-svn: 325699

6 years ago[X86][MMX] Regenerate MMX MASKMOV test
Simon Pilgrim [Wed, 21 Feb 2018 16:38:08 +0000 (16:38 +0000)]
[X86][MMX] Regenerate MMX MASKMOV test

llvm-svn: 325698

6 years ago[Hexagon] Return true in enableMultipleCopyHints().
Jonas Paulsson [Wed, 21 Feb 2018 16:37:45 +0000 (16:37 +0000)]
[Hexagon]  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: Krzysztof Parzyszek
llvm-svn: 325697

6 years ago[X86][MMX] Regenerate MMX arithmetic tests
Simon Pilgrim [Wed, 21 Feb 2018 16:37:10 +0000 (16:37 +0000)]
[X86][MMX] Regenerate MMX arithmetic tests

llvm-svn: 325696

6 years ago[X86] LowerBITCAST - pull out repeated calls to getOperand(0). NFCI.
Simon Pilgrim [Wed, 21 Feb 2018 16:35:40 +0000 (16:35 +0000)]
[X86] LowerBITCAST - pull out repeated calls to getOperand(0). NFCI.

llvm-svn: 325695

6 years ago[clangd] Update canonical header mapping for STL
Eric Liu [Wed, 21 Feb 2018 16:17:25 +0000 (16:17 +0000)]
[clangd] Update canonical header mapping for STL

llvm-svn: 325694

6 years ago[analyzer] Prevent AnalyzerStatsChecker from crash
Peter Szecsi [Wed, 21 Feb 2018 16:06:56 +0000 (16:06 +0000)]
[analyzer] Prevent AnalyzerStatsChecker from crash

The checker marks the locations where the analyzer creates sinks. However, it
can happen that the sink was created because of a loop which does not contain
condition statement, only breaks in the body. The exhausted block is the block
which should contain the condition but empty, in this case.
This change only emits this marking in order to avoid the undefined behavior.

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

llvm-svn: 325693

6 years agoRemove use of the 'gmlt' term from the -fsplit-dwarf-inlining flag description to...
David Blaikie [Wed, 21 Feb 2018 16:00:50 +0000 (16:00 +0000)]
Remove use of the 'gmlt' term from the -fsplit-dwarf-inlining flag description to make it more readily legible

llvm-svn: 325692

6 years ago[clang-format] New API guessLanguage()
Ben Hamilton [Wed, 21 Feb 2018 15:54:31 +0000 (15:54 +0000)]
[clang-format] New API guessLanguage()

Summary:
For clients which don't have a filesystem, calling getStyle() doesn't
make much sense (there's no .clang-format files to search for).

In this diff, I hoist out the language-guessing logic from getStyle()
and move it into a new API guessLanguage().

I also added support for guessing the language of files which have no
extension (they could be C++ or ObjC).

Test Plan: New tests added. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: jolesiak, krasimir

Reviewed By: jolesiak, krasimir

Subscribers: klimek, cfe-commits, sammccall

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

llvm-svn: 325691

6 years agoFix a couple of more tests to not create files in the source tree
Pavel Labath [Wed, 21 Feb 2018 15:33:53 +0000 (15:33 +0000)]
Fix a couple of more tests to not create files in the source tree

Summary:
These were not being flaky, but they're still making the tree dirty.

These tests were using lldbutil.append_to_process_working_directory to
derive the file path so I fix them by modifying the function to return
the build directory for local tests.

Technically, now the path returned by this function does not point to
the process working directory for local tests, but I think it makes
sense to keep the function name, as I think we should move towards
launching the process in the build directory (and I intend to change
this for the handful of inferiors that actually care about their PWD,
for example because they need to create files there).

Reviewers: davide, aprantl

Subscribers: lldb-commits

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

llvm-svn: 325690

6 years ago[SLP] Fix test checks, NFC.
Alexey Bataev [Wed, 21 Feb 2018 15:32:58 +0000 (15:32 +0000)]
[SLP] Fix test checks, NFC.

llvm-svn: 325689

6 years ago[Sparc] Include __tls_get_addr in symbol table for TLS calls to it
Jonas Devlieghere [Wed, 21 Feb 2018 15:25:26 +0000 (15:25 +0000)]
[Sparc] Include __tls_get_addr in symbol table for TLS calls to it

Global Dynamic and Local Dynamic call relocations only implicitly
reference __tls_get_addr; there is no connection in the ELF file between
the relocations and the symbol other than the specification for the
relocations' semantics. However, it still needs to be in the symbol
table despite the lack of explicit references to the symbol table entry,
since it needs to be bound at link time for these relocations, otherwise
any objects will fail to link.

For details, see https://sourceware.org/bugzilla/show_bug.cgi?id=22832.

Path by: James Clarke (jrtc27)

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

llvm-svn: 325688

6 years ago[SCEV] Temporarily disable loop versioning for the purpose
Silviu Baranga [Wed, 21 Feb 2018 15:20:32 +0000 (15:20 +0000)]
[SCEV] Temporarily disable loop versioning for the purpose
of turning SCEVUnknowns of PHIs into AddRecExprs.

This feature is now hidden behind the -scev-version-unknown flag.

Fixes PR36032 and PR35432.

llvm-svn: 325687

6 years ago[IRMover] Implement name based structure type mapping
Eugene Leviant [Wed, 21 Feb 2018 15:13:48 +0000 (15:13 +0000)]
[IRMover] Implement name based structure type mapping

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

llvm-svn: 325686

6 years ago[X86][MMX] Regenerate MMX PSUB commutation test
Simon Pilgrim [Wed, 21 Feb 2018 15:07:47 +0000 (15:07 +0000)]
[X86][MMX] Regenerate MMX PSUB commutation test

llvm-svn: 325685

6 years ago[X86] Regenerate GPR:XMM bitcast test
Simon Pilgrim [Wed, 21 Feb 2018 15:05:47 +0000 (15:05 +0000)]
[X86] Regenerate GPR:XMM bitcast test

llvm-svn: 325684

6 years ago[ASTMatchers] Regenerate documentation after r325678
Eric Liu [Wed, 21 Feb 2018 14:22:42 +0000 (14:22 +0000)]
[ASTMatchers] Regenerate documentation after r325678

llvm-svn: 325682

6 years ago[ELF] - Simplify. NFC.
George Rimar [Wed, 21 Feb 2018 14:21:23 +0000 (14:21 +0000)]
[ELF] - Simplify. NFC.

llvm-svn: 325681

6 years ago[ELF] Add -nopie alias for -no-pie (PR36423)
Hans Wennborg [Wed, 21 Feb 2018 13:54:26 +0000 (13:54 +0000)]
[ELF] Add -nopie alias for -no-pie (PR36423)

In r324043, --nopie was renamed to --no-pie to presumably fix a typo.

As it turns out, "nopie" wasn't a typo but the spelling used by
OpenBSD's binutils ld. Gold on the other hand spells the flag "no-pie".
(Vanilla binutils doesn't have a flag like this at all.)

Since they do the same thing, let's support both spellings.

llvm-svn: 325679

6 years ago[ASTMatchers] isTemplateInstantiation: also match explicit instantiation declaration.
Eric Liu [Wed, 21 Feb 2018 13:51:27 +0000 (13:51 +0000)]
[ASTMatchers] isTemplateInstantiation: also match explicit instantiation declaration.

Summary:
Example:
template <typename T> class X {}; class A {};
// Explicit instantiation declaration.
extern template class X<A>;

Reviewers: bkramer

Subscribers: klimek, cfe-commits

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

llvm-svn: 325678

6 years agoAMDGPU: Do not combine loads/store across physreg defs
Nicolai Haehnle [Wed, 21 Feb 2018 13:31:35 +0000 (13:31 +0000)]
AMDGPU: Do not combine loads/store across physreg defs

Summary:
Since this pass operates on machine SSA form, this should only really
affect M0 in practice.

Fixes various piglit variable-indexing/vs-varying-array-mat4-index-*

Change-Id: Ib2a1dc3a8d7b08225a8da49a86f533faa0986aa8
Fixes: r317751 ("AMDGPU: Merge S_BUFFER_LOAD_DWORD_IMM into x2, x4")

Reviewers: arsenm, mareko, rampitec

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 325677

6 years ago[AMDGPU][MC] Added lds support for MUBUF instructions
Dmitry Preobrazhensky [Wed, 21 Feb 2018 13:13:48 +0000 (13:13 +0000)]
[AMDGPU][MC] Added lds support for MUBUF instructions

See bug 28234: https://bugs.llvm.org/show_bug.cgi?id=28234

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

Reviewers: vpykhtin, artem.tamazov, arsenm
llvm-svn: 325676

6 years ago[X86][MMX] Add PR29222 test case
Simon Pilgrim [Wed, 21 Feb 2018 12:06:27 +0000 (12:06 +0000)]
[X86][MMX] Add PR29222 test case

llvm-svn: 325675

6 years ago[X86][MMX] Add some MMX build vector tests
Simon Pilgrim [Wed, 21 Feb 2018 12:01:30 +0000 (12:01 +0000)]
[X86][MMX] Add some MMX build vector tests

llvm-svn: 325674

6 years ago[ELF] - Simplify testcase. NFC.
George Rimar [Wed, 21 Feb 2018 11:56:55 +0000 (11:56 +0000)]
[ELF] - Simplify testcase. NFC.

This removes script input file and inlines script into
testcase body. That is consistent with othet LS tests
and makes testcase easier to read.

llvm-svn: 325673

6 years ago[Sema] Classify conversions from enum to float as narrowing
Mikhail Maltsev [Wed, 21 Feb 2018 10:08:18 +0000 (10:08 +0000)]
[Sema] Classify conversions from enum to float as narrowing

Summary:
According to [dcl.init.list]p7:
  A narrowing conversion is an implicit conversion
  - ...
  - from an integer type or unscoped enumeration type to a
    floating-point type, except where the source is a constant
    expression and the actual value after conversion will fit into
    the target type and will produce the original value when
    converted back to the original type, or
  - ...

Currently clang does not handle the 'unscoped enumeration' case. This
patch fixes the corresponding check.

Reviewers: faisalv, rsmith, rogfer01

Reviewed By: rogfer01

Subscribers: rogfer01, cfe-commits

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

llvm-svn: 325668

6 years agoRISCV: Add COFF address space
Martell Malone [Wed, 21 Feb 2018 06:42:38 +0000 (06:42 +0000)]
RISCV: Add COFF address space

PE spec defines and reserves to following for RISCV

IMAGE_FILE_MACHINE_RISCV32  0x5032
IMAGE_FILE_MACHINE_RISCV64  0x5064
IMAGE_FILE_MACHINE_RISCV128 0x5128

https://msdn.microsoft.com/en-us/library/windows/desktop/ms680547(v=vs.85).aspx

Reviewers: asb, rnk, compnerd

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

llvm-svn: 325667

6 years agoFix TestAppleTypesIsProduced after r324226
Frederic Riss [Wed, 21 Feb 2018 06:20:03 +0000 (06:20 +0000)]
Fix TestAppleTypesIsProduced after r324226

This test was accessing self.debug_info, which doesn't exist anymore. For
some reason the macOS bots are skipping this test because they think the
compiler is not clang. We'll look into this separately.

llvm-svn: 325666

6 years ago[Fuchsia] Include libClang and clang-include-fixer in the toolchain
Petr Hosek [Wed, 21 Feb 2018 04:39:15 +0000 (04:39 +0000)]
[Fuchsia] Include libClang and clang-include-fixer in the toolchain

libClang is used by other Clang based tools such as cquery while
clang-include-fixer is generally a useful tool.

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

llvm-svn: 325665

6 years agoMsan, fixing DTLS_on_tls_get_addr signature empty implementation
Kamil Rytarowski [Wed, 21 Feb 2018 04:16:45 +0000 (04:16 +0000)]
Msan, fixing DTLS_on_tls_get_addr signature empty implementation

Summary: No supported oses normally compiled that code (or not for a long time) probably never caught it.

Patch by: David CARLIER

Reviewers: vitalybuka, krytarowski

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

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

llvm-svn: 325664

6 years agoIn C++14 onwards, it is permitted to read mutable members in constant
Richard Smith [Wed, 21 Feb 2018 03:38:30 +0000 (03:38 +0000)]
In C++14 onwards, it is permitted to read mutable members in constant
expressions, if their lifetime began during the evaluation of the expression.

This is technically not allowed in C++11, though we could consider permitting
it there too, as an extension.

llvm-svn: 325663

6 years ago[clangd] #include statements support for Open definition
Marc-Andre Laperle [Wed, 21 Feb 2018 02:39:08 +0000 (02:39 +0000)]
[clangd] #include statements support for Open definition

Summary: ctrl-clicking on #include statements now opens the file being pointed by that statement.

Reviewers: malaperle, krasimir, bkramer, ilya-biryukov

Reviewed By: ilya-biryukov

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

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

llvm-svn: 325662

6 years agoClean up use of C allocation functions
Serge Pavlov [Wed, 21 Feb 2018 02:02:39 +0000 (02:02 +0000)]
Clean up use of C allocation functions

If the value returned by `malloc`, `calloc` or `realloc` is not checked
for null pointer, this change replaces them for `safe_malloc`,
`safe_calloc` or `safe_realloc`, which are defined in the namespace `llvm`.
These function report fatal error on out of memory.

In the plain C files, assertion statements are added to ensure that memory
is successfully allocated.

The aim of this change is to get better diagnostics of OOM on Windows.

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

llvm-svn: 325661

6 years ago[BDCE] Salvage debug info from dying insts
Vedant Kumar [Wed, 21 Feb 2018 01:55:33 +0000 (01:55 +0000)]
[BDCE] Salvage debug info from dying insts

This results in 15 additional unique source variables in a stage2 build
of FileCheck (at '-Os -g'), with a negligible increase in the size of
the .debug_loc section.

llvm-svn: 325660

6 years ago[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Wed, 21 Feb 2018 01:45:26 +0000 (01:45 +0000)]
[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 325659

6 years agorevert r325515: [TTI CostModel] change default cost of FP ops to 1 (PR36280)
Sanjay Patel [Wed, 21 Feb 2018 01:42:52 +0000 (01:42 +0000)]
revert r325515: [TTI CostModel] change default cost of FP ops to 1 (PR36280)

There are too many perf regressions resulting from this, so we need to
investigate (and add tests for) targets like ARM and AArch64 before
trying to reinstate.

llvm-svn: 325658

6 years ago[lit] Fix a problem with spaces in the python path by adding quotes around it
Aaron Smith [Wed, 21 Feb 2018 00:41:30 +0000 (00:41 +0000)]
[lit] Fix a problem with spaces in the python path by adding quotes around it

These are the last tests left to fix after D43265.

llvm-svn: 325657

6 years ago[WebAssembly] Use stable sort when sorting ctore functions
Sam Clegg [Wed, 21 Feb 2018 00:34:34 +0000 (00:34 +0000)]
[WebAssembly] Use stable sort when sorting ctore functions

Patch by Nicholas Wilson!

llvm-svn: 325656

6 years ago[X86] Disable CLWB in Cannon Lake
Craig Topper [Wed, 21 Feb 2018 00:16:50 +0000 (00:16 +0000)]
[X86] Disable CLWB in Cannon Lake

Cannon Lake does not support CLWB, therefore it
does not include all features listed under SKX.

Patch by Gabor Buella

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

llvm-svn: 325655

6 years ago[X86] Disable CLWB for Cannon Lake
Craig Topper [Wed, 21 Feb 2018 00:15:48 +0000 (00:15 +0000)]
[X86] Disable CLWB for Cannon Lake

Cannon Lake does not support CLWB, therefore it
does not include all features listed under SKX anymore.

Instead, enumerate all SKX features with the exception of CLWB.

Patch by Gabor Buella

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

llvm-svn: 325654

6 years ago[mips] Spectre variant two mitigation for MIPSR2
Simon Dardis [Wed, 21 Feb 2018 00:06:53 +0000 (00:06 +0000)]
[mips] Spectre variant two mitigation for MIPSR2

This patch provides mitigation for CVE-2017-5715, Spectre variant two,
which affects the P5600 and P6600. It implements the LLVM part of
-mindirect-jump=hazard. It is _not_ enabled by default for the P5600.

The migitation strategy suggested by MIPS for these processors is to use
hazard barrier instructions. 'jalr.hb' and 'jr.hb' are hazard
barrier variants of the 'jalr' and 'jr' instructions respectively.

These instructions impede the execution of instruction stream until
architecturally defined hazards (changes to the instruction stream,
privileged registers which may affect execution) are cleared. These
instructions in MIPS' designs are not speculated past.

These instructions are used with the attribute +use-indirect-jump-hazard
when branching indirectly and for indirect function calls.

These instructions are defined by the MIPS32R2 ISA, so this mitigation
method is not compatible with processors which implement an earlier
revision of the MIPS ISA.

Performance benchmarking of this option with -fpic and lld using
-z hazardplt shows a difference of overall 10%~ time increase
for the LLVM testsuite. Certain benchmarks such as methcall show a
substantially larger increase in time due to their nature.

Reviewers: atanasyan, zoran.jovanovic

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

llvm-svn: 325653

6 years ago[lit] Update how clang and other binaries are found in per-configuration directories
Aaron Smith [Wed, 21 Feb 2018 00:05:51 +0000 (00:05 +0000)]
[lit] Update how clang and other binaries are found in per-configuration directories

Summary:
This is modeled after the clang and llvm lit tests.

Several properties have CMAKE_CFG_INTDIR as part of the path - this works correctly when the cmake generator only supports one configuration which is known at configuration time, but it does not work correctly when the cmake generator supports multiple configurations (for example, VS).

For VS, CMAKE_CFG_INTDIR ends up set as $Configuration and then it is never updated correctly. Instead, the lit configuration can use a property that can be overwritten at run time. AddLLVM does that for several properties (such as LLVM_TOOLS_DIR).

This change is also removing properties from the lit/CMakeLists.txt that are actually set during the call to configure_lit_site_cfg

Reviewers: zturner, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits, labath, stella.stamenova, mgorny, hintonda

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

llvm-svn: 325652

6 years ago[mips] Spectre variant two mitigation for MIPSR2
Simon Dardis [Wed, 21 Feb 2018 00:05:05 +0000 (00:05 +0000)]
[mips] Spectre variant two mitigation for MIPSR2

This patch provides mitigation for CVE-2017-5715, Spectre variant two,
which affects the P5600 and P6600. It provides the option
-mindirect-jump=hazard, which instructs the LLVM backend to replace
indirect branches with their hazard barrier variants.

This option is accepted when targeting MIPS revision two or later.

The migitation strategy suggested by MIPS for these processors is to
use two hazard barrier instructions. 'jalr.hb' and 'jr.hb' are hazard
barrier variants of the 'jalr' and 'jr' instructions respectively.

These instructions impede the execution of instruction stream until
architecturally defined hazards (changes to the instruction stream,
privileged registers which may affect execution) are cleared. These
instructions in MIPS' designs are not speculated past.

These instructions are used with the option -mindirect-jump=hazard
when branching indirectly and for indirect function calls.

These instructions are defined by the MIPS32R2 ISA, so this mitigation
method is not compatible with processors which implement an earlier
revision of the MIPS ISA.

Implementation note: I've opted to provide this as an
-mindirect-jump={hazard,...} style option in case alternative
mitigation methods are required for other implementations of the MIPS
ISA in future, e.g. retpoline style solutions.

Reviewers: atanasyan

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

llvm-svn: 325651

6 years ago[lit] Fix a problem with spaces in the python path by adding quotes around it
Aaron Smith [Wed, 21 Feb 2018 00:03:41 +0000 (00:03 +0000)]
[lit] Fix a problem with spaces in the python path by adding quotes around it

Summary:
This fixes two failing tests on Windows with an installed version of python that has spaces in the path.

* elf/lto/cache.ll
* mach-o/dependency_info.yaml

Reviewers: zturner, llvm-commits, stella.stamenova

Subscribers: emaste, arichardson

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

llvm-svn: 325650

6 years ago[InstCombine] C / -X --> -C / X
Sanjay Patel [Wed, 21 Feb 2018 00:01:45 +0000 (00:01 +0000)]
[InstCombine] C / -X --> -C / X

We already do this in DAGCombiner, but it should
also be good to eliminate the fsub use in IR.

This is similar to rL325648.

llvm-svn: 325649

6 years ago[InstCombine] -X / C --> X / -C for FP
Sanjay Patel [Tue, 20 Feb 2018 23:51:16 +0000 (23:51 +0000)]
[InstCombine] -X / C --> X / -C for FP

We already do this in DAGCombiner, but it should
also be good to eliminate the fsub use in IR.

llvm-svn: 325648

6 years ago[mips][lld] Spectre variant two mitigation for MIPSR2
Simon Dardis [Tue, 20 Feb 2018 23:49:17 +0000 (23:49 +0000)]
[mips][lld] Spectre variant two mitigation for MIPSR2

This patch provides migitation for CVE-2017-5715, Spectre variant two,
which affects the P5600 and P6600. It implements the LLD part of
-z hazardplt. Like the Clang part of this patch, I have opted for that
specific option name in case alternative migitation methods are required
in the future.

The mitigation strategy suggested by MIPS for these processors is to use
hazard barrier instructions. 'jalr.hb' and 'jr.hb' are hazard
barrier variants of the 'jalr' and 'jr' instructions respectively.

These instructions impede the execution of instruction stream until
architecturally defined hazards (changes to the instruction stream,
privileged registers which may affect execution) are cleared. These
instructions in MIPS' designs are not speculated past.

These instructions are defined by the MIPS32R2 ISA, so this mitigation
method is not compatible with processors which implement an earlier
revision of the MIPS ISA.

For LLD, this changes PLT stubs to use 'jalr.hb' and 'jr.hb'.

Reviewers: atanasyan, ruiu

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

llvm-svn: 325647

6 years agoFix assert when template argument deduction's original call arg checking triggers...
Richard Smith [Tue, 20 Feb 2018 23:47:12 +0000 (23:47 +0000)]
Fix assert when template argument deduction's original call arg checking triggers class template instantiation.

llvm-svn: 325646

6 years ago[WebAssembly] Rename GlobalSymbol types. NFC.
Sam Clegg [Tue, 20 Feb 2018 23:38:27 +0000 (23:38 +0000)]
[WebAssembly] Rename GlobalSymbol types. NFC.

Purely a rename in preparation for adding new global symbol type.

We want to use GlobalSymbol to represent real wasm globals and
DataSymbol for pointers to things in linear memory (what ELF would
call STT_OBJECT).

This reduces the size the patch to add the explicit symbol table
which is coming soon!

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

llvm-svn: 325645

6 years ago[InstCombine] add tests for fdiv with negated op and constant op; NFC
Sanjay Patel [Tue, 20 Feb 2018 23:34:43 +0000 (23:34 +0000)]
[InstCombine] add tests for fdiv with negated op and constant op; NFC

llvm-svn: 325644

6 years agoRevert "[AMDGPU] Increased vector length for global/constant loads."
Konstantin Zhuravlyov [Tue, 20 Feb 2018 23:30:21 +0000 (23:30 +0000)]
Revert "[AMDGPU] Increased vector length for global/constant loads."

https://reviews.llvm.org/rL325518

It breaks following OpenCL conformance tests:
  - Basic - parameter_types
  - Basic - vload_private

llvm-svn: 325643

6 years ago[PatternMatch] allow vector matches with m_FNeg
Sanjay Patel [Tue, 20 Feb 2018 23:29:05 +0000 (23:29 +0000)]
[PatternMatch] allow vector matches with m_FNeg

llvm-svn: 325642

6 years ago[DSE] Don't DSE stores that subsequent memmove calls read from
Sanjoy Das [Tue, 20 Feb 2018 23:19:34 +0000 (23:19 +0000)]
[DSE] Don't DSE stores that subsequent memmove calls read from

Summary:
We used to remove the first memmove in cases like this:

  memmove(p, p+2, 8);
  memmove(p, p+2, 8);

which is incorrect.  Fix this by changing isPossibleSelfRead to what was most
likely the intended behavior.

Historical note: the buggy code was added in https://reviews.llvm.org/rL120974
to address PR8728.

Reviewers: rsmith

Subscribers: mcrosier, llvm-commits, jlebar

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

llvm-svn: 325641

6 years agoWhen multiple sanitizers are enabled (ubsan + something else), use all relevant black...
Richard Smith [Tue, 20 Feb 2018 23:17:41 +0000 (23:17 +0000)]
When multiple sanitizers are enabled (ubsan + something else), use all relevant blacklists.

Ideally, we'd only use the ubsan blacklist for ubsan sanitizers, and only use
the other-sanitizer blacklist for its sanitizers, but this at least enables the
intended suppressions.

llvm-svn: 325640

6 years ago[InstCombine] auto-generate full checks; NFC
Sanjay Patel [Tue, 20 Feb 2018 23:08:47 +0000 (23:08 +0000)]
[InstCombine] auto-generate full checks; NFC

llvm-svn: 325639

6 years ago[InstCombine] add test for vector -X/-Y; NFC
Sanjay Patel [Tue, 20 Feb 2018 22:46:38 +0000 (22:46 +0000)]
[InstCombine] add test for vector -X/-Y; NFC

m_FNeg doesn't match vector types.

llvm-svn: 325637

6 years ago[X86] Fix copy/paste mistake in test.
Craig Topper [Tue, 20 Feb 2018 22:33:23 +0000 (22:33 +0000)]
[X86] Fix copy/paste mistake in test.

The contents of the test case didnt' match the name of the test case. And they were identical to the test above.

llvm-svn: 325635

6 years agoFix broken test from r325630.
Benjamin Kramer [Tue, 20 Feb 2018 22:30:16 +0000 (22:30 +0000)]
Fix broken test from r325630.

llvm-svn: 325634

6 years ago[NFC] In Multiversion Check function, switch to return Diag
Erich Keane [Tue, 20 Feb 2018 22:25:28 +0000 (22:25 +0000)]
[NFC] In Multiversion Check function, switch to return Diag

This function did a lot of 'Diag, return true' stuff.  This resulted in needing
to introduce scopes in quite a few places.  This patch replaces useages of a
single "S.Diag" followed by return true with simply "return S.Diag".

llvm-svn: 325633

6 years ago[PBQP] Fix PR33038 by pruning empty intervals in initializeGraph.
Lang Hames [Tue, 20 Feb 2018 22:15:09 +0000 (22:15 +0000)]
[PBQP] Fix PR33038 by pruning empty intervals in initializeGraph.

Spilling may cause previously non-empty intervals (both for the spilled vreg
and others) to become empty. Moving the pruning into initializeGraph catches
these cases and fixes PR33038.

llvm-svn: 325632

6 years agoConsistent use of header file for ICF and MarkLive
Sam Clegg [Tue, 20 Feb 2018 22:09:59 +0000 (22:09 +0000)]
Consistent use of header file for ICF and MarkLive

Previously wasm used a separate header to declare markLive
and ELF used to declare ICF.  This change makes each backend
consistently declare these in their own headers.

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

llvm-svn: 325631

6 years ago[MemoryBuiltins] Check nobuiltin status when identifying calls to free.
Benjamin Kramer [Tue, 20 Feb 2018 22:00:33 +0000 (22:00 +0000)]
[MemoryBuiltins] Check nobuiltin status when identifying calls to free.

This is usually not a problem because this code's main purpose is
eliminating unused new/delete pairs. We got deletes of nullptr or
nobuiltin deletes of builtin new wrong though.

llvm-svn: 325630

6 years agoConsistent (non) use of empty lines in include blocks
Sam Clegg [Tue, 20 Feb 2018 21:53:18 +0000 (21:53 +0000)]
Consistent (non) use of empty lines in include blocks

The profailing style in lld seem to be to not include such empty lines.
Clang-tidy/clang-format seem to handle this just fine.

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

llvm-svn: 325629

6 years ago[InstCombine] remove unneeded operand swap: NFCI
Sanjay Patel [Tue, 20 Feb 2018 21:52:46 +0000 (21:52 +0000)]
[InstCombine] remove unneeded operand swap: NFCI

FMul is commutative, so complexity-based canonicalization should always
take care of the swap via SimplifyAssociativeOrCommutative().

llvm-svn: 325628

6 years ago[SelectionDAG] Support known true/false SimplifySetCC cases for comparing against...
Craig Topper [Tue, 20 Feb 2018 21:48:14 +0000 (21:48 +0000)]
[SelectionDAG] Support known true/false SimplifySetCC cases for comparing against vector splats of constants.

This is split off from D42948 and includes just the cases that constant fold to true or false. It also includes some refactoring to keep predicate checks together.

This supports things like

(setcc uge X, 0) -> true

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

llvm-svn: 325627

6 years ago[CUDA] Added missing __threadfence_system() function for CUDA9.
Artem Belevich [Tue, 20 Feb 2018 21:25:30 +0000 (21:25 +0000)]
[CUDA] Added missing __threadfence_system() function for CUDA9.

llvm-svn: 325626

6 years agoUse more early returns in SymbolTable.cpp.
Rui Ueyama [Tue, 20 Feb 2018 21:08:47 +0000 (21:08 +0000)]
Use more early returns in SymbolTable.cpp.

I think if statements that end with return is easier to read than
cascaded if-else-if-else-if statements because it makes clear that
execution of a function terminates there. This patch also adds more
blank lines to separate code blocks to meaningful pieces.

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

llvm-svn: 325625

6 years ago[WebAssembly] Remove unused header
Sam Clegg [Tue, 20 Feb 2018 21:08:28 +0000 (21:08 +0000)]
[WebAssembly] Remove unused header

llvm-svn: 325624

6 years ago[PatternMatch] enhance m_SignMask() to ignore undef elements in vectors
Sanjay Patel [Tue, 20 Feb 2018 21:02:40 +0000 (21:02 +0000)]
[PatternMatch] enhance m_SignMask() to ignore undef elements in vectors

llvm-svn: 325623

6 years ago[InstSimplify] add tests for m_SignMask with undef vector elements; NFC
Sanjay Patel [Tue, 20 Feb 2018 20:53:35 +0000 (20:53 +0000)]
[InstSimplify] add tests for m_SignMask with undef vector elements; NFC

llvm-svn: 325622

6 years ago[AArch64] Refactor instructions using SIMD immediates
Evandro Menezes [Tue, 20 Feb 2018 20:31:45 +0000 (20:31 +0000)]
[AArch64] Refactor instructions using SIMD immediates

Get rid of icky goto loops and make the code easier to maintain.  Otherwise,
NFC.

Restore r324903 and fix PR36369.

Differentail revision: https://reviews.llvm.org/D43364

llvm-svn: 325621

6 years ago[lld/LTO] Remove unused Path parameter to AddBufferFn
Teresa Johnson [Tue, 20 Feb 2018 20:21:59 +0000 (20:21 +0000)]
[lld/LTO] Remove unused Path parameter to AddBufferFn

Summary:
With D43396, no clients use the Path parameter anymore.
This is the lld side fix with D43400.

Depends on D43396 and D43400.

Reviewers: pcc

Subscribers: emaste, inglorion, arichardson, llvm-commits

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

llvm-svn: 325620

6 years ago[LTO] Remove unused Path parameter to AddBufferFn
Teresa Johnson [Tue, 20 Feb 2018 20:21:53 +0000 (20:21 +0000)]
[LTO] Remove unused Path parameter to AddBufferFn

Summary:
With D43396, no clients use the Path parameter anymore.

Depends on D43396.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, llvm-commits

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

llvm-svn: 325619

6 years ago[ThinLTO/gold] Avoid race with cache pruner by copying to temp files
Teresa Johnson [Tue, 20 Feb 2018 19:51:30 +0000 (19:51 +0000)]
[ThinLTO/gold] Avoid race with cache pruner by copying to temp files

Summary:
This will avoid the race condition described in the review for D37993.

I believe that the Path parameter to AddBufferFn is no longer utilized.
I would prefer to remove that as a follow up clean up patch to reduce
the diffs in this patch.

Reviewers: pcc

Reviewed By: pcc

Subscribers: inglorion, llvm-commits

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

llvm-svn: 325618

6 years ago[LV] Fix test checks, NFC.
Alexey Bataev [Tue, 20 Feb 2018 19:49:25 +0000 (19:49 +0000)]
[LV] Fix test checks, NFC.

llvm-svn: 325617

6 years ago[ARM] Lower BR_CC for f16
Sjoerd Meijer [Tue, 20 Feb 2018 19:28:05 +0000 (19:28 +0000)]
[ARM] Lower BR_CC for f16

This case wasn't handled yet.

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

llvm-svn: 325616

6 years ago[AMDGPU] Removed redundant run lines for fmuladd.f16 test. NFC.
Stanislav Mekhanoshin [Tue, 20 Feb 2018 19:19:56 +0000 (19:19 +0000)]
[AMDGPU] Removed redundant run lines for fmuladd.f16 test. NFC.

llvm-svn: 325615

6 years agofeedback
Sam Clegg [Tue, 20 Feb 2018 18:55:07 +0000 (18:55 +0000)]
feedback

llvm-svn: 325614

6 years ago[WebAssembly] Split addDefined into two different methods. NFC.
Sam Clegg [Tue, 20 Feb 2018 18:55:06 +0000 (18:55 +0000)]
[WebAssembly] Split addDefined into two different methods. NFC.

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 325613

6 years ago[llvm-objdump] Use unique_ptr to simplify memory ownership
David Blaikie [Tue, 20 Feb 2018 18:48:51 +0000 (18:48 +0000)]
[llvm-objdump] Use unique_ptr to simplify memory ownership

Followup to r325099/r325100 to simplify further.

llvm-svn: 325612

6 years ago[X86][MMX] Regenerate MMX bitcast test
Simon Pilgrim [Tue, 20 Feb 2018 18:48:29 +0000 (18:48 +0000)]
[X86][MMX] Regenerate MMX bitcast test

llvm-svn: 325611

6 years agoCorrect multiversion unsupported target behavior, add a test.
Erich Keane [Tue, 20 Feb 2018 18:44:50 +0000 (18:44 +0000)]
Correct multiversion unsupported target behavior, add a test.

Multiversioning SEMA failed to set the declaration as invalid on unsupported
targets.  This patch does that.

Additionally, I noticed that there is no test to validate this error message.
This patch adds one, and uses 'mips' as the test architecture.

llvm-svn: 325610

6 years ago[X86][3DNow] Regenerate intrinsics tests
Simon Pilgrim [Tue, 20 Feb 2018 18:44:21 +0000 (18:44 +0000)]
[X86][3DNow] Regenerate intrinsics tests

llvm-svn: 325609

6 years ago[WebAssembly] Remove unused header
Sam Clegg [Tue, 20 Feb 2018 18:40:05 +0000 (18:40 +0000)]
[WebAssembly] Remove unused header

This header used to be needed here for the `OutRelocation` struct
but that no longer exists.

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

llvm-svn: 325608

6 years ago[IRBuilder] fix CreateMaxNum to actually produce maxnum (PR36454)
Sanjay Patel [Tue, 20 Feb 2018 18:21:43 +0000 (18:21 +0000)]
[IRBuilder] fix CreateMaxNum to actually produce maxnum (PR36454)

The bug was introduced here:
https://reviews.llvm.org/rL296409
...but the patch doesn't use maxnum and nothing else in
trunk has tried since then, so the bug went unnoticed.

llvm-svn: 325607

6 years ago[Hexagon] Handle *Low8 register classes in early if-conversion
Krzysztof Parzyszek [Tue, 20 Feb 2018 18:19:17 +0000 (18:19 +0000)]
[Hexagon] Handle *Low8 register classes in early if-conversion

llvm-svn: 325606

6 years ago[SLP] Fix tests checks, NFC.
Alexey Bataev [Tue, 20 Feb 2018 18:11:50 +0000 (18:11 +0000)]
[SLP] Fix tests checks, NFC.

llvm-svn: 325605

6 years ago[X86] Correct SHRUNKBLEND creation to work correctly when there are multiple uses...
Craig Topper [Tue, 20 Feb 2018 17:58:17 +0000 (17:58 +0000)]
[X86] Correct SHRUNKBLEND creation to work correctly when there are multiple uses of the condition.

SimplifyDemandedBits forces the demanded mask to all 1s if the node has multiple uses, unless the AssumeSingleUse flag is set.

So previously we were only really likely to simplify something if the condition had a single use. And on the off chance we did simplify with multiple uses the demanded mask being used was all ones so there was no reason to create a shrunkblend.

This patch now checks that the condition is only used by selects first, and then sets the AssumeSingleUse flag for the simplifcation. Then we convert the selects to shrunkblend, and finally replace condition.

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

llvm-svn: 325604

6 years ago[WebAssembly] Remove InputChunk from Symbol baseclass
Sam Clegg [Tue, 20 Feb 2018 17:45:38 +0000 (17:45 +0000)]
[WebAssembly] Remove InputChunk from Symbol baseclass

Instead include InputFuction and InputSegment directly
in the subclasses that use them (DefinedFunction and
DefinedGlobal).

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

llvm-svn: 325603

6 years ago[SelectionDAG] Add LegalTypes flag to getShiftAmountTy. Use it to unify and simplify...
Craig Topper [Tue, 20 Feb 2018 17:41:05 +0000 (17:41 +0000)]
[SelectionDAG] Add LegalTypes flag to getShiftAmountTy. Use it to unify and simplify DAGCombiner and simplifySetCC code and fix a bug.

DAGCombiner and SimplifySetCC both use getPointerTy for shift amounts pre-legalization. DAGCombiner uses a single helper function to hide this. SimplifySetCC does it in multiple places.

This patch adds a defaulted parameter to getShiftAmountTy that can make it return getPointerTy for scalar types. Use this parameter to simplify the SimplifySetCC and DAGCombiner.

Additionally, there were two places in SimplifySetCC that were creating shifts using the target's preferred shift amount pre-legalization. If the target uses a narrow type and the type is illegal, this can cause SimplfiySetCC to create a shift with an amount that can't represent all possible shift values for the type. To fix this we should use pointer type there too.

Alternatively we could make getScalarShiftAmountTy for each target return a safe value for large types as proposed in D43445. And maybe we should still do that, but fixing the SimplifySetCC code keeps other targets from tripping over this in the future.

Fixes PR36250.

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

llvm-svn: 325602

6 years ago[X86] Promote 16-bit cmovs to 32-bits
Craig Topper [Tue, 20 Feb 2018 17:41:00 +0000 (17:41 +0000)]
[X86] Promote 16-bit cmovs to 32-bits

This allows us to avoid an opsize prefix. And forcing some move immediates to i32 avoids a length changing prefix on those instructions.

This mostly replaces the existing combine we had for zext/sext+cmov of constants. I left in a case for sign extending a 32 bit cmov of constants to 64 bits.

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

llvm-svn: 325601

6 years ago[dsymutil] Correctly handle DW_TAG_label
Jonas Devlieghere [Tue, 20 Feb 2018 17:34:29 +0000 (17:34 +0000)]
[dsymutil] Correctly handle DW_TAG_label

This patch contains logic for handling DW_TAG_label that's present in
darwin's dsymutil implementation, but not yet upstream.

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

llvm-svn: 325600

6 years ago[vim] Recognize more FileCheck comments
Mikhail Maltsev [Tue, 20 Feb 2018 17:27:44 +0000 (17:27 +0000)]
[vim] Recognize more FileCheck comments

Summary:
Currently vim syntax highlighting recognizes 'CHECK:' as a special
comment, but not CHECK-DAG, CHECK-NOT and other CHECKs. This patch
adds rules for these comments.

Reviewers: chandlerc, compnerd, rogfer01

Reviewed By: rogfer01

Subscribers: rogfer01, llvm-commits

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

llvm-svn: 325599

6 years ago[WebAssembly] Check signatures of weakly defined funtions too
Sam Clegg [Tue, 20 Feb 2018 17:20:44 +0000 (17:20 +0000)]
[WebAssembly] Check signatures of weakly defined funtions too

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 325598

6 years ago[InstCombine] remove unneeded dyn_cast to prevent unused variable warning
Sanjay Patel [Tue, 20 Feb 2018 17:14:53 +0000 (17:14 +0000)]
[InstCombine] remove unneeded dyn_cast to prevent unused variable warning

llvm-svn: 325597

6 years ago[clangd] Fix formatting in XRefs.cpp
Simon Marchi [Tue, 20 Feb 2018 16:57:47 +0000 (16:57 +0000)]
[clangd] Fix formatting in XRefs.cpp

This is also to test my commit access.

llvm-svn: 325596

6 years ago[InstCombine] remove compound fdiv pattern folds
Sanjay Patel [Tue, 20 Feb 2018 16:52:17 +0000 (16:52 +0000)]
[InstCombine] remove compound fdiv pattern folds

These are fdiv-with-constant-divisor, so they already become
reciprocal multiplies. The last gap for vector ops should be
closed with rL325590.

It's possible that we're missing folds for some edge cases
with denormal intermediate constants after deleting these,
but there are no tests for those patterns, and it would be
better to handle denormals more consistently (and less
conservatively) as noted in TODO comments.

llvm-svn: 325595