platform/upstream/llvm.git
5 years ago[FileCheck] Remove llvm:: prefix
Thomas Preud'homme [Thu, 23 May 2019 17:19:36 +0000 (17:19 +0000)]
[FileCheck] Remove llvm:: prefix

Summary:
Remove all llvm:: prefixes in FileCheck library header and
implementation except for calls to make_unique and make_shared since
both files already use the llvm namespace.

Reviewers: jhenderson, jdenny, probinson, arichardson

Subscribers: hiraditya, arichardson, probinson, llvm-commits

Tags: #llvm

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

llvm-svn: 361515

5 years ago[LibTooling] Fix dangling references in RangeSelector.
Yitzhak Mandelbaum [Thu, 23 May 2019 17:11:33 +0000 (17:11 +0000)]
[LibTooling] Fix dangling references in RangeSelector.

Summary:
RangeSelector had a number of cases of capturing a StringRef in a lambda, which
lead to dangling references. This change converts all uses in the API of
`StringRef` to `std::string` to avoid this problem. `std::string` in the API is
a reasonable choice, because the combinators are always storing the string
beyond the life of the combinator construction.

Reviewers: ilya-biryukov, gribozavr

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 361514

5 years ago[CMake] Copy C++ headers before configuring runtimes build
Chris Bieneman [Thu, 23 May 2019 17:06:46 +0000 (17:06 +0000)]
[CMake] Copy C++ headers before configuring runtimes build

Summary: On some platforms C++ headers are packaged with the compiler not the sysroot. If you don't copy C++ headers into the build include directory during configuraiton of the outer build the C++ check during the runtime configuration may get inaccurate results.

Reviewers: phosek, compnerd, smeenai, EricWF

Reviewed By: compnerd

Subscribers: EricWF, christof, libcxx-commits, mgorny, llvm-commits

Tags: #llvm, #libc

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

llvm-svn: 361513

5 years agoTransforms: lower fadd and fsub atomicrmw instructions
Saleem Abdulrasool [Thu, 23 May 2019 17:03:43 +0000 (17:03 +0000)]
Transforms: lower fadd and fsub atomicrmw instructions

`fadd` and `fsub` have recently (r351850) been added as `atomicrmw`
operations. This diff adds lowering cases for them to the LowerAtomic
transform.

Patch by Josh Berdine!

llvm-svn: 361512

5 years ago[Index] Fix reported references in presence of template type aliases
Ilya Biryukov [Thu, 23 May 2019 16:48:47 +0000 (16:48 +0000)]
[Index] Fix reported references in presence of template type aliases

Summary: See the added test for an example.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 361511

5 years ago[CodeComplete] Only show lambda completions if patterns are requested
Ilya Biryukov [Thu, 23 May 2019 16:39:26 +0000 (16:39 +0000)]
[CodeComplete] Only show lambda completions if patterns are requested

This is a trivial follow-up to r361461, so sending without review.

llvm-svn: 361510

5 years ago[MCA] Add the ability to compute critical register dependency of an instruction.
Andrea Di Biagio [Thu, 23 May 2019 16:32:19 +0000 (16:32 +0000)]
[MCA] Add the ability to compute critical register dependency of an instruction.

This patch adds the methods `getCriticalRegDep()` and `computeCriticalRegDep()` to
class InstructionBase.
The goal is to allow users to obtain information about the critical register
dependency that most affects the latency of an instruction.

These methods are currently unused. However, the long term plan is to use them
in order to allow the computation of a critical-path as part of the bottleneck
analysis. So, this is yet another step towards fixing PR37494.

llvm-svn: 361509

5 years ago[AsmPrinter] Treat a narrowing PtrToInt like Trunc
Shoaib Meenai [Thu, 23 May 2019 16:29:09 +0000 (16:29 +0000)]
[AsmPrinter] Treat a narrowing PtrToInt like Trunc

When printing assembly for PtrToInt, AsmPrinter::lowerConstant
incorrectly assumed that if PtrToInt was not converting to an
int with exactly the same number of bits, it must be widening
to a larger int. But this isn't necessarily true; PtrToInt can
also shrink the size, which is useful when you want to produce
a known 32-bit pointer on a 64-bit platform (on x86_64 ELF
this yields a R_X86_64_32 relocation).

The old behavior of falling through to the widening case for a
narrowing PtrToInt yields bogus assembly code like this, which
fails to assemble because the no-op bit and it accidentally
creates is not a valid relocation:

```
        .long   a&-1
```

The fix is to treat a narrowing PtrToInt exactly the same as
it already treats Trunc: just emit the expression and let
the assembler deal with truncating it in the appropriate way.

Patch by Mat Hostetter <mjh@fb.com>.

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

llvm-svn: 361508

5 years agoEnsure builtins use the target default Calling Convention
Erich Keane [Thu, 23 May 2019 16:05:21 +0000 (16:05 +0000)]
Ensure builtins use the target default Calling Convention

r355317 changed builtins/allocation functions to use the default calling
convention in order to support platforms that use non-cdecl calling
conventions by default.

However the default calling convention is overridable on Windows 32 bit
implementations with some of the /G options. The intent is to permit the
user to set the calling convention of normal functions, however it
should NOT apply to builtins and C++ allocation functions.

This patch ensures that the builtin/allocation functions always use the
Target specific Calling Convention, ignoring the user overridden version
of said default.

llvm-svn: 361507

5 years ago[Object] object::ELFObjectFile::symbol_begin(): skip symbol index 0
Fangrui Song [Thu, 23 May 2019 16:01:59 +0000 (16:01 +0000)]
[Object] object::ELFObjectFile::symbol_begin(): skip symbol index 0

For clients iterating the symbol table, none expects to handle index 0
(STN_UNDEF). Skip it to improve consistency with other binary formats.
Clients that need STN_UNDEF (e.g. lld) can use
getSectionContentsAsArray(). A test will be added in D62148.

Reviewed By: mtrent

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

llvm-svn: 361506

5 years ago[analyzer][NFC] Prettify some RUN: lines in test files.
Kristof Umann [Thu, 23 May 2019 15:49:04 +0000 (15:49 +0000)]
[analyzer][NFC] Prettify some RUN: lines in test files.

This is a test commit in disguise.

llvm-svn: 361505

5 years ago[Driver] Try normalized triple when looking for C++ libraries
Petr Hosek [Thu, 23 May 2019 15:23:16 +0000 (15:23 +0000)]
[Driver] Try normalized triple when looking for C++ libraries

This addresses the issue introduced in r361432 where we would only
try effective triple but not the normalized one as we do for other
runtimes.

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

llvm-svn: 361504

