platform/upstream/llvm.git
5 years ago[llvm-objcopy] [COFF] Implement --strip-all[-gnu] for symbols
Martin Storsjo [Tue, 15 Jan 2019 09:34:55 +0000 (09:34 +0000)]
[llvm-objcopy] [COFF] Implement --strip-all[-gnu] for symbols

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

llvm-svn: 351174

5 years ago[llvm-objcopy] [COFF] Remove pointless comment chars from .test files. NFC.
Martin Storsjo [Tue, 15 Jan 2019 09:34:45 +0000 (09:34 +0000)]
[llvm-objcopy] [COFF] Remove pointless comment chars from .test files. NFC.

llvm-svn: 351173

5 years ago[ASTDump] NFC: Move dump of type nodes to NodeDumper
Stephen Kelly [Tue, 15 Jan 2019 09:30:00 +0000 (09:30 +0000)]
[ASTDump] NFC: Move dump of type nodes to NodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 351172

5 years ago[llvm-objdump] - Cleanup the code. NFCI.
George Rimar [Tue, 15 Jan 2019 09:19:18 +0000 (09:19 +0000)]
[llvm-objdump] - Cleanup the code. NFCI.

This is a cosmetic cleanup for the llvm-objdump code.

This patch:
* Renames things to match the official LLVM code style (lower case -> upper case).
* Removes few obviously excessive variables.
* Moves a few lines closer to the place of use, reorders the code a bit to simplify it,
to avoid doing excessive returns and to avoid using 'else` after returns.

I focused only on a llvm-objdump.h/llvm-objdump.cpp files. Few changes in the
MachODump.cpp and COFFDump.cpp are a result of llvm-objdump.h modification.

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

llvm-svn: 351171

5 years ago[clangd] Fix updated file detection logic in indexing
Kadir Cetinkaya [Tue, 15 Jan 2019 09:03:33 +0000 (09:03 +0000)]
[clangd] Fix updated file detection logic in indexing

Summary:
Files without any symbols were never marked as updated during indexing, which resulted in failure while writing shards for these files.

This patch fixes the logic to mark files that are seen for the first time but don't contain any symbols as updated.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

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

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

llvm-svn: 351170

5 years agoExplicitly set C++ standard for `Posix/no-fd.cc` ASan test.
Dan Liew [Tue, 15 Jan 2019 08:54:10 +0000 (08:54 +0000)]
Explicitly set C++ standard for `Posix/no-fd.cc` ASan test.

Summary:
The test uses `nullptr` which can break running the test if the
compiler happens to be using something older than C++11 as the default
language standard. Avoid this by explicitly setting the standard.

rdar://problem/47253542

Reviewers: eugenis, yln, vitalybuka

Subscribers: kubamracek, #sanitizers, llvm-commits

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

llvm-svn: 351169

5 years agogn build: Rename llvm_host_triple to llvm_current_triple and have it use current_...
Peter Collingbourne [Tue, 15 Jan 2019 08:20:29 +0000 (08:20 +0000)]
gn build: Rename llvm_host_triple to llvm_current_triple and have it use current_{cpu,os}.

This makes e.g. ToolChain::isCrossCompiling() in
clang/lib/Driver/ToolChain.cpp return the correct result
if the compiler was cross-compiled. This change also affects
llvm_default_target_triple, so cross-compiled compilers default to
targeting the cross-compilation target, which makes more sense than
the host that the compiler was compiled on.

This change will also be necessary in order for the correct triples
to appear in generated lit files for non-native targets.

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

llvm-svn: 351168

5 years agogn build: Make a couple of improvements to the unix toolchain.
Peter Collingbourne [Tue, 15 Jan 2019 08:14:38 +0000 (08:14 +0000)]
gn build: Make a couple of improvements to the unix toolchain.

Add an asm tool (will be required for building sanitizer_common on
x64) and set a soname for DSOs so that anything that links against
them gets the correct DT_NEEDED.

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

llvm-svn: 351167

5 years agogn build: Switch to using current_os in lib/Support/BUILD.gn.
Peter Collingbourne [Tue, 15 Jan 2019 07:17:03 +0000 (07:17 +0000)]
gn build: Switch to using current_os in lib/Support/BUILD.gn.

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

llvm-svn: 351166

5 years ago[X86] Upgrade some avx512bw shift intrinsics that were removed a while ago. NFC
Craig Topper [Tue, 15 Jan 2019 07:15:20 +0000 (07:15 +0000)]
[X86] Upgrade some avx512bw shift intrinsics that were removed a while ago. NFC

Masking was removed from these intrinsics and I guess we didn't update the tests then.

llvm-svn: 351165

5 years ago[WebAssembly] Support multilibs for wasm32 and add a wasm OS that uses it
Dan Gohman [Tue, 15 Jan 2019 06:58:16 +0000 (06:58 +0000)]
[WebAssembly] Support multilibs for wasm32 and add a wasm OS that uses it

