platform/upstream/llvm.git
5 years agoMake git-llvm python3 compatible again. Hopefully. :)
James Y Knight [Fri, 16 Nov 2018 23:59:23 +0000 (23:59 +0000)]
Make git-llvm python3 compatible again. Hopefully. :)

llvm-svn: 347113

5 years agoFixed test after r347110
Stanislav Mekhanoshin [Fri, 16 Nov 2018 23:40:04 +0000 (23:40 +0000)]
Fixed test after r347110

Comments in llc outputs are printed differently on different
platforms, some with '#', some with '##'. Removed non-essential
part of the checks.

llvm-svn: 347112

5 years agoAdd missing test for r347072 -gcodeview-ghash
Reid Kleckner [Fri, 16 Nov 2018 23:17:11 +0000 (23:17 +0000)]
Add missing test for r347072 -gcodeview-ghash

llvm-svn: 347111

5 years agoDAG combiner: fold (select, C, X, undef) -> X
Stanislav Mekhanoshin [Fri, 16 Nov 2018 23:13:38 +0000 (23:13 +0000)]
DAG combiner: fold (select, C, X, undef) -> X

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

llvm-svn: 347110

5 years agoRewrite stop-hook tests as a couple of FileCheck tests
Frederic Riss [Fri, 16 Nov 2018 23:07:28 +0000 (23:07 +0000)]
Rewrite stop-hook tests as a couple of FileCheck tests

Those tests were using pexpect and being flaky on some of ours bots.
This patch reimplmeents the tests usinf FileCheck, and it also
extends the test coverage to a few more stop-hook options.

llvm-svn: 347109

5 years ago[CMake] Use lld and llvm-objcopy for first stage compiler in Fuchsia
Petr Hosek [Fri, 16 Nov 2018 23:07:03 +0000 (23:07 +0000)]
[CMake] Use lld and llvm-objcopy for first stage compiler in Fuchsia

When cross-compiling the second stage to a different target, we need to
make sure that the first-stage compiler can produce binaries for that
target. Using lld and llvm-objcopy as the default linker and objcopy
tool eliminates some of the dependencies on the host toolchain.

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

llvm-svn: 347108

5 years ago[hwasan] use reads instead of writes in a test
Kostya Serebryany [Fri, 16 Nov 2018 23:01:42 +0000 (23:01 +0000)]
[hwasan] use reads instead of writes in a test

llvm-svn: 347107

5 years agoRevert "Cast the 2nd argument of _Unwind_SetIP() to _Unwind_Ptr"
Kamil Rytarowski [Fri, 16 Nov 2018 23:00:28 +0000 (23:00 +0000)]
Revert "Cast the 2nd argument of _Unwind_SetIP() to _Unwind_Ptr"

_Unwind_Ptr is unknown on some targets.

Detected on green-dragon-21 (MacPro Late 2013 | OS X 10.14(18A391) | Xcode 10.1(10B61)).

llvm-svn: 347106

5 years ago[X86] Add custom promotion of narrow fp_to_uint/fp_to_sint operations under -x86...
Craig Topper [Fri, 16 Nov 2018 22:53:00 +0000 (22:53 +0000)]
[X86] Add custom promotion of narrow fp_to_uint/fp_to_sint operations under -x86-experimental-vector-widening-legalization.

This tries to force the result type to vXi32 followed by a truncate. This can help avoid scalarization that would otherwise occur.

There's some annoying examples of an avx512 truncate instruction followed by a packus where we should really be able to just use one truncate. But overall this is still a net improvement.

llvm-svn: 347105

5 years agoMakefile.rules: Degrade gracefully on Windows machines without sed.
Adrian Prantl [Fri, 16 Nov 2018 22:44:57 +0000 (22:44 +0000)]
Makefile.rules: Degrade gracefully on Windows machines without sed.

llvm-svn: 347104

5 years agoSpeed up git-llvm script by only svn up'ing affected directories.
James Y Knight [Fri, 16 Nov 2018 22:36:17 +0000 (22:36 +0000)]
Speed up git-llvm script by only svn up'ing affected directories.

Also, support modifications to toplevel files in git (which need to be
committed to "monorepo-root" in svn).

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

llvm-svn: 347103

5 years agoCast the 2nd argument of _Unwind_SetIP() to _Unwind_Ptr
Kamil Rytarowski [Fri, 16 Nov 2018 22:17:36 +0000 (22:17 +0000)]
Cast the 2nd argument of _Unwind_SetIP() to _Unwind_Ptr

This modification is require for NetBSD with GCC, as there is a
custom unwind.h header implementation with different types.

No functional change intended for others.

Cherry-picked chunk from D33878.

llvm-svn: 347102

5 years agoCast _Unwind_GetIP() and _Unwind_GetRegionStart() to uintptr_t
Kamil Rytarowski [Fri, 16 Nov 2018 22:15:09 +0000 (22:15 +0000)]
Cast _Unwind_GetIP() and _Unwind_GetRegionStart() to uintptr_t

This modification is require for NetBSD with GCC, as there is a
custom unwind.h header implementation with different types.

No functional change intended for others.

Cherry-picked chunk from D33878.

llvm-svn: 347101

5 years ago[X86] Qualify part of the masked gather handling in ReplaceNodeResults with a getType...
Craig Topper [Fri, 16 Nov 2018 22:04:29 +0000 (22:04 +0000)]
[X86] Qualify part of the masked gather handling in ReplaceNodeResults with a getTypeAction call to know if we can use default legalization.

If we managed to switch to -x86-experimental-vector-widening-legalization this block can be removed.

llvm-svn: 347100

5 years ago[sanitizer] Update global_symbols.txt
Vitaly Buka [Fri, 16 Nov 2018 21:42:22 +0000 (21:42 +0000)]
[sanitizer] Update global_symbols.txt

llvm-svn: 347099