5 years ago[lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'
Konrad Kleine [Thu, 23 May 2019 15:17:39 +0000 (15:17 +0000)]
[lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

Summary:
On Windows `lldb::thread_result_t` resolves to `typedef unsigned thread_result_t;` and on other platforms it resolves to `typedef void *thread_result_t;`.
 Therefore one cannot use `nullptr` when returning from a function that returns `thread_result_t`.

I've made this change because a windows build bot fails with these errors:

```
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Communication.cpp(362): error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Communication.cpp(362): note: A native nullptr can only be converted to bool or, using reinterpret_cast, to an integral type
```

and

```
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1619): error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1619): note: A native nullptr can only be converted to bool or, using reinterpret_cast, to an integral type
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1664): error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1664): note: A native nullptr can only be converted to bool or, using reinterpret_cast, to an integral type
```

This is the failing build: http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/5035/steps/build/logs/stdio

Reviewers: JDevlieghere, teemperor, jankratochvil, labath, clayborg, RKSimon, courbet, jhenderson

Reviewed By: labath, clayborg

Subscribers: labath, lldb-commits

Tags: #lldb

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

llvm-svn: 361503

5 years agoWork around a Visual C++ bug.
Paul Robinson [Thu, 23 May 2019 15:07:46 +0000 (15:07 +0000)]
Work around a Visual C++ bug.

Using a static function as a template parameter gets a bogus compile-time
error with Visual Studio 2017, prior to version 15.8. Our current
minimum-version requirement is a particular update to VS2015, and we
assume all Visual Studio 2017 versions are usable. This patch makes the
code buildable with older versions of VS2017, and can be reverted after
we upgrade the minimum version sometime in the future.

Description of the Microsoft bug:
https://developercommunity.visualstudio.com/content/problem/25334/error-code-c2971-when-specifying-a-function-as-the.html

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

llvm-svn: 361502

5 years ago[cmake] When getting Ninja version, don't include CMakeNinjaFindMake
Don Hinton [Thu, 23 May 2019 15:03:22 +0000 (15:03 +0000)]
[cmake] When getting Ninja version, don't include CMakeNinjaFindMake
which doesn't play well with passing CMAKE_MAKE_PROGRAM from the
commandline without a path.

Fixes a bug introduced in r361280.

Thanks to Mikael Holmén for reporting this!

llvm-svn: 361501

5 years ago[NFC][InstCombine] Add unary FNeg tests to maximum.ll/minimum.ll
Cameron McInally [Thu, 23 May 2019 14:53:42 +0000 (14:53 +0000)]
[NFC][InstCombine] Add unary FNeg tests to maximum.ll/minimum.ll

llvm-svn: 361500

5 years ago[RISCV] Support assembling TLS LA pseudo instructions
Lewis Revill [Thu, 23 May 2019 14:46:27 +0000 (14:46 +0000)]
[RISCV] Support assembling TLS LA pseudo instructions

This patch adds the pseudo instructions la.tls.ie and la.tls.gd, used in
the initial-exec and global-dynamic TLS models respectively when
addressing a global. The pseudo instructions are expanded in the
assembly parser.

llvm-svn: 361499

5 years agogn build: Merge r361487
Nico Weber [Thu, 23 May 2019 13:59:44 +0000 (13:59 +0000)]
gn build: Merge r361487

llvm-svn: 361498

5 years ago[LiveDebugValues] Rename 'DMI' into 'DebugInstr' (NFC)
Petar Jovanovic [Thu, 23 May 2019 13:49:06 +0000 (13:49 +0000)]
[LiveDebugValues] Rename 'DMI' into 'DebugInstr' (NFC)

This will improve code readability.

Patch by Djordje Todorovic.

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

llvm-svn: 361497

5 years ago[MCA] Introduce class LSUnitBase and let LSUnit derive from it.
Andrea Di Biagio [Thu, 23 May 2019 13:42:47 +0000 (13:42 +0000)]
[MCA] Introduce class LSUnitBase and let LSUnit derive from it.

Class LSUnitBase provides a abstract interface for all the concrete LS units in
llvm-mca.

Methods exposed by the public abstract LSUnitBase interface are:
 - Status isAvailable(const InstRef&);
 - void dispatch(const InstRef &);
 - const InstRef &isReady(const InstRef &);

LSUnitBase standardises the API, but not the data structures internally used by
LS units. This allows for more flexibility.
Previously, only method `isReady()` was declared virtual by class LSUnit.
Also, derived classes had to inherit all the internal data members of LSUnit.

No functional change intended.

llvm-svn: 361496

5 years ago[X86] Regenerate LZCNT tests on x86/x32/x64 targets
Simon Pilgrim [Thu, 23 May 2019 13:30:10 +0000 (13:30 +0000)]
[X86] Regenerate LZCNT tests on x86/x32/x64 targets

llvm-svn: 361495

5 years ago[libcxx][tests] Fix order checking in unordered_multiset tests.
Louis Dionne [Thu, 23 May 2019 13:11:00 +0000 (13:11 +0000)]
[libcxx][tests] Fix order checking in unordered_multiset tests.

Some tests assume that iteration through an unordered multiset elements
will return them in the same order as at the container creation. This
assumption is not true since the container is unordered, so that no
specific order of elements is ever guaranteed for such container. This
patch introduces checks verifying that any iteration will return
elements exactly from a set of valid values and without repetition,
but in no particular order.

Thanks to Andrey Maksimov for  the patch.

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

llvm-svn: 361494

5 years ago[RISCV][NFC] Add nounwind attribute to functions missing it in test/CodeGen/RISCV
Alex Bradbury [Thu, 23 May 2019 12:43:13 +0000 (12:43 +0000)]
[RISCV][NFC] Add nounwind attribute to functions missing it in test/CodeGen/RISCV

r360897 was incomplete, must have applied an old/wip patch. This is in preparation for emitting CFI directives.

llvm-svn: 361493

5 years ago[llvm-objdump][test] Make MachO test names consistent
Fangrui Song [Thu, 23 May 2019 12:43:08 +0000 (12:43 +0000)]
[llvm-objdump][test] Make MachO test names consistent

We have macho-disassembl{e,y}-*. Rename macho-disassembly-* to
macho-disassemble-* for consistency.

llvm-svn: 361492

5 years ago[llvm-objdump][test] Make test names consistent
James Henderson [Thu, 23 May 2019 12:38:06 +0000 (12:38 +0000)]
[llvm-objdump][test] Make test names consistent

This change renames a number of the disassembly tests to standardise
disasm/diassemble/disassembly to disassemble. Requested in
https://reviews.llvm.org/D62255.

llvm-svn: 361491

5 years ago[MergeICmps] Make the pass compatible with the new pass manager.
Clement Courbet [Thu, 23 May 2019 12:35:26 +0000 (12:35 +0000)]
[MergeICmps] Make the pass compatible with the new pass manager.

Reviewers: gchatelet, spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 361490

5 years ago[llvm-objdump][test] Improve testing of some switches #3
James Henderson [Thu, 23 May 2019 12:30:39 +0000 (12:30 +0000)]
[llvm-objdump][test] Improve testing of some switches #3

This is the third commit in a series of patches to improve test coverage
of llvm-objdump. In this patch I have added a number of tests testing
various aspects of disassembly.

Reviewed by: MaskRay, grimar, rupprecht

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

llvm-svn: 361489

5 years ago[clangd] Also update package-lock.json
Kadir Cetinkaya [Thu, 23 May 2019 12:02:14 +0000 (12:02 +0000)]
[clangd] Also update package-lock.json

llvm-svn: 361488

5 years ago[clang-tidy] New check calling out uses of +new in Objective-C code
Dmitri Gribenko [Thu, 23 May 2019 12:01:26 +0000 (12:01 +0000)]
[clang-tidy] New check calling out uses of +new in Objective-C code

Summary:
Google's Objective-C style guide forbids calling or overriding +new to instantiate objects. This check warns on violations.

Style guide reference: https://google.github.io/styleguide/objcguide.html#do-not-use-new

Patch by Michael Wyman.

Reviewers: benhamilton, aaron.ballman, JonasToth, gribozavr, ilya-biryukov, stephanemoore, mwyman

Reviewed By: aaron.ballman, gribozavr, stephanemoore, mwyman

Subscribers: stephanemoore, xazax.hun, Eugene.Zelenko, mgorny, cfe-commits

Tags: #clang, #clang-tools-extra

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

llvm-svn: 361487

5 years ago[clangd] Bump vscode extension version
Kadir Cetinkaya [Thu, 23 May 2019 11:58:03 +0000 (11:58 +0000)]
[clangd] Bump vscode extension version

llvm-svn: 361486

5 years ago[AMDGPU] Regenerate vector sub tests
Simon Pilgrim [Thu, 23 May 2019 11:27:28 +0000 (11:27 +0000)]
[AMDGPU] Regenerate vector sub tests

llvm-svn: 361485

5 years ago[lldb] NFC modernize codebase with modernize-use-nullptr
Konrad Kleine [Thu, 23 May 2019 11:14:47 +0000 (11:14 +0000)]
[lldb] NFC modernize codebase with modernize-use-nullptr

Summary:
NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]]

