platform/upstream/llvm.git
5 years ago[opaque pointer types] Pass value type to GetElementPtr creation.
James Y Knight [Fri, 1 Feb 2019 20:44:47 +0000 (20:44 +0000)]
[opaque pointer types] Pass value type to GetElementPtr creation.

This cleans up all GetElementPtr creation in LLVM to explicitly pass a
value type rather than deriving it from the pointer's element-type.

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

llvm-svn: 352913

5 years ago[opaque pointer types] Pass value type to LoadInst creation.
James Y Knight [Fri, 1 Feb 2019 20:44:24 +0000 (20:44 +0000)]
[opaque pointer types] Pass value type to LoadInst creation.

This cleans up all LoadInst creation in LLVM to explicitly pass the
value type rather than deriving it from the pointer's element-type.

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

llvm-svn: 352911

5 years ago[opaque pointer types] Pass function types to InvokeInst creation.
James Y Knight [Fri, 1 Feb 2019 20:43:34 +0000 (20:43 +0000)]
[opaque pointer types] Pass function types to InvokeInst creation.

This cleans up all InvokeInst creation in LLVM to explicitly pass a
function type rather than deriving it from the pointer's element-type.

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

llvm-svn: 352910

5 years ago[opaque pointer types] Pass function types to CallInst creation.
James Y Knight [Fri, 1 Feb 2019 20:43:25 +0000 (20:43 +0000)]
[opaque pointer types] Pass function types to CallInst creation.

This cleans up all CallInst creation in LLVM to explicitly pass a
function type rather than deriving it from the pointer's element-type.

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

llvm-svn: 352909

5 years ago[InstCombine] Expand Windows test (NFC)
Evandro Menezes [Fri, 1 Feb 2019 20:42:03 +0000 (20:42 +0000)]
[InstCombine] Expand Windows test (NFC)

Run checks for Win64 as well.

llvm-svn: 352908

5 years agogn build: Create regular archives for the sanitizer runtimes.
Peter Collingbourne [Fri, 1 Feb 2019 20:34:43 +0000 (20:34 +0000)]
gn build: Create regular archives for the sanitizer runtimes.

We'll need to do this eventually if we create an installable package.
For now, this lets me use the archives to build Android, whose build
system wants to copy the archives to another location.

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

llvm-svn: 352907

5 years ago[OpenMP 5.0] Parsing/sema support for "omp declare mapper" directive.
Michael Kruse [Fri, 1 Feb 2019 20:25:04 +0000 (20:25 +0000)]
[OpenMP 5.0] Parsing/sema support for "omp declare mapper" directive.

This patch implements parsing and sema for "omp declare mapper"
directive. User defined mapper, i.e., declare mapper directive, is a new
feature in OpenMP 5.0. It is introduced to extend existing map clauses
for the purpose of simplifying the copy of complex data structures
between host and device (i.e., deep copy). An example is shown below:

    struct S {  int len;  int *d; };
    #pragma omp declare mapper(struct S s) map(s, s.d[0:s.len]) // Memory region that d points to is also mapped using this mapper.

Contributed-by: Lingda Li <lildmh@gmail.com>
Differential Revision: https://reviews.llvm.org/D56326

llvm-svn: 352906

5 years ago[libc++] Disentangle the 3 implementations of type_info
Louis Dionne [Fri, 1 Feb 2019 20:00:13 +0000 (20:00 +0000)]
[libc++] Disentangle the 3 implementations of type_info

Summary:
We currently have effectively 3 implementations of type_info: one for
the Microsoft ABI, one that does not assume that there's a unique copy
of each RTTI in a progran, and one that assumes a unique copy.

Those 3 implementations are entangled into the same class with nested
ifdefs, which makes it very difficult to understand. Furthermore, the
benefit of doing this is rather small since the code that is duplicated
across implementations is just a couple of trivial lines.

This patch stamps out the 3 versions of type_info explicitly to increase
readability. It also explains what's going on with short comments, because
it's far from obvious.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith

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

llvm-svn: 352905

5 years ago[InstCombine] Extra null-checking on TFE/LWE support
Michael Liao [Fri, 1 Feb 2019 19:53:44 +0000 (19:53 +0000)]
[InstCombine] Extra null-checking on TFE/LWE support

- If that operand is not ConstantInt, skip enabling TFE/LWE.

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

llvm-svn: 352904

5 years agoHopefully fix a couple more sphinx doc errors.
James Y Knight [Fri, 1 Feb 2019 19:40:07 +0000 (19:40 +0000)]
Hopefully fix a couple more sphinx doc errors.

These seem to only appear on the buildbot runner, and it looks like we
tried to suppress them, but it's not working. Not sure why.

llvm-svn: 352903

5 years agoFix the xcode build for r352845, attempt #2
Stefan Granitz [Fri, 1 Feb 2019 19:31:02 +0000 (19:31 +0000)]
Fix the xcode build for r352845, attempt #2

llvm-svn: 352902

5 years agoRevert "Fix the xcode build for r352845."
Stefan Granitz [Fri, 1 Feb 2019 19:30:57 +0000 (19:30 +0000)]
Revert "Fix the xcode build for r352845."

This reverts commit 72c1213a5e901b80c0f1d2794e5088d7f71a3632.

llvm-svn: 352901

5 years ago[llvm-objdump] - llvm-objdump can skip bytes at the end of a section.
Sid Manning [Fri, 1 Feb 2019 19:11:47 +0000 (19:11 +0000)]
[llvm-objdump] - llvm-objdump can skip bytes at the end of a section.

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

llvm-svn: 352900

5 years ago[lldb] Relax libc++ ABI version checking
Thomas Anderson [Fri, 1 Feb 2019 19:10:39 +0000 (19:10 +0000)]
[lldb] Relax libc++ ABI version checking

libc++ has programmable ABI versioning controllable with the _LIBCPP_ABI_VERSION
macro.  Currently there are at least 3 settings used in real systems (1 as the
default, ndk1 for Anroid, Cr for Chromium).

Only the 1 and ndk1 cases were handled.  This change relaxes the check to allow
any ABI version.

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

llvm-svn: 352899

5 years agoFix a bug in the definition of isUnordered on MachineMemOperand
Philip Reames [Fri, 1 Feb 2019 19:08:59 +0000 (19:08 +0000)]
Fix a bug in the definition of isUnordered on MachineMemOperand

Background: At the moment, we record the AtomicOrdering of an access in the MMO, but also mark any atomic access as volatile in SelectionDAG. GlobalISEL keeps the two separate, but currently doesn't know how to lower an atomic G_LOAD at all. See https://reviews.llvm.org/D57601 for context.

The definition used for unordered was only checking volatility, not atomicity. As noted above, all atomic MMOs are currently also volatile, so this is a latent bug only. Copy the definition used in IR, after auditing the two (2) uses of the function to be sure the desired semantics are the same.

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

llvm-svn: 352898

5 years agotest commit (add blank line) NFC
Roland Froese [Fri, 1 Feb 2019 18:55:43 +0000 (18:55 +0000)]
test commit (add blank line) NFC

llvm-svn: 352897