5 years ago[WebAssembly] Cleanup unused declares in test code. NFC.
Sam Clegg [Fri, 16 Nov 2018 21:20:00 +0000 (21:20 +0000)]
[WebAssembly] Cleanup unused declares in test code. NFC.

In one case probably you have be using it, in the other it
looks like it was redundant.

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

llvm-svn: 347098

5 years ago[SimpleLoopUnswitch] adding cost multiplier to cap exponential unswitch with
Fedor Sergeev [Fri, 16 Nov 2018 21:16:43 +0000 (21:16 +0000)]
[SimpleLoopUnswitch] adding cost multiplier to cap exponential unswitch with

We need to control exponential behavior of loop-unswitch so we do not get
run-away compilation.

Suggested solution is to introduce a multiplier for an unswitch cost that
makes cost prohibitive as soon as there are too many candidates and too
many sibling loops (meaning we have already started duplicating loops
by unswitching).

It does solve the currently known problem with compile-time degradation
(PR 39544).

Tests are built on top of a recently implemented CHECK-COUNT-<num>
FileCheck directives.

Reviewed By: chandlerc, mkazantsev
Differential Revision: https://reviews.llvm.org/D54223

llvm-svn: 347097

5 years ago[OPENMP]Fix PR39694: do not capture `this` in non-`this` region.
Alexey Bataev [Fri, 16 Nov 2018 21:13:33 +0000 (21:13 +0000)]
[OPENMP]Fix PR39694: do not capture `this` in non-`this` region.

If lambda is used inside of the OpenMP region and captures `this`, we
should recapture it in the OpenMP region also. But we should do this
only if the OpenMP region is used in the context of the same class, just
like the lambda.

llvm-svn: 347096

5 years ago[X86] Remove a branch on SSE4.1 from LowerLoad
Craig Topper [Fri, 16 Nov 2018 21:05:00 +0000 (21:05 +0000)]
[X86] Remove a branch on SSE4.1 from LowerLoad

We should be able to use getExtendInVec with or without sse4.1 to produce a SIGN_EXTEND_VECTOR_INREG.

llvm-svn: 347095

5 years ago[LegalizeVectorOps] After custom legalizing an extending load or a truncating store...
Craig Topper [Fri, 16 Nov 2018 21:04:58 +0000 (21:04 +0000)]
[LegalizeVectorOps] After custom legalizing an extending load or a truncating store, make sure the custom code is also legal.

For example, on X86 we emit a sign_extend_vector_inreg from LowerLoad and without sse4.1 this node will need further legalization. Previously this sign_extend_vector_inreg was being custom lowered during DAG legalization instead of vector op legalization.

Unfortunately, this doesn't seem to matter for the output of any existing lit tests.

llvm-svn: 347094

5 years ago[X86] In LowerLoad, fix assert messages and rename a variable that use Zize instead...
Craig Topper [Fri, 16 Nov 2018 21:04:56 +0000 (21:04 +0000)]
[X86] In LowerLoad, fix assert messages and rename a variable that use Zize instead of Size. NFC

llvm-svn: 347093

5 years agoPreprocessing support in tablegen.
Vyacheslav Zakharin [Fri, 16 Nov 2018 20:57:29 +0000 (20:57 +0000)]
Preprocessing support in tablegen.

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

llvm-svn: 347092

5 years ago[hwasan] disable one test line while investigating a bot failure
Kostya Serebryany [Fri, 16 Nov 2018 20:35:07 +0000 (20:35 +0000)]
[hwasan] disable one test line while investigating a bot failure

llvm-svn: 347091

5 years ago[PowerPC][NFC] Add tests for vector fp <-> int conversions
Nemanja Ivanovic [Fri, 16 Nov 2018 20:24:10 +0000 (20:24 +0000)]
[PowerPC][NFC] Add tests for vector fp <-> int conversions

This NFC patch just adds test cases for conversions that currently
require scalarization of vectors. An updcoming patch will change
the legalization for these and it is more suitable on the review
to show the diferences in code gen rather than just the new code gen.

llvm-svn: 347090

5 years agoAArch64: Emit a call frame instruction for the shadow call stack register.
Peter Collingbourne [Fri, 16 Nov 2018 20:08:54 +0000 (20:08 +0000)]
AArch64: Emit a call frame instruction for the shadow call stack register.

When unwinding past a function that uses shadow call stack, we must
subtract 8 from the value of the x18 register. This patch causes us
to emit a call frame instruction that causes that to happen.

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

llvm-svn: 347089

5 years agoAdd new interceptor for mi_vector_hash(3)
Kamil Rytarowski [Fri, 16 Nov 2018 19:54:13 +0000 (19:54 +0000)]
Add new interceptor for mi_vector_hash(3)

Summary:
mi_vector_hash(3) provides fast 32bit hash functions.

Add a test for this interface.

Enable the API for NetBSD.

Based on original work by Yang Zheng.

Reviewers: joerg, vitalybuka

Reviewed By: vitalybuka

Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers

Tags: #sanitizers

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

llvm-svn: 347088

5 years ago[Cocoa] Prefer llvm::SignExtend64. Pointed out by zturner.
Davide Italiano [Fri, 16 Nov 2018 19:53:00 +0000 (19:53 +0000)]
[Cocoa] Prefer llvm::SignExtend64. Pointed out by zturner.

llvm-svn: 347087

5 years ago[FNeg] Add FNeg Instruction to LangRef document
Cameron McInally [Fri, 16 Nov 2018 19:52:59 +0000 (19:52 +0000)]
[FNeg] Add FNeg Instruction to LangRef document

The FNeg IR Instruction code was added with D53877.

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

llvm-svn: 347086

5 years ago[libcxx] Add missing includes in tests
Louis Dionne [Fri, 16 Nov 2018 19:52:47 +0000 (19:52 +0000)]
[libcxx] Add missing includes in tests