This commit is the result of modernizing the LLDB codebase by using
`nullptr` instread of `0` or `NULL`. See
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
for more information.

This is the command I ran and I to fix and format the code base:

```
run-clang-tidy.py \
-header-filter='.*' \
-checks='-*,modernize-use-nullptr' \
-fix ~/dev/llvm-project/lldb/.* \
-format \
-style LLVM \
-p ~/llvm-builds/debug-ninja-gcc
```

NOTE: There were also changes to `llvm/utils/unittest` but I did not
include them because I felt that maybe this library shall be updated in
isolation somehow.

NOTE: I know this is a rather large commit but it is a nobrainer in most
parts.

Reviewers: martong, espindola, shafik, #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits

Tags: #lldb, #llvm

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

llvm-svn: 361484

5 years ago[NFC][X86] Fix check prefixes and autogenerate fold-pcmpeqd-2.ll test
Roman Lebedev [Thu, 23 May 2019 10:55:13 +0000 (10:55 +0000)]
[NFC][X86] Fix check prefixes and autogenerate fold-pcmpeqd-2.ll test

Being affected by (sub %x, c) -> (add %x, (sub 0, c))
patch in an uncertain way.

llvm-svn: 361483

5 years ago[MCA] Make the bool conversion operator in class InstRef explicit. NFCI
Andrea Di Biagio [Thu, 23 May 2019 10:50:01 +0000 (10:50 +0000)]
[MCA] Make the bool conversion operator in class InstRef explicit. NFCI

This patch makes the bool conversion operator in InstRef explicit.
It also adds a operator< to hel comparing InstRef objects in sets.

llvm-svn: 361482

5 years agoAdd REQUIRES: lld to debug-types-address-ranges.s
Pavel Labath [Thu, 23 May 2019 10:46:35 +0000 (10:46 +0000)]
Add REQUIRES: lld to debug-types-address-ranges.s

This should fix the green dragon bots.

llvm-svn: 361481

5 years ago[DwarfExpression] Refactor dwarf expression (NFC)
Petar Jovanovic [Thu, 23 May 2019 10:37:13 +0000 (10:37 +0000)]
[DwarfExpression] Refactor dwarf expression (NFC)

Refactor location description kind in order to be easier for extensions
(needed for D60866).
In addition, cut off some bits from the other class fields.

Patch by Djordje Todorovic.

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

llvm-svn: 361480

5 years ago[llvm-objdump][test] Improve testing of some switches #2
James Henderson [Thu, 23 May 2019 10:17:10 +0000 (10:17 +0000)]
[llvm-objdump][test] Improve testing of some switches #2

This patch focuses on adding additional testing for the --source switch.
For reference, the source-interleave-x86_64.ll test file has been split
into two parts - the input (shared with the other tests) and the test
itself.

Reviewed by: MaskRay, rupprecht, grimar

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

llvm-svn: 361479

5 years agoSimplify InputFile::fetch().
Rui Ueyama [Thu, 23 May 2019 10:15:12 +0000 (10:15 +0000)]
Simplify InputFile::fetch().

We don't have to return a value from the function. Instead, we can
directly call parseFile from the functions.

llvm-svn: 361478

5 years agoRemove LazyObjFile::AddedToLink.
Rui Ueyama [Thu, 23 May 2019 10:08:56 +0000 (10:08 +0000)]
Remove LazyObjFile::AddedToLink.

Instead we can just clear a MemoryBuffer so that we cannot get the
same buffer more than once.

llvm-svn: 361477

5 years agoReland: [WebAssembly] Add __start_/_stop_ symbols for data sections
Sam Clegg [Thu, 23 May 2019 10:06:03 +0000 (10:06 +0000)]
Reland: [WebAssembly] Add __start_/_stop_ symbols for data sections

This is a reland of rL361235.

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

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

llvm-svn: 361476

5 years ago[clangd-vscode] Do not customize uri converters in vscode
Kadir Cetinkaya [Thu, 23 May 2019 09:58:29 +0000 (09:58 +0000)]
[clangd-vscode] Do not customize uri converters in vscode