5 years ago[llvm-readobj] Add a flag to dump just the section-to-segment mapping.
Matt Davis [Fri, 1 Feb 2019 18:51:10 +0000 (18:51 +0000)]
[llvm-readobj] Add a flag to dump just the section-to-segment mapping.

Summary:
The following patch introduces a new function `printSectionMapping` which is responsible for dumping just the section-to-segment mapping.
This patch also introduces a n option `-section-mapping` that outputs that mapping without the program headers.

Previously, this functionality was controlled by `printProgramHeaders`, and the output from `-program-headers` has not been changed.  I am happy to change the option name, I copied  the name that was displayed when outputting the mapping table.

Reviewers: khemant, jhenderson, grimar, rupprecht

Reviewed By: jhenderson, grimar, rupprecht

Subscribers: rupprecht, jhenderson, llvm-commits

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

llvm-svn: 352896

5 years ago[InstCombine] Refactor test checks (NFC)
Evandro Menezes [Fri, 1 Feb 2019 18:34:20 +0000 (18:34 +0000)]
[InstCombine] Refactor test checks (NFC)

llvm-svn: 352895

5 years agoFix the xcode build for r352845.
Jim Ingham [Fri, 1 Feb 2019 18:26:08 +0000 (18:26 +0000)]
Fix the xcode build for r352845.

llvm-svn: 352894

5 years agogn build: Add a missing dependency from llvm/test to llvm-lit
Nico Weber [Fri, 1 Feb 2019 18:17:19 +0000 (18:17 +0000)]
gn build: Add a missing dependency from llvm/test to llvm-lit

check-llvm already listed llvm-lit as script which counts as a dep, so running
check-llvm worked fine, but `ninja -C out/gn llvm/test` didn't build llvm-lit
before if it wasn't already there.

llvm-svn: 352893

5 years ago[InstCombine] Expand Windows test (NFC)
Evandro Menezes [Fri, 1 Feb 2019 17:39:48 +0000 (17:39 +0000)]
[InstCombine] Expand Windows test (NFC)

Add checks for Win64 to existing cases.

llvm-svn: 352892

5 years ago[llvm-nm] Report '.comment' ELF sections as 'n' instead of '?'
Matt Davis [Fri, 1 Feb 2019 17:38:08 +0000 (17:38 +0000)]
[llvm-nm] Report '.comment' ELF sections as 'n' instead of '?'

Summary:
The previous implementation reported `.comment` sections as '?'
GNU uses 'n' which means  "The symbol is a debugging symbol."  `.note`  sections are represented as 'n' too.

The test related to this change was updated to CHECK-NEXT to ensure
order and that we did not miss any symbols in the dump.

Reviewers: jhenderson

Reviewed By: jhenderson

Subscribers: rupprecht, llvm-commits

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

llvm-svn: 352891

5 years agoUpdate SanitizerCoverage doc regarding the issue with pc-table and gc-sections.
Max Moroz [Fri, 1 Feb 2019 17:12:35 +0000 (17:12 +0000)]
Update SanitizerCoverage doc regarding the issue with pc-table and gc-sections.

Summary:
There is a bug for this: https://bugs.llvm.org/show_bug.cgi?id=34636
But it would be also helpful to leave a note in the docs to prevent users from
running into issues, e.g. https://crbug.com/926588.

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: cfe-commits, llvm-commits, kcc

Tags: #clang

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

llvm-svn: 352890

5 years ago[DWARF v5] Fix DWARF emitter and consumer to produce/expect a uleb for a location...
Wolfgang Pieb [Fri, 1 Feb 2019 17:11:58 +0000 (17:11 +0000)]
[DWARF v5] Fix DWARF emitter and consumer to produce/expect a uleb for a location description's length.

Reviewer: davide, JDevliegere

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

llvm-svn: 352889

5 years ago[llvm-objcopy][NFC] More error propagation (executeObjcopyOnArchive)
Jordan Rupprecht [Fri, 1 Feb 2019 17:08:07 +0000 (17:08 +0000)]
[llvm-objcopy][NFC] More error propagation (executeObjcopyOnArchive)

Summary:
Replace some reportError() calls with error propagation that was missed from rL352625.

Note this also adds an error check during Archive iteration that was being hidden by a different error check before:

```
  for (const Archive::Child &Child : Ar.children(Err)) {
    Expected<std::unique_ptr<Binary>> ChildOrErr = Child.getAsBinary();
    if (!ChildOrErr)
      // This aborts, so Err is never checked
      reportError(Ar.getFileName(), ChildOrErr.takeError());
```

Err is being checked after the loop, so during happy runs, everything is fine. But when reportError is changed to return the error instead of aborting, the fact that Err is never checked is now noticed in tests that trigger an error during the loop.

Reviewers: jhenderson, dblaikie, alexshap

Reviewed By: dblaikie

Subscribers: llvm-commits, lhames, jakehehrlich

Tags: #llvm

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

llvm-svn: 352888

5 years agoFix some sphinx doc errors.
James Y Knight [Fri, 1 Feb 2019 17:06:41 +0000 (17:06 +0000)]
Fix some sphinx doc errors.

llvm-svn: 352887

5 years ago[InstCombine] Refactor test checks (NFC)
Evandro Menezes [Fri, 1 Feb 2019 16:57:53 +0000 (16:57 +0000)]
[InstCombine] Refactor test checks (NFC)

llvm-svn: 352886

5 years ago[AMDGPU] Fix for vector element insertion
Tim Corringham [Fri, 1 Feb 2019 16:51:09 +0000 (16:51 +0000)]
[AMDGPU] Fix for vector element insertion

Summary:
Incorrect code was generated when lowering insertelement operations
for vectors with 8 or 16 bit elements.  The value being inserted was
not adjusted for the position of the element within the 32 bit word
and so only the low element within each 32 bit word could receive
the intended value.

Fixed by simply replicating the value to each element of a
congruent vector before the mask and or operation used to
update the intended element.

A number of affected LIT tests have been updated appropriately.

before the mask & or into the intended

Reviewers: arsenm, nhaehnle

Reviewed By: arsenm

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

Tags: #llvm

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

llvm-svn: 352885

5 years ago[SDAG] improve variable names; NFC
Sanjay Patel [Fri, 1 Feb 2019 16:06:53 +0000 (16:06 +0000)]
[SDAG] improve variable names; NFC

The version of FoldConstantArithmetic() that takes arbitrary nodes
was confusingly naming those nodes as constants when they might
not be; also "Cst" reads like "Cast".

llvm-svn: 352884

5 years ago[X86][SSE] Use PSLLDQ/PSRLDQ to mask out zeroable ends of a shuffle
Simon Pilgrim [Fri, 1 Feb 2019 16:02:12 +0000 (16:02 +0000)]
[X86][SSE] Use PSLLDQ/PSRLDQ to mask out zeroable ends of a shuffle

As suggested on PR40318, this patch uses PSLLDQ/PSRLDQ to lower shuffles to zero out the ends of a vector, leaving a sequential inner section.

For pre-SSSE3 we do this for shuffles with zeros at either end (requiring up to 3 shifts), but once PSHUFB is available I've limited this to shuffles with a single zeroable end (2 shifts).

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

llvm-svn: 352883