A bunch of unordered containers tests call library functions but don't directly
include the corresponding header files:

- fabs() (defined in <cmath> which is not included);
- is_permutation() (defined in <algorithm> which is not included);
- next() (defined in <iterator> which is not included).
- As a result, these tests won't compile against some conformant libraries.

Reviewed as https://reviews.llvm.org/D54643.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 347085

5 years ago[SymbolFile] Remove unused function. NFCI.
Davide Italiano [Fri, 16 Nov 2018 19:48:23 +0000 (19:48 +0000)]
[SymbolFile] Remove unused function. NFCI.

llvm-svn: 347084

5 years agoAdd new interceptor for getmntinfo(3) from NetBSD
Kamil Rytarowski [Fri, 16 Nov 2018 19:47:42 +0000 (19:47 +0000)]
Add new interceptor for getmntinfo(3) from NetBSD

Summary:
getmntinfo gets information about mounted file systems.

Add a dedicated test for new interceptor.

Based on original work by Yang Zheng.

Reviewers: joerg, vitalybuka

Reviewed By: vitalybuka

Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers

Tags: #sanitizers

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

llvm-svn: 347083

5 years ago[hwasan] optionally right-align heap allocations
Kostya Serebryany [Fri, 16 Nov 2018 19:38:48 +0000 (19:38 +0000)]
[hwasan] optionally right-align heap allocations

Summary:
... so that we can find intra-granule buffer overflows.
The default is still to always align left.
It remains to be seen wether we can enable this mode at scale.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: jfb, dvyukov, kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 347082

5 years ago[OPENMP][NVPTX]Emit correct reduction code for teams/parallel
Alexey Bataev [Fri, 16 Nov 2018 19:38:21 +0000 (19:38 +0000)]
[OPENMP][NVPTX]Emit correct reduction code for teams/parallel
reductions.

Fixed previously committed code for the reduction support in
teams/parallel constructs taking into account new design of the NVPTX
support in the compiler. Teams reduction are not fully functional yet,
it is going to be fixed in the following patches.

llvm-svn: 347081

5 years ago[MSP430] Add RTLIB::[SRL/SRA/SHL]_I32 lowering to EABI lib calls
Anton Korobeynikov [Fri, 16 Nov 2018 19:36:15 +0000 (19:36 +0000)]
[MSP430] Add RTLIB::[SRL/SRA/SHL]_I32 lowering to EABI lib calls

Patch by Kristina Bessonova!

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

llvm-svn: 347080

5 years ago[X86] Disable Condbr_merge pass
Rong Xu [Fri, 16 Nov 2018 19:35:00 +0000 (19:35 +0000)]
[X86] Disable Condbr_merge pass

Disable Condbr_merge pass for now due to PR39658.
Will reenable the pass once the bug is fixed.

llvm-svn: 347079

5 years agoSupport ARM_V4BX relocation
Fangrui Song [Fri, 16 Nov 2018 19:24:45 +0000 (19:24 +0000)]
Support ARM_V4BX relocation

Summary: This patch implementation the handler for ARM_V4BX. This relocation is used by GNU runtime files and other armv4 applications.

Patch by Yin Ma

Reviewers: espindola, MaskRay, ruiu, peter.smith, pcc

Reviewed By: ruiu

Subscribers: yinma, pcc, peter.smith, MaskRay, rovka, efriedma, emaste, javed.absar, arichardson, kristof.beyls, chrib, llvm-commits

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

llvm-svn: 347077

5 years agoRevert "[PowerPC] Make no-PIC default to match GCC - LLVM"
Stefan Pintilie [Fri, 16 Nov 2018 19:24:23 +0000 (19:24 +0000)]
Revert "[PowerPC] Make no-PIC default to match GCC - LLVM"

This reverts commit r347069

llvm-svn: 347076

5 years agoRevert "[PowerPC] Make no-PIC default to match GCC - CLANG"
Stefan Pintilie [Fri, 16 Nov 2018 19:21:33 +0000 (19:21 +0000)]
Revert "[PowerPC] Make no-PIC default to match GCC - CLANG"

This reverts commit r347070

llvm-svn: 347075

5 years ago[MSP430] Use R_MSP430_16_BYTE type for FK_Data_2 fixup
Anton Korobeynikov [Fri, 16 Nov 2018 19:20:51 +0000 (19:20 +0000)]
[MSP430] Use R_MSP430_16_BYTE type for FK_Data_2 fixup

Linker fails to link example like this (simplified case from newlib
sources):

$ cat test.c

extern const char _ctype_b[];
struct _t { char *ptr; };
struct _t T = { ((char *) _ctype_b + 3) };
$ cat ctype.c

char _ctype_b[4] = { 0, 0, 0, 0 };
LD: test.o:(.data+0x0): warning: internal error: unsupported relocation error

We also follow gnu toolchain here, where 2-byte relocation mapped to
R_MSP430_16_BYTE, instead of R_MSP430_16.

Patch by Kristina Bessonova!

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

llvm-svn: 347074

5 years ago[WebAssembly] Default to static reloc model
Sam Clegg [Fri, 16 Nov 2018 18:59:51 +0000 (18:59 +0000)]
[WebAssembly] Default to static reloc model

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

llvm-svn: 347073

5 years ago[codeview] Expose -gcodeview-ghash for global type hashing
Reid Kleckner [Fri, 16 Nov 2018 18:47:41 +0000 (18:47 +0000)]
[codeview] Expose -gcodeview-ghash for global type hashing

Summary:
Experience has shown that the functionality is useful. It makes linking
optimized clang with debug info for me a lot faster, 20s to 13s. The
type merging phase of PDB writing goes from 10s to 3s.

This removes the LLVM cl::opt and replaces it with a metadata flag.

After this change, users can do the following to use ghash:
- add -gcodeview-ghash to compiler flags
- replace /DEBUG with /DEBUG:GHASH in linker flags

