platform/upstream/llvm.git
5 years ago[llvm-objcopy][NFC] More error propagation (linkToBuildIdDir)
Jordan Rupprecht [Wed, 30 Jan 2019 18:13:30 +0000 (18:13 +0000)]
[llvm-objcopy][NFC] More error propagation (linkToBuildIdDir)

llvm-svn: 352640

5 years ago[Scalar] Implement support for 512-bit values.
Davide Italiano [Wed, 30 Jan 2019 18:05:36 +0000 (18:05 +0000)]
[Scalar] Implement support for 512-bit values.

(useful, e.g. when reading 512-bits registers, a-la AVX-512).

<rdar://problem/46886288>

llvm-svn: 352639

5 years agogn build: Add BPF target.
Peter Collingbourne [Wed, 30 Jan 2019 18:04:08 +0000 (18:04 +0000)]
gn build: Add BPF target.

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

llvm-svn: 352638

5 years agoGlobalISel: Add simpler way of always specifying custom lowering
Matt Arsenault [Wed, 30 Jan 2019 17:52:25 +0000 (17:52 +0000)]
GlobalISel: Add simpler way of always specifying custom lowering

llvm-svn: 352637

5 years agoGlobalISel: Add assert that legalize mutation makes sense
Matt Arsenault [Wed, 30 Jan 2019 17:52:23 +0000 (17:52 +0000)]
GlobalISel: Add assert that legalize mutation makes sense

I've repeatedly encountered bugs resulting from custom legalize
mutations returning nonsense legalize results, such as increasing the
number of elements for FewerElements. Add an assert function to make
sure the type to mutate to is consistent with the legalize action.

llvm-svn: 352636

5 years agoAMDGPU: Stop generating unused intrinsic .inc files
Matt Arsenault [Wed, 30 Jan 2019 17:25:37 +0000 (17:25 +0000)]
AMDGPU: Stop generating unused intrinsic .inc files

llvm-svn: 352635

5 years ago[X86][AVX] Prefer to combine shuffle to broadcasts whenever possible
Simon Pilgrim [Wed, 30 Jan 2019 16:19:19 +0000 (16:19 +0000)]
[X86][AVX] Prefer to combine shuffle to broadcasts whenever possible

This is the first step towards improving broadcast support on AVX1 targets.

llvm-svn: 352634

5 years ago[utils] Fix update scripts output when run on python3.
Simon Pilgrim [Wed, 30 Jan 2019 16:15:59 +0000 (16:15 +0000)]
[utils] Fix update scripts output when run on python3.

This fixes a "bytes-like object is required, not 'str'" python3 error I hit on update_llc_test_checks.py (but present on the other scripts as well) by matching what update_mca_test_checks.py already does, plus I've added an explicit 'utf-8' encoding.

llvm-svn: 352633

5 years ago[llvm-exegesis] Add throughput mode.
Clement Courbet [Wed, 30 Jan 2019 16:02:20 +0000 (16:02 +0000)]
[llvm-exegesis] Add throughput mode.

Summary:
This just uses the latency benchmark runner on the parallel uops snippet
generator.

Fixes PR37698.

Reviewers: gchatelet

Subscribers: tschuett, RKSimon, llvm-commits

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

llvm-svn: 352632