Summary:
Clangd is already resolving symlinks on the server side, therefore
there is no more need to handle it in client side. This was also resulting in
breakages whenever index contained a symbol coming from a non-existent file(like
a generated file), e.g. during workspace symbols whole response was dropped
since stat had failed.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 361475

5 years agoMove code for symbol resolution from SymbolTable.cpp to Symbols.cpp.
Rui Ueyama [Thu, 23 May 2019 09:58:08 +0000 (09:58 +0000)]
Move code for symbol resolution from SymbolTable.cpp to Symbols.cpp.

My recent commits separated symbol resolution from the symbol table,
so the functions to resolve symbols are now in a somewhat wrong file.
This patch moves it to Symbols.cpp.

The functions are now member functions of the symbol.

This is code move change. I modified function names so that they are
appropriate as member functions, though. No functionality change
intended.

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

llvm-svn: 361474

5 years agoSpeed up --start-lib and --end-lib.
Rui Ueyama [Thu, 23 May 2019 09:53:30 +0000 (09:53 +0000)]
Speed up --start-lib and --end-lib.

--{start,end}-lib give files grouped by the options the archive file
semantics. That is, each object file between them acts as if it were
in an archive file whose sole member is the file.

Therefore, files between --{start,end}-lib are linked to the final
output only if they are needed to resolve some undefined symbols.

Previously, the feature was implemented this way:

 1. We read a symbol table and insert defined symbols to the symbol
    table as lazy symbols.

 2. If an undefind symbol is resolved to a lazy symbol, that lazy
    symbol instantiate ObjFile class for that symbol, which re-insert
    all defined symbols to the symbol table.

So, if an ObjFile is instantiated, defined symbols are inserted to the
symbol table twice. Since inserting long symbol names is not cheap,
there's a room to optimize here.

This patch optimzies it. Now, LazyObjFile remembers symbol handles and
passed them over to a new ObjFile instance, so that the ObjFile
doesn't insert the same strings.

Here is a quick benchmark to link clang. "Original" is the original
lld with unmodified command line options. For "Case 1" and "Case 2", I
extracted all files from archive files and replace .a's in a command
line with .o's wrapped with --{start,end}-lib. I used the original lld
for Case 1" and use this patch for Case 2.

  Original: 5.892
    Case 1: 6.001 (+1.8%)
    Case 2: 5.701 (-3.2%)

So, interestingly, --{start,end}-lib are now faster than the regular
linking scheme with archive files. That's perhaps not too surprising,
though, because for regular archive files, we look up the symbol table
with the same string twice.

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

llvm-svn: 361473

5 years ago[LLD][ELF] - Improve diagnostic about unrecognized relocations.
George Rimar [Thu, 23 May 2019 09:50:18 +0000 (09:50 +0000)]
[LLD][ELF] - Improve diagnostic about unrecognized relocations.

This is a minor improvement inspired by https://bugs.llvm.org/show_bug.cgi?id=38303.

A person reported that he observed message complaining about unsupported R_ARM_V4BX:
error: can't create dynamic relocation R_ARM_V4BX against local symbol in readonly segment; recompile object files with -fPIC

But with -z notext he only saw a relocation number, what is not convenient:
error: ../../gfx/cairo/libpixman/src/pixman-arm-neon-asm-bilinear.o:(.text+0x4F0): unrecognized reloc 40

Also, in the error messages we use relocation but not reloc.

With this patch we start to print one of the following messages:
error: file.o: unrecognized relocation Unknown(999)
error: file.o: unrecognized relocation R_X_KNOWN_BY_LLVM_BUT_UNSUPPORTED_BY_LLD_NAME

There is no way to write a test for that I believe.

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

llvm-svn: 361472

5 years agoDWARFASTParserClang: Reduce indentation
Pavel Labath [Thu, 23 May 2019 09:41:39 +0000 (09:41 +0000)]
DWARFASTParserClang: Reduce indentation

by two levels via early returns.

llvm-svn: 361471

5 years ago[WebAssembly] Seal imports section before counting imports
Sam Clegg [Thu, 23 May 2019 09:41:03 +0000 (09:41 +0000)]
[WebAssembly] Seal imports section before counting imports

Summary:
Before we can assign entries in the function of global index space
we need to know the total number of function and global imports
respectively.

To avoid programmer error this change seals that imports section before
assigned function and global index space.  Any attempt to add an import
after the section is sealed will assert.

The lack this such as check caused  https://reviews.llvm.org/D61876
to be reverted.  I'm also trying to craft a test case the this
failure.

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

Tags: #llvm

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

llvm-svn: 361470

5 years agoMove SymbolTable::addCombinedLTOObject() to LinkerDriver.
Rui Ueyama [Thu, 23 May 2019 09:26:27 +0000 (09:26 +0000)]
Move SymbolTable::addCombinedLTOObject() to LinkerDriver.

Also renames it LinkerDriver::compileBitcodeFiles.

The function doesn't logically belong to SymbolTable. We added this
function to the symbol table because symbol table used to be a
container of input files. This is no longer the case.

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

llvm-svn: 361469

5 years agoDelete default constructors, copy constructors, move constructors, copy assignment...
Dmitri Gribenko [Thu, 23 May 2019 09:22:43 +0000 (09:22 +0000)]
Delete default constructors, copy constructors, move constructors, copy assignment, move assignment operators on Expr, Stmt and Decl

Reviewers: ilya-biryukov, rsmith

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 361468

5 years agoEnable queue_t and clk_event_t comparisons in C++ mode
Sven van Haastregt [Thu, 23 May 2019 09:20:08 +0000 (09:20 +0000)]
Enable queue_t and clk_event_t comparisons in C++ mode

Support queue_t and clk_event_t comparisons in C++ for OpenCL mode, to
preserve backwards compatibility with OpenCL C.

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

llvm-svn: 361467

5 years ago[llvm-objcopy] - Many minor NFC changes to cleanup/improve the code in ELF/Object...
George Rimar [Thu, 23 May 2019 09:18:57 +0000 (09:18 +0000)]
[llvm-objcopy] - Many minor NFC changes to cleanup/improve the code in ELF/Object.cpp.

The code in ELF/Object.cpp is sometimes a bit hard to read because of
lots of auto used everywhere. The main intention of this patch is
to replace them with the real type for places where it is not obvious.
Also it cleanups few places.

It is NFC change, but I want to be sure that there is no objections to do that since it
is massive.

DIfferential revision: https://reviews.llvm.org/D62260

llvm-svn: 361466

5 years agoDWARF: Don't compute address ranges for type units
Pavel Labath [Thu, 23 May 2019 09:07:51 +0000 (09:07 +0000)]
DWARF: Don't compute address ranges for type units

Summary:
Type units don't describe any code, so they should never be the result
of any address lookup queries.