Reviewers: zturner, hans, thakis, takuto.ikuta

Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits

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

llvm-svn: 347072

5 years agoMake path more robust so it also works with out-of-tree builds.
Adrian Prantl [Fri, 16 Nov 2018 18:43:16 +0000 (18:43 +0000)]
Make path more robust so it also works with out-of-tree builds.

llvm-svn: 347071

5 years ago[PowerPC] Make no-PIC default to match GCC - CLANG
Stefan Pintilie [Fri, 16 Nov 2018 18:37:01 +0000 (18:37 +0000)]
[PowerPC] Make no-PIC default to match GCC - CLANG

Make the default -fno-PIC on Power PC.

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

llvm-svn: 347070

5 years ago[PowerPC] Make no-PIC default to match GCC - LLVM
Stefan Pintilie [Fri, 16 Nov 2018 18:36:21 +0000 (18:36 +0000)]
[PowerPC] Make no-PIC default to match GCC - LLVM

Set -fno-PIC as the default option.

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

llvm-svn: 347069

5 years ago[CMake] Accept ENTITLEMENTS in add_llvm_executable and llvm_codesign
Stefan Granitz [Fri, 16 Nov 2018 18:10:36 +0000 (18:10 +0000)]
[CMake] Accept ENTITLEMENTS in add_llvm_executable and llvm_codesign

Summary: Allow code-signing with entitlements. FORCE may be used to avoid an error when replacing existing signatures.

Reviewers: beanz, bogner

Reviewed By: beanz

Subscribers: mgorny, llvm-commits, lldb-commits

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

llvm-svn: 347068

5 years ago[SelectionDAG] Move (repeated) SDTIntShiftDOp double shift node def to common code...
Simon Pilgrim [Fri, 16 Nov 2018 17:50:59 +0000 (17:50 +0000)]
[SelectionDAG] Move (repeated) SDTIntShiftDOp double shift node def to common code. NFCI.

Prep work for PR39467.

llvm-svn: 347067

5 years ago[X86] Add codegen tests for scalar funnel shifts
Simon Pilgrim [Fri, 16 Nov 2018 17:48:52 +0000 (17:48 +0000)]
[X86] Add codegen tests for scalar funnel shifts

llvm-svn: 347066

5 years agoGlobalDCE: Teach isEmptyFunction() to ignore debug intrinsics.
Adrian Prantl [Fri, 16 Nov 2018 17:47:21 +0000 (17:47 +0000)]
GlobalDCE: Teach isEmptyFunction() to ignore debug intrinsics.

This fixes PR39669.
https://bugs.llvm.org/show_bug.cgi?id=39669

llvm-svn: 347065

5 years ago[AST][NFC] Pack CXXThisExpr
Bruno Ricci [Fri, 16 Nov 2018 17:38:35 +0000 (17:38 +0000)]
[AST][NFC] Pack CXXThisExpr

Use the newly available space in the bit-fields of Stmt.
This saves 8 bytes per CXXThisExpr.

llvm-svn: 347064

5 years ago[AST][NFC] Pack CXXNullPtrLiteralExpr
Bruno Ricci [Fri, 16 Nov 2018 16:56:49 +0000 (16:56 +0000)]
[AST][NFC] Pack CXXNullPtrLiteralExpr

Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXNullPtrLiteralExpr.

llvm-svn: 347063

5 years ago[AST][NFC] Pack CXXBoolLiteralExpr
Bruno Ricci [Fri, 16 Nov 2018 16:54:17 +0000 (16:54 +0000)]
[AST][NFC] Pack CXXBoolLiteralExpr

Use the newly available space in Stmt.
This saves 8 bytes per CXXBoolLiteralExpr.

llvm-svn: 347062

5 years ago[CodeGen] Expose some data types and accessors from StackMaps
Than McIntosh [Fri, 16 Nov 2018 16:48:49 +0000 (16:48 +0000)]
[CodeGen] Expose some data types and accessors from StackMaps

Summary:
This is for supporting custom stack map formats, where the
custom printer can access the stack map data.

Patch by Cherry Zhang <cherryyz@google.com>.

Related: https://reviews.llvm.org/D53892

Reviewers: thanm, apilipenko

Reviewed By: apilipenko

Subscribers: llvm-commits

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

llvm-svn: 347061

5 years ago[InstSimplify] add tests for saturating add/sub; NFC
Sanjay Patel [Fri, 16 Nov 2018 16:32:34 +0000 (16:32 +0000)]
[InstSimplify] add tests for saturating add/sub; NFC

These are baseline tests for D54532.
Patch based on the original tests by:
@nikic (Nikita Popov)

llvm-svn: 347060

5 years ago[OpenCL] Enable address spaces for references in C++
Anastasia Stulova [Fri, 16 Nov 2018 16:22:56 +0000 (16:22 +0000)]
[OpenCL] Enable address spaces for references in C++

Added references to the addr spaces deduction and enabled
CL2.0 features (program scope variables and storage class
qualifiers) to work in C++ mode too.

Fixed several address space conversion issues in CodeGen
for references.

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

llvm-svn: 347059

5 years agoTypo
Adrian Prantl [Fri, 16 Nov 2018 16:19:08 +0000 (16:19 +0000)]
Typo

llvm-svn: 347058

5 years agoUse a shared module cache directory for LLDB.
Adrian Prantl [Fri, 16 Nov 2018 16:19:07 +0000 (16:19 +0000)]
Use a shared module cache directory for LLDB.

This saves about 3 redundant gigabytes from the Objective-C test build
directories. Tests that must do unsavory things with the LLDB clang
module cache, already specify a per-test module cache in their .py
test instructions.

<rdar://problem/36002081>

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

llvm-svn: 347057

5 years agoMakefile.rules: Use a shared clang module cache directory.
Adrian Prantl [Fri, 16 Nov 2018 16:19:07 +0000 (16:19 +0000)]
Makefile.rules: Use a shared clang module cache directory.