5 years ago[AST][OpenMP] OpenMP Sections / Section constructs contain Structured blocks
Roman Lebedev [Fri, 1 Feb 2019 15:41:54 +0000 (15:41 +0000)]
[AST][OpenMP] OpenMP Sections / Section constructs contain Structured blocks

Summary:
I'm working on a clang-tidy check, much like existing [[ http://clang.llvm.org/extra/clang-tidy/checks/bugprone-exception-escape.html | bugprone-exception-escape ]],
to detect when an exception might escape out of an OpenMP construct it isn't supposed to escape from.
For that i will be using the `nothrow` bit of `CapturedDecl`s.

While that bit is already correctly set for some constructs, e.g. `#pragma omp parallel`: https://godbolt.org/z/2La7pv
it isn't set for the `#pragma omp sections`, or `#pragma omp section`: https://godbolt.org/z/qZ-EbP

If i'm reading [[ https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5.0.pdf | `OpenMP Application Programming Interface Version 5.0 November 2018` ]] correctly,
they should be, as per `2.8.1 sections Construct`, starting with page 86:
* The sections construct is a non-iterative worksharing construct that contains a set of **structured blocks**
  that are to be distributed among and executed by the threads in a team. Each **structured block** is executed
  once by one of the threads in the team in the context of its implicit task.