Previously, we would compute the address ranges for the type units for
via the line tables they reference because the type units looked a lot
like line-tables-only compile units. However, this is not correct, as
the line tables are only referenced from type units so that other
declarations can use the file names contained in them.

In this patch I make the BuildAddressRangeTable function virtual, and
implement it only for compile units.

Testing this was a bit tricky, because the behavior depends on the order
in which we add things to the address range map. This rarely caused a
problem with DWARF v4 type units, as they are always added after all
CUs. It happened more frequently with DWARF v5, as there clang emits the
type units first. However, this is still not something that it is
required to do, so for testing I've created an assembly file where I've
deliberately sandwiched a compile unit between two type units, which
should isolate us from both changes in how the compiler emits the units
and changes in the order we process them.

Reviewers: clayborg, aprantl, JDevlieghere

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 361465

5 years ago[clangd-vscode] Bump versions dependencies. NFC
Ilya Biryukov [Thu, 23 May 2019 08:06:24 +0000 (08:06 +0000)]
[clangd-vscode] Bump versions dependencies. NFC

Result of running 'npm audit fix', which tracks security vulnerabilities.

llvm-svn: 361464

5 years agoSimplify `GetName`+`AppendTypeName` by `DWARFDIE`
Jan Kratochvil [Thu, 23 May 2019 08:00:49 +0000 (08:00 +0000)]
Simplify `GetName`+`AppendTypeName` by `DWARFDIE`

In D61502#1503247 @clayborg suggested that DWARFUnit *+dw_offset_t can be now
replaced by DWARFDIE.

It is moved from DWARFDebugInfoEntry to DWARFDIE as noted by @clayborg.

I have also removed return type as (1) it was wrong in one case and (2) no
existing caller used the return type. I also refactored the deep nesting noted
by @JDevlieghere.

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

llvm-svn: 361463

5 years ago[ARM][CGP] Clear SafeWrap before each search
Sam Parker [Thu, 23 May 2019 07:46:39 +0000 (07:46 +0000)]
[ARM][CGP] Clear SafeWrap before each search

The previous patch added a member set to store instructions that we
could allow to wrap. But this wasn't cleared between searches meaning
that they could get promoted, incorrectly, during the promotion of a
separate valid chain.

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

llvm-svn: 361462

5 years ago[CodeComplete] Complete a lambda when preferred type is a function
Ilya Biryukov [Thu, 23 May 2019 07:45:35 +0000 (07:45 +0000)]
[CodeComplete] Complete a lambda when preferred type is a function

Summary: Uses a heuristic to detect std::function and friends.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 361461

5 years ago[GlobalOpt] recognize dead struct fields and propagate values
Christian Bruel [Thu, 23 May 2019 05:53:10 +0000 (05:53 +0000)]
[GlobalOpt] recognize dead struct fields and propagate values

Summary:
Allow struct fields SRA and dead stores. This works by considering fields accesses from getElementPtr to be considered as a possible pointer root that can be cleaned up.
We check that the variable can be SRA by recursively checking the sub expressions with the new isSafeSubSROAGEP function.

basically this allows the array in following C code  to be optimized out

struct Expr {
  int a[2];
  int b;
};

static struct Expr e;

int foo (int i)
{
  e.b = 2;
  e.a[i] = 1;
  return e.b;
}

Reviewers: greened, bkramer, nicholas, jmolloy

Reviewed By: jmolloy

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 361460

5 years ago[Reproducer] Pass FileSpec by const-ref. (NFC)
Jonas Devlieghere [Thu, 23 May 2019 05:45:49 +0000 (05:45 +0000)]
[Reproducer] Pass FileSpec by const-ref. (NFC)

Fix two functions where we were passing FileSpecs by value, while we
could pass by const reference.

llvm-svn: 361459

5 years ago[Utility] Modernize C-style cats
Jonas Devlieghere [Thu, 23 May 2019 05:12:11 +0000 (05:12 +0000)]
[Utility] Modernize C-style cats

Replaces the remaining C-style casts with explicit casts in Utility. The
motivation is that they are (1) easier to spot and (2) don't have
multiple meanings.

llvm-svn: 361458

5 years agoRemove unnecessary const&s; NFC
George Burgess IV [Thu, 23 May 2019 02:52:39 +0000 (02:52 +0000)]
Remove unnecessary const&s; NFC

It's uncommon to rely on temporary lifetime extension when having a
regular, non-`const&` value behaves identically. Since `Twine::str`
and `buildFixMsgForStringFlag` both return regular `std::string`s,
there's seemingly no point in having `const&` here.

llvm-svn: 361457

5 years ago[CMake][Fuchsia] Use cannonical triples for runtimes
Petr Hosek [Thu, 23 May 2019 02:35:12 +0000 (02:35 +0000)]
[CMake][Fuchsia] Use cannonical triples for runtimes

This ensures that whether the user uses short or cannonical version
of the triple, Clang will still find the runtimes under the cannonical
triple name.

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

llvm-svn: 361456

5 years agoRemove unused const version of CommandInterpreter::GetCommandHistory.
Jim Ingham [Thu, 23 May 2019 01:40:33 +0000 (01:40 +0000)]
Remove unused const version of CommandInterpreter::GetCommandHistory.

llvm-svn: 361455

5 years ago[WebAssembly] Implement __builtin_return_address for emscripten
Thomas Lively [Thu, 23 May 2019 01:24:01 +0000 (01:24 +0000)]
[WebAssembly] Implement __builtin_return_address for emscripten

Summary:
In this patch, `ISD::RETURNADDR` is lowered on the emscripten target
to the new Emscripten runtime function `emscripten_return_address`, which
implements the functionality.

Patch by Guanzhong Chen

Reviewers: tlively, aheejin

Reviewed By: tlively

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

Tags: #llvm

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

llvm-svn: 361454

5 years ago[X86] Support -fno-plt __tls_get_addr calls
Fangrui Song [Thu, 23 May 2019 01:05:13 +0000 (01:05 +0000)]
[X86] Support -fno-plt __tls_get_addr calls

In general dynamic/local dynamic TLS models, with -fno-plt,

* x86: emit `calll *___tls_get_addr@GOT(%ebx)` instead of `calll ___tls_get_addr@PLT`
  Note, on x86, if we can get rid of %ebx as the PIC register,
  it may be better to use a register not preserved across function calls.
* x86_64: emit `callq *__tls_get_addr@GOTPCREL(%rip)` instead of `callq __tls_get_addr@PLT`

Reorganize the code by separating 32-bit and 64-bit.

Reviewed By: rnk

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

llvm-svn: 361453