Just to be safe, up until now each test used its own Clang module
cache directory. Since the compiler within one testsuite doesn't
change it is just as safe to share a clang module directory inside the
LLDB test build directory. This saves us from compiling tens of
gigabytes of redundant Darwin and Foundation .pcm files and also
speeds up running the test suite quite significantly.

rdar://problem/36002081

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

llvm-svn: 347056

5 years ago[InstSimplify] add test to demonstrate undef matching differences; NFC
Sanjay Patel [Fri, 16 Nov 2018 15:35:58 +0000 (15:35 +0000)]
[InstSimplify] add test to demonstrate undef matching differences; NFC

This is a baseline test for D54631.
Patch by:
@nikic (Nikita Popov)

llvm-svn: 347055

5 years ago[X86][SSE] Move number of input limit out of resolveTargetShuffleInputs.
Simon Pilgrim [Fri, 16 Nov 2018 15:01:05 +0000 (15:01 +0000)]
[X86][SSE] Move number of input limit out of resolveTargetShuffleInputs.

Only combineX86ShufflesRecursively needs this limit.

llvm-svn: 347054

5 years ago[clang-tidy] Expanded a test NFC
Alexander Kornienko [Fri, 16 Nov 2018 14:57:51 +0000 (14:57 +0000)]
[clang-tidy] Expanded a test NFC

Expanded the readability-inconsistent-declaration-parameter-name-macros.cpp to
check notes and added a test with pasted tokens.

llvm-svn: 347053

5 years ago[libcxx] Mention restriction on inline namespaces in LIBCXX_ABI_NAMESPACE docs
Louis Dionne [Fri, 16 Nov 2018 14:57:47 +0000 (14:57 +0000)]
[libcxx] Mention restriction on inline namespaces in LIBCXX_ABI_NAMESPACE docs

I also kept the original "vague" documentation that saying that users are
responsible for not breaking us. This doesn't mean anything because there's
no way they can actually enforce that unless we restrict ourselves to a
specific naming scheme, but I left the documentation because it acts as a
good warning and gives us more leeway.

llvm-svn: 347052

5 years ago[x86] regenerate complete checks for test; NFC
Sanjay Patel [Fri, 16 Nov 2018 14:44:20 +0000 (14:44 +0000)]
[x86] regenerate complete checks for test; NFC

llvm-svn: 347051

5 years ago[IRVerifier] Allow StructRet in statepoint
Than McIntosh [Fri, 16 Nov 2018 14:28:05 +0000 (14:28 +0000)]
[IRVerifier] Allow StructRet in statepoint

Summary:
StructRet attribute is not allowed in vararg calls. The statepoint
intrinsic is vararg, but the wrapped function may be not. Allow
calls of statepoint with StructRet arg, as long as the wrapped
function is not vararg.

Reviewers: thanm, anna

Reviewed By: anna

Subscribers: anna, llvm-commits

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

llvm-svn: 347050

5 years ago[DWARF] Use PRIx64 instead of 'x' to format 64-bit values
Simon Atanasyan [Fri, 16 Nov 2018 13:14:26 +0000 (13:14 +0000)]
[DWARF] Use PRIx64 instead of 'x' to format 64-bit values

This is a follow-up to r346715. Use PRIx64 to formatted print of 64-bit
value in the `DWARFDebugLoclists::LocationList::dump` to escape problem
on big-endian hosts.

llvm-svn: 347049

5 years ago[X86] X86DAGToDAGISel::matchBitExtract(): extract 'lshr' from `X`
Roman Lebedev [Fri, 16 Nov 2018 13:04:54 +0000 (13:04 +0000)]
[X86] X86DAGToDAGISel::matchBitExtract(): extract 'lshr' from `X`

Summary:
As discussed in previous review, and noted in the FIXME, if `X` is actually an `lshr Y, Z` (logical!),
we can fold the `Z` into 'control`, and let the `BEXTR` do this too.
We could just insert those 8 bits of shift amount into control,
but it is better to instead zero-extend them, and 'or' them in place.

We can only do this for `lshr`, not `ashr`, because we do not know that the mask cover only the bits of `Y`,
and not any of the sign-extended bits.

The obvious question is, is this actually legal to do?
I believe it is. Relevant quotes, from `Intel® 64 and IA-32 Architectures Software Developer’s Manual`, `BEXTR — Bit Field Extract`:
* `Bit 7:0 of the second source operand specifies the starting bit position of bit extraction.`
* `A START value exceeding the operand size will not extract any bits from the second source operand.`
* `Only bit positions up to (OperandSize -1) of the first source operand are extracted.`
* `All higher order bits in the destination operand (starting at bit position LENGTH) are zeroed.`
* `The destination register is cleared if no bits are extracted.`

FIXME: if we can do this, i wonder if we should prefer `BEXTR` over `BZHI` in such cases.

Reviewers: RKSimon, craig.topper, spatel, andreadb

Reviewed By: RKSimon, craig.topper, andreadb

Subscribers: llvm-commits

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

llvm-svn: 347048

5 years ago[lldb] NFC: Remove the extra ';'
Henry Wong [Fri, 16 Nov 2018 13:01:57 +0000 (13:01 +0000)]
[lldb] NFC: Remove the extra ';'

Summary:
Remove extra `;` to eliminate the following pedantic warning.

```
warning: extra ';' [-Wpedantic]

```

Reviewers: shafik

Reviewed By: shafik

Subscribers: abidh, lldb-commits

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

llvm-svn: 347047

5 years agoRemove BUILD file from google-benchmark
Benjamin Kramer [Fri, 16 Nov 2018 12:53:17 +0000 (12:53 +0000)]
Remove BUILD file from google-benchmark

This was removed in r336666, but accidentally re-added in r346984.

llvm-svn: 347046