5 years ago[ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit
Roman Lebedev [Wed, 30 Jan 2019 15:41:20 +0000 (15:41 +0000)]
[ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

Summary:
Was trying to understand how complicated it would be to write
a clang-tidy `openmp-exception-escape`-ish check once D57100 lands.

Just so it happens, all the data is already there,
it is just conveniently omitted from AST dump.

Reviewers: aaron.ballman, steveire, ABataev

Reviewed By: ABataev

Subscribers: ABataev, guansong, cfe-commits

Tags: #openmp, #clang

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

llvm-svn: 352631

5 years ago[llvm-readobj] - Few minor cleanups. NFC.
George Rimar [Wed, 30 Jan 2019 15:39:05 +0000 (15:39 +0000)]
[llvm-readobj] - Few minor cleanups. NFC.

Minor code simplifications, relocations,
renamings (to match LLVM style).

llvm-svn: 352630

5 years ago[CMake] Accept entitlements for code signing in add_lldb_library()
Stefan Granitz [Wed, 30 Jan 2019 15:13:16 +0000 (15:13 +0000)]
[CMake] Accept entitlements for code signing in add_lldb_library()

Summary:
D57334 added entitlements support in `add_llvm_library()` so we can use it for library targets in LLDB.

Additionally this patch fixes the way that the entitlements argument is passed on from `add_lldb_executable()` to `add_llvm_executable()`. We still need the explicit parsing and passing on of single- and multi-value arguments as long as we are on CMake < 3.7 (due to bug https://gitlab.kitware.com/cmake/cmake/merge_requests/133).

Reviewers: beanz, JDevlieghere, aprantl

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits, #lldb

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

llvm-svn: 352629

5 years ago[CMake] Accept ENTITLEMENTS in llvm_add_library()
Stefan Granitz [Wed, 30 Jan 2019 15:10:08 +0000 (15:10 +0000)]
[CMake] Accept ENTITLEMENTS in llvm_add_library()

Summary: We added support for code signing entitlements in add_llvm_executable() with D54443. In the future it would be useful to have this functionality available also for libraries.

Reviewers: beanz, bogner

Reviewed By: bogner

Subscribers: mgorny, llvm-commits, lldb-commits, #lldb

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

llvm-svn: 352628

5 years ago[InstCombine][x86] add tests for addcarry intrinsic; NFC
Sanjay Patel [Wed, 30 Jan 2019 15:07:49 +0000 (15:07 +0000)]
[InstCombine][x86] add tests for addcarry intrinsic; NFC

llvm-svn: 352627

5 years ago[llvm-objcopy] Support -X|--discard-locals.
Jordan Rupprecht [Wed, 30 Jan 2019 14:58:13 +0000 (14:58 +0000)]
[llvm-objcopy] Support -X|--discard-locals.

Summary:
This adds support for the --discard-locals flag, which acts similarly to --discard-all, except it only applies to compiler-generated symbols (i.e. symbols starting with `.L` in ELF).

I am not sure about COFF local symbols: those appear to also use `.L` in most cases, but also use just `L` in other cases, so for now I am just leaving it unimplemented there.

Fixes PR36160

Reviewers: jhenderson, alexshap, jakehehrlich, mstorsjo, espindola

Reviewed By: jhenderson

Subscribers: llvm-commits, emaste, arichardson

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

llvm-svn: 352626

5 years ago[llvm-objcopy][NFC] More error propagation
Jordan Rupprecht [Wed, 30 Jan 2019 14:36:53 +0000 (14:36 +0000)]
[llvm-objcopy][NFC] More error propagation

Summary: Do some more error cleanup, removing some dependencies from llvm-objcopy's error/reportError in [ELF/COFF]Objcopy methods.

Reviewers: jhenderson, alexshap, jakehehrlich, mstorsjo, espindola

Subscribers: emaste, arichardson

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

llvm-svn: 352625

5 years ago[clangd] Drop fixes if replying with tweaks resulted in an error
Ilya Biryukov [Wed, 30 Jan 2019 14:24:17 +0000 (14:24 +0000)]
[clangd] Drop fixes if replying with tweaks resulted in an error

This should not happen in normal operation, as it implies that the diagnostics
with some available fixes were produced but the AST is invalid.
Moreover, the code had an error: always returned code actions ignoring the
SupportsCodeAction capability and writing a test for this is impossible,
since this can only happen due to programmer's error rather than invalid inputs.

llvm-svn: 352624

5 years ago[llvm-readobj] - Simplify the code.
George Rimar [Wed, 30 Jan 2019 14:08:55 +0000 (14:08 +0000)]
[llvm-readobj] - Simplify the code.

We have a Field struct which has a StringRef member Str.

The code needs to create and keep alive the temporarily
std::string variables because of that.
That is not convenient and makes the code be more complicated
than it could be.

There seems to be no reason to keep Str be StringRef.
The patch changes it to be std::string and
rearranges the code around slightly.

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

llvm-svn: 352623

5 years ago[clang-format] Fix line parsing for noexcept lambdas
Ben Hamilton [Wed, 30 Jan 2019 13:54:32 +0000 (13:54 +0000)]
[clang-format] Fix line parsing for noexcept lambdas

Summary:
> $ echo "int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();" |clang-format

```
int c = [b]() mutable noexcept {
  return [&b] { return b++; }();
}
();
```
with patch:
> $ echo "int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();" |bin/clang-format
```
int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();
```

Contributed by hultman.

Reviewers: benhamilton, jolesiak, klimek, Wizard

Reviewed By: benhamilton

Subscribers: cfe-commits

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

llvm-svn: 352622

5 years agoProperly use DT.verify in LoopSimplifyCFG
Max Kazantsev [Wed, 30 Jan 2019 12:32:19 +0000 (12:32 +0000)]
Properly use DT.verify in LoopSimplifyCFG

llvm-svn: 352621

5 years ago[HIP] Fix size_t for MSVC environment
Yaxun Liu [Wed, 30 Jan 2019 12:26:54 +0000 (12:26 +0000)]
[HIP] Fix size_t for MSVC environment

In 64 bit MSVC environment size_t is defined as unsigned long long.
In single source language like HIP, data layout should be consistent
in device and host compilation, therefore copy data layout controlling
fields from Aux target for AMDGPU target.

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

llvm-svn: 352620

5 years agoEnable IRCE for narrow latch by defailt
Max Kazantsev [Wed, 30 Jan 2019 11:25:12 +0000 (11:25 +0000)]
Enable IRCE for narrow latch by defailt

llvm-svn: 352619

5 years ago[OpenGL] Fix test on PPC after r352540
Eric Liu [Wed, 30 Jan 2019 11:24:04 +0000 (11:24 +0000)]
[OpenGL] Fix test on PPC after r352540

Summary:
Specify -triple like test/SemaOpenCL/logical-ops.cl. Otherwise, this test fails
on PPC.

Reviewers: bkramer

Subscribers: Anastasia, cfe-commits

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

llvm-svn: 352618

5 years ago[OpenCL] Add generic addr space to the return of implicit assignment.
Anastasia Stulova [Wed, 30 Jan 2019 11:18:08 +0000 (11:18 +0000)]
[OpenCL] Add generic addr space to the return of implicit assignment.

When creating the prototype of implicit assignment operators the
returned reference to the class should be qualified with the same
addr space as 'this' (i.e. __generic in OpenCL).

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

llvm-svn: 352617

5 years ago[RISCV] Insert R_RISCV_ALIGN relocation type and Nops for code alignment when linker...
Shiva Chen [Wed, 30 Jan 2019 11:16:59 +0000 (11:16 +0000)]
[RISCV] Insert R_RISCV_ALIGN relocation type and Nops for code alignment when linker relaxation enabled

Linker relaxation may change code size. We need to fix up the alignment
of alignment directive in text section by inserting Nops and R_RISCV_ALIGN
relocation type. So then linker could satisfy the alignment by removing Nops.

To do this:

1. Add shouldInsertExtraNopBytesForCodeAlign target hook to calculate
   the Nops we need to insert.

2. Add shouldInsertFixupForCodeAlign target hook to insert
   R_RISCV_ALIGN fixup type.

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

llvm-svn: 352616

5 years ago[NativePDB] Fix access to both old & new fpo data entries from dbi stream
Aleksandr Urakov [Wed, 30 Jan 2019 10:40:45 +0000 (10:40 +0000)]
[NativePDB] Fix access to both old & new fpo data entries from dbi stream

Summary:
This patch fixes access to fpo streams in native pdb from DbiStream and makes
code consistent with DbiStreamBuilder.

Patch By: leonid.mashinskiy

Reviewers: zturner, aleksandr.urakov

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 352615

5 years agoAdd lit config file to skip tests if WebAssembly target is not available.
Douglas Yung [Wed, 30 Jan 2019 09:49:39 +0000 (09:49 +0000)]
Add lit config file to skip tests if WebAssembly target is not available.

llvm-svn: 352614

5 years agoCommit tests for changes in revision D41342
Dmitry Venikov [Wed, 30 Jan 2019 09:49:25 +0000 (09:49 +0000)]
Commit tests for changes in revision D41342

llvm-svn: 352613

5 years ago[clangd] Fix a use after move
Ilya Biryukov [Wed, 30 Jan 2019 09:39:01 +0000 (09:39 +0000)]
[clangd] Fix a use after move

Introduced in r352494.

llvm-svn: 352612

5 years ago[OMPT] Make sure that OMPT is enabled when accessing internals of the runtime
Joachim Protze [Wed, 30 Jan 2019 08:41:06 +0000 (08:41 +0000)]
[OMPT] Make sure that OMPT is enabled when accessing internals of the runtime

Redo after revert by hans. The wrong include in one test is fixed.

Make sure that OMPT is enabled in runtime entry points that access internals
of the runtime. Else, return an appropiate value indicating an error or that
the data is not available.

Patch provided by @sconvent

Reviewers: jlpeyton, omalyshe, hbae, Hahnfeld, joachim.protze

Reviewed By: joachim.protze

Tags: #openmp, #ompt

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

llvm-svn: 352611

5 years ago[clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes
Michal Gorny [Wed, 30 Jan 2019 08:20:24 +0000 (08:20 +0000)]
[clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes

Append appropriate -rpath when using shared compiler-rt runtimes,
e.g. '-fsanitize=address -shared-libasan'.  There's already a similar
logic in CommonArgs.cpp but it uses non-standard arch-suffixed
installation directory while we want our driver to work with standard
installation paths.

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

llvm-svn: 352610

5 years ago[X86] Remove unnecessary code from the top of handleCompareFP in X86FloatingPoint...
Craig Topper [Wed, 30 Jan 2019 08:04:06 +0000 (08:04 +0000)]
[X86] Remove unnecessary code from the top of handleCompareFP in X86FloatingPoint.cpp.

There were checks to ensure some tables were sorted, but those tables aren't used by this function. The same tables are checked in the function that does use them. Maybe this was copy/pasted?

llvm-svn: 352609

5 years ago[X86] Remove a couple places where we unnecessarily pass 0 to the EmitPriority of...
Craig Topper [Wed, 30 Jan 2019 07:33:24 +0000 (07:33 +0000)]
[X86] Remove a couple places where we unnecessarily pass 0 to the EmitPriority of some FP instruction aliases. NFC

As far as I can tell we already won't emit these aliases due to an operand count check in the tablegen code. Removing these because I couldn't make sense of the inconsistency between fadd and fmul from reading the code.

I checked the AsmMatcher and AsmWriter files before and after this change and there were no differences.

llvm-svn: 352608

5 years ago[X86] Add FPSW as a Def on some FP instructions that were missing it.
Craig Topper [Wed, 30 Jan 2019 07:08:44 +0000 (07:08 +0000)]
[X86] Add FPSW as a Def on some FP instructions that were missing it.

llvm-svn: 352607

5 years agoRecognize FreeBSD specific BFD names in OUTPUT_FORMAT
Dimitry Andric [Wed, 30 Jan 2019 06:31:52 +0000 (06:31 +0000)]
Recognize FreeBSD specific BFD names in OUTPUT_FORMAT

Summary:
After rLLD344952 ("Add OUTPUT_FORMAT linker script directive support"),
using BFD names such as `elf64-x86-64-freebsd` the `OUTPUT_FORMAT`
linker script command does not work anymore, resulting in errors like:

```
ld: error: /home/dim/src/clang800-import/stand/efi/loader/arch/amd64/ldscript.amd64:2: unknown output format name: elf64-x86-64-freebsd
>>> OUTPUT_FORMAT("elf64-x86-64-freebsd", "elf64-x86-64-freebsd", "elf64-x86-64-freebsd")
>>>               ^
```

To fix this, recognize a `-freebsd` suffix in BFD names, and also set
`Configuration::OSABI` to `ELFOSABI_FREEBSD` for those cases.

Add and/or update several test cases to check for the correct results of
these new `OUTPUT_FORMAT` arguments.

Reviewers: ruiu, atanasyan, grimar, hokein, emaste, espindola

Reviewed By: ruiu

Subscribers: nemanjai, javed.absar, arichardson, krytarowski, kristof.beyls, kbarton, llvm-commits

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

llvm-svn: 352606

5 years ago[ModuleDependencyCollector] Use llvm::sys::fs::real_path (NFC)
Jonas Devlieghere [Wed, 30 Jan 2019 06:26:26 +0000 (06:26 +0000)]
[ModuleDependencyCollector] Use llvm::sys::fs::real_path (NFC)

Use the real_path implementation from llvm::sys::fs::real_path instead
of having a custom implementation in the ModuleDependencyCollector.

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

llvm-svn: 352605

5 years ago[libFuzzer] remove stale code, NFC
Kostya Serebryany [Wed, 30 Jan 2019 06:21:20 +0000 (06:21 +0000)]
[libFuzzer] remove stale code, NFC

llvm-svn: 352604

5 years ago[libFuzzer] refactor the handling of instrumentation counters so that they are groupe...
Kostya Serebryany [Wed, 30 Jan 2019 06:15:52 +0000 (06:15 +0000)]
[libFuzzer] refactor the handling of instrumentation counters so that they are grouped in regions one full page each. Needed for future optimization. NFC

llvm-svn: 352603

5 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Wed, 30 Jan 2019 05:26:31 +0000 (05:26 +0000)]
[NFC] fix trivial typos in comments

llvm-svn: 352602

5 years agoGlobalISel: Implement fewerElementsVector for select
Matt Arsenault [Wed, 30 Jan 2019 04:19:31 +0000 (04:19 +0000)]
GlobalISel: Implement fewerElementsVector for select

llvm-svn: 352601

5 years ago[IR] Use CallBase to simplify some code
Craig Topper [Wed, 30 Jan 2019 03:43:41 +0000 (03:43 +0000)]
[IR] Use CallBase to simplify some code

Summary:
This patch does the following to simplify the asm-goto patch

-Move isInlineAsm from CallInst to CallBase to share with CallBrInst in the asm-goto patch.
-Forward CallSite's data_operands_begin()/data_operands_end() to CallBase's implementation.
-Forward CallSite's getOperandBundlesAsDefs to CallBase.

Reviewers: chandlerc

Reviewed By: chandlerc

Subscribers: nickdesaulniers, llvm-commits

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

llvm-svn: 352600

5 years agoAMDGPU/GlobalISel: Fix clamping shifts with 16-bit insts
Matt Arsenault [Wed, 30 Jan 2019 03:36:25 +0000 (03:36 +0000)]
AMDGPU/GlobalISel: Fix clamping shifts with 16-bit insts

llvm-svn: 352599

5 years ago[WebAssembly] Exception handling: Switch to the new proposal
Heejin Ahn [Wed, 30 Jan 2019 03:21:57 +0000 (03:21 +0000)]
[WebAssembly] Exception handling: Switch to the new proposal

Summary:
This switches the EH implementation to the new proposal:
https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md
(The previous proposal was
 https://github.com/WebAssembly/exception-handling/blob/master/proposals/old/Exceptions.md)

- Instruction changes
  - Now we have one single `catch` instruction that returns a except_ref
    value
  - `throw` now can take variable number of operations
  - `rethrow` does not have 'depth' argument anymore
  - `br_on_exn` queries an except_ref to see if it matches the tag and
    branches to the given label if true.
  - `extract_exception` is a pseudo instruction that simulates popping
    values from wasm stack. This is to make `br_on_exn`, a very special
    instruction, work: `br_on_exn` puts values onto the stack only if it
    is taken, and the # of values can vay depending on the tag.

- Now there's only one `catch` per `try`, this patch removes all special
  handling for terminate pad with a call to `__clang_call_terminate`.
  Before it was the only case there are two catch clauses (a normal
  `catch` and `catch_all` per `try`).

- Make `rethrow` act as a terminator like `throw`. This splits BB after
  `rethrow` in WasmEHPrepare, and deletes an unnecessary `unreachable`
  after `rethrow` in LateEHPrepare.

- Now we stop at all catchpads (because we add wasm `catch` instruction
  that catches all exceptions), this creates new
  `findWasmUnwindDestinations` function in SelectionDAGBuilder.

- Now we use `br_on_exn` instrution to figure out if an except_ref
  matches the current tag or not, LateEHPrepare generates this sequence
  for catch pads:
```
  catch
  block i32
  br_on_exn $__cpp_exception
  end_block
  extract_exception
```

- Branch analysis for `br_on_exn` in WebAssemblyInstrInfo

- Other various misc. changes to switch to the new proposal.

Reviewers: dschuff

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

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

llvm-svn: 352598

5 years agoGlobalISel: Use appropriate extension for legalizing select conditions
Matt Arsenault [Wed, 30 Jan 2019 02:57:43 +0000 (02:57 +0000)]
GlobalISel: Use appropriate extension for legalizing select conditions

llvm-svn: 352597

5 years ago[PowerPC] [NFC] Create a helper function to copy register to particular register...
Zi Xuan Wu [Wed, 30 Jan 2019 02:56:22 +0000 (02:56 +0000)]
[PowerPC] [NFC] Create a helper function to copy register to particular register class at PPCFastISel

Make copy register code as common function as following.

unsigned copyRegToRegClass(const TargetRegisterClass *ToRC, unsigned SrcReg, unsigned Flag = 0, unsigned SubReg = 0);

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

llvm-svn: 352596

5 years agoCleanup: replace uses of CallSite with CallBase.
James Y Knight [Wed, 30 Jan 2019 02:54:28 +0000 (02:54 +0000)]
Cleanup: replace uses of CallSite with CallBase.

llvm-svn: 352595

5 years agoGlobalISel: Support narrowScalar for uneven loads
Matt Arsenault [Wed, 30 Jan 2019 02:35:38 +0000 (02:35 +0000)]
GlobalISel: Support narrowScalar for uneven loads

llvm-svn: 352594

5 years agoSimplify and modernize this code a little.
Richard Smith [Wed, 30 Jan 2019 02:23:34 +0000 (02:23 +0000)]
Simplify and modernize this code a little.

No functionality change intended.

llvm-svn: 352593

5 years ago[WebAssembly] Optimize BUILD_VECTOR lowering for size
Thomas Lively [Wed, 30 Jan 2019 02:23:29 +0000 (02:23 +0000)]
[WebAssembly] Optimize BUILD_VECTOR lowering for size

Summary:
Implements custom lowering logic that finds the optimal value for the
initial splat of the vector and either uses it or uses v128.const if
it is available and if it would produce smaller code. This logic
replaces large TableGen ISEL patterns that would lower all non-splat
BUILD_VECTORs into a splat followed by a fixed number of replace_lane
instructions. This CL fixes PR39685.

Reviewers: aheejin

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

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

llvm-svn: 352592

5 years agoGlobalISel: Handle some odd splits in fewerElementsVector
Matt Arsenault [Wed, 30 Jan 2019 02:22:13 +0000 (02:22 +0000)]
GlobalISel: Handle some odd splits in fewerElementsVector

Also add some quick hacks to AMDGPU legality for the tests.

llvm-svn: 352591

5 years agolld/coff: Implement some support for the comdat selection field
Nico Weber [Wed, 30 Jan 2019 02:17:27 +0000 (02:17 +0000)]
lld/coff: Implement some support for the comdat selection field

LLD used to handle comdats as if the selection field was always set to
IMAGE_COMDAT_SELECT_ANY. This means for obj files produced by `cl /Gy`, LLD
would never report a duplicate symbol error.

This change:
- adds validation for the Selection field (should make no difference in
  practice for compiler-generated obj inputs)
- rejects comdats that have different Selection fields in different obj files
  (likewise). This is a bit more strict but also more self-consistent thank
  link.exe (see comment in code)
- implements handling for all the selection kinds

In practice, compilers only generate comdats with
IMAGE_COMDAT_SELECT_NODUPLICATES (LLD now produces duplicate symbol errors for
these), IMAGE_COMDAT_SELECT_ANY (no behavior change), and
IMAGE_COMDAT_SELECT_LARGEST (for RTTI data; here LLD should no longer create
broken executables when linking some TUs with RTTI enabled and some with it
disabled â€“ but see below).

The implementation of `IMAGE_COMDAT_SELECT_LARGEST` is incomplete: If one
SELECT_LARGEST comdat replaces an earlier one, the comdat symbol is replaced
correctly, but the old section stays loaded and if /opt:ref is disabled (via
/opt:noref or /debug) it's still written to the output. That's not ideal, but
better than the current treatment of just picking any one of those comdats. I
hope to fix this better later.

Fixes most of PR40094.

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

llvm-svn: 352590

5 years agolld-link: Add test I forgot to add in 332012
Nico Weber [Wed, 30 Jan 2019 02:15:08 +0000 (02:15 +0000)]
lld-link: Add test I forgot to add in 332012

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

llvm-svn: 352589

5 years ago[analyzer] [RetainCountChecker] Bugfix for tracking top-level parameters of Objective...
George Karpenkov [Wed, 30 Jan 2019 02:11:04 +0000 (02:11 +0000)]
[analyzer] [RetainCountChecker] Bugfix for tracking top-level parameters of Objective-C methods

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

llvm-svn: 352588

5 years agoAdd enum values to CodeGenOpt::Level
Sam Clegg [Wed, 30 Jan 2019 02:08:34 +0000 (02:08 +0000)]
Add enum values to CodeGenOpt::Level

The absolute values of this enum are important at least in that
they get printed by SelectionDAGISel. e.g:
  `Before: -O2 ; After: -O0`

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

llvm-svn: 352587

5 years ago[CMake][Fuchsia] Re-enable iOS runtimes for Fuchsia standard
Petr Hosek [Wed, 30 Jan 2019 02:06:06 +0000 (02:06 +0000)]
[CMake][Fuchsia] Re-enable iOS runtimes for Fuchsia standard

Turned out this is used by Flutter which uses Fuchsia Clang toolchain.

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

llvm-svn: 352586

5 years agoGlobalISel: Handle more cases for widenScalar for G_STORE
Matt Arsenault [Wed, 30 Jan 2019 02:04:31 +0000 (02:04 +0000)]
GlobalISel: Handle more cases for widenScalar for G_STORE

llvm-svn: 352585

5 years ago[CMake][Fuchsia] Enable hermetic static libunwind for Fuchsia
Petr Hosek [Wed, 30 Jan 2019 02:02:25 +0000 (02:02 +0000)]
[CMake][Fuchsia] Enable hermetic static libunwind for Fuchsia

In addition to libc++abi and libc++, we also want to use hermetic
static libunwind on Fuchsia.

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

llvm-svn: 352584

5 years ago[PowerPC] more opportunity for converting reg+reg to reg+imm
Chen Zheng [Wed, 30 Jan 2019 01:57:01 +0000 (01:57 +0000)]
[PowerPC] more opportunity for converting reg+reg to reg+imm
Differential Revision: https://reviews.llvm.org/D57314

llvm-svn: 352583

5 years agoAdd 8.0 release bug to merge request script
Matt Arsenault [Wed, 30 Jan 2019 01:10:47 +0000 (01:10 +0000)]
Add 8.0 release bug to merge request script

llvm-svn: 352579

5 years agoGlobalISel: Verify memory size for load/store
Matt Arsenault [Wed, 30 Jan 2019 01:10:42 +0000 (01:10 +0000)]
GlobalISel: Verify memory size for load/store

llvm-svn: 352578

5 years ago[libFuzzer] update a test
Kostya Serebryany [Wed, 30 Jan 2019 00:36:28 +0000 (00:36 +0000)]
[libFuzzer] update a test

llvm-svn: 352577

5 years agoRemove a redundant space from an error message; NFC
George Burgess IV [Wed, 30 Jan 2019 00:28:56 +0000 (00:28 +0000)]
Remove a redundant space from an error message; NFC

llvm-svn: 352576

5 years ago[WebAssembly] Fix undefined weak function symbols in LTO builds
Sam Clegg [Wed, 30 Jan 2019 00:25:52 +0000 (00:25 +0000)]
[WebAssembly] Fix undefined weak function symbols in LTO builds

Summary: Fixes PR40219

Subscribers: dschuff, mehdi_amini, inglorion, jgravelle-google, aheejin, sunfish, steven_wu, dexonsmith, llvm-commits

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

llvm-svn: 352575

5 years agoFix thread safety tests after r352549
Aaron Puchert [Wed, 30 Jan 2019 00:18:24 +0000 (00:18 +0000)]
Fix thread safety tests after r352549

llvm-svn: 352574

5 years ago[WebAssembly] Add missing SymbolRef update from rL352551
Sam Clegg [Wed, 30 Jan 2019 00:15:48 +0000 (00:15 +0000)]
[WebAssembly] Add missing SymbolRef update from rL352551

This change broke some MC tests which are now fixed.

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

llvm-svn: 352573

5 years ago[analyzer] NFC: GenericTaintChecker: Revise rule specification mechanisms.
Artem Dergachev [Wed, 30 Jan 2019 00:06:43 +0000 (00:06 +0000)]
[analyzer] NFC: GenericTaintChecker: Revise rule specification mechanisms.

Provide a more powerful and at the same time more readable way of specifying
taint propagation rules for known functions within the checker.

Now it should be possible to specify an unlimited amount of source and
destination parameters for taint propagation.

No functional change intended just yet.

Patch by Gábor Borsik!

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

llvm-svn: 352572

5 years ago[libFuzzer] remove stale code
Kostya Serebryany [Tue, 29 Jan 2019 23:53:28 +0000 (23:53 +0000)]
[libFuzzer] remove stale code

llvm-svn: 352571

5 years agoAdd FileCollector + test to Xcode project.
Jonas Devlieghere [Tue, 29 Jan 2019 23:48:53 +0000 (23:48 +0000)]
Add FileCollector + test to Xcode project.

llvm-svn: 352570

5 years ago[WebAssembly] Lower SCALAR_TO_VECTOR to splats
Thomas Lively [Tue, 29 Jan 2019 23:44:48 +0000 (23:44 +0000)]
[WebAssembly] Lower SCALAR_TO_VECTOR to splats

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish

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

llvm-svn: 352568

5 years ago[libFuzzer] revert an accidental commit
Kostya Serebryany [Tue, 29 Jan 2019 23:41:50 +0000 (23:41 +0000)]
[libFuzzer] revert an accidental commit

llvm-svn: 352567

5 years ago[libFuzzer] remove deprecated support for -fsanitize-coverage=trace-pc[-guard]
Kostya Serebryany [Tue, 29 Jan 2019 23:40:05 +0000 (23:40 +0000)]
[libFuzzer] remove deprecated support for -fsanitize-coverage=trace-pc[-guard]

llvm-svn: 352566

5 years agoGlobalISel: Fix unused variable warning in release builds
Matt Arsenault [Tue, 29 Jan 2019 23:38:42 +0000 (23:38 +0000)]
GlobalISel: Fix unused variable warning in release builds

llvm-svn: 352565

5 years ago[libFuzzer] remove deprecated support for -fsanitize-coverage=trace-pc[-guard]
Kostya Serebryany [Tue, 29 Jan 2019 23:37:20 +0000 (23:37 +0000)]
[libFuzzer] remove deprecated support for -fsanitize-coverage=trace-pc[-guard]

llvm-svn: 352564

5 years ago[IR] Use CallBase to reduce code duplication. NFC
Craig Topper [Tue, 29 Jan 2019 23:31:54 +0000 (23:31 +0000)]
[IR] Use CallBase to reduce code duplication. NFC

Noticed in the asm-goto patch. Callbr needs to go here too. One cast and call is better than 3.

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

llvm-svn: 352563

5 years agoGlobalISel: Verify pointer casts
Matt Arsenault [Tue, 29 Jan 2019 23:29:00 +0000 (23:29 +0000)]
GlobalISel: Verify pointer casts

Not sure if the old AArch64 tests should be just
deleted or not.

llvm-svn: 352562

5 years ago[libc++] Fix Windows build error in <functional>
Thomas Anderson [Tue, 29 Jan 2019 23:19:45 +0000 (23:19 +0000)]
[libc++] Fix Windows build error in <functional>

On my Windows system, __allocator is defined to nothing.  This change fixes build errors of the below form:

    In file included from algorithm:644:
    functional(1492,31):  error: expected member name or ';' after declaration specifiers
        const _Alloc& __allocator() const { return __f_.second(); }

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

llvm-svn: 352561

5 years agoGlobalISel: Partially implement widenScalar for MERGE_VALUES
Matt Arsenault [Tue, 29 Jan 2019 23:17:35 +0000 (23:17 +0000)]
GlobalISel: Partially implement widenScalar for MERGE_VALUES

llvm-svn: 352560

5 years ago[libunwind] Support building hermetic static library
Petr Hosek [Tue, 29 Jan 2019 23:01:08 +0000 (23:01 +0000)]
[libunwind] Support building hermetic static library

This is useful when the static libunwind library is being linked into
shared libraries that may be used in with other shared libraries that
use different unwinder. We want to avoid avoid exporting libunwind
symbols in those cases. This achieved by a new CMake option which can be
enabled by libunwind vendors as needed.

The same CMake option has already been added to libc++ and libc++abi in
D55404 and D56026.

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

llvm-svn: 352559

5 years agoNFC: Move GenericSelectionExpr dump to NodeDumper
Stephen Kelly [Tue, 29 Jan 2019 22:58:28 +0000 (22:58 +0000)]
NFC: Move GenericSelectionExpr dump to NodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 352558

5 years agoFix some warnings in building LLDB.
Zachary Turner [Tue, 29 Jan 2019 22:55:21 +0000 (22:55 +0000)]
Fix some warnings in building LLDB.

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

llvm-svn: 352557

5 years ago[test] Use correct macro in FileCollectorTest.cpp
Jonas Devlieghere [Tue, 29 Jan 2019 22:53:47 +0000 (22:53 +0000)]
[test] Use correct macro in FileCollectorTest.cpp

This test was supposed to be skipped on Windows but was using the wrong
macro name.

llvm-svn: 352556

5 years agoCheck bool attribute value in getOptionalBoolLoopAttribute.
Alina Sbirlea [Tue, 29 Jan 2019 22:33:20 +0000 (22:33 +0000)]
Check bool attribute value in getOptionalBoolLoopAttribute.

Summary:
Check the bool value of the attribute in getOptionalBoolLoopAttribute
not just its existance.
Eliminates the warning noise generated when vectorization is explicitly disabled.

Reviewers: Meinersbur, hfinkel, dmgreen

Subscribers: jlebar, sanjoy, llvm-commits

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

llvm-svn: 352555

5 years ago[WebAssembly] Don't load weak undefined symbols from archive files
Sam Clegg [Tue, 29 Jan 2019 22:26:31 +0000 (22:26 +0000)]
[WebAssembly] Don't load weak undefined symbols from archive files

Summary: Fixes PR40494

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

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

llvm-svn: 352554

5 years agoDrop the dependency on <algorithm>, add placement new inline
Petr Hosek [Tue, 29 Jan 2019 22:26:18 +0000 (22:26 +0000)]
Drop the dependency on <algorithm>, add placement new inline

We haven't eliminated C++ library dependency altogether in D57251,
UnwindCursor.hpp had an unused dependency on <algorithm> which was
pulling in other C++ headers. Removing that dependency also revealed
(correctly) that we need our own global placement new declaration. Now
libunwind should be independent of the C++ library.

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

llvm-svn: 352553

5 years agoNFC: Implement GenericSelectionExpr::Association dump with Visitor
Stephen Kelly [Tue, 29 Jan 2019 22:22:55 +0000 (22:22 +0000)]
NFC: Implement GenericSelectionExpr::Association dump with Visitor

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 352552

5 years ago[WebAssembly] Ensure BasicSymbolRef.getRawDataRefImpl().p is non-null
Sam Clegg [Tue, 29 Jan 2019 22:22:32 +0000 (22:22 +0000)]
[WebAssembly] Ensure BasicSymbolRef.getRawDataRefImpl().p is non-null

Store a non-zero value to ref.d.a and use ref.d.b to store the symbol
index.  This means that ref.p is never null, which was confusing
llvm-nm.

Fixes PR40497

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

llvm-svn: 352551

5 years ago[docs] Prevent O0 optnone for opt input
Shoaib Meenai [Tue, 29 Jan 2019 22:17:51 +0000 (22:17 +0000)]
[docs] Prevent O0 optnone for opt input

If we just compile with -O0, clang will add optnone attributes
everywhere, so opt won't actually be able to perform any passes.
Instruct clang to not emit the optnone so opt can do its thing.

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

llvm-svn: 352550

5 years agoThread safety analysis: Improve diagnostics for double locking
Aaron Puchert [Tue, 29 Jan 2019 22:11:42 +0000 (22:11 +0000)]
Thread safety analysis: Improve diagnostics for double locking

Summary:
We use the existing diag::note_locked_here to tell the user where we saw
the first locking.

Reviewers: aaron.ballman, delesley

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 352549

5 years agoMake a blind attempt at fixing PDBASTParser nullability issues
Adrian Prantl [Tue, 29 Jan 2019 21:46:34 +0000 (21:46 +0000)]
Make a blind attempt at fixing PDBASTParser nullability issues

llvm-svn: 352548

5 years ago[AArch64][GlobalISel] Unmerge into scalars from a vector should use FPR bank.
Amara Emerson [Tue, 29 Jan 2019 21:19:33 +0000 (21:19 +0000)]
[AArch64][GlobalISel] Unmerge into scalars from a vector should use FPR bank.

This currently shows up as a selection fallback since the dest regs were given
GPR banks but the source was a vector FPR reg.

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

llvm-svn: 352545

5 years agoOpenCL: Try to fix bot test failure
Matt Arsenault [Tue, 29 Jan 2019 21:14:56 +0000 (21:14 +0000)]
OpenCL: Try to fix bot test failure

llvm-svn: 352544

5 years ago[OPENMP]Fix PR40513: lastprivate taskloop counter.
Alexey Bataev [Tue, 29 Jan 2019 21:12:28 +0000 (21:12 +0000)]
[OPENMP]Fix PR40513: lastprivate taskloop counter.

We don't need to use the predetermined data-sharing attributes for the
loop counters if the user explicitly specified correct data-sharing
attributes for such variables.

llvm-svn: 352543

5 years ago[cc1as] Test that -g of empty .s file does something sensible.
Paul Robinson [Tue, 29 Jan 2019 20:57:50 +0000 (20:57 +0000)]
[cc1as] Test that -g of empty .s file does something sensible.

Depends on LLVM r352541.

llvm-svn: 352542

5 years ago[DWARF] Emit reasonable debug info for empty .s files.
Paul Robinson [Tue, 29 Jan 2019 20:53:51 +0000 (20:53 +0000)]
[DWARF] Emit reasonable debug info for empty .s files.

llvm-svn: 352541

5 years agoOpenCL: Use length modifier for warning on vector printf arguments
Matt Arsenault [Tue, 29 Jan 2019 20:49:54 +0000 (20:49 +0000)]
OpenCL: Use length modifier for warning on vector printf arguments

Re-enable format string warnings on printf.

The warnings are still incomplete. Apparently it is undefined to use a
vector specifier without a length modifier, which is not currently
warned on. Additionally, type warnings appear to not be working with
the hh modifier, and aren't warning on all of the special restrictions
from c99 printf.

llvm-svn: 352540

5 years agoRevert "OpenCL: Extend argument promotion rules to vector types"
Matt Arsenault [Tue, 29 Jan 2019 20:49:47 +0000 (20:49 +0000)]
Revert "OpenCL: Extend argument promotion rules to vector types"

This reverts r348083. This was based on a misreading of the spec
for printf specifiers.

Also revert r343653, as without a subsequent patch, a correctly
specified format for a vector will incorrectly warn.

Fixes bug 40491.

llvm-svn: 352539

5 years ago[Reproducers] Add file provider
Jonas Devlieghere [Tue, 29 Jan 2019 20:36:38 +0000 (20:36 +0000)]
[Reproducers] Add file provider

This patch adds the file provider which is responsible for capturing
files used by LLDB.

When capturing a reproducer, we use a file collector that is very
similar to the one used in clang. For every file that we touch, we add
an entry with a mapping from its virtual to its real path. When we
decide to generate a reproducer we copy over the files and their
permission into to reproducer folder.

When replaying a reproducer, we load the VFS mapping and instantiate a
RedirectingFileSystem. The latter will transparently use the files
available in the reproducer.

I've tested this on two macOS machines with an artificial example.
Still, it is very likely that I missed some places where we (still) use
native file system calls. I'm hoping to flesh those out while testing
with more advanced examples. However, I will fix those things in
separate patches.

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

llvm-svn: 352538

5 years agoFix the tests from r350970
Steven Wu [Tue, 29 Jan 2019 20:13:02 +0000 (20:13 +0000)]
Fix the tests from r350970

Relax the tests from r350970 to allow non-standard path for ld.

llvm-svn: 352537

5 years ago[InstCombine] canonicalize cmp/select form of uadd saturate with constant
Sanjay Patel [Tue, 29 Jan 2019 20:02:45 +0000 (20:02 +0000)]
[InstCombine] canonicalize cmp/select form of uadd saturate with constant

I'm circling back around to a loose end from D51929.

The backend (either CGP or DAG) doesn't recognize this pattern, so we end up with different asm for these IR variants.

Regardless of any future changes to canonicalize to saturation/overflow intrinsics, we want to get raw IR variations
into the minimal number of raw IR forms. If/when we can canonicalize to intrinsics, that will make that step easier.

  Pre: C2 == ~C1
  %a = add i32 %x, C1
  %c = icmp ugt i32 %x, C2
  %r = select i1 %c, i32 -1, i32 %a
  =>
  %a = add i32 %x, C1
  %c2 = icmp ult i32 %x, C2
  %r = select i1 %c2, i32 %a, i32 -1

  https://rise4fun.com/Alive/pkH

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

llvm-svn: 352536

5 years agoFix the behavior of clang's -w flag.
James Y Knight [Tue, 29 Jan 2019 19:33:48 +0000 (19:33 +0000)]
Fix the behavior of clang's -w flag.

It is intended to disable _all_ warnings, even those upgraded to
errors via `-Werror=warningname` or `#pragma clang diagnostic error'

Fixes: https://llvm.org/PR38231
Differential Revision: https://reviews.llvm.org/D53199

llvm-svn: 352535