5 years ago[libFuzzer] remove the data-flow-trace (DFT) python scripts; their functionality...
Kostya Serebryany [Thu, 23 May 2019 01:03:42 +0000 (01:03 +0000)]
[libFuzzer] remove the data-flow-trace (DFT) python scripts; their functionality is now part of libFuzzer proper; also write functions.txt to the disk only if this file doesn't exist yet

llvm-svn: 361452

5 years ago[ARM64][AArch64] Update disassembler attributes to ARMv8.5 ISA with SVE extensions
Omair Javaid [Thu, 23 May 2019 00:46:34 +0000 (00:46 +0000)]
[ARM64][AArch64] Update disassembler attributes to ARMv8.5 ISA with SVE extensions

This patch updates assembler attributes for AArch64 targets so we can disassemble newer instructions supported in ISA version 8.5 and SVE extensions.

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

llvm-svn: 361451

5 years ago[llvm-objcopy] Add file names to error messages
Seiya Nuta [Thu, 23 May 2019 00:42:46 +0000 (00:42 +0000)]
[llvm-objcopy] Add file names to error messages

Summary:
This patch adds the file names to llvm-objcopy error messages. It makes easy to identify which file causes an error.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=41798

Reviewers: espindola, alexshap, rupprecht, jhenderson, jakehehrlich

Reviewed By: rupprecht, jhenderson, jakehehrlich

Subscribers: emaste, arichardson, jakehehrlich, MaskRay, llvm-commits

Tags: #llvm

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

llvm-svn: 361450

5 years agogn build: Merge r361418.
Peter Collingbourne [Thu, 23 May 2019 00:31:55 +0000 (00:31 +0000)]
gn build: Merge r361418.

llvm-svn: 361449

5 years ago[libFuzzer] automatically collect the data flow trace (DFT) in the fork mode if ...
Kostya Serebryany [Thu, 23 May 2019 00:22:46 +0000 (00:22 +0000)]
[libFuzzer] automatically collect the data flow trace (DFT) in the fork mode if -collect_data_flow= is given

llvm-svn: 361448

5 years agoAck, added DWARFTypeUnit to the wrong target...
Jim Ingham [Thu, 23 May 2019 00:12:45 +0000 (00:12 +0000)]
Ack, added DWARFTypeUnit to the wrong target...

LLDB -> liblldbcore.a

llvm-svn: 361447

5 years ago[FileCheck] Introduce substitution subclasses
Thomas Preud'homme [Thu, 23 May 2019 00:10:29 +0000 (00:10 +0000)]
[FileCheck] Introduce substitution subclasses

Summary:
With now a clear distinction between string and numeric substitutions,
this patch introduces separate classes to represent them with a parent
class implementing the common interface. Diagnostics in
printSubstitutions() are also adapted to not require knowing which
substitution is being looked at since it does not hinder clarity and
makes the implementation simpler.

Reviewers: jhenderson, jdenny, probinson, arichardson

Subscribers: llvm-commits, probinson, arichardson, hiraditya

Tags: #llvm

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

llvm-svn: 361446

5 years agoFileCheck: Improve FileCheck variable terminology
Thomas Preud'homme [Thu, 23 May 2019 00:10:14 +0000 (00:10 +0000)]
FileCheck: Improve FileCheck variable terminology