5 years ago[TargetLowering] Cleanup more of the EXTEND demanded bits cases so that they match...
Simon Pilgrim [Fri, 16 Nov 2018 12:26:26 +0000 (12:26 +0000)]
[TargetLowering] Cleanup more of the EXTEND demanded bits cases so that they match. NFCI.

Use the same variable names etc.

llvm-svn: 347045

5 years ago[clangd] Truncate SymbolID to 8 bytes.
Haojian Wu [Fri, 16 Nov 2018 10:58:40 +0000 (10:58 +0000)]
[clangd] Truncate SymbolID to 8 bytes.

Summary:
This is our goal. It has a non-zero rick, but so far we haven't see any
collision (externally and internally).

Reviewers: sammccall

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

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

llvm-svn: 347044

5 years ago[RISCV][NFC] Define and use the new CA instruction format
Alex Bradbury [Fri, 16 Nov 2018 10:33:23 +0000 (10:33 +0000)]
[RISCV][NFC] Define and use the new CA instruction format

The RISC-V ISA manual was updated on 2018-11-07 (commit 00557c3) to define a
new compressed instruction format, RVC format CA (no actual instruction
encodings were changed). This patch updates the RISC-V backend to define the
new format, and to use it in the relevant instructions.

Differential Revision: https://reviews.llvm.org/D54302
Patch by Luís Marques.

llvm-svn: 347043

5 years ago[RISCV] Constant materialisation for RV64I
Alex Bradbury [Fri, 16 Nov 2018 10:14:16 +0000 (10:14 +0000)]
[RISCV] Constant materialisation for RV64I

This commit introduces support for materialising 64-bit constants for RV64I,
making use of the RISCVMatInt::generateInstSeq helper in order to share logic
for immediate materialisation with the MC layer (where it's used for the li
pseudoinstruction).

test/CodeGen/RISCV/imm.ll is updated to test RV64, and gains new 64-bit
constant tests. It would be preferable if anyext constant returns were sign
rather than zero extended (see PR39092). This patch simply adds an explicit
signext to the returns in imm.ll.

Further optimisations for constant materialisation are possible, most notably
for mask-like values which can be generated my loading -1 and shifting right.
A future patch will standardise on the C++ codepath for immediate selection on
RV32 as well as RV64, and then add further such optimisations to
RISCVMatInt::generateInstSeq in order to benefit both RV32 and RV64 for
codegen and li expansion.

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

llvm-svn: 347042

5 years ago[MSP430] Add support for .refsym directive
Anton Korobeynikov [Fri, 16 Nov 2018 09:50:24 +0000 (09:50 +0000)]
[MSP430] Add support for .refsym directive

Introduces support for '.refsym' assembler directive.

From GCC docs (for MSP430):
'.refsym' - This directive instructs assembler to add an undefined reference
to the symbol following the directive. No relocation is created for this symbol;
it will exist purely for pulling in object files from archives.

Patch by Kristina Bessonova!

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

llvm-svn: 347041

5 years ago[MSP430] Add more tests for ABI and calling convention
Anton Korobeynikov [Fri, 16 Nov 2018 09:47:58 +0000 (09:47 +0000)]
[MSP430] Add more tests for ABI and calling convention

Patch by Kristina Bessonova!

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

llvm-svn: 347040

5 years ago[clangd] Fix a compiler warning and test crashes caused in rL347038.
Haojian Wu [Fri, 16 Nov 2018 09:41:14 +0000 (09:41 +0000)]
[clangd] Fix a compiler warning and test crashes caused in rL347038.

llvm-svn: 347039

5 years agoIntroduce shard storage to auto-index.
Kadir Cetinkaya [Fri, 16 Nov 2018 09:03:56 +0000 (09:03 +0000)]
Introduce shard storage to auto-index.

Reviewers: sammccall, ioeric

Reviewed By: sammccall

Subscribers: llvm-commits, mgorny, Eugene.Zelenko, ilya-biryukov, jkorous, arphaman, cfe-commits

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

llvm-svn: 347038

5 years ago[DAGCombine] Fix non-deterministic debug output
Sam Parker [Fri, 16 Nov 2018 08:35:19 +0000 (08:35 +0000)]
[DAGCombine] Fix non-deterministic debug output

PR37970 reported non-deterministic debug output, this was caused by
iterating through a set and not a a vector.

bugzilla: https://bugs.llvm.org/show_bug.cgi?id=37970

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

llvm-svn: 347037

5 years ago[clangd] Initial clang-tidy diagnostics support.
Sam McCall [Fri, 16 Nov 2018 08:32:23 +0000 (08:32 +0000)]
[clangd] Initial clang-tidy diagnostics support.

Summary:
This runs checks over a restricted subset of the TU:
 - preprocessor callbacks just receive the truncated PP events that
   occur when a preamble is used.
 - ASTMatchers run only over the top-level decls in the main-file

This patch just turns on one simple check (bugprone-sizeof-expression)
with no configuration. Configuration is complex enough to warrant a separate patch

This depends on a patch allowing traversal to be restricted to a scope.

Reviewers: hokein

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

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

llvm-svn: 347036

5 years ago[clang] - Simplify tools::SplitDebugName.
George Rimar [Fri, 16 Nov 2018 07:59:24 +0000 (07:59 +0000)]
[clang] - Simplify tools::SplitDebugName.

This should be NFC change.

SplitDebugName recently started to accept the `Output` that
can be used to simplify the logic a bit, also it
seems that code in SplitDebugName that uses
OPT_fdebug_compilation_dir is simply dead.

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

llvm-svn: 347035

5 years ago[LegalizeVectorTypes] Teach WidenVecRes_Convert to turn ANY_EXTEND into ANY_EXTEND_VE...
Craig Topper [Fri, 16 Nov 2018 07:13:34 +0000 (07:13 +0000)]
[LegalizeVectorTypes] Teach WidenVecRes_Convert to turn ANY_EXTEND into ANY_EXTEND_VECTOR_INREG when the input and output types need to be widened to the same width.

