platform/upstream/llvm.git
5 years ago[runtime] Use --strip-all rather than --strip-sections
Petr Hosek [Sun, 10 Mar 2019 04:26:54 +0000 (04:26 +0000)]
[runtime] Use --strip-all rather than --strip-sections

We need to preserve section headers for shared libraries.

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

llvm-svn: 355783

5 years ago[git-llvm] Only use --force-interactive when supported
Shoaib Meenai [Sun, 10 Mar 2019 01:34:42 +0000 (01:34 +0000)]
[git-llvm] Only use --force-interactive when supported

The --force-interactive option was introduced in SVN 1.8, and trying to
pass it to older SVN clients causes an error; CentOS 7 includes SVN 1.7,
for example, so this makes `git llvm` not usable out of the box. Older
clients would be interactive by default anyway [1], so just don't pass
the option if it's not supported.

An alternative would be to check the version instead of checking the
help text, but I think directly detecting the presence of the option is
more direct.

[1] http://svn.apache.org/viewvc?view=revision&revision=1424037

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

llvm-svn: 355782

5 years ago[ValueTracking] Move constant range computation into ValueTracking; NFC
Nikita Popov [Sat, 9 Mar 2019 21:17:42 +0000 (21:17 +0000)]
[ValueTracking] Move constant range computation into ValueTracking; NFC

InstructionSimplify currently has some code to determine the constant
range of integer instructions for some simple cases. It is used to
simplify icmps.

This change moves the relevant code into ValueTracking as
llvm::computeConstantRange(), so it can also be reused for other
purposes.

In particular this is with the optimization of overflow checks in
mind (ref D59071), where constant ranges cover some cases that
known bits don't.

llvm-svn: 355781

5 years agoStop relying on allocator behaviour in modules unit test
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 20:15:01 +0000 (20:15 +0000)]
Stop relying on allocator behaviour in modules unit test

Another fixup for r355778 for Windows bots, this time to stop
accidentally relying on allocator behaviour for the test to pass.

llvm-svn: 355780

5 years agoFix slashes in path references in -Rmodule-import test from r355778
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 19:33:32 +0000 (19:33 +0000)]
Fix slashes in path references in -Rmodule-import test from r355778

Fixup for r355778 to fix all the Windows bots.  Apparently I already
forgot the lesson from r355482 :/.

llvm-svn: 355779

5 years agoModules: Invalidate out-of-date PCMs as they're discovered
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 17:44:01 +0000 (17:44 +0000)]
Modules: Invalidate out-of-date PCMs as they're discovered

Leverage the InMemoryModuleCache to invalidate a module the first time
it fails to import (and to lock a module as soon as it's built or
imported successfully).  For implicit module builds, this optimizes
importing deep graphs where the leaf module is out-of-date; see example
near the end of the commit message.

Previously the cache finalized ("locked in") all modules imported so far
when starting a new module build.  This was sufficient to prevent
loading two versions of the same module, but was somewhat arbitrary and
hard to reason about.

Now the cache explicitly tracks module state, where each module must be
one of:

- Unknown: module not in the cache (yet).
- Tentative: module in the cache, but not yet fully imported.
- ToBuild: module found on disk could not be imported; need to build.
- Final: module in the cache has been successfully built or imported.

Preventing repeated failed imports avoids variation in builds based on
shifting filesystem state.  Now it's guaranteed that a module is loaded
from disk exactly once.  It now seems safe to remove
FileManager::invalidateCache, but I'm leaving that for a later commit.

The new, precise logic uncovered a pre-existing problem in the cache:
the map key is the module filename, and different contexts use different
filenames for the same PCM file.  (In particular, the test
Modules/relative-import-path.c does not build without this commit.
r223577 started using a relative path to describe a module's base
directory when importing it within another module.  As a result, the
module cache sees an absolute path when (a) building the module or
importing it at the top-level, and a relative path when (b) importing
the module underneath another one.)

The "obvious" fix is to resolve paths using FileManager::getVirtualFile
and change the map key for the cache to a FileEntry, but some contexts
(particularly related to ASTUnit) have a shorter lifetime for their
FileManager than the InMemoryModuleCache.  This is worth pursuing
further in a later commit; perhaps by tying together the FileManager and
InMemoryModuleCache lifetime, or moving the in-memory PCM storage into a
VFS layer.

For now, use the PCM's base directory as-written for constructing the
filename to check the ModuleCache.

Example
=======

To understand the build optimization, first consider the build of a
module graph TU -> A -> B -> C -> D with an empty cache:

    TU builds A'
       A' builds B'
          B' builds C'
             C' builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
    TU imports A'
       imports B'
       imports C'
       imports D'

If we build TU again, where A, B, C, and D are in the cache and D is
out-of-date, we would previously get this build:

    TU imports A
       imports B
       imports C
       imports D (out-of-date)
    TU builds A'
       A' imports B
          imports C
          imports D (out-of-date)
          builds B'
          B' imports C
             imports D (out-of-date)
             builds C'
             C' imports D (out-of-date)
                builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
     TU imports A'
        imports B'
        imports C'
        imports D'

After this commit, we'll immediateley invalidate A, B, C, and D when we
first observe that D is out-of-date, giving this build:

    TU imports A
       imports B
       imports C
       imports D (out-of-date)
    TU builds A' // The same graph as an empty cache.
       A' builds B'
          B' builds C'
             C' builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
    TU imports A'
       imports B'
       imports C'
       imports D'

The new build matches what we'd naively expect, pretty closely matching
the original build with the empty cache.

rdar://problem/48545366

llvm-svn: 355778

5 years agoModules: Rename MemoryBufferCache to InMemoryModuleCache
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 17:33:56 +0000 (17:33 +0000)]
Modules: Rename MemoryBufferCache to InMemoryModuleCache

Change MemoryBufferCache to InMemoryModuleCache, moving it from Basic to
Serialization.  Another patch will start using it to manage module build
more explicitly, but this is split out because it's mostly mechanical.

Because of the move to Serialization we can no longer abuse the
Preprocessor to forward it to the ASTReader.  Besides the rename and
file move, that means Preprocessor::Preprocessor has one fewer parameter
and ASTReader::ASTReader has one more.

llvm-svn: 355777

5 years ago[ARM] Use non-constant operand in umulo-32.ll; NFC
Nikita Popov [Sat, 9 Mar 2019 13:43:21 +0000 (13:43 +0000)]
[ARM] Use non-constant operand in umulo-32.ll; NFC

Currently the store+load is folded and both operands of the umulo
end up being constants. To avoid this getting folded away entirely,
make sure at least one operand is non-constant.

Also remove some allocas which don't seem relevant to the test.

llvm-svn: 355776

5 years ago[ARM] Generate test checks for umulo-32.ll; NFC
Nikita Popov [Sat, 9 Mar 2019 13:21:15 +0000 (13:21 +0000)]
[ARM] Generate test checks for umulo-32.ll; NFC

The second test case is going to be changed by D59041, so generate
full baseline checks.

llvm-svn: 355775