* The syntax of the sections construct is as follows:
  #pragma omp sections [clause[ [,] clause] ... ] new-line
    {
      [#pragma omp section new-line]
        **structured-block**
   ...
* Description
  Each **structured block** in the sections construct is preceded by a section directive except
  possibly **the first block**, for which a preceding section directive is optional.

* Restrictions
  • The code enclosed in a sections construct must be a **structured block**.
  * A throw executed inside a sections region must cause execution to resume within the same
    section of the sections region, and the same thread that threw the exception must catch it.

Reviewers: ABataev, #openmp

Reviewed By: ABataev

Subscribers: guansong, openmp-commits, cfe-commits

Tags: #clang, #openmp

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

llvm-svn: 352882

5 years ago[CMake] External compiler-rt-configure requires LLVMTestingSupport when including...
Stefan Granitz [Fri, 1 Feb 2019 15:35:25 +0000 (15:35 +0000)]
[CMake] External compiler-rt-configure requires LLVMTestingSupport when including tests

Summary:
Apparently `LLVMTestingSupport` must be built before `llvm-config` can be asked for it. Symptom with `LLVM_INCLUDE_TESTS=ON` is:
```
$ ./path/to/llvm-build/bin/llvm-config --ldflags --libs testingsupport
-L/path/to/llvm-build/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names
llvm-config: error: component libraries and shared library

llvm-config: error: missing: /path/to/llvm-build/lib/libLLVMTestingSupport.a
```

With `LLVMTestingSupport` as dependency of `compiler-rt-configure` we get the expected behavior:
```
$ ./path/to/llvm-build/bin/llvm-config --ldflags --libs testingsupport
-L/path/to/llvm-build/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names
-lLLVMTestingSupport -lLLVMSupport -lLLVMDemangle
```

Reviewers: ab, beanz

Subscribers: dberris, mgorny, erik.pilkington, llvm-commits, cfe-commits

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

llvm-svn: 352881

5 years ago[TargetLowering] try harder to determine undef elements of vector binops
Sanjay Patel [Fri, 1 Feb 2019 15:35:12 +0000 (15:35 +0000)]
[TargetLowering] try harder to determine undef elements of vector binops

This might be the start of tracking all vector element constants generally if we take it to its
logical conclusion, but let's stop here and make sure this is correct/beneficial so far.

The affected tests require a convoluted path before they get simplified currently because we
don't call SimplifyDemandedVectorElts() from binops directly and don't modify the binop operands
directly in SimplifyDemandedVectorElts().

That's why the tests all have a trailing shuffle to induce a chain reaction of transforms. So
something like this is happening:

1. Improve the knowledge of undefs in the binop via a SimplifyDemandedVectorElts() call that
   originates from a shuffle.
2. Transfer that undef knowledge back to the shuffle mask user as more undef lanes.
3. Combine the modified shuffle by calling SimplifyDemandedVectorElts() again.
4. Translate the improved shuffle mask as undemanded lanes of build vector constants causing
   those to become full undef constants.
5. Simplify the binop now that it has a full undef operand.

As we can see from the unchanged 'and' and 'or' tests, tracking undefs alone isn't a full solution.
We would need to track zero and all-ones constants to improve those opcodes. We'd probably need to
track NaN for FP ops too (assuming we don't have fast-math-flags set).

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

llvm-svn: 352880

5 years ago[X86][AVX] Combine INSERT_SUBVECTOR(SRC0, BITCAST(SHUFFLE(EXTRACT_SUBVECTOR(SRC1)))
Simon Pilgrim [Fri, 1 Feb 2019 15:31:01 +0000 (15:31 +0000)]
[X86][AVX] Combine INSERT_SUBVECTOR(SRC0, BITCAST(SHUFFLE(EXTRACT_SUBVECTOR(SRC1)))

Enable peeking through one use bitcasts to the subvector shuffle.

This still depends on the subvector being the same scalar-size but D57514 has already helped with the more tricky patterns

llvm-svn: 352879

5 years ago[llvm-strip] Implement --keep-file-symbols
Eugene Leviant [Fri, 1 Feb 2019 15:25:15 +0000 (15:25 +0000)]
[llvm-strip] Implement --keep-file-symbols

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

llvm-svn: 352878

5 years ago[llvm-objcopy][NFC] Propagate errors in removeSymbols/removeSectionReferences
Jordan Rupprecht [Fri, 1 Feb 2019 15:20:36 +0000 (15:20 +0000)]
[llvm-objcopy][NFC] Propagate errors in removeSymbols/removeSectionReferences

Reviewers: jhenderson, alexshap, jakehehrlich, espindola

Reviewed By: jhenderson

Subscribers: emaste, arichardson, llvm-commits

Tags: #llvm

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

llvm-svn: 352877

5 years ago[clangd] Expose SelectionTree to code tweaks, and use it for swap if branches.
Sam McCall [Fri, 1 Feb 2019 15:09:47 +0000 (15:09 +0000)]
[clangd] Expose SelectionTree to code tweaks, and use it for swap if branches.

Summary:
This reduces the per-check implementation burden and redundant work.
It also makes checks range-aware by default (treating the commonAncestor
as if it were a point selection should be good baseline behavior).

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet

Tags: #clang

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

llvm-svn: 352876

5 years ago[clangd] Lib to compute and represent selection under cursor.
Sam McCall [Fri, 1 Feb 2019 15:09:41 +0000 (15:09 +0000)]
[clangd] Lib to compute and represent selection under cursor.

Summary:
The primary problem this solves is to expose the codeAction selection to
AST-based refactorings in a way that makes it easy and efficient for them to
bind to the right parts of the AST.

It should also allow us to make XRefs based features (textDocument/definition)
more robust, more easily implement textDocument/typeDefinition etc.
As an example, template parameter references can be identified without special
handling.
There should be slight speedup too: we can prune most of the AST traversal
in most cases.

Elephant in the room: this is similar-but-different to Tooling/Refactoring/ASTSelection.
That captures a smaller set of AST nodes, has a slightly different way of
representing selections, and generally has mare features and does more work.
The overall shape is pretty similar, and yet I can't quite get to behave as I
expect.

Reviewers: ilya-biryukov, kadircet

Subscribers: mgorny, ioeric, MaskRay, jkorous, mgrang, arphaman

Tags: #clang

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

llvm-svn: 352875

5 years ago[clangd] Lib to compute and represent selection under cursor.
Sam McCall [Fri, 1 Feb 2019 15:05:11 +0000 (15:05 +0000)]
[clangd] Lib to compute and represent selection under cursor.

Summary:
The primary problem this solves is to expose the codeAction selection to
AST-based refactorings in a way that makes it easy and efficient for them to
bind to the right parts of the AST.

It should also allow us to make XRefs based features (textDocument/definition)
more robust, more easily implement textDocument/typeDefinition etc.
As an example, template parameter references can be identified without special
handling.
There should be slight speedup too: we can prune most of the AST traversal
in most cases.

Elephant in the room: this is similar-but-different to Tooling/Refactoring/ASTSelection.
That captures a smaller set of AST nodes, has a slightly different way of
representing selections, and generally has mare features and does more work.
The overall shape is pretty similar, and yet I can't quite get to behave as I
expect.

Reviewers: ilya-biryukov, kadircet

Subscribers: mgorny, ioeric, MaskRay, jkorous, mgrang, arphaman

Tags: #clang

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

llvm-svn: 352874

5 years ago[InstCombine] reduce duplicate code; NFC
Sanjay Patel [Fri, 1 Feb 2019 14:37:49 +0000 (14:37 +0000)]
[InstCombine] reduce duplicate code; NFC

An unused variable problem was introduced with rL352870
and stubbed out with rL352871, but we can make a better
fix by actually using the local variable in code rather
than just the assert.

llvm-svn: 352873

5 years ago[libclang] Fix -DBUILD_SHARED_LIBS=on build after rC352803
Fangrui Song [Fri, 1 Feb 2019 14:31:01 +0000 (14:31 +0000)]
[libclang] Fix -DBUILD_SHARED_LIBS=on build after rC352803

llvm-svn: 352872

5 years ago[InstCombine] Fix -Wunused-variable when -DLLVM_ENABLE_ASSERTIONS=off
Fangrui Song [Fri, 1 Feb 2019 14:22:02 +0000 (14:22 +0000)]
[InstCombine] Fix -Wunused-variable when -DLLVM_ENABLE_ASSERTIONS=off

llvm-svn: 352871

5 years ago[InstCombine] try to reduce x86 addcarry to generic uaddo intrinsic
Sanjay Patel [Fri, 1 Feb 2019 14:14:47 +0000 (14:14 +0000)]
[InstCombine] try to reduce x86 addcarry to generic uaddo intrinsic

If we can reduce the x86-specific intrinsic to the generic op, it allows existing
simplifications and value tracking folds. AFAICT, this always results in identical
x86 codegen in the non-reduced case...which should be true because we semi-generically
(too aggressively IMO) convert to llvm.uadd.with.overflow in CGP, so the DAG/isel must
already combine/lower this intrinsic as expected.

This isn't quite what was requested in:
https://bugs.llvm.org/show_bug.cgi?id=40486
...but we want to have these kinds of folds early for efficiency and to enable greater
simplifications. For the case in the bug report where we have:
_addcarry_u64(0, ahi, 0, &ahi)
...this gets completely simplified away in IR.

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

llvm-svn: 352870

5 years ago[CMake] Add install targets for utilities to LLVM exports if LLVM_INSTALL_UTILS=ON
Stefan Granitz [Fri, 1 Feb 2019 13:08:09 +0000 (13:08 +0000)]
[CMake] Add install targets for utilities to LLVM exports if LLVM_INSTALL_UTILS=ON

Summary: D56606 was only appending target names to the `LLVM_EXPORTS`/`LLVM_EXPORTS_BUILDTREE_ONLY` properties. Targets showed up correctly in the build-tree `LLVMExports.cmake`, but they were missing in the installed one (as we found in https://bugs.llvm.org/show_bug.cgi?id=40443), because install did not register them explicitly.

Reviewers: mgorny, smeenai, beanz, gottesmm, dschuff, tstellar, serge-sans-paille

Reviewed By: smeenai

Subscribers: llvm-commits

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

llvm-svn: 352869

5 years ago[clangd] Penalize file-scope symbols in the ranking for non-completion queries
Sam McCall [Fri, 1 Feb 2019 13:07:37 +0000 (13:07 +0000)]
[clangd] Penalize file-scope symbols in the ranking for non-completion queries

Patch by Nathan Ridge!

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

llvm-svn: 352868

5 years ago[AArch64] Optimize floating point materialization
Adhemerval Zanella [Fri, 1 Feb 2019 12:26:06 +0000 (12:26 +0000)]
[AArch64] Optimize floating point materialization

This patch changes isFPImmLegal to return if the value can be enconded
as the immediate operand of a logical instruction besides checking if
for immediate field for fmov.

This optimizes some floating point materization, inclusive values
used on isinf lowering.

Reviewed By: rengolin, efriedma, evandro

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

llvm-svn: 352866

5 years ago[CUDA] Relax lit test condition after r352798.
Eric Liu [Fri, 1 Feb 2019 11:36:23 +0000 (11:36 +0000)]
[CUDA] Relax lit test condition after r352798.

Clang executable doesn't match clang.* in all test environment.

llvm-svn: 352865

5 years ago[clangd] Implement textDocument/declaration from LSP 3.14
Sam McCall [Fri, 1 Feb 2019 11:26:13 +0000 (11:26 +0000)]
[clangd] Implement textDocument/declaration from LSP 3.14

Summary:
LSP now reflects the declaration/definition distinction.

Language server changes:
 - textDocument/definition now returns a definition if one is found, otherwise
   the declaration. It no longer returns declaration + definition if they are
   distinct.
 - textDocument/declaration returns the best declaration we can find.
 - For macros, the active macro definition is returned for both methods.
 - For include directive, the top of the target file is returned for both.
There doesn't appear to be a discovery mechanism (we can't return everything to
clients that only know about definition), so this changes existing behavior.
In practice, it should greatly reduce the fraction of the time we need to show
the user a menu of options.

C++ API changes:
 - findDefinitions is replaced by locateSymbolAt, which returns a
   vector<LocatedSymbol> - one for each symbol under the cursor.
 - this contains the preferred declaration, the definition (if found), and
   the symbol name
This API enables some potentially-neat extensions, like swapping between decl
and def, and exposing the symbol name to the UI in the case of multiple symbols.

Reviewers: hokein

Subscribers: ilya-biryukov, javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 352864

5 years ago[clangd] Use delimited style to make life easier for the fuzzer
Sam McCall [Fri, 1 Feb 2019 11:20:20 +0000 (11:20 +0000)]
[clangd] Use delimited style to make life easier for the fuzzer

llvm-svn: 352863

5 years agoDisable tidy checks with too many hits
Ilya Biryukov [Fri, 1 Feb 2019 11:20:13 +0000 (11:20 +0000)]
Disable tidy checks with too many hits

Summary:
Some tidy checks have too many hits in the codebase, making it hard to spot
other results from clang-tidy, therefore rendering the tool less useful.

Two checks were disabled:
  - misc-non-private-member-variable-in-classes in the whole LLVM monorepo,
    it is very common to have those in LLVM and the style guide does not forbid
    them.
  - readability-identifier-naming in the clang subtree. There are thousands of
    violations in 'Sema.h' alone.

Before the change, 'Sema.h' had >1000 tidy warnings, after the change the number
dropped to 3 warnings (unterminated namespace comments).

Reviewers: alexfh, hokein

Reviewed By: hokein

Subscribers: llvm-commits, cfe-commits

Tags: #clang, #llvm

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

llvm-svn: 352862

5 years ago[X86][BdVer2] Transfer delays from the integer to the floating point unit.
Roman Lebedev [Fri, 1 Feb 2019 11:15:13 +0000 (11:15 +0000)]
[X86][BdVer2] Transfer delays from the integer to the floating point unit.

Summary:
I'm unable to find this number in the "AMD SOG for family 15h".
llvm-exegesis measures the latencies of these instructions as `2`,
which matches the latencies specified in "AMD SOG for family 15h".

However if we look at Agner, Microarchitecture, "AMD Bulldozer, Piledriver,
Steamroller and Excavator pipeline", "Data delay between different execution
domains", the int->ivec transfer is listed as `8`..`10`cy of additional latency.

Also, Agner's "Instruction tables", for Piledriver, lists their latencies as `12`,
which is consistent with `2cy` from exegesis / AMD SOG + `10cy` transfer delay.

Additional data point comes from the fact that Agner's "Instruction tables",
for Jaguar, lists their latencies as `8`; and "AMD SOG for family 16h" does
state the `+6cy` int->ivec delay, which is consistent with instr latency of `1` or `2`.

Reviewers: andreadb, RKSimon, craig.topper

Reviewed By: andreadb

Subscribers: gbedwell, courbet, llvm-commits

Tags: #llvm

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

llvm-svn: 352861

5 years ago[PDB] Fix build after r352845
Aleksandr Urakov [Fri, 1 Feb 2019 11:10:28 +0000 (11:10 +0000)]
[PDB] Fix build after r352845

llvm-svn: 352858

5 years ago[clangd] Unbreak fuzzer target
Sam McCall [Fri, 1 Feb 2019 11:09:06 +0000 (11:09 +0000)]
[clangd] Unbreak fuzzer target

llvm-svn: 352857

5 years agoProvide reason messages for unviable inlining
Yevgeny Rouban [Fri, 1 Feb 2019 10:44:43 +0000 (10:44 +0000)]
Provide reason messages for unviable inlining

InlineCost's isInlineViable() is changed to return InlineResult
instead of bool. This provides messages for failure reasons and
allows to get more specific messages for cases where callsites
are not viable for inlining.

Reviewed By: xbolva00, anemet

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

llvm-svn: 352849

5 years agoRevert r352750.
James Henderson [Fri, 1 Feb 2019 10:38:40 +0000 (10:38 +0000)]
Revert r352750.

This was causing a build bot failure:
http://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/15346/

llvm-svn: 352848

5 years ago[llvm-symbolizer][test] Rename and tweak tests using llvm-symbolizer
James Henderson [Fri, 1 Feb 2019 10:24:55 +0000 (10:24 +0000)]
[llvm-symbolizer][test] Rename and tweak tests using llvm-symbolizer

Prior to this change, there are a few tests called llvm-symbolizer* in
the DebugInfo test area. These really were testing either the DebugInfo
or Symbolizer library, rather than the llvm-symbolizer tool itself, so
this patch renames them to be clearer that they aren't explicitly tests
for llvm-symbolizer (such tests belong in test/tools/llvm-symbolizer).

This patch also reinstates the copying of a DWO file, removed previously
in r352752. The test needs this so that it could possibly fail.

Finally, some of the tests have been simplified slightly by removing
unnecessary switches and/or unused check-prefixes.

Reviewed by: dblaikie

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

llvm-svn: 352847

5 years ago[doc]Update String Error documentation in Programmer Manual
James Henderson [Fri, 1 Feb 2019 10:02:42 +0000 (10:02 +0000)]
[doc]Update String Error documentation in Programmer Manual

A while back, createStringError was added to provide easier construction
of StringError instances, especially with formatting options. Prior to
this patch, that the documentation only mentions the standard method of
using it. Since createStringError is slightly shorter to type, and also
provides the formatting options, this patch updates the Programmer's
Manual to use the new function in its examples, and to mention the
printf formatting options. It also fixes a small typo in one of the
examples and removes the unnecessary make_error_code call.

llvm-svn: 352846

5 years ago[PDB] Fix location retrieval for function local variables and arguments that are
Aleksandr Urakov [Fri, 1 Feb 2019 10:01:18 +0000 (10:01 +0000)]
[PDB] Fix location retrieval for function local variables and arguments that are
stored relative to VFRAME

Summary:
This patch makes LLDB able to retrieve proper values for function arguments and
local variables stored in PDB relative to VFRAME register.

Patch contains retrieval of corresponding FPO table entries from PDB and a
generic translator from FPO programs to DWARF expressions to get correct VFRAME
value.

Patch also improves variables-locations.test and makes this test passable on
x86.

Patch By: leonid.mashinsky

Reviewers: zturner, asmith, stella.stamenova, aleksandr.urakov

Reviewed By: zturner

Subscribers: arphaman, labath, mgorny, aprantl, JDevlieghere, lldb-commits

Tags: #lldb

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

llvm-svn: 352845

5 years ago[CodeGen] Don't scavenge non-saved regs in exception throwing functions
Oliver Stannard [Fri, 1 Feb 2019 09:23:51 +0000 (09:23 +0000)]
[CodeGen] Don't scavenge non-saved regs in exception throwing functions

Previously, LiveRegUnits was assuming that if a block has no successors
and does not return, then no registers are live at the end of it
(because the end of the block is unreachable). This was causing the
register scavenger to use callee-saved registers to materialise stack
frame addresses without saving them in the prologue. This would normally
be fine, because the end of the block is unreachable, but this is not
legal if the block ends by throwing a C++ exception. If this happens,
the scratch register will be modified, but its previous value won't be
preserved, so it doesn't get restored by the exception unwinder.

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

llvm-svn: 352844

5 years ago[clangd] clangDaemonTweaks - fix -DBUILD_SHARED_LIBS=ON build
Roman Lebedev [Fri, 1 Feb 2019 08:58:37 +0000 (08:58 +0000)]
[clangd] clangDaemonTweaks - fix -DBUILD_SHARED_LIBS=ON build

Followup for rL352841.

llvm-svn: 352843

5 years agoTest commit: fix typo
Sergi Mateo Bellido [Fri, 1 Feb 2019 08:39:01 +0000 (08:39 +0000)]
Test commit: fix typo

llvm-svn: 352842

5 years ago[clangd] Fix -DBUILD_SHARED_LIBS=ON build - SwapIfBranches needs clangAST.
Roman Lebedev [Fri, 1 Feb 2019 08:23:23 +0000 (08:23 +0000)]
[clangd] Fix -DBUILD_SHARED_LIBS=ON build - SwapIfBranches needs clangAST.

Else, fails with:

[1/2] Linking CXX executable bin/clangd
FAILED: bin/clangd
: && /usr/bin/g++  -pipe -O2 -g0 -UNDEBUG -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -pipe -O2 -g0 -UNDEBUG  -fuse-ld=lld -Wl,--color-diagnostics -Wl,-allow-shlib-undefined     -Wl,-O3 -Wl,--gc-sections tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/SwapIfBranches.cpp.o tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o  -o bin/clangd  -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMSupport.so.9svn -lpthread lib/libclangBasic.so.9svn lib/libclangTidy.so.9svn lib/libclangDaemon.so.9svn lib/libclangFormat.so.9svn lib/libclangFrontend.so.9svn lib/libclangSema.so.9svn lib/libclangTooling.so.9svn lib/libclangToolingCore.so.9svn && :
ld.lld: error: undefined symbol: clang::FunctionDecl::getBody(clang::FunctionDecl const*&) const
>>> referenced by SwapIfBranches.cpp
>>>               tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/SwapIfBranches.cpp.o:(clang::FunctionDecl::getBody() const)

and so on.

llvm-svn: 352841

5 years ago[obj2yaml] - Merge dumpRelSection and dumpRelaSection. NFC.
George Rimar [Fri, 1 Feb 2019 07:50:08 +0000 (07:50 +0000)]
[obj2yaml] - Merge dumpRelSection and dumpRelaSection. NFC.

These methods are very similar, patch merge them into one.

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

llvm-svn: 352840

5 years ago[SLPVectorizer] Get rid of IndexQueue array from vectorizeStores. NFCI.
Yevgeny Rouban [Fri, 1 Feb 2019 06:44:08 +0000 (06:44 +0000)]
[SLPVectorizer] Get rid of IndexQueue array from vectorizeStores. NFCI.

Indices are checked as they are generated. No need to fill the whole array of indices.

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

llvm-svn: 352839

5 years agoFix isInSystemMacro to handle pasted macros
Serge Guelton [Fri, 1 Feb 2019 06:11:44 +0000 (06:11 +0000)]
Fix isInSystemMacro to handle pasted macros

Token pasted by the preprocessor (through ##) have a Spelling pointing to scratch buffer.
As a result they are not recognized at system macro, even though the pasting happened in
a system macro. Fix that by looking into the parent macro if the original lookup finds a
scratch buffer.

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

This effectively fixes https://bugs.llvm.org/show_bug.cgi?id=35268,

llvm-svn: 352838

5 years ago[clangd] Fix crash in applyTweak, remove TweakID alias.
Sam McCall [Fri, 1 Feb 2019 05:41:50 +0000 (05:41 +0000)]
[clangd] Fix crash in applyTweak, remove TweakID alias.

Strings are complicated, giving them opaque names makes us forget
they're complicated.

llvm-svn: 352837

5 years agoRevert "Bump minimum toolchain version"
JF Bastien [Fri, 1 Feb 2019 04:44:39 +0000 (04:44 +0000)]
Revert "Bump minimum toolchain version"

Looks like we still have a few bots that are sad. Let try to get them fixed!

llvm-svn: 352835

5 years agoBump minimum toolchain version
JF Bastien [Fri, 1 Feb 2019 04:33:21 +0000 (04:33 +0000)]
Bump minimum toolchain version

Summary:
The RFC on moving past C++11 got good traction:
  http://lists.llvm.org/pipermail/llvm-dev/2019-January/129452.html

This patch therefore bumps the toolchain versions according to our policy:
  llvm.org/docs/DeveloperPolicy.html#toolchain

Subscribers: mgorny, jkorous, dexonsmith, llvm-commits, mehdi_amini, jyknight, rsmith, chandlerc, smeenai, hans, reames, lattner, lhames, erichkeane

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

llvm-svn: 352834

5 years ago[RISCV] Implement RV64D codegen
Alex Bradbury [Fri, 1 Feb 2019 03:53:30 +0000 (03:53 +0000)]
[RISCV] Implement RV64D codegen

This patch:
* Adds necessary RV64D codegen patterns
* Modifies CC_RISCV so it will properly handle f64 types (with soft float ABI)

Note that in general there is no reason to try to select fcvt.w[u].d rather than fcvt.l[u].d for i32 conversions because fptosi/fptoui produce poison if the input won't fit into the target type.

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

llvm-svn: 352833

5 years ago[SelectionDAG] Support promotion of the FPOWI integer operand
Alex Bradbury [Fri, 1 Feb 2019 03:46:28 +0000 (03:46 +0000)]
[SelectionDAG] Support promotion of the FPOWI integer operand

For targets where i32 is not a legal type (e.g. 64-bit RISC-V),
LegalizeIntegerTypes must promote the integer operand of ISD::FPOWI. As this
is a signed value, this should be sign-extended.

This patch enables all tests in test/CodeGen/RISCVfloat-intrinsics.ll for
RV64, as prior to this patch that file couldn't be compiled for RV64 due to an
assertion when performing codegen for fpowi.

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

llvm-svn: 352832

5 years ago[SemaCXX] Param diagnostic matches overload logic
Brian Gesiak [Fri, 1 Feb 2019 03:30:29 +0000 (03:30 +0000)]
[SemaCXX] Param diagnostic matches overload logic

Summary:
Given the following test program:

```
class C {
public:
  int A(int a, int& b);
};

int C::A(const int a, int b) {
  return a * b;
}
```

Clang would produce an error message that correctly diagnosed the
redeclaration of `C::A` to not match the original declaration (the
parameters to the two declarations do not match -- the original takes an
`int &` as its 2nd parameter, but the redeclaration takes an `int`). However,
it also produced a note diagnostic that inaccurately pointed to the
first parameter, claiming that `const int` in the redeclaration did not
match the unqualified `int` in the original. The diagnostic is
misleading because it has nothing to do with why the program does not
compile.

The logic for checking for a function overload, in
`Sema::FunctionParamTypesAreEqual`, discards cv-qualifiers before
checking whether the types are equal. Do the same when producing the
overload diagnostic.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cpplearner, cfe-commits

Tags: #clang

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

llvm-svn: 352831

5 years agoFix compilation of examples after 13680223b9d8 / r352827
James Y Knight [Fri, 1 Feb 2019 03:23:42 +0000 (03:23 +0000)]
Fix compilation of examples after 13680223b9d8 / r352827

Who knew...they're not built by default or as part of the tests.

llvm-svn: 352830

5 years ago[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn...
Julian Lettner [Fri, 1 Feb 2019 02:51:00 +0000 (02:51 +0000)]
[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls

Summary:
UBSan wants to detect when unreachable code is actually reached, so it
adds instrumentation before every unreachable instruction. However, the
optimizer will remove code after calls to functions marked with
noreturn. To avoid this UBSan removes noreturn from both the call
instruction as well as from the function itself. Unfortunately, ASan
relies on this annotation to unpoison the stack by inserting calls to
_asan_handle_no_return before noreturn functions. This is important for
functions that do not return but access the the stack memory, e.g.,
unwinder functions *like* longjmp (longjmp itself is actually
"double-proofed" via its interceptor). The result is that when ASan and
UBSan are combined, the noreturn attributes are missing and ASan cannot
unpoison the stack, so it has false positives when stack unwinding is
used.

Changes:
Clang-CodeGen now directly insert calls to `__asan_handle_no_return`
when a call to a noreturn function is encountered and both
UBsan-unreachable and ASan are enabled. This allows UBSan to continue
removing the noreturn attribute from functions without any changes to
the ASan pass.

Previously generated code:
```
  call void @longjmp
  call void @__asan_handle_no_return
  call void @__ubsan_handle_builtin_unreachable
```

Generated code (for now):
```
  call void @__asan_handle_no_return
  call void @longjmp
  call void @__asan_handle_no_return
  call void @__ubsan_handle_builtin_unreachable
```

rdar://problem/40723397

Reviewers: delcypher, eugenis, vsk

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

> llvm-svn: 352690

llvm-svn: 352829

5 years ago[WebAssembly] Support imports from custom module names
Sam Clegg [Fri, 1 Feb 2019 02:29:57 +0000 (02:29 +0000)]
[WebAssembly] Support imports from custom module names

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

This is only a first pass at supporting these custom import
modules.  In the long run we most likely want to treat these
kinds of symbols very differently.  For example, it should not
be possible to resolve such as symbol at static link type.

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

llvm-svn: 352828

5 years ago[opaque pointer types] Add a FunctionCallee wrapper type, and use it.
James Y Knight [Fri, 1 Feb 2019 02:28:03 +0000 (02:28 +0000)]
[opaque pointer types] Add a FunctionCallee wrapper type, and use it.

Recommit r352791 after tweaking DerivedTypes.h slightly, so that gcc
doesn't choke on it, hopefully.

Original Message:
The FunctionCallee type is effectively a {FunctionType*,Value*} pair,
and is a useful convenience to enable code to continue passing the
result of getOrInsertFunction() through to EmitCall, even once pointer
types lose their pointee-type.

Then:
- update the CallInst/InvokeInst instruction creation functions to
  take a Callee,
- modify getOrInsertFunction to return FunctionCallee, and
- update all callers appropriately.

One area of particular note is the change to the sanitizer
code. Previously, they had been casting the result of
`getOrInsertFunction` to a `Function*` via
`checkSanitizerInterfaceFunction`, and storing that. That would report
an error if someone had already inserted a function declaraction with
a mismatching signature.

However, in general, LLVM allows for such mismatches, as
`getOrInsertFunction` will automatically insert a bitcast if
needed. As part of this cleanup, cause the sanitizer code to do the
same. (It will call its functions using the expected signature,
however they may have been declared.)

Finally, in a small number of locations, callers of
`getOrInsertFunction` actually were expecting/requiring that a brand
new function was being created. In such cases, I've switched them to
Function::Create instead.

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

llvm-svn: 352827

5 years ago[ELF] Support --{,no-}allow-shlib-undefined
Fangrui Song [Fri, 1 Feb 2019 02:25:05 +0000 (02:25 +0000)]
[ELF] Support --{,no-}allow-shlib-undefined

Summary:
In ld.bfd/gold, --no-allow-shlib-undefined is the default when linking
an executable. This patch implements a check to error on undefined
symbols in a shared object, if all of its DT_NEEDED entries are seen.

Our approach resembles the one used in gold, achieves a good balance to
be useful but not too smart (ld.bfd traces all DSOs and emulates the
behavior of a dynamic linker to catch more cases).

The error is issued based on the symbol table, different from undefined
reference errors issued for relocations. It is most effective when there
are DSOs that were not linked with -z defs (e.g. when static sanitizers
runtime is used).

gold has a comment that some system libraries on GNU/Linux may have
spurious undefined references and thus system libraries should be
excluded (https://sourceware.org/bugzilla/show_bug.cgi?id=6811). The
story may have changed now but we make --allow-shlib-undefined the
default for now. Its interaction with -shared can be discussed in the
future.

Reviewers: ruiu, grimar, pcc, espindola

Reviewed By: ruiu

Subscribers: joerg, emaste, arichardson, llvm-commits

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

llvm-svn: 352826

5 years agoFix names of functions in TargetOptionsCommandFlags.h. NFC.
Sam Clegg [Fri, 1 Feb 2019 02:24:50 +0000 (02:24 +0000)]
Fix names of functions in TargetOptionsCommandFlags.h. NFC.

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

llvm-svn: 352825

5 years ago[analyzer] [RetainCountChecker] Fix object type for CF/Obj-C bridged casts
George Karpenkov [Fri, 1 Feb 2019 02:13:02 +0000 (02:13 +0000)]
[analyzer] [RetainCountChecker] Fix object type for CF/Obj-C bridged casts

Having an incorrect type for a cast causes the checker to incorrectly
dismiss the operation under ARC, leading to a false positive
use-after-release on the test.

rdar://47709885

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

llvm-svn: 352824

5 years agoMark __rela_iplt_{start,end} as weak.
Peter Collingbourne [Fri, 1 Feb 2019 00:43:31 +0000 (00:43 +0000)]
Mark __rela_iplt_{start,end} as weak.

Should fix non-lld links.

llvm-svn: 352823

5 years agoRevert "[Sema] Make canPassInRegisters return true if the CXXRecordDecl passed"
Akira Hatanaka [Fri, 1 Feb 2019 00:12:06 +0000 (00:12 +0000)]
Revert "[Sema] Make canPassInRegisters return true if the CXXRecordDecl passed"

This reverts commit r350920 as it is not clear whether we should force a
class to be returned in registers when copy and move constructors are
both deleted.

For more background, see the following discussion:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20190128/259907.html

llvm-svn: 352822

5 years ago[x86] adjust test to show both add/inc options; NFC
Sanjay Patel [Fri, 1 Feb 2019 00:07:20 +0000 (00:07 +0000)]
[x86] adjust test to show both add/inc options; NFC

If we're optimizing for size, that overrides the subtarget
feature, so we would always produce 'inc' if we matched
this pattern.

llvm-svn: 352821

5 years ago[x86] add test for missed opportunity to use 'inc'; NFC
Sanjay Patel [Thu, 31 Jan 2019 23:46:58 +0000 (23:46 +0000)]
[x86] add test for missed opportunity to use 'inc'; NFC

Another pattern exposed in D57516.

llvm-svn: 352820

5 years ago[libFuzzer] make a test for exploding dfsan labels more agressive
Kostya Serebryany [Thu, 31 Jan 2019 23:43:54 +0000 (23:43 +0000)]
[libFuzzer] make a test for exploding dfsan labels more agressive

llvm-svn: 352819

5 years ago[sanitizer-coverage] prune trace-cmp instrumentation for CMP isntructions that feed...
Kostya Serebryany [Thu, 31 Jan 2019 23:43:00 +0000 (23:43 +0000)]
[sanitizer-coverage] prune trace-cmp instrumentation for CMP isntructions that feed into the backedge branch. Instrumenting these CMP instructions is almost always useless (and harmful) for fuzzing

llvm-svn: 352818

5 years agoGlobalISel: Fix MMO creation with non-power-of-2 mem size
Matt Arsenault [Thu, 31 Jan 2019 23:41:23 +0000 (23:41 +0000)]
GlobalISel: Fix MMO creation with non-power-of-2 mem size

It should probably just be mandatory for getTgtMemIntrinsic to return
the alignment.

llvm-svn: 352817

5 years agohwasan: Add __hwasan_init_static() function.
Peter Collingbourne [Thu, 31 Jan 2019 23:37:12 +0000 (23:37 +0000)]
hwasan: Add __hwasan_init_static() function.

This function initializes enough of the runtime to be able to run
instrumented code in a statically linked executable. It replaces
__hwasan_shadow_init() which wasn't doing enough initialization for
instrumented code that uses either TLS or IFUNC to work.

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

llvm-svn: 352816

5 years ago[libFuzzer][Windows] Temporarily disable value-profile-cmp2.test on Win
Jonathan Metzman [Thu, 31 Jan 2019 23:34:56 +0000 (23:34 +0000)]
[libFuzzer][Windows] Temporarily disable value-profile-cmp2.test on Win

Summary:
Temporarily disable value-profile-cmp2.test on Win.
https://reviews.llvm.org/D57465 causes the test to fail on Win.
However, it seems that the behavior of libFuzzer on Win was broken
before that patch. It crashes in the exit handler when not used with
ASAN. Prior to the patch, the crash handler would run, tricking the
test into thinking libFuzzer on Win had exited properly.

Reviewers: morehouse, vitalybuka

Reviewed By: morehouse

Subscribers: yln

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

llvm-svn: 352815

5 years agoRevert "Bump minimum toolchain version"
JF Bastien [Thu, 31 Jan 2019 23:29:39 +0000 (23:29 +0000)]
Revert "Bump minimum toolchain version"

A handful of bots are still breaking, either because I missed them in my audit,
they were offline, or something else. I'm contacting their authors, but I'll
revert for now and re-commit later.

llvm-svn: 352814

5 years ago[WebAssembly] Fix a regression selecting negative build_vector lanes
Thomas Lively [Thu, 31 Jan 2019 23:22:39 +0000 (23:22 +0000)]
[WebAssembly] Fix a regression selecting negative build_vector lanes

Summary:
The custom lowering introduced in rL352592 creates build_vector nodes
with negative i32 operands, but these operands did not meet the value
range constraints necessary to match build_vector nodes. This CL fixes
the issue by removing the unnecessary constraints.

Reviewers: aheejin

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

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

llvm-svn: 352813

5 years agoDeveloperPolicy: update toolchain with sample RFC / patch
JF Bastien [Thu, 31 Jan 2019 23:18:11 +0000 (23:18 +0000)]
DeveloperPolicy: update toolchain with sample RFC / patch

As was suggested when the policy originally went in.

llvm-svn: 352812

5 years agoBump minimum toolchain version
JF Bastien [Thu, 31 Jan 2019 23:13:10 +0000 (23:13 +0000)]
Bump minimum toolchain version

Summary:
The RFC on moving past C++11 got good traction:
  http://lists.llvm.org/pipermail/llvm-dev/2019-January/129452.html

This patch therefore bumps the toolchain versions according to our policy:
  llvm.org/docs/DeveloperPolicy.html#toolchain

Subscribers: mgorny, jkorous, dexonsmith, llvm-commits, mehdi_amini, jyknight, rsmith, chandlerc, smeenai, hans, reames, lattner, lhames, erichkeane

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

llvm-svn: 352811

5 years agoFixed hasLinkerPrivateGlobalPrefix treating StringRef as C String.
Wouter van Oortmerssen [Thu, 31 Jan 2019 23:03:48 +0000 (23:03 +0000)]
Fixed hasLinkerPrivateGlobalPrefix treating StringRef as C String.

Reviewers: jgravelle-google, sbc100

Subscribers: aheejin, llvm-commits

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

llvm-svn: 352810

5 years agoRe-disable pch-from-libclang.c after 352803, some buildbots are still unhappy
Nico Weber [Thu, 31 Jan 2019 22:57:52 +0000 (22:57 +0000)]
Re-disable pch-from-libclang.c after 352803, some buildbots are still unhappy

llvm-svn: 352809

5 years ago[RISCV] Add RV64F codegen support
Alex Bradbury [Thu, 31 Jan 2019 22:48:38 +0000 (22:48 +0000)]
[RISCV] Add RV64F codegen support

This requires a little extra work due tothe fact i32 is not a legal type. When
call lowering happens post-legalisation (e.g. when an intrinsic was inserted
during legalisation). A bitcast from f32 to i32 can't be introduced. This is
similar to the challenges with RV32D. To handle this, we introduce
target-specific DAG nodes that perform bitcast+anyext for f32->i64 and
trunc+bitcast for i64->f32.

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

llvm-svn: 352807

5 years ago[WebAssembly] MC: Fix for outputing wasm object to /dev/null
Sam Clegg [Thu, 31 Jan 2019 22:38:22 +0000 (22:38 +0000)]
[WebAssembly] MC: Fix for outputing wasm object to /dev/null

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

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

llvm-svn: 352806

5 years ago[x86] add test for missed opportunity to use 'inc'; NFC
Sanjay Patel [Thu, 31 Jan 2019 22:33:11 +0000 (22:33 +0000)]
[x86] add test for missed opportunity to use 'inc'; NFC

llvm-svn: 352805

5 years ago[ASTDump] Make template specialization tests more exact
Stephen Kelly [Thu, 31 Jan 2019 22:28:38 +0000 (22:28 +0000)]
[ASTDump] Make template specialization tests more exact

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 352804

5 years agoMake clang/test/Index/pch-from-libclang.c pass in more places
Nico Weber [Thu, 31 Jan 2019 22:15:32 +0000 (22:15 +0000)]
Make clang/test/Index/pch-from-libclang.c pass in more places

- fixes the test on macOS with LLVM_ENABLE_PIC=OFF
- together with D57343, gets the test to pass on Windows
- makes it run everywhere (it seems to just pass on Linux)

The main change is to pull out the resource directory computation into a
function shared by all 3 places that do it. In CIndexer.cpp, this now works no
matter if libclang is in lib/ or bin/ or statically linked to a binary in bin/.

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

llvm-svn: 352803

5 years ago[Hexagon] Rename textually included file from .h to .inc
Richard Trieu [Thu, 31 Jan 2019 21:58:42 +0000 (21:58 +0000)]
[Hexagon] Rename textually included file from .h to .inc

llvm-svn: 352802

5 years agoDo not copy long double and 128-bit fp format from aux target for AMDGPU
Yaxun Liu [Thu, 31 Jan 2019 21:57:51 +0000 (21:57 +0000)]
Do not copy long double and 128-bit fp format from aux target for AMDGPU

rC352620 caused regressions because it copied floating point format from
aux target.

floating point format decides whether extended long double is supported.
It is x86_fp80 on x86 but IEEE double on amdgcn.

Document usage of long doubel type in HIP programming guide
https://github.com/ROCm-Developer-Tools/HIP/pull/890

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

llvm-svn: 352801