If we don't do it here, DAGCombine will just end up creating it from the scalar any_extend+build_vector so might as well save a step.

llvm-svn: 347034

5 years ago[ThinLTO] Internalize readonly globals
Eugene Leviant [Fri, 16 Nov 2018 07:08:00 +0000 (07:08 +0000)]
[ThinLTO] Internalize readonly globals

An attempt to recommit r346584 after failure on OSX build bot.
Fixed cache key computation in ThinLTOCodeGenerator and added
test case

llvm-svn: 347033

5 years ago[X86] Add custom type legalization for v2i8/v4i8/v8i8 mul under -x86-experimental...
Craig Topper [Fri, 16 Nov 2018 06:15:21 +0000 (06:15 +0000)]
[X86] Add custom type legalization for v2i8/v4i8/v8i8 mul under -x86-experimental-vector-widening.

By early promoting the multiply to use an i16 element type we can avoid op legalization emit a second multiply for the 8 upper elements of the v16i8 type we would otherwise get.

llvm-svn: 347032

5 years ago[X86] Add some test cases for vector multiplies on vectors shorter than 128 bits...
Craig Topper [Fri, 16 Nov 2018 06:15:20 +0000 (06:15 +0000)]
[X86] Add some test cases for vector multiplies on vectors shorter than 128 bits with -x86-experimental-vector-widening-legalization.

llvm-svn: 347031

5 years ago[ELF][MIPS] Use MIPS R6 `sigrie` as a trap instruction
Simon Atanasyan [Fri, 16 Nov 2018 05:30:47 +0000 (05:30 +0000)]
[ELF][MIPS] Use MIPS R6 `sigrie` as a trap instruction

Current value using as a trap instruction (0xefefefef) is not a good choice
for MIPS because it's a valid MIPS instruction `swc3 $15,-4113(ra)`. This
patch replaces 0xefefefef by 0x04170001. For all MIPS ISA revisions before
R6, this value is just invalid instruction. Starting from MIPS R6 it's
a valid instruction `sigrie 1` which signals a Reserved Instruction exception.

mips-traps.s test case is added to test trap encoding. Other test cases
are modified to remove redundant checking.

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

llvm-svn: 347029

5 years agoAMDGPU: Fix analyzeBranch failing with pseudoterminators
Matt Arsenault [Fri, 16 Nov 2018 05:03:02 +0000 (05:03 +0000)]
AMDGPU: Fix analyzeBranch failing with pseudoterminators

If a block had one of the _term instructions used for gluing
exec modifying instructions to the end of the block,
analyzeBranch would fail, preventing the verifier from catching
a broken successor list.

llvm-svn: 347027

5 years ago[CMake] Support cross-compiling with Fuchsia toolchain build
Petr Hosek [Fri, 16 Nov 2018 04:50:12 +0000 (04:50 +0000)]
[CMake] Support cross-compiling with Fuchsia toolchain build

When second stage is being cross-compiled for a different platform
we need to build enough of first stage runtimes to get a working
compiler.

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

llvm-svn: 347026

5 years ago[CMake] Support cross-compiling with multi-stage builds
Petr Hosek [Fri, 16 Nov 2018 04:46:48 +0000 (04:46 +0000)]
[CMake] Support cross-compiling with multi-stage builds

When using multi-stage builds, we would like support cross-compilation.
Example is 2-stage build when the first stage is compiled for host while
the second stage is compiled for the target.

Normally, the second stage would be also used for compiling runtimes,
but that's not possible when cross-compiling, so we use the first stage
compiler instead. However, we still want to use the second stage paths.
To do so, we set the -resource-dir of the first stage compiler to point
to the resource directory of the second stage.

We also need compiler tools that support the target architecture. These
tools are not guaranteed to be present on the host, but in case of
multi-stage build, we can build these tools in the first stage.

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

llvm-svn: 347025

5 years ago[compiler-rt] Use exact spelling when building for default target
Petr Hosek [Fri, 16 Nov 2018 04:14:23 +0000 (04:14 +0000)]
[compiler-rt] Use exact spelling when building for default target

When building for default target only, use exact target spelling
when deriving the name for the per-target runtime directory. This
is necessary for AArch32 where the CMake build by default rewrites
the architecture which leads to unexpected results.

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

llvm-svn: 347022

5 years ago[CMake] Use the correct spelling for armv7 in Fuchsia's toolchain
Petr Hosek [Fri, 16 Nov 2018 04:09:47 +0000 (04:09 +0000)]
[CMake] Use the correct spelling for armv7 in Fuchsia's toolchain

We need to explicitly specify the architecture version.

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

llvm-svn: 347021

5 years agoDon't use uniform initialization syntax.
Zachary Turner [Fri, 16 Nov 2018 03:16:27 +0000 (03:16 +0000)]
Don't use uniform initialization syntax.

llvm-svn: 347020

5 years ago[Clang][Sema]Choose a better candidate in overload function call if there is a compat...
Zi Xuan Wu [Fri, 16 Nov 2018 03:00:00 +0000 (03:00 +0000)]
[Clang][Sema]Choose a better candidate in overload function call if there is a compatible vector conversion instead of ambiguous call error

There are 2 function variations with vector type parameter. When we call them with argument of different vector type we would prefer to
choose the variation with implicit argument conversion of compatible vector type instead of incompatible vector type. For example,

typedef float __v4sf __attribute__((__vector_size__(16)));
void f(vector float);
void f(vector signed int);

int main {
   __v4sf a;
   f(a);
}

Here, we'd like to choose f(vector float) but not report an ambiguous call error.

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

llvm-svn: 347019