5 years ago[lldb] [test] Adjust XFAIL list to match buildbot results
Michal Gorny [Sat, 9 Mar 2019 12:47:38 +0000 (12:47 +0000)]
[lldb] [test] Adjust XFAIL list to match buildbot results

Adjust the XFAIL-ing tests to match consistent results from buildbot.
I'm going to work on differences between them and my local results
following this.

llvm-svn: 355774

5 years ago[RISCV][NFC] Minor refactoring of CC_RISCV
Alex Bradbury [Sat, 9 Mar 2019 11:16:27 +0000 (11:16 +0000)]
[RISCV][NFC] Minor refactoring of CC_RISCV

Immediately check if we need to early-exit as we have a return value that
can't be returned directly. Also tweak following if/else.

llvm-svn: 355773

5 years ago[RISCV][NFC] Split out emitSelectPseudo from EmitInstrWithCustomInserter
Alex Bradbury [Sat, 9 Mar 2019 09:30:14 +0000 (09:30 +0000)]
[RISCV][NFC] Split out emitSelectPseudo from EmitInstrWithCustomInserter

It's cleaner and more consistent to have a separate helper function here.

llvm-svn: 355772

5 years ago[RISCV] Support -target-abi at the MC layer and for codegen
Alex Bradbury [Sat, 9 Mar 2019 09:28:06 +0000 (09:28 +0000)]
[RISCV] Support -target-abi at the MC layer and for codegen