Summary:
Terminology introduced by [[#]] blocks is confusing and does not
integrate well with existing terminology.

First, variables referred by [[]] blocks are called "pattern variables"
while the text a CHECK directive needs to match is called a "CHECK
pattern". This is inconsistent with variables in [[#]] blocks since
[[#]] blocks are also found in CHECK pattern yet those variables are
called "numeric variable".

Second, the replacing of both [[]] and [[#]] blocks by the value of the
variable or expression they contain is represented by a
FileCheckPatternSubstitution class. The naming refers to being a
substitution in a CHECK pattern but could be wrongly understood as being
a substitution of a pattern variable.

Third and lastly, comments use "numeric expression" to refer both to the
[[#]] blocks as well as to the numeric expressions these blocks contain
which get evaluated at match time.

This patch solves these confusions by
- calling variables in [[]] and [[#]] blocks as string and numeric
  variables respectively;
- referring to [[]] and [[#]] as substitution *blocks*, with the former
  being a string substitution block and the latter a numeric
  substitution block;
- calling [[]] and [[#]] blocks to be replaced by the value of a
  variable or expression they contain a substitution (as opposed to
  definition when these blocks are used to defined a variable), with the
  former being a string substitution and the latter a numeric
  substitution;
- renaming the FileCheckPatternSubstitution as a FileCheckSubstitution
  class with FileCheckStringSubstitution and
  FileCheckNumericSubstitution subclasses;
- restricting the use of "numeric expression" to refer to the expression
  that is evaluated in a numeric substitution.

While numeric substitution blocks only support numeric substitutions of
numeric expressions at the moment there are plans to augment numeric
substitution blocks to support numeric definitions as well as both a
numeric definition and numeric substitution in the same numeric
substitution block.

Reviewers: jhenderson, jdenny, probinson, arichardson

Subscribers: hiraditya, arichardson, probinson, llvm-commits

Tags: #llvm

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

llvm-svn: 361445

5 years ago[lldb] Fix use-of-uninitialized-value in Driver
Jorge Gorbe Moya [Wed, 22 May 2019 23:37:48 +0000 (23:37 +0000)]
[lldb] Fix use-of-uninitialized-value in Driver

The driver passes by reference an uninitialized num_errors variable to
RunCommandInterpreter. This should be fine, as it's supposed to be
an output argument, but the reproducer instrumentation reads it in order
to record the value of all the arguments to the function.

This change fixes it by initializing num_errors to 0 before calling
RunCommandInterpreter.

llvm-svn: 361444

5 years agoExpression: correct relocation model for Windows
Saleem Abdulrasool [Wed, 22 May 2019 23:23:39 +0000 (23:23 +0000)]
Expression: correct relocation model for Windows

The Windows Code Generation model cannot generation code with the PIC relocation
model - all code is implicitly position independent due to the DLL load slide
that occurs if it is not loaded at the preferred base address.  Invert the
condition and inline the single use of the variable.  This should also aid the
WASM target.  This significantly improves the state of the (swift) repl on
Windows (and should aid in expression evaluation on Windows).

llvm-svn: 361443

5 years ago[Target] Protect Processes' language runtimes map with a mutex
Alex Langford [Wed, 22 May 2019 23:01:18 +0000 (23:01 +0000)]
[Target] Protect Processes' language runtimes map with a mutex

Summary:
From what I understand, it's possible for multiple threads to request
a specific language runtime (e.g. CPPLanguageRuntime). This leads to a data
race.

Reviewers: jingham, JDevlieghere, compnerd, clayborg

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

llvm-svn: 361442

5 years ago[ORC] Remove a stray decl that accidentally found its way in to r361322.
Lang Hames [Wed, 22 May 2019 22:57:40 +0000 (22:57 +0000)]
[ORC] Remove a stray decl that accidentally found its way in to r361322.

llvm-svn: 361441

5 years agoActaully lock accesses to OptionValueFileSpecList objects
Frederic Riss [Wed, 22 May 2019 21:58:52 +0000 (21:58 +0000)]
Actaully lock accesses to OptionValueFileSpecList objects

The patch in r359029 missed a few accessors and mutators. This patch
also changes the lock to a recursive one as OptionValueFileSpecList::Clear()
can be invoked from some of the other methods.

llvm-svn: 361440

5 years agoFix r361428 for Windows buildbots/mangling
David Blaikie [Wed, 22 May 2019 21:58:17 +0000 (21:58 +0000)]
Fix r361428 for Windows buildbots/mangling

llvm-svn: 361439

5 years agoFix new enum-codegen.cpp test
Reid Kleckner [Wed, 22 May 2019 21:52:12 +0000 (21:52 +0000)]
Fix new enum-codegen.cpp test

llvm-svn: 361438

5 years ago[docs] Make a note of the HowToUseLLJIT example in the ORCv2 design doc.
Lang Hames [Wed, 22 May 2019 21:44:46 +0000 (21:44 +0000)]
[docs] Make a note of the HowToUseLLJIT example in the ORCv2 design doc.

llvm-svn: 361437

5 years ago[Runtimes] If LLVM_INCLUDE_TESTS=On depend on gtest
Chris Bieneman [Wed, 22 May 2019 21:42:06 +0000 (21:42 +0000)]
[Runtimes] If LLVM_INCLUDE_TESTS=On depend on gtest

Summary: If we are building the tests for the runtimes we should make them depend on gtest so that gtest is built and ready before we run any of the check-* targets.

Reviewers: phosek, compnerd

Reviewed By: compnerd

Subscribers: mgorny, winksaville, llvm-commits

Tags: #llvm

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

llvm-svn: 361436

5 years agoAdd a HowToUseLLJIT example project.
Lang Hames [Wed, 22 May 2019 21:38:41 +0000 (21:38 +0000)]
Add a HowToUseLLJIT example project.

A very minimal demo of how to use the LLJIT class, along the lines of the old
HowToUseJIT example.

llvm-svn: 361435

5 years agoTableGen: Handle nontrivial foreach range bounds
Matt Arsenault [Wed, 22 May 2019 21:28:20 +0000 (21:28 +0000)]
TableGen: Handle nontrivial foreach range bounds

This allows using anything that isn't a literal integer as the bounds
for a foreach. Some of the diagnostics aren't perfect, but nobody ever
accused tablegen of having good errors. For example, the existing
wording suggests a bitrange is valid, but as far as I can tell this
has never worked.

Fixes bug 41958.

llvm-svn: 361434

5 years agoAdd some notes on immutability and faithfulness to the internals manual.
Richard Smith [Wed, 22 May 2019 21:20:09 +0000 (21:20 +0000)]
Add some notes on immutability and faithfulness to the internals manual.

llvm-svn: 361433

5 years ago[runtimes] Move libunwind, libc++abi and libc++ to lib/$target/c++ and include/c++
Petr Hosek [Wed, 22 May 2019 21:08:33 +0000 (21:08 +0000)]
[runtimes] Move libunwind, libc++abi and libc++ to lib/$target/c++ and include/c++

This change is a consequence of the discussion in "RFC: Place libs in
Clang-dedicated directories", specifically the suggestion that
libunwind, libc++abi and libc++ shouldn't be using Clang resource
directory. Tools like clangd make this assumption, but this is
currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build.
This change addresses that by moving the output of these libraries to
lib/$target/c++ and include/c++ directories, leaving resource directory
only for compiler-rt runtimes and Clang builtin headers.

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

llvm-svn: 361432

5 years ago[X86] Explcitly disable VEXTRACT instruction matching for an immediate of 0. Remove...
Craig Topper [Wed, 22 May 2019 21:00:18 +0000 (21:00 +0000)]
[X86] Explcitly disable VEXTRACT instruction matching for an immediate of 0. Remove a bunch of isel patterns that become unnecessary.

We effectively had a second set of isel patterns that tried to use a
regular store instruction and an extract_subreg instruction. Or a masked move
and an extract_subreg. These patterns were intended to override the
matching of VEXTRACT instructions by taking advantage of the priority
of the explicit immediate 0 for the index.

This patch instaed just disables the immediate 0 matchin the VEXTRACT
patterns. This each of the component pieces of the larger patterns will
match by themselves.

This found a bug of sorts were we didn't use 128-bit store for 512->128
extract on KNL. Its unclear what the right thing here should be.
Using the vextract avoids constraining the register allocator to use
xmm0-15. But it always results in a longer encoding if the register
allocator ends up choosing xmm0-15 anyway.

llvm-svn: 361431

5 years agoReverted r361134 because of a failing test left unattended for a long time.
Galina Kistanova [Wed, 22 May 2019 20:42:56 +0000 (20:42 +0000)]
Reverted r361134 because of a failing test left unattended for a long time.

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/17792/steps/test-check-all/logs/stdio
Failing Tests (1):
    LLVM :: CodeGen/AMDGPU/regbank-reassign.mir

llvm-svn: 361430

5 years agoAdd back --sysroot support for darwin header search.
James Y Knight [Wed, 22 May 2019 20:39:51 +0000 (20:39 +0000)]
Add back --sysroot support for darwin header search.

Before e97b5f5cf37e ([clang][Darwin] Refactor header search path logic
into the driver), both --sysroot and -isysroot worked to specify where
to look for system and C++ headers on Darwin. However, that change
caused clang to start ignoring --sysroot.

This fixes the regression, and adds tests.

(I also note that on all other platforms, clang seems to almost
completely ignore -isysroot, but that's another issue...)

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

llvm-svn: 361429

5 years agoModules: Code generation of enum constants for merged enum definitions
David Blaikie [Wed, 22 May 2019 20:36:06 +0000 (20:36 +0000)]
Modules: Code generation of enum constants for merged enum definitions

Found in a bootstrap of LLVM with implicit modules, resulting in a
deadlock of some Orc unit tests with libstdc++ 8.1. An enum was used as
part of the implementation of std::recursive_mutex and this bug resulted
in the constant initialization of zero instead of the desired non-zero
value. => Badness.

Richard Smith tells me neither of these fields are necessarily canonical
& so using declaresSamEntity is the right solution here (rather than
changing both of these Fields to be canonical by construction/from their
source)

llvm-svn: 361428

5 years ago[asan] Fix debug asan build link error
Reid Kleckner [Wed, 22 May 2019 20:29:12 +0000 (20:29 +0000)]
[asan] Fix debug asan build link error

Reviewers: dmajor, vitalybuka, waltl

Subscribers: kubamracek, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 361427

5 years agoRe-land r361206 "[COFF] Store alignment in log2 form, NFC"
Reid Kleckner [Wed, 22 May 2019 20:21:52 +0000 (20:21 +0000)]
Re-land r361206 "[COFF] Store alignment in log2 form, NFC"

The previous patch lost the call to PowerOf2Ceil, which causes LLD to
crash when handling common symbols with a non-power-of-2 size. I tweaked
the existing common.test to make the bsspad16 common symbol be 15 bytes
to add coverage for this case.

llvm-svn: 361426

5 years ago[X86][InstCombine] Remove InstCombine code that turns X86 round intrinsics into llvm...
Craig Topper [Wed, 22 May 2019 20:04:55 +0000 (20:04 +0000)]
[X86][InstCombine] Remove InstCombine code that turns X86 round intrinsics into llvm.ceil/floor. Remove some isel patterns that existed because that was happening.

We were turning roundss/sd/ps/pd intrinsics with immediates of 1 or 2 into
llvm.floor/ceil.  The llvm.ceil/floor intrinsics are supposed to correspond
to the libm functions.  For the libm functions we need to disable the
precision exception so the llvm.floor/ceil functions should always map to
encodings 0x9 and 0xA.

We had a mix of isel patterns where some used 0x9 and 0xA and others used
0x1 and 0x2. We need to be consistent and always use 0x9 and 0xA.

Since we have no way in isel of knowing where the llvm.ceil/floor came
from, we can't map X86 specific intrinsics with encodings 1 or 2 to it.
We could map 0x9 and 0xA to llvm.ceil/floor instead, but I'd really like
to see a use case and optimization advantage first.

I've left the backend test cases to show the blend we now emit without
the extra isel patterns. But I've removed the InstCombine tests completely.

llvm-svn: 361425

5 years agoPart of P1091R3: permit structured bindings to be declared 'static' and
Richard Smith [Wed, 22 May 2019 19:52:55 +0000 (19:52 +0000)]
Part of P1091R3: permit structured bindings to be declared 'static' and
'thread_local' in C++20.

llvm-svn: 361424

5 years ago[X86] Add more icelake model numbers to compiler-rt implementation of __builtin_cpu_is.
Craig Topper [Wed, 22 May 2019 19:51:48 +0000 (19:51 +0000)]
[X86] Add more icelake model numbers to compiler-rt implementation of __builtin_cpu_is.

Using model numbers found in Table 2-1 of the May 2019 version
of the Intel Software Developer's Manual Volume 4.

llvm-svn: 361423

5 years ago[X86] Add more icelake model numbers to getHostCPUName.
Craig Topper [Wed, 22 May 2019 19:51:35 +0000 (19:51 +0000)]
[X86] Add more icelake model numbers to getHostCPUName.

Using model numbers found in Table 2-1 of the May 2019 version
of the Intel Software Developer's Manual Volume 4.

llvm-svn: 361422

5 years ago[OPENMP][NVPTX]Fix barriers and parallel level counters, NFC.
Alexey Bataev [Wed, 22 May 2019 19:50:32 +0000 (19:50 +0000)]
[OPENMP][NVPTX]Fix barriers and parallel level counters, NFC.

Summary:
Parallel level counter should be volatile to prevent some dangerous
optimiations by the ptxas. Otherwise, ptxas optimizations lead to
undefined behaviour in some cases.
Also, use __threadfence() for #pragma omp flush and if the barrier
should not be used (we have only one thread in the team), still perform
flush operation since the standard requires implicit flush when
executing barriers.

Reviewers: gtbercea, kkwli0, grokos

Subscribers: guansong, jfb, jdoerfert, openmp-commits, caomhin

Tags: #openmp

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

llvm-svn: 361421

5 years agoAdd DWARFTypeUnit to the Xcode project.
Jim Ingham [Wed, 22 May 2019 19:05:59 +0000 (19:05 +0000)]
Add DWARFTypeUnit to the Xcode project.

llvm-svn: 361420

5 years agogn build: Fix check-clangd target after r359825
Nico Weber [Wed, 22 May 2019 19:03:45 +0000 (19:03 +0000)]
gn build: Fix check-clangd target after r359825

llvm-svn: 361419

5 years ago[clang-tidy] Add support for writing a check as a Transformer rewrite rule.
Yitzhak Mandelbaum [Wed, 22 May 2019 18:56:18 +0000 (18:56 +0000)]
[clang-tidy] Add support for writing a check as a Transformer rewrite rule.

This revision introduces an adaptor from Transformer's rewrite rules
(`clang::tooling::RewriteRule`) to `ClangTidyCheck`.  For example, given a
RewriteRule `MyCheckAsRewriteRule`, it lets one define a tidy check as follows:

```
class MyTidyCheck : public TransformerClangTidyCheck {
 public:
  MyTidyCheck(StringRef Name, ClangTidyContext *Context)
      : TransformerClangTidyCheck(MyCheckAsRewriteRule, Name, Context) {}
};
```

Reviewers: aaron.ballman

Subscribers: mgorny, xazax.hun, cfe-commits, ilya-biryukov

Tags: #clang

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

llvm-svn: 361418

5 years ago[DebugInfo][AArch64] Recognise target specific instruction as mov instr
Alexey Lapshin [Wed, 22 May 2019 18:48:58 +0000 (18:48 +0000)]
[DebugInfo][AArch64] Recognise target specific instruction as mov instr

This fix is for the problem from https://bugs.llvm.org/show_bug.cgi?id=38714.
Specifically, Simple Register Coalescing creates following conversion :

 undef %0.sub_32:gpr64 = ORRWrs $wzr, %3:gpr32common, 0, debug-location !24;

It copies 32-bit value from gpr32 into gpr64. But Live DEBUG_VALUE analysis
is not able to create debug location record for that instruction. So the problem
is in that debug info for argc variable is incorrect. The fix is
to write custom isCopyInstrImpl() which would recognize the ORRWrs instr.

llvm-svn: 361417

5 years ago[PGO][CHR] Speed up following long use-def chains.
Hiroshi Yamauchi [Wed, 22 May 2019 18:37:34 +0000 (18:37 +0000)]
[PGO][CHR] Speed up following long use-def chains.

Summary: Avoid visiting an instruction more than once by using a map.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 361416