5 years ago[NativePDB] Rewrite the PdbSymUid to use our own custom namespacing scheme.
Zachary Turner [Fri, 16 Nov 2018 02:42:32 +0000 (02:42 +0000)]
[NativePDB] Rewrite the PdbSymUid to use our own custom namespacing scheme.

Originally we created our 64-bit UID scheme by using the first byte as
sort of a "tag" to represent what kind of symbol this was, and we
re-used the PDB_SymType enumeration for this.  For native pdb support,
this is not really the right abstraction layer, because what we really
want is something that tells us *how* to find the symbol.  This means,
specifically, is in the globals stream / public stream / module stream /
TPI stream / etc, and for whichever one it is in, where is it within
that stream?

A good example of why the old namespacing scheme was insufficient is
that it is more or less impossible to create a uid for a field list
member of a class/struction/union/enum that tells you how to locate
the original record.

With this new scheme, the first byte is no longer a PDB_SymType enum
but a new enum created specifically to identify where in the PDB
this record lives.  This gives us much better flexibility in
what kinds of symbols the uids can identify.

llvm-svn: 347018

5 years ago[VFS] Update unittest to fix Windows buildbot.
Volodymyr Sapsai [Fri, 16 Nov 2018 02:20:33 +0000 (02:20 +0000)]
[VFS] Update unittest to fix Windows buildbot.

Buildbot http://lab.llvm.org:8011/builders/clang-x64-windows-msvc is failing
because it doesn't like paths in VFS, make them more Windows-friendly.

Follow up to r347009.

llvm-svn: 347016

5 years agoRevert r347014 "[X86] Add some test cases for vector multiplies on vectors shorter...
Craig Topper [Fri, 16 Nov 2018 01:57:55 +0000 (01:57 +0000)]
Revert r347014 "[X86] Add some test cases for vector multiplies on vectors shorter than 128 bits with -x86-experimental-vector-widening-legalization."

Apparently I failed to update this after turnign sign extend to any extend.

llvm-svn: 347015

5 years ago[X86] Add some test cases for vector multiplies on vectors shorter than 128 bits...
Craig Topper [Fri, 16 Nov 2018 01:52:32 +0000 (01:52 +0000)]
[X86] Add some test cases for vector multiplies on vectors shorter than 128 bits with -x86-experimental-vector-widening-legalization.

llvm-svn: 347014

5 years agoAdded missing whitespace in the link.
Artem Belevich [Fri, 16 Nov 2018 01:23:12 +0000 (01:23 +0000)]
Added missing whitespace in the link.

llvm-svn: 347013

5 years ago[VFS] Implement `RedirectingFileSystem::getRealPath`.
Volodymyr Sapsai [Fri, 16 Nov 2018 01:18:04 +0000 (01:18 +0000)]
[VFS] Implement `RedirectingFileSystem::getRealPath`.

It fixes the case when Objective-C framework is added as a subframework
through a symlink. When parent framework infers a module map and fails
to detect a symlink, it would add a subframework as a submodule. And
when we parse module map for the subframework, we would encounter an
error like

> error: umbrella for module 'WithSubframework.Foo' already covers this directory

By implementing `getRealPath` "an egregious but useful hack" in
`ModuleMap::inferFrameworkModule` works as expected.

LLVM commit is r347009.

rdar://problem/45821279

Reviewers: bruno, benlangmuir, erik.pilkington

Reviewed By: bruno

Subscribers: hiraditya, dexonsmith, JDevlieghere, cfe-commits, llvm-commits

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

llvm-svn: 347012

5 years ago[X86] Use ANY_EXTEND instead of SIGN_EXTEND in the AVX2 and later path for legalizing...
Craig Topper [Fri, 16 Nov 2018 01:16:59 +0000 (01:16 +0000)]
[X86] Use ANY_EXTEND instead of SIGN_EXTEND in the AVX2 and later path for legalizing vXi8 multiply.

We aren't going to use the upper bits of the multiply result that the extend would effect. So we don't need a specific type of extend.

This makes some reduction test cases shorter because we were previously trying to sign_extend a truncate which we can't eliminate.

llvm-svn: 347011

5 years ago[X86] Update a couple comments to remove a mention of a sign extending that no longer...
Craig Topper [Fri, 16 Nov 2018 01:16:51 +0000 (01:16 +0000)]
[X86] Update a couple comments to remove a mention of a sign extending that no longer happens. NFC

llvm-svn: 347010

5 years ago[VFS] Implement `RedirectingFileSystem::getRealPath`.
Volodymyr Sapsai [Fri, 16 Nov 2018 01:15:54 +0000 (01:15 +0000)]
[VFS] Implement `RedirectingFileSystem::getRealPath`.

It fixes the case when Objective-C framework is added as a subframework
through a symlink. When parent framework infers a module map and fails
to detect a symlink, it would add a subframework as a submodule. And
when we parse module map for the subframework, we would encounter an
error like

> error: umbrella for module 'WithSubframework.Foo' already covers this directory

By implementing `getRealPath` "an egregious but useful hack" in
`ModuleMap::inferFrameworkModule` works as expected.

rdar://problem/45821279

Reviewers: bruno, benlangmuir, erik.pilkington

Reviewed By: bruno

Subscribers: hiraditya, dexonsmith, JDevlieghere, cfe-commits, llvm-commits

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

llvm-svn: 347009

5 years ago[AMDGPU] Add FixupVectorISel pass, currently Supports SREGs in GLOBAL LD/ST
Ron Lieberman [Fri, 16 Nov 2018 01:13:34 +0000 (01:13 +0000)]
[AMDGPU] Add FixupVectorISel pass, currently Supports SREGs in GLOBAL LD/ST

Add a pass to fixup various vector ISel issues.
Currently we handle converting GLOBAL_{LOAD|STORE}_*
and GLOBAL_Atomic_* instructions into their _SADDR variants.
This involves feeding the sreg into the saddr field of the new instruction.

llvm-svn: 347008