This patch adds proper handling of -target-abi, as accepted by llvm-mc and
llc. Lowering (codegen) for the hard-float ABIs will follow in a subsequent
patch. However, this patch does add MC layer support for the hard float and
RVE ABIs (emission of the appropriate ELF flags
https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#-file-header).

ABI parsing must be shared between codegen and the MC layer, so we add
computeTargetABI to RISCVUtils. A warning will be printed if an invalid or
unrecognized ABI is given.

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

llvm-svn: 355771

5 years ago[WebAssembly] Use named operands to identify loads and stores
Thomas Lively [Sat, 9 Mar 2019 04:31:37 +0000 (04:31 +0000)]
[WebAssembly] Use named operands to identify loads and stores

Summary:
Uses the named operands tablegen feature to look up the indices of
offset, address, and p2align operands for all load and store
instructions. This replaces brittle, incorrect logic for identifying
loads and store when eliminating frame indices, which previously
crashed on bulk-memory ops. It also cleans up the SetP2Alignment pass.

Reviewers: aheejin, dschuff

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

Tags: #llvm

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

llvm-svn: 355770

5 years agoRefactor isBooleanFlip into extractBooleanFlip so that users do not depend on the...
Amaury Sechet [Sat, 9 Mar 2019 02:51:52 +0000 (02:51 +0000)]
Refactor isBooleanFlip into extractBooleanFlip so that users do not depend on the patern matched. NFC

llvm-svn: 355769

5 years ago[x86] add tests for extract of FP select; NFC
Sanjay Patel [Sat, 9 Mar 2019 02:11:05 +0000 (02:11 +0000)]
[x86] add tests for extract of FP select; NFC

llvm-svn: 355768

5 years ago[ScalarizeMaskedMemIntrin] Use IRBuilder functions that take uint32_t/uint64_t for...
Craig Topper [Sat, 9 Mar 2019 02:08:41 +0000 (02:08 +0000)]
[ScalarizeMaskedMemIntrin] Use IRBuilder functions that take uint32_t/uint64_t for getelementptr, extractelement, and insertelement.

This saves needing to call getInt32 ourselves. Making the code a little shorter.

The test changes are because insert/extract use getInt64 internally. Shouldn't be a functional issue.

This cleanup because I plan to write similar code for expandload/compressstore.

llvm-svn: 355767

5 years agoActually implement the TestQueues.py workaround
Frederic Riss [Sat, 9 Mar 2019 01:34:44 +0000 (01:34 +0000)]
Actually implement the TestQueues.py workaround

The code commited in r355764 didn't do what I want as I typed GetThreadID
instead of GetQueueID. This commit contains a (hopefully) better version
of the workaround.

llvm-svn: 355766

5 years ago[CMake] Support stripping and linking output to .build-id directory
Petr Hosek [Sat, 9 Mar 2019 01:26:55 +0000 (01:26 +0000)]
[CMake] Support stripping and linking output to .build-id directory

When installing runtimes with install-runtimes-stripped, we don't want
to just strip them, we also want to preserve the debugging information
for potential debugging. To make it possible to later find the stripped
debugging information, we want to use the .build-id layout:

https://fedoraproject.org/wiki/RolandMcGrath/BuildID#Find_files_by_build_ID

That is, for libfoo.so with build ID abcdef1234, the debugging information
will be installed into lib/debug/.build-id/ab/cdef1234. llvm-objcopy
already has support for stripping files and linking the debugging
stripped output into the right location. However, CMake doesn't support
customizing strip invocation for the *-stripped targets. So instead, we
replace CMAKE_STRIP with a custom script that invokes llvm-objcopy with
the right command line flags.

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

llvm-svn: 355765

5 years agoTry to workaround the TestQueues.py flakyness
Frederic Riss [Sat, 9 Mar 2019 01:23:47 +0000 (01:23 +0000)]
Try to workaround the TestQueues.py flakyness

This is not a fix, but if I understand enough of the issue, it should
bail out early of the test when in a situation that would result in
a failure down the road.

llvm-svn: 355764

5 years agoLWG 2843 "Unclear behavior of std::pmr::memory_resource::do_allocate()"
Eric Fiselier [Sat, 9 Mar 2019 00:38:19 +0000 (00:38 +0000)]
LWG 2843 "Unclear behavior of std::pmr::memory_resource::do_allocate()"

Patch by Arthur O'Dwyer.
Reviewed as https://reviews.llvm.org/D47344

new_delete_resource().allocate(n, a) has basically two permissible results:

* Return an appropriately sized and aligned block.
* Throw bad_alloc.

Before this patch, libc++'s new_delete_resource would do a third and impermissible thing, which was
to return an appropriately sized but inappropriately under-aligned block. This is now fixed.

(This came up while I was stress-testing unsynchronized_pool_resource on my MacBook. If we can't
trust the default resource to return appropriately aligned blocks, pretty much everything breaks.
For similar reasons, I would strongly support just patching __libcpp_allocate directly, but I don't
care to die on that hill, so I made this patch as a <memory_resource>-specific workaround.)

llvm-svn: 355763

5 years agoBreak cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands
Jonas Devlieghere [Sat, 9 Mar 2019 00:10:52 +0000 (00:10 +0000)]
Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

Inspired by Zachary's mail on lldb-dev, this seemed like low hanging
fruit. This patch breaks the circular dependency between commands and
expression.

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

llvm-svn: 355762

5 years agoAdd parens to force the order of operations in an expression trying
Jason Molenda [Sat, 9 Mar 2019 00:04:24 +0000 (00:04 +0000)]
Add parens to force the order of operations in an expression trying
to do "databuffer + offset" so that we don't overflow the uint64_t's
we're using for addresses when working with high addresses.

Found with clang's ubsan while doing darwin kernel debugging.

<rdar://problem/48728940>

llvm-svn: 355761

5 years agoWork around dllimport bug with exclude_from_explicit_instantiation.
Eric Fiselier [Fri, 8 Mar 2019 23:59:29 +0000 (23:59 +0000)]
Work around dllimport bug with exclude_from_explicit_instantiation.

When dllimport is specified on a class, and
exclude_from_explicit_instatiation is specified on a member, clang-cl
will still expect a definition to be available externally. But this is
not correct.

Surprisingly one one symbol seems to be consistently affected by this
bug. So this patch simply works around it there.

llvm-svn: 355760

5 years agoRename a local variable counter to Counter.
Wei Mi [Fri, 8 Mar 2019 23:32:07 +0000 (23:32 +0000)]
Rename a local variable counter to Counter.

llvm-svn: 355759

5 years agoFix C++03 build failure
Eric Fiselier [Fri, 8 Mar 2019 23:30:26 +0000 (23:30 +0000)]
Fix C++03 build failure

llvm-svn: 355758

5 years ago[RegisterCoalescer][NFC] bind a DenseMap access to a reference to avoid
Wei Mi [Fri, 8 Mar 2019 23:29:46 +0000 (23:29 +0000)]
[RegisterCoalescer][NFC] bind a DenseMap access to a reference to avoid
repeated lookup operations

llvm-svn: 355757

5 years agoRevert "[libc++] Do not force building with -fPIC"
Eric Fiselier [Fri, 8 Mar 2019 23:27:46 +0000 (23:27 +0000)]
Revert "[libc++] Do not force building with -fPIC"

This reverts commit r355764.

CMake does not turn -fPIC on for us by default. so this patch breaks
standalone builds. The only reason it hasn't broken any bots is because
LLVM turns on and specifies '-fPIC' for us.

llvm-svn: 355756

5 years agoUnbork `std::memory_order` ABI.
Eric Fiselier [Fri, 8 Mar 2019 23:15:54 +0000 (23:15 +0000)]
Unbork `std::memory_order` ABI.

Summary:
We need to pin the underlying type of C++20' `std::memory_order` to match the C++17 version. Anything less is an ABI break.

At the moment it's `unsigned` before C++20 and `int` after. Or if you're using `-fshort-enums` it's `unsigned char` before C++20 and `int` after.

This patch explicitly specifies the underlying type of the  C++20 `memory_order` to be w/e type the compiler would have chosen for the C++17 version.

Reviewers: mclow.lists, ldionne

Reviewed By: ldionne

Subscribers: jfb, jdoerfert, #libc, zoecarver

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

llvm-svn: 355755

5 years ago[ScalarizeMaskedMemIntrin] Only set the ModifiedDT flag if new basic blocks were...
Craig Topper [Fri, 8 Mar 2019 23:03:43 +0000 (23:03 +0000)]
[ScalarizeMaskedMemIntrin] Only set the ModifiedDT flag if new basic blocks were added.

There are special cases in the scalarization for constant masks. If we hit one of the special cases we don't need to reset the iteration.

Noticed while starting work on adding expandload/compressstore to this pass.

llvm-svn: 355754

5 years ago[RISCV] Allow access to FP CSRs without F extension
Ana Pazos [Fri, 8 Mar 2019 23:01:08 +0000 (23:01 +0000)]
[RISCV] Allow access to FP CSRs without F extension

Summary:
Floating-point CSRs should be accessible even when F extension is not enabled.
But pseudo instructions that access floating point CSRs still require the F extension.
GNU tools already implement this behavior. RISC-V spec is pending update to reflect
this behavior and to extend it to pseudo instructions that access floating point CSRs.

Reviewers: asb

Reviewed By: asb

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

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

llvm-svn: 355753

5 years agoFix PR41017 - Build failure with _LIBCPP_DEBUG=0 and non-const-ref
Eric Fiselier [Fri, 8 Mar 2019 22:58:59 +0000 (22:58 +0000)]
Fix PR41017 - Build failure with _LIBCPP_DEBUG=0 and non-const-ref
comparator for std::sort()

Our debug comparator assumed that the comparator it wraps would always
accepts the values by const ref. This isn't required by the standard.

This patch makes our __debug_less comparator forward the constness.

llvm-svn: 355752

5 years ago[CodeGenPrepare] Fix ModifiedDT flag in optimizeSelectInst
Rong Xu [Fri, 8 Mar 2019 22:46:18 +0000 (22:46 +0000)]
[CodeGenPrepare] Fix ModifiedDT flag in optimizeSelectInst

r44412 fixed a huge compile time regression but it needed ModifiedDT flag to be
maintained correctly in optimizations in optimizeBlock() and optimizeInst().
Function optimizeSelectInst() does not update the flag.
This patch propagates the flag in optimizeSelectInst() back to
optimizeBlock().

This patch also removes ModifiedDT in CodeGenPrepare class (which is not used).
The property of ModifiedDT is now recorded in a ref parameter.

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

llvm-svn: 355751

5 years ago[lldb] [test] Skip broken NetBSD core test
Michal Gorny [Fri, 8 Mar 2019 22:41:14 +0000 (22:41 +0000)]
[lldb] [test] Skip broken NetBSD core test

Apparently the problem is harder than anticipated.  Skip the test for
now to fix buildbots.

llvm-svn: 355750

5 years ago[Go / ASAN] Disable Go bindings for ASAN tests.
Mitch Phillips [Fri, 8 Mar 2019 22:34:33 +0000 (22:34 +0000)]
[Go / ASAN] Disable Go bindings for ASAN tests.

Go binding tests fail under ASAN with the error at the bottom of this
commit message. The reason the buildbots are not currently always
failing on this test is that they selectively disable the bindings due
to a Go binary not being present on their system.

This change should allow users to build an asan-bootstrapped compiler
and run asan-ified unit tests locally, similar to the way that
sanitizer-* buildbots do.

The error is:
```
FAIL: LLVM :: Bindings/Go/go.test (7050 of 30112)
******************** TEST 'LLVM :: Bindings/Go/go.test' FAILED ********************
Script:
--
: 'RUN: at line 1';   /usr/local/google/home/mitchp/llvm-build/asan/sanitized-clang/bin/llvm-go go=/usr/lib/google-golang/bin/go test llvm.org/llvm/bindings/go/llvm
--
Exit Code: 1

Command Output (stdout):
--
FAIL llvm.org/llvm/bindings/go/llvm [build failed]

--
Command Output (stderr):
--
ld.lld: error: undefined symbol: std::allocator<char>::allocator()
>>> referenced by InstrumentationBindings.cpp
>>>               $WORK/b048/_x018.o:(LLVMAddDataFlowSanitizerPass)

ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)
>>> referenced by InstrumentationBindings.cpp
>>>               $WORK/b048/_x018.o:(LLVMAddDataFlowSanitizerPass)

ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
>>> referenced by InstrumentationBindings.cpp
>>>               $WORK/b048/_x018.o:(LLVMAddDataFlowSanitizerPass)

ld.lld: error: undefined symbol: std::allocator<char>::~allocator()
>>> referenced by InstrumentationBindings.cpp
>>>               $WORK/b048/_x018.o:(LLVMAddDataFlowSanitizerPass)

ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
>>> referenced by InstrumentationBindings.cpp
>>>               $WORK/b048/_x018.o:(LLVMAddDataFlowSanitizerPass)

ld.lld: error: undefined symbol: std::allocator<char>::~allocator()
>>> referenced by InstrumentationBindings.cpp
>>>               $WORK/b048/_x018.o:(LLVMAddDataFlowSanitizerPass)

ld.lld: error: undefined symbol: llvm::createDataFlowSanitizerPass(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, void* (*)(), void* (*)())
>>> referenced by InstrumentationBindings.cpp
>>>               $WORK/b048/_x018.o:(LLVMAddDataFlowSanitizerPass)

ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
>>> referenced by InstrumentationBindings.cpp
>>>               $WORK/b048/_x018.o:(void std::_Destroy<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*))

ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)
>>> referenced by InstrumentationBindings.cpp
>>>               $WORK/b048/_x018.o:(void __gnu_cxx::new_allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::construct<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&))

ld.lld: error: undefined symbol: std::__throw_length_error(char const*)
>>> referenced by InstrumentationBindings.cpp
>>>               $WORK/b048/_x018.o:(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_check_len(unsigned long, char const*) const)

ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)
>>> referenced by InstrumentationBindings.cpp
>>>               $WORK/b048/_x018.o:(void std::_Construct<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&))

ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
>>> referenced by InstrumentationBindings.cpp
>>>               $WORK/b048/_x018.o:(void __gnu_cxx::new_allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::destroy<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*))

ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()
>>> referenced by SupportBindings.cpp
>>>               $WORK/b048/_x019.o:(LLVMLoadLibraryPermanently2)

ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const
>>> referenced by SupportBindings.cpp
>>>               $WORK/b048/_x019.o:(LLVMLoadLibraryPermanently2)

ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::c_str() const
>>> referenced by SupportBindings.cpp
>>>               $WORK/b048/_x019.o:(LLVMLoadLibraryPermanently2)

ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const
>>> referenced by SupportBindings.cpp
>>>               $WORK/b048/_x019.o:(LLVMLoadLibraryPermanently2)

ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
>>> referenced by SupportBindings.cpp
>>>               $WORK/b048/_x019.o:(LLVMLoadLibraryPermanently2)

ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
>>> referenced by SupportBindings.cpp
>>>               $WORK/b048/_x019.o:(LLVMLoadLibraryPermanently2)

ld.lld: error: undefined symbol: llvm::sys::DynamicLibrary::getPermanentLibrary(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)
>>> referenced by SupportBindings.cpp
>>>               $WORK/b048/_x019.o:(llvm::sys::DynamicLibrary::LoadLibraryPermanently(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*))

ld.lld: error: undefined symbol: __asan_option_detect_stack_use_after_return
>>> referenced by MCJIT.cpp:45 (/usr/local/google/home/mitchp/llvm/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp:45)
>>>               MCJIT.cpp.o:(llvm::MCJIT::createJIT(std::__1::unique_ptr<llvm::Module, std::__1::default_delete<llvm::Module> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::shared_ptr<llvm::MCJITMemoryManager>, std::__1::shared_ptr<llvm::LegacyJITSymbolResolver>, std::__1::unique_ptr<llvm::TargetMachine, std::__1::default_delete<llvm::TargetMachine> >)) in archive /usr/local/google/home/mitchp/llvm-build/asan/sanitized-clang/lib/libLLVMMCJIT.a

ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

--
```

llvm-svn: 355749

5 years ago[LLD] Fixed flaky unit test based on build directory.
Mitch Phillips [Fri, 8 Mar 2019 22:33:22 +0000 (22:33 +0000)]
[LLD] Fixed flaky unit test based on build directory.

This unit test fails if 'zed' appears in your build path, as lld is
echoing out the path of the source file. Change the unit test to
explicitly only match everything after the 'Symbols [' line of the
output, to make sure that this test doesn't inadvertently fail due to
the build path.

llvm-svn: 355748

5 years ago[lldb] [test] Do not check libc function names in NetBSD core test
Michal Gorny [Fri, 8 Mar 2019 22:32:35 +0000 (22:32 +0000)]
[lldb] [test] Do not check libc function names in NetBSD core test

Fix the NetBSD core test not to verify libc function names in backtrace.
This obviously requires the same libc.so as originally used to produce
the core file, and so it is going to fail everywhere except on my
system.

llvm-svn: 355747

5 years ago[libc++] Do not force building with -fPIC
Louis Dionne [Fri, 8 Mar 2019 22:24:12 +0000 (22:24 +0000)]
[libc++] Do not force building with -fPIC

Summary:
Whether we build with -fPIC should be specified by the
CMAKE_POSITION_INDEPENDENT_CODE option at configure time.
Note that this patch doesn't change the behavior when building
by default, since -fPIC is used for shared libraries by default.

Reviewers: EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 355746

5 years ago[AArch64][GlobalISel] Fix i1 arguments not being zero-extended as required by ABI.
Amara Emerson [Fri, 8 Mar 2019 22:17:00 +0000 (22:17 +0000)]
[AArch64][GlobalISel] Fix i1 arguments not being zero-extended as required by ABI.

Fixes PR41001.

llvm-svn: 355745

5 years ago[8.0 Regression] Fix handling of `__builtin_constant_p` inside template arguments...
Eric Fiselier [Fri, 8 Mar 2019 22:06:48 +0000 (22:06 +0000)]
[8.0 Regression] Fix handling of `__builtin_constant_p` inside template arguments, enumerators, case statements, and the enable_if attribute.

Summary:
The following code is accepted by Clang 7 and prior but rejected by the upcoming 8 release and in trunk [1]

```
// error {{never produces a constant expression}}
void foo(const char* s) __attribute__((enable_if(__builtin_constant_p(*s) == false, "trap"))) {}
void test() { foo("abc"); }
```

Prior to Clang 8, the call to `__builtin_constant_p` was a constant expression returning false. Currently, it's not a valid constant expression.

The bug is caused because we failed to set `InConstantContext` when attempting to evaluate unevaluated constant expressions.

[1]  https://godbolt.org/z/ksAjmq

Reviewers: rsmith, hans, sbenza

Reviewed By: rsmith

Subscribers: kristina, cfe-commits

Tags: #clang

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

llvm-svn: 355743

5 years agoImprove "llvm-nm -f sysv" output for Elf files
Sunil Srivastava [Fri, 8 Mar 2019 22:00:50 +0000 (22:00 +0000)]
Improve "llvm-nm -f sysv" output for Elf files

Specifically, compute and Print Type and Section columns.

This is a re-commit of rL354833, after fixing the Asan problem found a a buildbot.

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

llvm-svn: 355742

5 years ago[x86] scalarize extract element 0 of FP cmp
Sanjay Patel [Fri, 8 Mar 2019 21:54:41 +0000 (21:54 +0000)]
[x86] scalarize extract element 0 of FP cmp

An extension of D58282 noted in PR39665:
https://bugs.llvm.org/show_bug.cgi?id=39665

This doesn't answer the request to use movmsk, but that's an
independent problem. We need this and probably still need
scalarization of FP selects because we can't do that as a
target-independent transform (although it seems likely that
targets besides x86 should have this transform).

llvm-svn: 355741

5 years ago[NVPTX][DEBUGINFO]Temp workaround for crash of ptxas: disable packed bytes in debug...
Alexey Bataev [Fri, 8 Mar 2019 21:29:17 +0000 (21:29 +0000)]
[NVPTX][DEBUGINFO]Temp workaround for crash of ptxas: disable packed bytes in debug sections.

Summary:
This patch works around the bug in the ptxas tool with the processing of bytes
separated by the comma symbol. The emission of the packed string is
temporarily disabled.

Reviewers: tra

Subscribers: jholewinski, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 355740

5 years ago[OpenMP][stats] Update stats gathering macros
Jonathan Peyton [Fri, 8 Mar 2019 21:23:34 +0000 (21:23 +0000)]
[OpenMP][stats] Update stats gathering macros

llvm-svn: 355739

5 years ago[HWASan] Save + print registers when tag mismatch occurs in AArch64.
Mitch Phillips [Fri, 8 Mar 2019 21:22:35 +0000 (21:22 +0000)]
[HWASan] Save + print registers when tag mismatch occurs in AArch64.

Summary:
This change change the instrumentation to allow users to view the registers at the point at which tag mismatch occured. Most of the heavy lifting is done in the runtime library, where we save the registers to the stack and emit unwind information. This allows us to reduce the overhead, as very little additional work needs to be done in each __hwasan_check instance.

In this implementation, the fast path of __hwasan_check is unmodified. There are an additional 4 instructions (16B) emitted in the slow path in every __hwasan_check instance. This may increase binary size somewhat, but as most of the work is done in the runtime library, it's manageable.

The failure trace now contains a list of registers at the point of which the failure occured, in a format similar to that of Android's tombstones. It currently has the following format:

Registers where the failure occurred (pc 0x0055555561b4):
    x0  0000000000000014  x1  0000007ffffff6c0  x2  1100007ffffff6d0  x3  12000056ffffe025
    x4  0000007fff800000  x5  0000000000000014  x6  0000007fff800000  x7  0000000000000001
    x8  12000056ffffe020  x9  0200007700000000  x10 0200007700000000  x11 0000000000000000
    x12 0000007fffffdde0  x13 0000000000000000  x14 02b65b01f7a97490  x15 0000000000000000
    x16 0000007fb77376b8  x17 0000000000000012  x18 0000007fb7ed6000  x19 0000005555556078
    x20 0000007ffffff768  x21 0000007ffffff778  x22 0000000000000001  x23 0000000000000000
    x24 0000000000000000  x25 0000000000000000  x26 0000000000000000  x27 0000000000000000
    x28 0000000000000000  x29 0000007ffffff6f0  x30 00000055555561b4

... and prints after the dump of memory tags around the buggy address.

Every register is saved exactly as it was at the point where the tag mismatch occurs, with the exception of x16/x17. These registers are used in the tag mismatch calculation as scratch registers during __hwasan_check, and cannot be saved without affecting the fast path. As these registers are designated as scratch registers for linking, there should be no important information in them that could aid in debugging.

Reviewers: pcc, eugenis

Reviewed By: pcc, eugenis

Subscribers: srhines, kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, hiraditya, jdoerfert, llvm-commits, #sanitizers

Tags: #sanitizers, #llvm

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

llvm-svn: 355738

5 years ago[WebAssembly] Don't mark lazy symbols as `IsUsedInRegularObj`
Sam Clegg [Fri, 8 Mar 2019 21:10:48 +0000 (21:10 +0000)]
[WebAssembly] Don't mark lazy symbols as `IsUsedInRegularObj`

This matches the ELF does.  Update the comment in ELF/Symbols.h and
duplicate it in wasm/Symbols.h

This a followup on rL355580 and rL355577.

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

llvm-svn: 355737

5 years ago[lldb] [Process] Add proper support for NetBSD core files with threads
Michal Gorny [Fri, 8 Mar 2019 21:10:43 +0000 (21:10 +0000)]
[lldb] [Process] Add proper support for NetBSD core files with threads

Improve the support for processing NetBSD cores.  Fix reading process
identifier, thread information and associating the terminating signal
with the correct thread.

Includes test cases for single-threaded program receiving SIGSEGV,
and two dual-threaded programs: one where thread receives the signal,
and the other one when the whole process is signalled.

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

llvm-svn: 355736

5 years ago[cmake] Remove llvm from LLVM_ALL_PROJECTS
Shoaib Meenai [Fri, 8 Mar 2019 21:10:22 +0000 (21:10 +0000)]
[cmake] Remove llvm from LLVM_ALL_PROJECTS

LLVM is always built; including it in LLVM_ENABLE_PROJECTS has no
effect, but since it's in LLVM_ALL_PROJECTS, we produce a confusing
message about it being disabled. Drop it from LLVM_ALL_PROJECTS to avoid
this. Pointed out by David Greene on the mailing list [1].

[1] http://lists.llvm.org/pipermail/llvm-dev/2019-March/130854.html

llvm-svn: 355735

5 years ago[GN] Merge 355720.
Mitch Phillips [Fri, 8 Mar 2019 21:05:27 +0000 (21:05 +0000)]
[GN] Merge 355720.

llvm-svn: 355734

5 years ago[RegionPass] Fix forgotten "!".
Michael Kruse [Fri, 8 Mar 2019 21:03:06 +0000 (21:03 +0000)]
[RegionPass] Fix forgotten "!".

Commit r355068 "Fix IR/Analysis layering issue with OptBisect" uses the
template

   return Gate.isEnabled() && !Gate.shouldRunPass(this, getDescription(...));

for all pass kinds. For the RegionPass, it left out the not operator,
causing region passes to be skipped as soon as a pass gate is used.

llvm-svn: 355733

5 years ago[NFC] Add missing revision information to ABI Changelog
Louis Dionne [Fri, 8 Mar 2019 21:01:25 +0000 (21:01 +0000)]
[NFC] Add missing revision information to ABI Changelog

llvm-svn: 355732

5 years agoAMDGPU: Move d16 load matching to preprocess step
Matt Arsenault [Fri, 8 Mar 2019 20:58:11 +0000 (20:58 +0000)]
AMDGPU: Move d16 load matching to preprocess step

When matching half of the build_vector to a load, there could still be
a hidden dependency on the other half of the build_vector the pattern
wouldn't detect. If there was an additional chain dependency on the
other value, a cycle could be introduced.

I don't think a tablegen pattern is capable of matching the necessary
conditions, so move this into PreprocessISelDAG. Check isPredecessorOf
for the other value to avoid a cycle. This has a warning that it's
expensive, so this should probably be moved into an MI pass eventually
that will have more freedom to reorder instructions to help match
this. That is currently complicated by the lack of a computeKnownBits
type mechanism for the selected function.

llvm-svn: 355731

5 years agoRemove dependency edges from Host to Target/Core.
Zachary Turner [Fri, 8 Mar 2019 20:56:10 +0000 (20:56 +0000)]
Remove dependency edges from Host to Target/Core.

After recent changes, Host is now dependency-free.

llvm-svn: 355730

5 years ago[OPENMP]Remove debug service variable.
Alexey Bataev [Fri, 8 Mar 2019 20:48:54 +0000 (20:48 +0000)]
[OPENMP]Remove debug service variable.

Removed not required service variable for the debug info.

llvm-svn: 355729

5 years agoDAG: Don't try to cluster loads with tied inputs
Matt Arsenault [Fri, 8 Mar 2019 20:46:15 +0000 (20:46 +0000)]
DAG: Don't try to cluster loads with tied inputs

This avoids breaking possible value dependencies when sorting loads by
offset.

AMDGPU has some load instructions that write into the high or low bits
of the destination register, and have a tied input for the other input
bits. These can easily have the same base pointer, but be a swizzle so
the high address load needs to come first. This was inserting glue
forcing the opposite ordering, producing a cycle the InstrEmitter
would assert on. It may be potentially expensive to look for the
dependency between the other loads, so just skip any where this could
happen.

Fixes bug 40936 by reverting r351379, which added a hacky attempt to
fix this by adding chains in this case, which I think was just working
around broken glue before the InstrEmitter. The core of the patch is
re-implementing the fix for that problem.

llvm-svn: 355728

5 years ago[x86] add tests for extracted vector FP cmp; NFC
Sanjay Patel [Fri, 8 Mar 2019 20:45:27 +0000 (20:45 +0000)]
[x86] add tests for extracted vector FP cmp; NFC

llvm-svn: 355727

5 years ago[docs] Fix checkers.rst doc for PointerSorting checker
Mandeep Singh Grang [Fri, 8 Mar 2019 20:35:25 +0000 (20:35 +0000)]
[docs] Fix checkers.rst doc for PointerSorting checker

llvm-svn: 355726

5 years agoRevert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"
Matthew Voss [Fri, 8 Mar 2019 20:33:55 +0000 (20:33 +0000)]
Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"

This broke the windows bots.

This reverts commit 28302c66d2586074f77497d5dc4eac7182b679e0.

llvm-svn: 355725

5 years agoAMDGPU: Add more tests for d16 loads
Matt Arsenault [Fri, 8 Mar 2019 20:30:51 +0000 (20:30 +0000)]
AMDGPU: Add more tests for d16 loads

Also fix a few cases that weren't testing what they were supposed to.

llvm-svn: 355724

5 years agoAMDGPU: Don't bother checking the chain in areLoadsFromSameBasePtr
Matt Arsenault [Fri, 8 Mar 2019 20:30:51 +0000 (20:30 +0000)]
AMDGPU: Don't bother checking the chain in areLoadsFromSameBasePtr

This is only called in contexts that are verifying the chain itself,
and the query itself is only asking about the address.

llvm-svn: 355723

5 years agoAMDGPU: Correct DS implementation of areLoadsFromSameBasePtr
Matt Arsenault [Fri, 8 Mar 2019 20:30:50 +0000 (20:30 +0000)]
AMDGPU: Correct DS implementation of areLoadsFromSameBasePtr

This was checking the wrong operands for the base register and the
offsets. The indexes are shifted by the number of output registers
from the machine instruction definition, and the chain is moved to the
end.

llvm-svn: 355722

5 years agoRevert "Recommit "Support attribute used in member funcs of class templates""
Rafael Auler [Fri, 8 Mar 2019 20:23:57 +0000 (20:23 +0000)]
Revert "Recommit "Support attribute used in member funcs of class templates""

There is nontrivial bug caused in lld that I need to further
investigate. Meanwhile, I'll revert this.

This reverts commit 8297e93480c636dc90fd14653c5a66406193363f.

llvm-svn: 355721

5 years ago[Analyzer] Checker for non-determinism caused by sorting of pointer-like elements
Mandeep Singh Grang [Fri, 8 Mar 2019 20:13:53 +0000 (20:13 +0000)]
[Analyzer] Checker for non-determinism caused by sorting of pointer-like elements

Summary:
Added a new category of checkers for non-determinism. Added a checker for non-determinism
caused due to sorting containers with pointer-like elements.

Reviewers: NoQ, george.karpenkov, whisperity, Szelethus

Reviewed By: NoQ, Szelethus

Subscribers: Charusso, baloghadamsoftware, jdoerfert, donat.nagy, dkrupp, martong, dblaikie, MTC, Szelethus, mgorny, xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits

Tags: #clang

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

llvm-svn: 355720

5 years ago[DEBUG_INFO][NVPTX]Emit empty .debug_loc section in presence of the debug option.
Alexey Bataev [Fri, 8 Mar 2019 20:08:04 +0000 (20:08 +0000)]
[DEBUG_INFO][NVPTX]Emit empty .debug_loc section in presence of the debug option.

Summary:
If the LLVM module shows that it has debug info, but the file is
actually empty and the real debug info is not emitted, the ptxas tool
emits error 'Debug information not found in presence of .target debug'.
We need at leas one empty debug section to silence this message. Section
`.debug_loc` is not emitted for PTX and we can emit empty `.debug_loc`
section if `debug` option was emitted.

Reviewers: tra

Subscribers: jholewinski, aprantl, llvm-commits

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

llvm-svn: 355719

5 years ago[msan] Properly guard tests added by r355348; NFC
Hubert Tong [Fri, 8 Mar 2019 19:57:27 +0000 (19:57 +0000)]
[msan] Properly guard tests added by r355348; NFC

r355348 uses builtins without proper guards, breaking the test on
various platforms.

llvm-svn: 355718

5 years ago[TSan] Initialize libdispatch interceptors if necessary
Julian Lettner [Fri, 8 Mar 2019 19:52:45 +0000 (19:52 +0000)]
[TSan] Initialize libdispatch interceptors if necessary

On Linux (and other non-Darwin platforms) we need to initialize
interceptors. Since tsan_libdispatch.cc is compiled optionally, add a
weak default implementation of `InitializeLibdispatchInterceptors`.

Reviewed By: dvyukov

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

llvm-svn: 355717

5 years ago[DAGCombiner] fold (add (add (xor a, -1), b), 1) -> (sub b, a)
Amaury Sechet [Fri, 8 Mar 2019 19:39:32 +0000 (19:39 +0000)]
[DAGCombiner] fold (add (add (xor a, -1), b), 1) -> (sub b, a)

Summary: This pattern is sometime created after legalization.

Reviewers: efriedma, spatel, RKSimon, zvi, bkramer

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 355716

5 years ago[CFLAnders] Fix typo in comment; NFC
George Burgess IV [Fri, 8 Mar 2019 19:28:55 +0000 (19:28 +0000)]
[CFLAnders] Fix typo in comment; NFC

Patch by Enna1!

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

llvm-svn: 355715

5 years ago[RegisterCoalescer] Limit the number of joins for large live interval with
Wei Mi [Fri, 8 Mar 2019 19:25:32 +0000 (19:25 +0000)]
[RegisterCoalescer] Limit the number of joins for large live interval with
many valnos.

Recently we found compile time out problem in several cases when
SpeculativeLoadHardening was enabled. The significant compile time was spent
in register coalescing pass, where register coalescer tried to join many other
live intervals with some very large live intervals with many valnos.

Specifically, every time JoinVals::mapValues is called, computeAssignment will
be called by getNumValNums() times of the target live interval. If the large
live interval has N valnos and has N copies associated with it, trying to
coalescing those copies will at least cost N^2 complexity.

The patch adds some limit to the effort trying to join those very large live
intervals with others. By default, for live interval with > 100 valnos, and
when it has been coalesced with other live interval by more than 100 times,
we will stop coalescing for the live interval anymore. That put a compile
time cap for the N^2 algorithm and effectively solves the compile time
problem we saw.

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

llvm-svn: 355714

5 years ago[x86] prevent infinite looping from inverse shuffle transforms
Sanjay Patel [Fri, 8 Mar 2019 19:20:28 +0000 (19:20 +0000)]
[x86] prevent infinite looping from inverse shuffle transforms

llvm-svn: 355713

5 years ago[X86] Add test case for PR22473
Simon Pilgrim [Fri, 8 Mar 2019 19:16:26 +0000 (19:16 +0000)]
[X86] Add test case for PR22473

llvm-svn: 355712

5 years ago[Reproducers] Add missing LLDB_RECORD_DUMMY macros
Jonas Devlieghere [Fri, 8 Mar 2019 19:09:27 +0000 (19:09 +0000)]
[Reproducers] Add missing LLDB_RECORD_DUMMY macros

Re-ran lldb-inst on the API folder to insert missing LLDB_RECORD_DUMMY
macros.

llvm-svn: 355711

5 years ago[lldb-instr] Support LLDB_RECORD_DUMMY
Jonas Devlieghere [Fri, 8 Mar 2019 18:33:40 +0000 (18:33 +0000)]
[lldb-instr] Support LLDB_RECORD_DUMMY

Extend lldb-instr to insert LLDB_RECORD_DUMMY macros for currently
unsupported signatures (void and function pointers).

llvm-svn: 355710

5 years ago[Reproducers] Add LLDB_RECORD_DUMMY
Jonas Devlieghere [Fri, 8 Mar 2019 17:50:27 +0000 (17:50 +0000)]
[Reproducers] Add LLDB_RECORD_DUMMY

Add a macro that doesn't actually record anything but still toggles the
API boundary. Removing just the register macros for lldb::thread_t
wasn't sufficient on NetBSD because the serialization logic needed the
underlying type to be complete.

This macro should be used by functions that are currently unsupported,
as they might trip the API boundary logic. This should be easy using the
lldb-instr tool.

llvm-svn: 355709

5 years ago[lldb-vscode] Fix warning
Jonas Devlieghere [Fri, 8 Mar 2019 17:36:54 +0000 (17:36 +0000)]
[lldb-vscode] Fix warning

I changed the variable to an unsigned to get rid of a signed and
unsigned compare without realizing the value could be negative. This
fixes the assert instead.

llvm-svn: 355708

5 years ago[ARM][FIX] Fix vfmal.f16 and vfmsl.f16 operand
Diogo N. Sampaio [Fri, 8 Mar 2019 17:11:20 +0000 (17:11 +0000)]
[ARM][FIX] Fix vfmal.f16 and vfmsl.f16 operand

The indexed variant of vfmal.f16 and vfmsl.f16
instructions use the uppser bits of the indexed
operand to store the index (1 bit for the double
variant, 2 bits for the quad).

This limits the usable registers to d0 - d7 or
s0 - s15. This patch enforces this limitation.

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

llvm-svn: 355707

5 years agoAdd more logging to TestQueues.py
Frederic Riss [Fri, 8 Mar 2019 17:09:13 +0000 (17:09 +0000)]
Add more logging to TestQueues.py

The last round of logging taught us that when the test fails, lldb
is indeed aware of the thread it's failing to associate to a given
queue. Add more logging to try to figure out why the thread and the
queue do not appear related to the Queue APIs.

llvm-svn: 355706

5 years ago[analyzer] Fix infinite recursion in printing macros
Kristof Umann [Fri, 8 Mar 2019 16:26:29 +0000 (16:26 +0000)]
[analyzer] Fix infinite recursion in printing macros

In the commited testfile, macro expansion (the one implemented for the plist
output) runs into an infinite recursion. The issue originates from the algorithm
being faulty, as in

#define value REC_MACRO_FUNC(value)

the "value" is being (or at least attempted) expanded from the same macro.

The solved this issue by gathering already visited macros in a set, which does
resolve the crash, but will result in an incorrect macro expansion, that would
preferably be fixed down the line.

Patch by Tibor Brunner!

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

llvm-svn: 355705

5 years ago[analyzer] Emit an error rather than assert on invalid checker option input
Kristof Umann [Fri, 8 Mar 2019 16:00:42 +0000 (16:00 +0000)]
[analyzer] Emit an error rather than assert on invalid checker option input

Asserting on invalid input isn't very nice, hence the patch to emit an error
instead.

This is the first of many patches to overhaul the way we handle checker options.

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

llvm-svn: 355704

5 years ago[analyzer] Use the new infrastructure of expressing taint propagation, NFC
Kristof Umann [Fri, 8 Mar 2019 15:47:56 +0000 (15:47 +0000)]
[analyzer] Use the new infrastructure of expressing taint propagation, NFC

In D55734, we implemented a far more general way of describing taint propagation
rules for functions, like being able to specify an unlimited amount of
source and destination parameters. Previously, we didn't have a particularly
elegant way of expressing the propagation rules for functions that always return
(either through an out-param or return value) a tainted value. In this patch,
we model these functions similarly to other ones, by assigning them a
TaintPropagationRule that describes that they "create a tainted value out of
nothing".

The socket C function is somewhat special, because for certain parameters (for
example, if we supply localhost as parameter), none of the out-params should
be tainted. For this, we added a general solution of being able to specify
custom taint propagation rules through function pointers.

Patch by Gábor Borsik!

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

llvm-svn: 355703

5 years ago[clang-tidy] NFC: Negate the name and semantics of the isNotInMacro function.
Hyrum Wright [Fri, 8 Mar 2019 15:37:15 +0000 (15:37 +0000)]
[clang-tidy] NFC: Negate the name and semantics of the isNotInMacro function.

This function is always used in a context where its result was also
negated, which made for confusing naming and code.

llvm-svn: 355702

5 years agoReland compiler-rt support for order file instrumentation.
Manman Ren [Fri, 8 Mar 2019 15:30:56 +0000 (15:30 +0000)]
Reland compiler-rt support for order file instrumentation.

r355343 was landed and was reverted in r355363 due to build breakage.
This patch adds Linux/Windows support on top of r355343.

In this patch, Darwin should be working with testing case. Linux should be working,
I will enable the testing case in a follwup diff. Windows/Other should be building.
Correct implementation for Other platforms will be added.

Thanks David for reviewing the original diff, helping me with issues on Linux, and
giving suggestions for adding support for Other platforms.

llvm-svn: 355701

5 years agoUse {{.*}} in test case to match the type of wide string literals.
Akira Hatanaka [Fri, 8 Mar 2019 15:20:12 +0000 (15:20 +0000)]
Use {{.*}} in test case to match the type of wide string literals.

The type of wide string literals varies depending on the target.

llvm-svn: 355700

5 years agoFix typo in constant vector
Simon Pilgrim [Fri, 8 Mar 2019 15:17:26 +0000 (15:17 +0000)]
Fix typo in constant vector

llvm-svn: 355699

5 years agoRe-fix _lrotl/_lrotr to always take Long, no matter the platform.
Erich Keane [Fri, 8 Mar 2019 15:10:07 +0000 (15:10 +0000)]
Re-fix _lrotl/_lrotr to always take Long, no matter the platform.

r355322 fixed this, however is being reverted due to concerns with
enabling it in other modes.

Change-Id: I6a939b7469b8fa196d5871a627eb2330dbd30f29
llvm-svn: 355698

5 years agoRevert "Enable _rotl, _lrotl, _rotr, _lrotr on all platforms."
Erich Keane [Fri, 8 Mar 2019 15:10:05 +0000 (15:10 +0000)]
Revert "Enable _rotl, _lrotl, _rotr, _lrotr on all platforms."

This reverts commit 24400dafe16716f28cd0e7e5fa6e004c0e50686a.

llvm-svn: 355697

5 years ago[llvm-readelf]Don't lose negative-ness of negative addends for no symbol relocations
James Henderson [Fri, 8 Mar 2019 13:22:05 +0000 (13:22 +0000)]
[llvm-readelf]Don't lose negative-ness of negative addends for no symbol relocations

llvm-readelf prints relocation addends as:

  <symbol value>[+-]<absolute addend>

where [+-] is determined from whether addend is less than zero or not.
However, it does not print the +/- if there is no symbol, which meant
that negative addends became their positive value with no indication
that this had happened. This patch stops the absolute conversion when
addends are negative and there is no associated symbol.

Reviewed by: Higuoxing, mattd, MaskRay

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

llvm-svn: 355696

5 years agogn build: Merge r355685
Nico Weber [Fri, 8 Mar 2019 13:07:22 +0000 (13:07 +0000)]
gn build: Merge r355685

llvm-svn: 355695

5 years agogn build: Unbreak finding a working `gn` on $PATH on Unix after r355645
Nico Weber [Fri, 8 Mar 2019 13:01:58 +0000 (13:01 +0000)]
gn build: Unbreak finding a working `gn` on $PATH on Unix after r355645

From the Python subprocess docs:

   If shell is True, it is recommended to pass args as a string rather than as
   a sequence.

   [...]

   If args is a sequence, the first item specifies the command string, and any
   additional items will be treated as additional arguments to the shell itself.

Prior to this change, the `--version` would be passed to the shell, not to
a potential gn binary on $PATH, and running `gn` without any arguments makes
it exit with an exit code != 0, so the script would think that there wasn't
a working gn binary on $PATH.

Fix this by following the documentation's recommendation of using a string
now that we pass shell=True. I tested this on macOS and Windows, each with
the three cases of

- no gn on PATH (should run gn downloaded by get.py if present,
  else suggest running get.py)
- broken gn wrapper on PATH (should behave like the previous item)
- working gn on PATH (should use gn on PATH)

llvm-svn: 355694

5 years agogn build: Unbreak get.py and gn.py on Windows
Nico Weber [Fri, 8 Mar 2019 12:45:50 +0000 (12:45 +0000)]
gn build: Unbreak get.py and gn.py on Windows

`os.uname()` doesn't exist on Windows, so use `platform.machine()` which
returns `os.uname()[4]` on non-Win and (on 64-bit systems) "AMD64" on Windows.
Also use `sys.platform` instead of `platform` to check for Windows-ness for the
file extension in gn.py (get.py got this right).

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

llvm-svn: 355693

5 years ago[sanitizer] Update global_symbols.txt
Clement Courbet [Fri, 8 Mar 2019 12:41:42 +0000 (12:41 +0000)]
[sanitizer] Update global_symbols.txt

Add `bcmp` after r355672.

llvm-svn: 355692

5 years ago[DAGCombine] Merge visitSMULO+visitUMULO into visitMULO. NFCI.
Simon Pilgrim [Fri, 8 Mar 2019 11:41:18 +0000 (11:41 +0000)]
[DAGCombine] Merge visitSMULO+visitUMULO into visitMULO. NFCI.

llvm-svn: 355690

5 years ago[DAGCombine] Merge visitSADDO+visitUADDO into visitADDO. NFCI.
Simon Pilgrim [Fri, 8 Mar 2019 11:30:33 +0000 (11:30 +0000)]
[DAGCombine] Merge visitSADDO+visitUADDO into visitADDO. NFCI.

llvm-svn: 355689

5 years ago[DAGCombine] Merge visitSSUBO+visitUSUBO into visitSUBO. NFCI.
Simon Pilgrim [Fri, 8 Mar 2019 11:16:55 +0000 (11:16 +0000)]
[DAGCombine] Merge visitSSUBO+visitUSUBO into visitSUBO. NFCI.

llvm-svn: 355688

5 years ago[mips] Use libatomic instead of GCC intrinsics for 64bit
Petar Jovanovic [Fri, 8 Mar 2019 10:53:19 +0000 (10:53 +0000)]
[mips] Use libatomic instead of GCC intrinsics for 64bit

The following GCC intrinsics are not available on MIPS32:

__sync_fetch_and_add_8
__sync_fetch_and_and_8
__sync_fetch_and_or_8
__sync_val_compare_and_swap_8

Replace these with appropriate libatomic implementation.

Patch by Miodrag Dinic.

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

llvm-svn: 355687

5 years ago[IR][ARM] Add function pointer alignment to datalayout
Michael Platings [Fri, 8 Mar 2019 10:44:06 +0000 (10:44 +0000)]
[IR][ARM] Add function pointer alignment to datalayout

Use this feature to fix a bug on ARM where 4 byte alignment is
incorrectly assumed.

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

llvm-svn: 355685

5 years agoMake function definition in header inline
Benjamin Kramer [Fri, 8 Mar 2019 10:43:56 +0000 (10:43 +0000)]
Make function definition in header inline

Otherwise including this header from more than one place will break
linking.

llvm-svn: 355684

5 years ago[clang][Index] Fix msan failure
Kadir Cetinkaya [Fri, 8 Mar 2019 10:18:40 +0000 (10:18 +0000)]
[clang][Index] Fix msan failure

llvm-svn: 355683

5 years agoclang-cl : Parse all /d2 options
Hans Wennborg [Fri, 8 Mar 2019 10:00:42 +0000 (10:00 +0000)]
clang-cl : Parse all /d2 options

We will now warn about such options being unused,
which is better than the current
"no such file or directory: '/d2foo'" errors.

Note that we can still handle specific flags separately,
e.g. we were already ignoring /d2FastFail and /d2Zi+

llvm-svn: 355682

5 years ago[clangd] Remove ./ and ../ in the file paths
Kadir Cetinkaya [Fri, 8 Mar 2019 09:57:33 +0000 (09:57 +0000)]
[clangd] Remove ./ and ../ in the file paths

Reviewers: hokein

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

Tags: #clang

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

llvm-svn: 355681