This adds support for multilib paths for wasm32 targets, following
[Debian's Multiarch conventions], and also adds an experimental OS name in
order to test it.

[Debian's Multiarch conventions]: https://wiki.debian.org/Multiarch/

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

llvm-svn: 351164

5 years ago[WebAssembly] Support multilibs for wasm32 and add a wasm OS that uses it
Dan Gohman [Tue, 15 Jan 2019 06:58:13 +0000 (06:58 +0000)]
[WebAssembly] Support multilibs for wasm32 and add a wasm OS that uses it

This adds support for multilib paths for wasm32 targets, following
[Debian's Multiarch conventions], and also adds an experimental OS name in
order to test it.

[Debian's Multiarch conventions]: https://wiki.debian.org/Multiarch/

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

llvm-svn: 351163

5 years ago[X86] Add test cases for D56695. NFC
Craig Topper [Tue, 15 Jan 2019 06:39:51 +0000 (06:39 +0000)]
[X86] Add test cases for D56695. NFC

llvm-svn: 351162

5 years ago[X86] Switch the triple on avx2-intrinsics-x86.ll to be -unknown-unknown instead...
Craig Topper [Tue, 15 Jan 2019 06:39:49 +0000 (06:39 +0000)]
[X86] Switch the triple on avx2-intrinsics-x86.ll to be -unknown-unknown instead of darwin so the constant pool entries will be filtered better by the script.

Darwin uses LCPI instead of .LCPI so the filter doesn't work.

This is silly, but it will help reduce some future some test diffs.

llvm-svn: 351161

5 years ago[X86] Make _xgetbv/_xsetbv on non-windows platforms
Craig Topper [Tue, 15 Jan 2019 05:03:18 +0000 (05:03 +0000)]
[X86] Make _xgetbv/_xsetbv on non-windows platforms

Summary:
This patch attempts to redo what was tried in r278783, but was reverted.

These intrinsics should be available on non-windows platforms with "xsave" feature check. But on Windows platforms they shouldn't have feature check since that's how MSVC behaves.

To accomplish this I've added a MS builtin with no feature check. And a normal gcc builtin with a feature check. When _MSC_VER is not defined _xgetbv/_xsetbv will be macros pointing to the gcc builtin name.

I've moved the forward declarations from intrin.h to immintrin.h to match the MSDN documentation and used that as the header file for the MS builtin.

I'm not super happy with this implementation, and I'm open to suggestions for better ways to do it.

Reviewers: rnk, RKSimon, spatel

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 351160

5 years agoRevert alignment assumptions changes
Vlad Tsyrklevich [Tue, 15 Jan 2019 03:38:02 +0000 (03:38 +0000)]
Revert alignment assumptions changes

Revert r351104-6, r351109, r351110, r351119, r351134, and r351153. These
changes fail on the sanitizer bots.

llvm-svn: 351159

5 years ago[LLDB] Remove the unused variable oso_dwarf.
David L. Jones [Tue, 15 Jan 2019 03:27:54 +0000 (03:27 +0000)]
[LLDB] Remove the unused variable oso_dwarf.

Patch by Ali Tamur! (tamur@google.com)

llvm-svn: 351158

5 years agogn build: Split no-RTTI flag into a config.
Peter Collingbourne [Tue, 15 Jan 2019 02:43:33 +0000 (02:43 +0000)]
gn build: Split no-RTTI flag into a config.

Some of the sanitizer runtime code needs to be built with RTTI;
this allows that code to opt in to RTTI.

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

llvm-svn: 351155

5 years agogn build: Stop defining LLVM_ON_UNIX globally.
Peter Collingbourne [Tue, 15 Jan 2019 02:42:47 +0000 (02:42 +0000)]
gn build: Stop defining LLVM_ON_UNIX globally.

This macro is already being defined in llvm-config.h.

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

llvm-svn: 351154

5 years agoSilence failing tests
Vlad Tsyrklevich [Tue, 15 Jan 2019 02:22:14 +0000 (02:22 +0000)]
Silence failing tests

r351134 tried to disable these tests by using 'UNSUPPORTED: *' but '*'
is not supported for UNSUPPORTED like it is for XFAIL. Update these
tests to use XFAIL for now in order to silence x86_64-linux and
x86_64-linux-android.

llvm-svn: 351153

5 years ago[libFuzzer][MSVC] Use alternatename for ext functions
Jonathan Metzman [Tue, 15 Jan 2019 02:20:53 +0000 (02:20 +0000)]
[libFuzzer][MSVC] Use alternatename for ext functions

Summary:
Use alternatename for external functions only when using
MSVC since Clang doesn't support it and MSVC doesn't support
Clang's method (weak aliases).

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: rnk, thakis, mgorny

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

llvm-svn: 351152

5 years ago[WebAssembly] Expand SIMD shifts while V8's implementation disagrees
Thomas Lively [Tue, 15 Jan 2019 02:16:03 +0000 (02:16 +0000)]
[WebAssembly] Expand SIMD shifts while V8's implementation disagrees

Summary:
V8 currently implements SIMD shifts as taking an immediate operation,
which disagrees with the spec proposal and the toolchain
implementation. As a stopgap measure to get things working, unroll all
vector shifts. Since this is a temporary measure, there are no tests.

Reviewers: aheejin, dschuff

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

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

llvm-svn: 351151

5 years agoAMDGPU: Add a fast path for icmp.i1(src, false, NE)
Marek Olsak [Tue, 15 Jan 2019 02:13:18 +0000 (02:13 +0000)]
AMDGPU: Add a fast path for icmp.i1(src, false, NE)

Summary:
This allows moving the condition from the intrinsic to the standard ICmp
opcode, so that LLVM can do simplifications on it. The icmp.i1 intrinsic
is an identity for retrieving the SGPR mask.

And we can also get the mask from and i1, or i1, xor i1.

Reviewers: arsenm, nhaehnle

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

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

llvm-svn: 351150

5 years ago[AArch64] Adjust the feature set for Exynos
Evandro Menezes [Tue, 15 Jan 2019 01:53:49 +0000 (01:53 +0000)]
[AArch64] Adjust the feature set for Exynos

Enable the fusion of arithmetic and logic instructions for Exynos M4.

llvm-svn: 351149

5 years ago[test] Fix logic error in <compare> tests; enable for MSVC Dev16
Casey Carter [Tue, 15 Jan 2019 01:53:12 +0000 (01:53 +0000)]
[test] Fix logic error in <compare> tests; enable for MSVC Dev16

Submitted upstream as https://reviews.llvm.org/D53763.

llvm-svn: 351148

5 years ago[COFF, ARM64] Add __byteswap intrinsics
Mandeep Singh Grang [Tue, 15 Jan 2019 01:26:26 +0000 (01:26 +0000)]
[COFF, ARM64] Add __byteswap intrinsics

Reviewers: rnk, efriedma, ssijaric, TomTan, haripul

Reviewed By: efriedma

Subscribers: javed.absar, cfe-commits, kristof.beyls

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

llvm-svn: 351147

5 years ago[X86] Avoid clobbering ESP/RSP in the epilogue.
Reid Kleckner [Tue, 15 Jan 2019 01:24:18 +0000 (01:24 +0000)]
[X86] Avoid clobbering ESP/RSP in the epilogue.

Summary:
In r345197 ESP and RSP were added to GR32_TC/GR64_TC, allowing them to
be used for tail calls, but this also caused `findDeadCallerSavedReg` to
think they were acceptable targets for clobbering. Filter them out.

Fixes PR40289.

Patch by Geoffry Song!

Reviewed By: rnk

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

llvm-svn: 351146

5 years ago[CMake][Fuchsia] Synchronize first and second stage builds
Petr Hosek [Tue, 15 Jan 2019 01:15:00 +0000 (01:15 +0000)]
[CMake][Fuchsia] Synchronize first and second stage builds

This reorders options between the first and second stage builds to make
them better lined up. The change also re-enables tests for first stage
which is useful e.g. for cross-compiling when we cannot run tests for
second stage directly (i.e. without emulation).

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

llvm-svn: 351145

5 years ago[AArch64] Fix typo (NFC)
Evandro Menezes [Tue, 15 Jan 2019 00:58:59 +0000 (00:58 +0000)]
[AArch64] Fix typo (NFC)

Fix another typo, this time in the `RUN` line, which used a syntax not
universally supported, in test case added by D56572.

llvm-svn: 351144

5 years ago[AArch64] Fix typo (NFC)
Evandro Menezes [Tue, 15 Jan 2019 00:20:57 +0000 (00:20 +0000)]
[AArch64] Fix typo (NFC)

Fix typo in test case added by D56572 (rL351139).

llvm-svn: 351143

5 years ago[EarlyIfConversion] Don't if-convert unconditional branches.
Eli Friedman [Tue, 15 Jan 2019 00:19:46 +0000 (00:19 +0000)]
[EarlyIfConversion] Don't if-convert unconditional branches.

A block ending in an unconditional branch can have two successors if one
is a landing pad.  In practice, I think this only has an effect on
Windows because landing pads are never empty for Itanium unwinding.

(Alternatively, I could add a check to
AArch64InstrInfo::canInsertSelect, but this seems more obvious.)

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

llvm-svn: 351142

5 years ago[AArch64] Explicitly use v1i64 type for llvm.aarch64.neon.abs.i64 .
Eli Friedman [Tue, 15 Jan 2019 00:15:24 +0000 (00:15 +0000)]
[AArch64] Explicitly use v1i64 type for llvm.aarch64.neon.abs.i64 .

Otherwise, with D56544, the intrinsic will be expanded to an integer
csel, which is probably not what the user expected.  This matches the
general convention of using "v1" types to represent scalar integer
operations in vector registers.

While I'm here, also add some error checking so we don't generate
illegal ABS nodes.

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

llvm-svn: 351141

5 years agoGeneralize the comparison test structure to support cross-type comparisons. NFC to...
Marshall Clow [Tue, 15 Jan 2019 00:05:05 +0000 (00:05 +0000)]
Generalize the comparison test structure to support cross-type comparisons. NFC to the library

llvm-svn: 351140

5 years ago[AArch64] Add new target feature to fuse arithmetic and logic operations
Evandro Menezes [Mon, 14 Jan 2019 23:54:36 +0000 (23:54 +0000)]
[AArch64] Add new target feature to fuse arithmetic and logic operations

This feature enables the fusion of some arithmetic and logic instructions
together.

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

llvm-svn: 351139

5 years ago[ORC] Move ORC Core symbol map and set types into their own header: CoreTypes.h.
Lang Hames [Mon, 14 Jan 2019 23:49:13 +0000 (23:49 +0000)]
[ORC] Move ORC Core symbol map and set types into their own header: CoreTypes.h.

This will allow other utilities (including a future RuntimeDyld replacement) to
use these types without pulling in the major Core types (JITDylib, etc.).

llvm-svn: 351138

5 years ago[Sema] Change std::sort to llvm::sort
Mandeep Singh Grang [Mon, 14 Jan 2019 23:45:58 +0000 (23:45 +0000)]
[Sema] Change std::sort to llvm::sort

llvm-svn: 351137

5 years ago[X86] Fix unused variable warning in Release builds. NFC.
Benjamin Kramer [Mon, 14 Jan 2019 23:29:54 +0000 (23:29 +0000)]
[X86] Fix unused variable warning in Release builds. NFC.

llvm-svn: 351136

5 years ago[COFF, ARM64] Add __nop intrinsic
Mandeep Singh Grang [Mon, 14 Jan 2019 23:26:01 +0000 (23:26 +0000)]
[COFF, ARM64] Add __nop intrinsic

Reviewers: rnk, efriedma, TomTan, haripul, ssijaric

Reviewed By: rnk, efriedma

Subscribers: javed.absar, kristof.beyls, cfe-commits

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

llvm-svn: 351135

5 years ago[compiler-rt] UBSan: just completely disable two alignment-assumption tests for now.
Roman Lebedev [Mon, 14 Jan 2019 22:44:19 +0000 (22:44 +0000)]
[compiler-rt] UBSan: just completely disable two alignment-assumption tests for now.

And they are faling on clang-cmake-armv7-full too.
*ONLY* these two.
I'm not sure what to make of it.

Perhaps doing a malloc and checking that pointer will
make them fail as expected?

llvm-svn: 351134

5 years ago[SymbolFile] Remove SymbolContext parameter from FindTypes.
Zachary Turner [Mon, 14 Jan 2019 22:41:21 +0000 (22:41 +0000)]
[SymbolFile] Remove SymbolContext parameter from FindTypes.

This parameter was only ever used with the Module set, and
since a SymbolFile is tied to a module, the parameter turns
out to be entirely unnecessary.  Furthermore, it doesn't make
a lot of sense to ask a caller to ask SymbolFile which is tied
to Module X to find types for Module Y, but that possibility
was open with the previous interface.  By removing this
parameter from the API, it makes it harder to use incorrectly
as well as easier for an implementor to understand what it
needs to do.

llvm-svn: 351133

5 years ago[SymbolFile] Remove the SymbolContext parameter from FindNamespace.
Zachary Turner [Mon, 14 Jan 2019 22:41:00 +0000 (22:41 +0000)]
[SymbolFile] Remove the SymbolContext parameter from FindNamespace.

Every callsite was passing an empty SymbolContext, so this parameter
had no effect.  Inside the DWARF implementation of this function,
however, there was one codepath that checked members of the
SymbolContext.  Since no call-sites actually ever used this
functionality, it was essentially dead code, so I've deleted this
code path as well.

llvm-svn: 351132

5 years ago[SymbolFile] Rename ParseFunctionBlocks to ParseBlocksRecursive.
Zachary Turner [Mon, 14 Jan 2019 22:40:41 +0000 (22:40 +0000)]
[SymbolFile] Rename ParseFunctionBlocks to ParseBlocksRecursive.

This method took a SymbolContext but only actually cared about the
case where the m_function member was set.  Furthermore, it was
intended to be implemented to parse blocks recursively despite not
documenting this in its name.  So we change the name to indicate
that it should be recursive, while also limiting the function
parameter to be a Function&.  This lets the caller know what is
required to use it, as well as letting new implementers know what
kind of inputs they need to be prepared to handle.

llvm-svn: 351131

5 years agoUpdate GettingStarted guide to recommend that people use the new
James Y Knight [Mon, 14 Jan 2019 22:27:32 +0000 (22:27 +0000)]
Update GettingStarted guide to recommend that people use the new
official Git repository.

Remove the directions for using git-svn, and demote the prominence of
the svn instructions.

Also, fix a few other issues while I'm in there:

* Mention LLVM_ENABLE_PROJECTS more.
* Getting started doesn't need to mention test-suite, but should
  mention clang and the other projects.
* Remove mentions of "configure", since that's long gone.

I've also adjusted a few other mentions of svn to point to github, but
have not done so comprehensively.

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

llvm-svn: 351130

5 years agoRevert "[CodeGen][X86] Expand USUBSAT to UMAX+SUB, also for vectors"
Nikita Popov [Mon, 14 Jan 2019 22:18:39 +0000 (22:18 +0000)]
Revert "[CodeGen][X86] Expand USUBSAT to UMAX+SUB, also for vectors"

This reverts commit r351125.

I missed test changes in an SLPVectorizer test, due to the cost model
changes. Reverting for now.

llvm-svn: 351129

5 years ago[Object] Return a symbol_iterator, rather than a basic_symbol_iterator, from
Lang Hames [Mon, 14 Jan 2019 22:05:12 +0000 (22:05 +0000)]
[Object] Return a symbol_iterator, rather than a basic_symbol_iterator, from
MachOObjectFile::getSymbolByIndex.

ObjectFile derivatives should prefer symbol_iterator/SymbolRef over
basic_symbol_iterator/BasicSymbolRef where possible, as the former
retain their link to the ObjectFile (rather than a SymbolicFile) and provide
more functionality.

No test for this: Existing code is working, and we don't have (m)any libObject
unit tests. I'll think about how we can test more systematically going forward.

llvm-svn: 351128

5 years ago[WebAssembly][FastISel] Do not assume naive CmpInst lowering
Thomas Lively [Mon, 14 Jan 2019 22:03:43 +0000 (22:03 +0000)]
[WebAssembly][FastISel] Do not assume naive CmpInst lowering

Summary:
Fixes https://bugs.llvm.org/show_bug.cgi?id=40172. See
test/CodeGen/WebAssembly/PR40172.ll for an explanation.

Reviewers: dschuff, aheejin

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

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

llvm-svn: 351127

5 years ago[llvm-ar] Temporarily remove failing test which is breaking buildbots
Jordan Rupprecht [Mon, 14 Jan 2019 21:58:15 +0000 (21:58 +0000)]
[llvm-ar] Temporarily remove failing test which is breaking buildbots

llvm-svn: 351126

5 years ago[CodeGen][X86] Expand USUBSAT to UMAX+SUB, also for vectors
Nikita Popov [Mon, 14 Jan 2019 21:43:30 +0000 (21:43 +0000)]
[CodeGen][X86] Expand USUBSAT to UMAX+SUB, also for vectors

Related to https://bugs.llvm.org/show_bug.cgi?id=40123.

Rather than scalarizing, expand a vector USUBSAT into UMAX+SUB,
which produces much better code for X86.

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

llvm-svn: 351125

5 years ago[opaque pointer types] Update GetElementPtr creation APIs to
James Y Knight [Mon, 14 Jan 2019 21:39:35 +0000 (21:39 +0000)]
[opaque pointer types] Update GetElementPtr creation APIs to
consistently accept a pointee-type argument.

Note: this also adds a new C API and soft-deprecates the old C API.

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

llvm-svn: 351124

5 years ago[opaque pointer types] Update LoadInst creation APIs to consistently
James Y Knight [Mon, 14 Jan 2019 21:37:53 +0000 (21:37 +0000)]
[opaque pointer types] Update LoadInst creation APIs to consistently
accept a return-type argument.

Note: this also adds a new C API and soft-deprecates the old C API.

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

llvm-svn: 351123

5 years ago[opaque pointer types] Update InvokeInst creation APIs to consistently
James Y Knight [Mon, 14 Jan 2019 21:37:48 +0000 (21:37 +0000)]
[opaque pointer types] Update InvokeInst creation APIs to consistently
accept a callee-type argument.

Note: this also adds a new C API and soft-deprecates the old C API.

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

llvm-svn: 351122

5 years ago[opaque pointer types] Update CallInst creation APIs to consistently
James Y Knight [Mon, 14 Jan 2019 21:37:42 +0000 (21:37 +0000)]
[opaque pointer types] Update CallInst creation APIs to consistently
accept a callee-type argument.

Note: this also adds a new C API and soft-deprecates the old C API.

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

llvm-svn: 351121

5 years ago[llvm-ar] Flatten thin archives.
Jordan Rupprecht [Mon, 14 Jan 2019 21:11:46 +0000 (21:11 +0000)]
[llvm-ar] Flatten thin archives.

Summary:
Normal behavior for GNU ar is to flatten thin archives when adding them to another thin archive, i.e. add the members directly instead of nesting the archive.

Some refactoring done as part of this patch to ease things:
 - Consolidate `addMember`/`addLibMember` methods
 - Rename `addMember` to `addChildMember` to make it more visibly different at the call site that an archive child is passed instead of a regular member
 - Pass in a separate vector and splice it back into position instead of passing a vector + optional Pos (which makes expanding libs tricky)

This fixes PR37530 as raised by https://github.com/ClangBuiltLinux/linux/issues/279.

Reviewers: mstorsjo, pcc, ruiu

Reviewed By: mstorsjo

Subscribers: llvm-commits, tpimh, nickdesaulniers

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

llvm-svn: 351120

5 years ago[compiler-rt] UBSan: Disable 3 of the new alignment assumption tests on android.
Roman Lebedev [Mon, 14 Jan 2019 21:02:25 +0000 (21:02 +0000)]
[compiler-rt] UBSan: Disable 3 of the new alignment assumption tests on android.

Once again, just like with r338296, these tests seem to only have
failed sanitizer-x86_64-linux-android, so let's just disable them,
since that seems like the pre-established practice here..

To be noted, they failed on some configs there, but not all,
so it is not XFAIL.

llvm-svn: 351119

5 years ago[SanitizerCoverage][NFC] Use appendToUsed instead of include
Jonathan Metzman [Mon, 14 Jan 2019 21:02:02 +0000 (21:02 +0000)]
[SanitizerCoverage][NFC] Use appendToUsed instead of include

Summary:
Use appendToUsed instead of include to ensure that
SanitizerCoverage's constructors are not stripped.

Also, use isOSBinFormatCOFF() to determine if target
binary format is COFF.

Reviewers: pcc

Reviewed By: pcc

Subscribers: hiraditya

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

llvm-svn: 351118

5 years ago[compiler-rt] Add option to disable libc++ build
Shoaib Meenai [Mon, 14 Jan 2019 20:33:30 +0000 (20:33 +0000)]
[compiler-rt] Add option to disable libc++ build

Having libc++ checked out doesn't necessarily mean it should be built;
for example, the same source tree might be used for multiple build
configurations, and libc++ might not build in some of those
configurations. Add an option to compiler-rt's build to disable building
libc++. This defaults to ON, so it shouldn't change any existing build
configurations.

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

llvm-svn: 351117

5 years ago[ASTDump] NFC: Move dumping of QualType node to TextNodeDumper
Stephen Kelly [Mon, 14 Jan 2019 20:15:29 +0000 (20:15 +0000)]
[ASTDump] NFC: Move dumping of QualType node to TextNodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 351116

5 years ago[ASTDump] NFC: Canonicalize handling of TypeLocInfo
Stephen Kelly [Mon, 14 Jan 2019 20:13:09 +0000 (20:13 +0000)]
[ASTDump] NFC: Canonicalize handling of TypeLocInfo

Summary: No need to avoid the Visit method.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 351115

5 years ago[ASTDump] NFC: Move Type Visit implementation to TextNodeDumper
Stephen Kelly [Mon, 14 Jan 2019 20:11:02 +0000 (20:11 +0000)]
[ASTDump] NFC: Move Type Visit implementation to TextNodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 351114

5 years ago[lit] llvm-lit.in: specify file encoding to UTF-8
George Karpenkov [Mon, 14 Jan 2019 20:02:11 +0000 (20:02 +0000)]
[lit] llvm-lit.in: specify file encoding to UTF-8

This is needed because otherwise if source dir is at location whose path
contains non-ASCII character then python will complain about
SyntaxError.

SyntaxError: Non-ASCII character '\xc4' in file
/home/D?vis/libc++/src/build/bin/llvm-lit on line 16, but no encoding
declared; see http://python.org/dev/peps/pep-0263/ for details

Patch by davispuh

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

llvm-svn: 351113

5 years agoNFC: Fix nits I missed before
Stephen Kelly [Mon, 14 Jan 2019 19:50:34 +0000 (19:50 +0000)]
NFC: Fix nits I missed before

llvm-svn: 351112

5 years ago[X86] Silence a -Wparentheses warning on gcc. NFC
Craig Topper [Mon, 14 Jan 2019 19:44:02 +0000 (19:44 +0000)]
[X86] Silence a -Wparentheses warning on gcc. NFC

llvm-svn: 351111

5 years ago[compiler-rt] Update ubsan_interface.inc with alignment assumption handlers
Roman Lebedev [Mon, 14 Jan 2019 19:35:12 +0000 (19:35 +0000)]
[compiler-rt] Update ubsan_interface.inc with alignment assumption handlers

Somehow this escaped my local testing.
A follow-up for r351106.

llvm-svn: 351110

5 years ago[test] Disable sunrpc tests when rpc/xdr.h is missing
Michal Gorny [Mon, 14 Jan 2019 19:18:34 +0000 (19:18 +0000)]
[test] Disable sunrpc tests when rpc/xdr.h is missing

Disable tests requiring sunrpc when the relevant headers are missing.
In order to accommodate that, move the header check
from sanitizer_common to base-config-ix, and define the check result
as a global variable there.  Use it afterwards both for definition
needed by sanitizer_common, and to control 'sunrpc' test feature.

While at it, remove the append_have_file_definition macro that was used
only once, and no longer fits the split check-definition.

Bug report: https://github.com/google/sanitizers/issues/974

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

llvm-svn: 351109

5 years agoImprove a -Wunguarded-availability note
Erik Pilkington [Mon, 14 Jan 2019 19:17:31 +0000 (19:17 +0000)]
Improve a -Wunguarded-availability note

Mention the deployment target, and don't say "partial" which doesn't
really mean anything to users.

rdar://problem/33601513

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

llvm-svn: 351108

5 years agoexpand DIContext interface a bit
David Callahan [Mon, 14 Jan 2019 19:11:32 +0000 (19:11 +0000)]
expand DIContext interface a bit

Summary:
This allows a bit more control for scenarios where client might
modifiy a DIContext

Reviewers: twoh, Kader, modocache

Reviewed By: Kader

Subscribers: llvm-commits

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

llvm-svn: 351107

5 years ago[compiler-rt][UBSan] Sanitization for alignment assumptions.
Roman Lebedev [Mon, 14 Jan 2019 19:09:29 +0000 (19:09 +0000)]
[compiler-rt][UBSan] Sanitization for alignment assumptions.

Summary:
This is the compiler-rt part.
The clang part is D54589.

Reviewers: filcab, vsk, #sanitizers, vitalybuka, rsmith, morehouse

Reviewed By: morehouse

Subscribers: rjmccall, krytarowski, rsmith, kcc, srhines, kubamracek, dberris, llvm-commits

Tags: #sanitizers

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

llvm-svn: 351106

5 years ago[clang][UBSan] Sanitization for alignment assumptions.
Roman Lebedev [Mon, 14 Jan 2019 19:09:27 +0000 (19:09 +0000)]
[clang][UBSan] Sanitization for alignment assumptions.

Summary:
UB isn't nice. It's cool and powerful, but not nice.
Having a way to detect it is nice though.
[[ https://wg21.link/p1007r3 | P1007R3: std::assume_aligned ]] / http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1007r2.pdf says:
```
We propose to add this functionality via a library function instead of a core language attribute.
...
If the pointer passed in is not aligned to at least N bytes, calling assume_aligned results in undefined behaviour.
```

This differential teaches clang to sanitize all the various variants of this assume-aligned attribute.

Requires D54588 for LLVM IRBuilder changes.
The compiler-rt part is D54590.

Reviewers: ABataev, craig.topper, vsk, rsmith, rnk, #sanitizers, erichkeane, filcab, rjmccall

Reviewed By: rjmccall

Subscribers: chandlerc, ldionne, EricWF, mclow.lists, cfe-commits, bkramer

Tags: #sanitizers

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

llvm-svn: 351105

5 years ago[llvm][IRBuilder] Introspection for CreateAlignmentAssumption*() functions
Roman Lebedev [Mon, 14 Jan 2019 19:09:15 +0000 (19:09 +0000)]
[llvm][IRBuilder] Introspection for CreateAlignmentAssumption*() functions

Summary:
Clang calls these functions to produce IR for assume-aligned attributes.
I would like to teach UBSAN to verify these assumptions.
For that, i need to access the final pointer on which the check is performed,
and the actual `icmp` that does the check.

The alternative to this would be to fully re-implement this in clang.

Reviewers: spatel, dneilson, craig.topper, dblaikie, hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, llvm-commits

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

llvm-svn: 351104

5 years ago[X86][SSSE3] Bailout of lowerVectorShuffleAsPermuteAndUnpack for shuffle-with-zero...
Simon Pilgrim [Mon, 14 Jan 2019 19:07:26 +0000 (19:07 +0000)]
[X86][SSSE3] Bailout of lowerVectorShuffleAsPermuteAndUnpack for shuffle-with-zero (PR40306)

If we have PSHUFB and we're shuffling with a zero vector, then we are better off not doing VECTOR_SHUFFLE(UNPCK()) as we lose track of those zero elements.

llvm-svn: 351103

5 years agoIgnore PhiNodes when mapping sample profile data
David Callahan [Mon, 14 Jan 2019 19:05:59 +0000 (19:05 +0000)]
Ignore PhiNodes when mapping sample profile data

Summary: Like branch instructions, phi nodes frequently do not have debug information related to the block they are in and so they should be ignored.

Reviewers: danielcdh, twoh, Kader, wmi

Reviewed By: wmi

Subscribers: aprantl, llvm-commits

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

llvm-svn: 351102

5 years agolld-link: Spelling fixes in comments and minor style tweaks
Nico Weber [Mon, 14 Jan 2019 19:05:21 +0000 (19:05 +0000)]
lld-link: Spelling fixes in comments and minor style tweaks

Changes a few things I noticed while reading this code.
- fix a few typos in comments
- remove two `auto` uses where the type wasn't clear to me
- add comment saying that two sequential checks for `if (SparseChunks[SectionNumber] == PendingComdat)` are intentional
- name two parameters

No behavior change.

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

llvm-svn: 351101

5 years agoRevert r351051 "[clangd] Unlink VFS working dir from OS working dir."
Amara Emerson [Mon, 14 Jan 2019 18:59:17 +0000 (18:59 +0000)]
Revert r351051 "[clangd] Unlink VFS working dir from OS working dir."

The llvm commit r351050 broke some bots and was reverted.

llvm-svn: 351100

5 years ago[llvm-objcopy] [COFF] Remove unreferenced undefined externals with --strip-unneeded.
Martin Storsjo [Mon, 14 Jan 2019 18:56:47 +0000 (18:56 +0000)]
[llvm-objcopy] [COFF] Remove unreferenced undefined externals with --strip-unneeded.

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

llvm-svn: 351099

5 years ago[llvm-objcopy] [COFF] Test absolute symbols wrt --strip-unneeded and --discard-all...
Martin Storsjo [Mon, 14 Jan 2019 18:56:27 +0000 (18:56 +0000)]
[llvm-objcopy] [COFF] Test absolute symbols wrt --strip-unneeded and --discard-all. NFC.

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

llvm-svn: 351098

5 years ago[analyzer] [PR39792] false positive on strcpy targeting struct members
George Karpenkov [Mon, 14 Jan 2019 18:54:48 +0000 (18:54 +0000)]
[analyzer] [PR39792] false positive on strcpy targeting struct members

Patch by Pierre van Houtryve.

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

llvm-svn: 351097

5 years ago[analyzer] [NFC] Remove unused undefined method.
George Karpenkov [Mon, 14 Jan 2019 18:54:35 +0000 (18:54 +0000)]
[analyzer] [NFC] Remove unused undefined method.

Wow, at no point the linker or compiler complaints about that!

llvm-svn: 351096

5 years agoRevert "Merge branch 'arcpatch-D55094'"
David Callahan [Mon, 14 Jan 2019 18:49:27 +0000 (18:49 +0000)]
Revert "Merge branch 'arcpatch-D55094'"

This reverts commit a9788dd6587d67c856df74eedff5a6ad34ce8320, reversing
changes made to f1309ffebf718d16aec4fab83380556c660e2825.

unintended merge pushed

llvm-svn: 351095

5 years ago[MC][X86] Add test case for invalid use of "(%dx)" operand.
Nirav Dave [Mon, 14 Jan 2019 18:44:32 +0000 (18:44 +0000)]
[MC][X86] Add test case for invalid use of "(%dx)" operand.

llvm-svn: 351094

5 years ago[x86] lower extracted add/sub to horizontal vector math
Sanjay Patel [Mon, 14 Jan 2019 18:44:02 +0000 (18:44 +0000)]
[x86] lower extracted add/sub to horizontal vector math

add (extractelt (X, 0), extractelt (X, 1)) --> extractelt (hadd X, X), 0

This is the integer sibling to D56011.

There's an additional restriction to only to do this transform in the
case where we don't have extra extracts from the source vector. Without
that, we can fail to match larger horizontal patterns that are more
beneficial than this minimal case. An improvement to the more general
h-op lowering may allow us to remove the restriction here in a follow-up.

llvm-svn: 351093

5 years agoMerge branch 'arcpatch-D55094'
David Callahan [Mon, 14 Jan 2019 18:35:43 +0000 (18:35 +0000)]
Merge branch 'arcpatch-D55094'

llvm-svn: 351092

5 years agoRevert "[VFS] Allow multiple RealFileSystem instances with independent CWDs."
Amara Emerson [Mon, 14 Jan 2019 18:32:09 +0000 (18:32 +0000)]
Revert "[VFS] Allow multiple RealFileSystem instances with independent CWDs."
This reverts commit r351079, r351069 and r351050 as it broken the greendragon bots on macOS.

llvm-svn: 351091

5 years agogn build: Unbreak mac build after r350977
Nico Weber [Mon, 14 Jan 2019 18:30:35 +0000 (18:30 +0000)]
gn build: Unbreak mac build after r350977

llvm-svn: 351090

5 years ago[WebAssembly] Remove old builtins
Dan Gohman [Mon, 14 Jan 2019 18:28:10 +0000 (18:28 +0000)]
[WebAssembly] Remove old builtins

This removes the old grow_memory and mem.grow-style builtins, leaving just
the memory.grow-style builtins.

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

llvm-svn: 351089

5 years agogn build: Fix path to gn.py in docs
Nico Weber [Mon, 14 Jan 2019 18:26:55 +0000 (18:26 +0000)]
gn build: Fix path to gn.py in docs

llvm-svn: 351088

5 years agocmake: Don't install plugins used for examples or tests
Tom Stellard [Mon, 14 Jan 2019 18:25:35 +0000 (18:25 +0000)]
cmake: Don't install plugins used for examples or tests

Summary:
This patch drops install targets for LLVMHello.so,
TestPlugin.so, and BugpointPasses.so.

Reviewers: chandlerc, beanz, thakis, philip.pfaffe

Reviewed By: chandlerc

Subscribers: SquallATF, mgorny, llvm-commits

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

llvm-svn: 351087

5 years ago[WebAssembly] Remove tests for old intrinsics.
Dan Gohman [Mon, 14 Jan 2019 18:25:29 +0000 (18:25 +0000)]
[WebAssembly] Remove tests for old intrinsics.

This is a followup to r351084 which removes the tests for the old
intrinsic names.

llvm-svn: 351086

5 years agogn build: svn propset svn:executable on utils/gn/gn.py
Nico Weber [Mon, 14 Jan 2019 18:24:44 +0000 (18:24 +0000)]
gn build: svn propset svn:executable on utils/gn/gn.py

llvm-svn: 351085

5 years ago[WebAssembly] Remove old intrinsics
Dan Gohman [Mon, 14 Jan 2019 18:23:45 +0000 (18:23 +0000)]
[WebAssembly] Remove old intrinsics

This removes the old grow_memory and mem.grow-style intrinsics, leaving just
the memory.grow-style intrinsics.

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

llvm-svn: 351084

5 years ago[WebAssembly] Add a release notes blurb
Dan Gohman [Mon, 14 Jan 2019 18:20:30 +0000 (18:20 +0000)]
[WebAssembly] Add a release notes blurb

Bid farewell to LLVM_EXPERIMENTAL_TARGETS_TO_BUILD!

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

llvm-svn: 351083

5 years ago[Sema] Expose a control flag for integer to pointer ext warning
Kristina Brooks [Mon, 14 Jan 2019 18:16:51 +0000 (18:16 +0000)]
[Sema] Expose a control flag for integer to pointer ext warning

While building openJDK11u, it seems that some of the code in the
native core libraries make liberal use of integer to pointer
comparisons. We currently have no flag to disabled this warning.
This add such a flag.

Patch by Kader (abdoul-kader keita)

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

llvm-svn: 351082

5 years ago[clangd] Add Limit parameter for xref.
Haojian Wu [Mon, 14 Jan 2019 18:11:09 +0000 (18:11 +0000)]
[clangd] Add Limit parameter for xref.

Reviewers: sammccall

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

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

llvm-svn: 351081

5 years ago[lldbsuite] Skip two more flaky tests on Windows
Stella Stamenova [Mon, 14 Jan 2019 17:55:17 +0000 (17:55 +0000)]
[lldbsuite] Skip two more flaky tests on Windows

TestNamespaceLookup occasionally passes unexpectedly and TestExitDuringStep occasionally fails unexpectedly

llvm-svn: 351080

5 years ago[VFS] Disable unix-assuming VFS test on windows
Sam McCall [Mon, 14 Jan 2019 17:51:10 +0000 (17:51 +0000)]
[VFS] Disable unix-assuming VFS test on windows

llvm-svn: 351079

5 years ago[X86] Add PR40306 shuffle test case
Simon Pilgrim [Mon, 14 Jan 2019 17:49:11 +0000 (17:49 +0000)]
[X86] Add PR40306 shuffle test case

llvm-svn: 351078

5 years agoReapply r345008 "Split MachinePipeliner code into header and cpp files"
Adrian Prantl [Mon, 14 Jan 2019 17:24:11 +0000 (17:24 +0000)]
Reapply r345008 "Split MachinePipeliner code into header and cpp files"

Split MachinePipeliner code into header and cpp files to allow
inheritance from SwingSchedulerDAG.

This reapplies https://reviews.llvm.org/D56084 after moving the
implementation of the dump functions into the .cpp files. This fixes a
linker error when building with Clang modules enables and local
submodule visibility disabled.

Original patch by Lama Saba <lama.saba@intel.com>!

llvm-svn: 351077

5 years agoRemove NameLen argument from newly-introduced IR C APIs.
James Y Knight [Mon, 14 Jan 2019 17:16:55 +0000 (17:16 +0000)]
Remove NameLen argument from newly-introduced IR C APIs.

Normally, changing the function signatures of C APIs is disallowed,
but as these two are brand new last week, and haven't been released
yet, it is okay in this instance.

As per discussion in D56556, we will not add NameLen arguments to IR
building APIs, for the following reasons:

1. We do not want to deprecate all of the IR building APIs, just to add a
NameLen argument to each one.

2. Consistency is important, so adding it just to new ones is unfortunate.

3. The IR names are completely optional, useful for readability of IR
only. There is no value in ever supporting nul bytes.

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

llvm-svn: 351076

5 years ago[AST] Fix double-traversal of code in top-level lambdas in RAV(implicit = yes).
Sam McCall [Mon, 14 Jan 2019 17:16:00 +0000 (17:16 +0000)]
[AST] Fix double-traversal of code in top-level lambdas in RAV(implicit = yes).

Summary:
Prior to r351069, lambda classes were traversed or not depending on the
{Function, Class, Namespace, TU} DeclContext containing them.
If it was a function (common case) they were not traversed.
If it was a namespace or TU (top-level lambda) they were traversed as part of
that DeclContext traversal.

r351069 "fixed" RAV to traverse these as part of the LambdaExpr, which is the
right place. But top-level lambdas are now traversed twice.
We fix that as blocks and block captures were apparently fixed in the past.

Maybe it would be nicer to avoid adding the lambda classes to the DeclContext
in the first place, but I can't work out the implications of that.

Reviewers: bkramer, klimek

Subscribers: cfe-commits

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

llvm-svn: 351075

5 years agoReland "Refactor GetRegistersForValue. NFCI."
Nirav Dave [Mon, 14 Jan 2019 17:09:45 +0000 (17:09 +0000)]
Reland "Refactor GetRegistersForValue. NFCI."

Remove over-strictification class membership check.

llvm-svn: 351074

5 years ago[DAGCombiner] Add (sub_sat x, x) -> 0 combine
Simon Pilgrim [Mon, 14 Jan 2019 15:43:34 +0000 (15:43 +0000)]
[DAGCombiner] Add (sub_sat x, x) -> 0 combine

llvm-svn: 351073