platform/upstream/llvm.git
6 years ago[cmake] Prevent LLVMgold.so from being unloaded on Linux
Hans Wennborg [Thu, 16 Aug 2018 15:12:12 +0000 (15:12 +0000)]
[cmake] Prevent LLVMgold.so from being unloaded on Linux

Extend the fix from D40459 to also apply to modules such as the LLVM
gold plugin. This is needed because current binutils master (and future
binutils 2.32) calls dlclose() on bfd plugins as part of a recent fix
for https://sourceware.org/bugzilla/show_bug.cgi?id=23460.

Patch by Evangelos Foutras!

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

llvm-svn: 339883

6 years ago[LLD][ELF] - Add a test case for DT_SONAME entry reading.
George Rimar [Thu, 16 Aug 2018 14:07:29 +0000 (14:07 +0000)]
[LLD][ELF] - Add a test case for DT_SONAME entry reading.

This covers a following line with a test:
https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L899

llvm-svn: 339880

6 years agoFixed unused variable warning. NFCI.
Simon Pilgrim [Thu, 16 Aug 2018 13:55:10 +0000 (13:55 +0000)]
Fixed unused variable warning. NFCI.

llvm-svn: 339879

6 years ago[libunwind][mips] Include gcc_s for linkage
Stefan Maksimovic [Thu, 16 Aug 2018 13:40:16 +0000 (13:40 +0000)]
[libunwind][mips] Include gcc_s for linkage

When compiling with optimizations, mips requires various helper routines(__ashldi3 and the like) contained in libgcc_s.
Conditionally include libgcc_s in the set of libraries to be linked to.

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

llvm-svn: 339878

6 years ago[clangd] NFC: Improve Dex Iterators debugging traits
Kirill Bobyrev [Thu, 16 Aug 2018 13:19:43 +0000 (13:19 +0000)]
[clangd] NFC: Improve Dex Iterators debugging traits

This patch improves `dex::Iterator` string representation by
incorporating the information about the element which is currently being
pointed to by the `DocumentIterator`.

Reviewed by: ioeric

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

llvm-svn: 339877

6 years ago[LLD][ELF] - Add a test case.
George Rimar [Thu, 16 Aug 2018 13:02:50 +0000 (13:02 +0000)]
[LLD][ELF] - Add a test case.

This covers the following line with a test:
https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L487

llvm-svn: 339876

6 years ago[InstCombine] move vector compare before same-shuffled ops
Sanjay Patel [Thu, 16 Aug 2018 12:52:17 +0000 (12:52 +0000)]
[InstCombine] move vector compare before same-shuffled ops

This is a step towards fixing PR37463:
https://bugs.llvm.org/show_bug.cgi?id=37463

llvm-svn: 339875

6 years ago[libcxx] By default, do not use internal_linkage to hide symbols from the ABI
Louis Dionne [Thu, 16 Aug 2018 12:44:28 +0000 (12:44 +0000)]
[libcxx] By default, do not use internal_linkage to hide symbols from the ABI

Summary:
https://reviews.llvm.org/D49240 led to symbol size problems in Chromium, and
we expect this may be the case in other projects built in debug mode too.
Instead, unless users explicitly ask for internal_linkage, we use always_inline
like we used to.

In the future, when we have a solution that allows us to drop always_inline
without falling back on internal_linkage, we can replace always_inline by
that.

Note that this commit introduces a change in contract for existing libc++
users: by default, libc++ used to guarantee that TUs built with different
versions of libc++ could be linked together. With the introduction of the
_LIBCPP_HIDE_FROM_ABI_PER_TU macro, the default behavior is that TUs built
with different libc++ versions are not guaranteed to link. This is a change
in contract but not a change in behavior, since the current implementation
still allows linking TUs built with different libc++ versions together.

Reviewers: EricWF, mclow.lists, dexonsmith, hans, rnk

Subscribers: christof, cfe-commits

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

llvm-svn: 339874

6 years ago[yaml2obj] - Allow to use numeric sh_link (Link) value for sections.
George Rimar [Thu, 16 Aug 2018 12:44:17 +0000 (12:44 +0000)]
[yaml2obj] - Allow to use numeric sh_link (Link) value for sections.

That change allows using numeric values for Link field.
It is consistent with the code for another fields in this method.

llvm-svn: 339873

6 years ago[yaml2elf] - Use check-next in test.
George Rimar [Thu, 16 Aug 2018 12:40:27 +0000 (12:40 +0000)]
[yaml2elf] - Use check-next in test.

Its a follow up for rL339870.

llvm-svn: 339872

6 years ago[ARM] Ignore GEPs in ARMCodeGenPrepare
Sam Parker [Thu, 16 Aug 2018 12:24:40 +0000 (12:24 +0000)]
[ARM] Ignore GEPs in ARMCodeGenPrepare

While searching through the use-def tree, ignore GetElementPtrInst
instructions because they don't need promoting and neither do their
indices. Otherwise, the wide indices prevent the transformation from
happening.

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

llvm-svn: 339871

6 years ago[yaml2elf] - Simplify code, add a test. NFC.
George Rimar [Thu, 16 Aug 2018 12:23:22 +0000 (12:23 +0000)]
[yaml2elf] - Simplify code, add a test. NFC.

This simplifies the code allowing to set the sh_info
for relocations sections. And adds a missing test.

llvm-svn: 339870

6 years ago[XRay][compiler-rt] Remove MAP_NORESERVE from XRay allocations
Dean Michael Berris [Thu, 16 Aug 2018 12:19:03 +0000 (12:19 +0000)]
[XRay][compiler-rt] Remove MAP_NORESERVE from XRay allocations

Summary:
This reverses an earlier decision to allow seg-faulting from the
XRay-allocated memory if it turns out that the system cannot provide
physical memory backing that cannot be swapped in/out on Linux.

This addresses http://llvm.org/PR38588.

Reviewers: eizan

Reviewed By: eizan

Subscribers: llvm-commits

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

llvm-svn: 339869

6 years ago[ARM] Allow zext in ARMCodeGenPrepare
Sam Parker [Thu, 16 Aug 2018 11:54:09 +0000 (11:54 +0000)]
[ARM] Allow zext in ARMCodeGenPrepare

Treat zext instructions as roots, like we do for truncs.

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

llvm-svn: 339868

6 years ago[LLD][ELF] - Add test case.
George Rimar [Thu, 16 Aug 2018 11:48:18 +0000 (11:48 +0000)]
[LLD][ELF] - Add test case.

To cover the following error message:
https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L463

llvm-svn: 339867

6 years agoAttempt to fix clangd tests on older compilers
Simon Pilgrim [Thu, 16 Aug 2018 11:41:19 +0000 (11:41 +0000)]
Attempt to fix clangd tests on older compilers

Old gcc versions of gcc struggle with raw string literals inside macros.

Inspired by rL339759

llvm-svn: 339866

6 years ago[libcxxabi] Fix test_exception_address_alignment test for ARM
Yvan Roux [Thu, 16 Aug 2018 11:38:09 +0000 (11:38 +0000)]
[libcxxabi] Fix test_exception_address_alignment test for ARM

Check _LIBCXXABI_ARM_EHABI macro instead of libunwind version.

Fixes PR34182

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

llvm-svn: 339865

6 years ago[RISCV][MC] Don't fold symbol differences if requiresDiffExpressionRelocations is...
Alex Bradbury [Thu, 16 Aug 2018 11:26:37 +0000 (11:26 +0000)]
[RISCV][MC] Don't fold symbol differences if requiresDiffExpressionRelocations is true

When emitting the difference between two symbols, the standard behavior is
that the difference will be resolved to an absolute value if both of the
symbols are offsets from the same data fragment. This is undesirable on
architectures such as RISC-V where relaxation in the linker may cause the
computed difference to become invalid. This caused an issue when compiling to
object code, where the size of a function in the debug information was already
calculated even though it could change as a consequence of relaxation in the
subsequent linking stage.

This patch inhibits the resolution of symbol differences to absolute values
where the target's AsmBackend has declared that it does not want these to be
folded.

Differential Revision: https://reviews.llvm.org/D45773
Patch by Edward Jones.

llvm-svn: 339864

6 years ago[ADT] Replace APInt::WORD_MAX with APInt::WORDTYPE_MAX
Simon Pilgrim [Thu, 16 Aug 2018 11:08:23 +0000 (11:08 +0000)]
[ADT] Replace APInt::WORD_MAX with APInt::WORDTYPE_MAX

The windows SDK defines WORD_MAX, so any poor soul that wants to use LLVM in a project that depends on the windows SDK gets a build error.

Given that it actually describes the maximal value of WordType, it actually fits even better than WORD_MAX

Patch by: @miscco

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

llvm-svn: 339863

6 years ago[AST] Store the OwnedTagDecl as a trailing object in ElaboratedType.
Bruno Ricci [Thu, 16 Aug 2018 10:48:16 +0000 (10:48 +0000)]
[AST] Store the OwnedTagDecl as a trailing object in ElaboratedType.

The TagDecl *OwnedTagDecl in ElaboratedType is quite commonly
null (at least when parsing all of Boost, it is non-null for only about 600
of the 66k ElaboratedType). Therefore we can save a pointer in the
common case by storing it as a trailing object, and storing a bit in the
bit-fields of Type indicating when the pointer is null.

Reviewed By: rjmccall

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

llvm-svn: 339862

6 years ago[AST] Pack the unsigned of SubstTemplateTypeParmPackType into Type
Bruno Ricci [Thu, 16 Aug 2018 10:33:36 +0000 (10:33 +0000)]
[AST] Pack the unsigned of SubstTemplateTypeParmPackType into Type

The bit-fields of Type have enough space for the member
unsigned NumArgs of SubstTemplateTypeParmPackType.

Reviewed By: erichkeane

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

llvm-svn: 339861

6 years ago[AST] Pack the unsigned of DependentTemplateSpecializationType into Type
Bruno Ricci [Thu, 16 Aug 2018 10:28:18 +0000 (10:28 +0000)]
[AST] Pack the unsigned of DependentTemplateSpecializationType into Type

The bit-fields of `Type` have enough space for the member
`unsigned NumArgs` of `DependentTemplateSpecializationType`.

Reviewed By: erichkeane

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

llvm-svn: 339860

6 years ago[ARM] Allow signed icmps in ARMCodeGenPrepare
Sam Parker [Thu, 16 Aug 2018 10:05:39 +0000 (10:05 +0000)]
[ARM] Allow signed icmps in ARMCodeGenPrepare

Originally committed in r339755 which was reverted in r339806 due to
an asan issue. The issue was caused by my assumption that operands to
a CallInst mapped to the FunctionType Params. CallInsts are now
handled by iterating over their ArgOperands instead of Operands.

Original Message:
  Treat signed icmps as 'sinks', allowing them to be in the use-def
  tree, enabling more promotions to be performed. As a sink, any
  promoted incoming values need to be truncated before being used by
  the signed icmp.

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

llvm-svn: 339858

6 years ago[libunwind][mips] Guard accumulator registers
Stefan Maksimovic [Thu, 16 Aug 2018 08:49:50 +0000 (08:49 +0000)]
[libunwind][mips] Guard accumulator registers

Mipsr6 does not possess HI and LO accumulator registers, adjust validRegister functions to respect that.

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

llvm-svn: 339849

6 years ago[libunwind][mips] Modify the __mips_fpr macro check
Stefan Maksimovic [Thu, 16 Aug 2018 08:47:43 +0000 (08:47 +0000)]
[libunwind][mips] Modify the __mips_fpr macro check

The __mips_fpr macro can take the value of 0 as well, change to account for that case.

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

llvm-svn: 339848

6 years ago[mips] Remove dead code from MipsPassConfig
Simon Atanasyan [Thu, 16 Aug 2018 08:43:17 +0000 (08:43 +0000)]
[mips] Remove dead code from MipsPassConfig

Found by GCC's -Wunused-function.

Patch by Kim Gräsman.

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

llvm-svn: 339847

6 years ago[NFC] Remove const modifier to allow further development in LICM
Max Kazantsev [Thu, 16 Aug 2018 08:30:15 +0000 (08:30 +0000)]
[NFC] Remove const modifier to allow further development in LICM

llvm-svn: 339846

6 years ago[X86] Remove masking from the 512-bit paddus/psubus builtins. Use a select builtin...
Craig Topper [Thu, 16 Aug 2018 07:28:06 +0000 (07:28 +0000)]
[X86] Remove masking from the 512-bit paddus/psubus builtins. Use a select builtin instead.

llvm-svn: 339845

6 years ago[NFC] Add missing const modifier
Max Kazantsev [Thu, 16 Aug 2018 06:28:04 +0000 (06:28 +0000)]
[NFC] Add missing const modifier

llvm-svn: 339844

6 years ago[X86] Remove masking from the 512-bit padds and psubs builtins. Use select builtin...
Craig Topper [Thu, 16 Aug 2018 06:20:29 +0000 (06:20 +0000)]
[X86] Remove masking from the 512-bit padds and psubs builtins. Use select builtin instead.

llvm-svn: 339843

6 years ago[X86] Remove masking from the 512-bit padds and psubs intrinsics. Use select in IR...
Craig Topper [Thu, 16 Aug 2018 06:20:24 +0000 (06:20 +0000)]
[X86] Remove masking from the 512-bit padds and psubs intrinsics. Use select in IR instead.

llvm-svn: 339842

6 years ago[X86] Remove the unused masked 128 and 256-bit masked padds/psubs intrinsics.
Craig Topper [Thu, 16 Aug 2018 06:20:22 +0000 (06:20 +0000)]
[X86] Remove the unused masked 128 and 256-bit masked padds/psubs intrinsics.

Still need to remove masking from the 512-bit versions.

llvm-svn: 339841

6 years ago[X86] Correct some bad FileCheck prefixes in tests. Add test cases for v64i8 padd...
Craig Topper [Thu, 16 Aug 2018 06:20:19 +0000 (06:20 +0000)]
[X86] Correct some bad FileCheck prefixes in tests. Add test cases for v64i8 padd/psub saturation intrinsics.

For some reason we had the 128/256-bit tests, but no the 512-bit tests.

llvm-svn: 339840

6 years ago[ASTImporter] Add test for CXXDefaultInitExpr
Raphael Isemann [Thu, 16 Aug 2018 01:37:43 +0000 (01:37 +0000)]
[ASTImporter] Add test for CXXDefaultInitExpr

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

llvm-svn: 339839

6 years ago[ASTImporter] Add test for CXXScalarValueInit
Raphael Isemann [Thu, 16 Aug 2018 01:36:37 +0000 (01:36 +0000)]
[ASTImporter] Add test for CXXScalarValueInit

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

llvm-svn: 339838

6 years ago[ASTImporter] Add test for ForStmt and ContinueStmt
Raphael Isemann [Thu, 16 Aug 2018 01:35:47 +0000 (01:35 +0000)]
[ASTImporter] Add test for ForStmt and ContinueStmt

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

llvm-svn: 339837

6 years ago[x86] Actually initialize the SLH pass with the x86 backend and use
Chandler Carruth [Thu, 16 Aug 2018 01:22:19 +0000 (01:22 +0000)]
[x86] Actually initialize the SLH pass with the x86 backend and use
a shorter name ('x86-slh') for the internal flags and pass name.

Without this, you can't use the -stop-after or -stop-before
infrastructure. I seem to have just missed this when originally adding
the pass.

The shorter name solves two problems. First, the flag names were ...
really long and hard to type/manage. Second, the pass name can't be the
exact same as the flag name used to enable this, and there are already
some users of that flag name so I'm avoiding changing it unnecessarily.

llvm-svn: 339836

6 years ago[BFI] Use rounding while computing profile counts.
Easwaran Raman [Thu, 16 Aug 2018 00:26:59 +0000 (00:26 +0000)]
[BFI] Use rounding while computing profile counts.

Summary:
Profile count of a block is computed by multiplying its block frequency
by entry count and dividing the result by entry block frequency. Do
rounded division in the last step and update test cases appropriately.

Reviewers: davidxl

Subscribers: llvm-commits

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

llvm-svn: 339835

6 years ago[Driver] -print-target-triple and -print-effective-triple options
Petr Hosek [Thu, 16 Aug 2018 00:22:03 +0000 (00:22 +0000)]
[Driver] -print-target-triple and -print-effective-triple options

These can be used to print Clang target and effective triple.

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

llvm-svn: 339834

6 years agoFix a little thinko in generating ___lldb_unnamed_symbol symbols
Jim Ingham [Wed, 15 Aug 2018 23:10:32 +0000 (23:10 +0000)]
Fix a little thinko in generating ___lldb_unnamed_symbol symbols
when we have only an in-memory copy of the binary.

Also added a test for the generation of these symbols in the
in-memory and regular cases.

<rdar://problem/43160401>

llvm-svn: 339833

6 years agoImplementation of nested loops in cxx_loop_proto
Emmett Neyman [Wed, 15 Aug 2018 23:05:48 +0000 (23:05 +0000)]
Implementation of nested loops in cxx_loop_proto

Summary: Extended `cxx_loop_proto` to have neste for loops. Modified `loop_proto_to_llvm` and `loop_proto_to_cxx` to handle the new protos. All protos have a set of statements designated as "inner loop" statements and a set of statements designated as "outer loop" statements.

Reviewers: morehouse, kcc

Reviewed By: morehouse

Subscribers: cfe-commits, llvm-commits

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

llvm-svn: 339832

6 years ago[ASTImporter] Add test for ArrayInitLoopExpr
Raphael Isemann [Wed, 15 Aug 2018 22:52:21 +0000 (22:52 +0000)]
[ASTImporter] Add test for ArrayInitLoopExpr

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: martong, cfe-commits

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

llvm-svn: 339831

6 years ago[ASTImporter] Add test for ExprWithCleanups
Raphael Isemann [Wed, 15 Aug 2018 22:51:37 +0000 (22:51 +0000)]
[ASTImporter] Add test for ExprWithCleanups

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

llvm-svn: 339830

6 years ago[Darwin Driver] Fix Simulator builtins and test cases
Chris Bieneman [Wed, 15 Aug 2018 22:50:06 +0000 (22:50 +0000)]
[Darwin Driver] Fix Simulator builtins and test cases

In r339807, I broke linking the builtins libraries for simulator targets, which itself was bad, but turns out it was all completely untested and marked with FIXME in the test suite.

This fixes all the test cases so they actually work, and fixes the bug I introduced in r339807.

llvm-svn: 339829

6 years agoAdd libc++ data formatters for std::optional.
Adrian Prantl [Wed, 15 Aug 2018 22:48:48 +0000 (22:48 +0000)]
Add libc++ data formatters for std::optional.

Patch by Shafik Yaghmour!

This reapplies an earlier version after addressing some post-commit feedback.

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

llvm-svn: 339828

6 years ago[ASTImporter] Add test for IfStmt
Raphael Isemann [Wed, 15 Aug 2018 22:36:58 +0000 (22:36 +0000)]
[ASTImporter] Add test for IfStmt

Reviewers: a.sidorin, hiraditya

Reviewed By: hiraditya

Subscribers: hiraditya, martong, cfe-commits

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

llvm-svn: 339827

6 years agoRevert "[ASTImporter] Add test for IfStmt"
Raphael Isemann [Wed, 15 Aug 2018 22:32:35 +0000 (22:32 +0000)]
Revert "[ASTImporter] Add test for IfStmt"

That's actually a clang patch, sorry.

llvm-svn: 339826

6 years ago[ASTImporter] Add test for IfStmt
Raphael Isemann [Wed, 15 Aug 2018 22:31:44 +0000 (22:31 +0000)]
[ASTImporter] Add test for IfStmt

Reviewers: a.sidorin, hiraditya

Reviewed By: hiraditya

Subscribers: hiraditya, martong, cfe-commits

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

llvm-svn: 339825

6 years ago[Metadata] Replace a SmallVector with an array; NFC
George Burgess IV [Wed, 15 Aug 2018 22:15:35 +0000 (22:15 +0000)]
[Metadata] Replace a SmallVector with an array; NFC

MDNode::get takes an ArrayRef, so these should be equivalent.

llvm-svn: 339824

6 years ago[llvm-mca] Minor style changes. NFC
Andrea Di Biagio [Wed, 15 Aug 2018 22:11:05 +0000 (22:11 +0000)]
[llvm-mca] Minor style changes. NFC

llvm-svn: 339823

6 years ago[CodeGenPrepare] Add BothExtension type to PromotedInsts
Guozhi Wei [Wed, 15 Aug 2018 22:08:26 +0000 (22:08 +0000)]
[CodeGenPrepare] Add BothExtension type to PromotedInsts

This patch fixes PR38125.

Instruction extension types are recorded in PromotedInsts, it can be used later in function canGetThrough. If an instruction has two users with different extension types, it will be inserted into PromotedInsts two times in function promoteOperandForOther. The second one overwrites the first one, and the final extension type is wrong, later causes problem in canGetThrough.

This patch changes the simple bool extension type to 2-bit enum type, add a BothExtension type in addition to zero/sign extension. When an user sees BothExtension for an instruction, it actually knows nothing about how that instruction is extended.

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

llvm-svn: 339822

6 years agoAMDGPU: Fold fneg into fmed3
Matt Arsenault [Wed, 15 Aug 2018 21:46:27 +0000 (21:46 +0000)]
AMDGPU: Fold fneg into fmed3

llvm-svn: 339821

6 years agoAMDGPU: Improve extract_vector_elt reduction combine
Matt Arsenault [Wed, 15 Aug 2018 21:34:06 +0000 (21:34 +0000)]
AMDGPU: Improve extract_vector_elt reduction combine

Handle fmul, fsub and preserve flags.

Also really test minnum/maxnum reductions.
The existing tests were only checking from
minnum/maxnum matched from a fast math compare
and select which is not the same.

llvm-svn: 339820

6 years agoAMDGPU: Implement llvm.amdgcn.icmp/fcmp for i16/f16
Matt Arsenault [Wed, 15 Aug 2018 21:25:20 +0000 (21:25 +0000)]
AMDGPU: Implement llvm.amdgcn.icmp/fcmp for i16/f16

Also support these on targets without support for these,
since it will allow us to freely create these in instcombine.

llvm-svn: 339819

6 years ago[X86] Improve AVX1 shuffle lowering for v8f32 shuffles where the low half comes from...
Craig Topper [Wed, 15 Aug 2018 21:21:52 +0000 (21:21 +0000)]
[X86] Improve AVX1 shuffle lowering for v8f32 shuffles where the low half comes from V1 and the high half comes from V2 and the halves do the same operation

To lower this we now create a new V1 containing the low half of both sources and a new V2 containing the upper half of both sources. Then we created a repeated lane shuffle of those new sources to create the final result.

This fixes PR35833

Differential Revison: https://reviews.llvm.org/D41794

llvm-svn: 339818

6 years agoFix doc string variable name to quiet a compiler warning.
Greg Clayton [Wed, 15 Aug 2018 21:21:22 +0000 (21:21 +0000)]
Fix doc string variable name to quiet a compiler warning.

llvm-svn: 339817

6 years agoSelectively import timespec_get into namespace std, since some C libraries don't...
Marshall Clow [Wed, 15 Aug 2018 21:19:08 +0000 (21:19 +0000)]
Selectively import timespec_get into namespace std, since some C libraries don't have it. Reviewed as https://reviews.llvm.org/D50799

llvm-svn: 339816

6 years agoAMDGPU: Stop producing icmp/fcmp intrinsics with invalid types
Matt Arsenault [Wed, 15 Aug 2018 21:14:25 +0000 (21:14 +0000)]
AMDGPU: Stop producing icmp/fcmp intrinsics with invalid types

llvm-svn: 339815

6 years agoAMDGPU: Address todo for handling 1/(2 pi)
Matt Arsenault [Wed, 15 Aug 2018 21:03:55 +0000 (21:03 +0000)]
AMDGPU: Address todo for handling 1/(2 pi)

llvm-svn: 339814

6 years agoDAG: Use getObjectOffset helper
Matt Arsenault [Wed, 15 Aug 2018 21:03:44 +0000 (21:03 +0000)]
DAG: Use getObjectOffset helper

llvm-svn: 339813

6 years ago[TableGen] Remove unnecessary TypeSetByHwMode -> ValueTypeByHwMode -> TypeSetByHwMode...
Simon Pilgrim [Wed, 15 Aug 2018 20:41:19 +0000 (20:41 +0000)]
[TableGen] Remove unnecessary TypeSetByHwMode -> ValueTypeByHwMode -> TypeSetByHwMode conversions in getPatternSize

I noticed this during profiling of tablegen (PR28222) that we were calling Child->getType(0) which creates a ValueTypeByHwMode on the fly from the requested internal TypeSetByHwMode type and returns it by value, we then treat it as a TypeSetByHwMode reference which involves constructing a new TypeSetByHwMode on the stack with a large amount of std::map iterating/copying all along the way.

I am not an expert on tablegen, but AFAICT this is all unnecessary and we should be calling Child->getExtType(0) which returns the original TypeSetByHwMode by reference.

This gives me a 90sec reduction in msvc debug builds of x86 -gen-dag-isel.

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

llvm-svn: 339812

6 years agoDAG: Try to custom lower when promoting float operands
Matt Arsenault [Wed, 15 Aug 2018 20:34:54 +0000 (20:34 +0000)]
DAG: Try to custom lower when promoting float operands

For some reason this wasn't done for floats like
integers.

llvm-svn: 339811

6 years agoAdd a newline to SourceLocation dump output
Stephen Kelly [Wed, 15 Aug 2018 20:32:06 +0000 (20:32 +0000)]
Add a newline to SourceLocation dump output

Summary:
Migrate callers to print().

dump() should be useful to downstreams and third parties as a debugging
aid.  Everyone trips up on this and creates confusing output.

Subscribers: cfe-commits

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

llvm-svn: 339810

6 years ago[MCJIT] Fix a case of Error::success() being passed to report_fatal_error.
Lang Hames [Wed, 15 Aug 2018 20:11:21 +0000 (20:11 +0000)]
[MCJIT] Fix a case of Error::success() being passed to report_fatal_error.

MCJIT::getSymbolAddress was handling a non-fatal error condition of JITSymbol
as fatal. JITSymbol::operator bool returns false if no address is available
but no error is set. This can occur e.g. if the symbol name was not found.

Patch by Jascha Wetzel. Thanks Jascha!

llvm-svn: 339809

6 years ago[CStringSyntaxChecker] Reduces space around error message for strlcat.
David Carlier [Wed, 15 Aug 2018 20:09:52 +0000 (20:09 +0000)]
[CStringSyntaxChecker] Reduces space around error message for strlcat.

llvm-svn: 339808

6 years agoRefactor Darwin driver to refer to runtimes by component
Chris Bieneman [Wed, 15 Aug 2018 20:09:38 +0000 (20:09 +0000)]
Refactor Darwin driver to refer to runtimes by component

Summary:
In r335809, Petr Hosek lays out support for what he calls the multiarch
runtimes layout. This new way of laying out the directories for runtime
libraries is workable for all platforms. Petr did some of the common
infrastructure and made it work for Linux and Fuscia. This patch is a
cleanup to the Darwin and MachO drivers to serve as a step toward
supporting it in Darwin.

This patch does primarily two things:
(1) Changes the APIs for how the Darwin driver refers to compiler-rt
libraries to use the component names, similar to how Linux and Fuscia do

(2) Removes some legacy functionality for supporting macOS versions
before 10.6. This functionality is effectively dead code because in
r339277, the support was removed from compiler-rt for generating the 10.4
runtime support library, and Xcode 10 (currently in beta) removes
libgcc_s.10.4 and libgcc_s.10.5 from the macOS SDK.

With this patch landed a subsequent patch can modify
MachO::AddLinkRuntimeLib to support the multiarch runtimes layout.

Worth noting: None of the removed functionality was actually covered in
the test suite. So no test case updates are required.

Reviewers: phosek, bruno, arphaman

Reviewed By: phosek, arphaman

Subscribers: cfe-commits

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

llvm-svn: 339807

6 years agoRevert "[ARM] Allow signed icmps in ARMCodeGenPrepare"
Vitaly Buka [Wed, 15 Aug 2018 20:09:35 +0000 (20:09 +0000)]
Revert "[ARM] Allow signed icmps in ARMCodeGenPrepare"

use-after-poison in check-llvm under asan

This reverts commit r339755.

llvm-svn: 339806

6 years ago[OPENMP] FIx processing of declare target variables.
Alexey Bataev [Wed, 15 Aug 2018 19:45:12 +0000 (19:45 +0000)]
[OPENMP] FIx processing of declare target variables.

The compiler may produce unexpected error messages/crashes when declare
target variables were used. Patch fixes problems with the declarations
marked as declare target to or link.

llvm-svn: 339805

6 years agoMark the at_exit and at_quick_exit tests as unsupported under C++98 an 03, since...
Marshall Clow [Wed, 15 Aug 2018 19:27:53 +0000 (19:27 +0000)]
Mark the at_exit and at_quick_exit tests as unsupported under C++98 an 03, since those calls were introduced in C++11.  They're already guarded by an ifdef in the code, so this is a 'belt-and-suspenders' change.

llvm-svn: 339804

6 years agoclang-format: Change Google style wrt. the formatting of empty messages.
Daniel Jasper [Wed, 15 Aug 2018 19:07:55 +0000 (19:07 +0000)]
clang-format: Change Google style wrt. the formatting of empty messages.

Before:
  message Empty {
  }

After:
  message Empty {}

llvm-svn: 339803

6 years ago[Support] Add a basic C API for llvm::Error.
Lang Hames [Wed, 15 Aug 2018 18:42:11 +0000 (18:42 +0000)]
[Support] Add a basic C API for llvm::Error.

Summary:
The C-API supports consuming errors, converting an error to a string error
message, and querying an error's type. Other LLVM C APIs that wish to use
llvm::Error can supply error-type-id checkers and custom
error-to-structured-type converters for any custom errors they provide.

Reviewers: bogner, zturner, labath, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 339802

6 years ago[WebAssembly][NFC] Standardize SIMD multiclass format
Thomas Lively [Wed, 15 Aug 2018 18:15:18 +0000 (18:15 +0000)]
[WebAssembly][NFC] Standardize SIMD multiclass format

Summary:
This CL changes the ExtractLane ISEL multiclass to more closely mirror
the structure of the splat and replace_lane multiclasses.

Reviewers: aheejin, dschuff

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

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

llvm-svn: 339801

6 years agocfi: Remove blacklist entries for libc++.
Peter Collingbourne [Wed, 15 Aug 2018 18:05:55 +0000 (18:05 +0000)]
cfi: Remove blacklist entries for libc++.

These functions have had no-CFI annotations in the source code for
a while now.

llvm-svn: 339800

6 years agollvm-readobj: Fix addend in relocations for android packed format
Peter Collingbourne [Wed, 15 Aug 2018 17:58:22 +0000 (17:58 +0000)]
llvm-readobj: Fix addend in relocations for android packed format

If a relocation group doesn't have the RELOCATION_GROUP_HAS_ADDEND_FLAG set, then this implies the group's addend equals zero.
In this case android packed format won't encode an explicit addend delta, instead we need to set Addend, the "previous addend" variable, to zero by ourself.

Patch by Yi-Yo Chiang!

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

llvm-svn: 339799

6 years ago[WebAssembly] Test commit
Thomas Lively [Wed, 15 Aug 2018 17:50:22 +0000 (17:50 +0000)]
[WebAssembly] Test commit

Changes a comment and some whitespace to test commit access.

llvm-svn: 339798

6 years agolibcxx: Mark __temp_value::__temp_value as _LIBCPP_NO_CFI.
Peter Collingbourne [Wed, 15 Aug 2018 17:49:30 +0000 (17:49 +0000)]
libcxx: Mark __temp_value::__temp_value as _LIBCPP_NO_CFI.

This constructor needs to cast a pointer to uninitialized
memory to a pointer to object type in order to call
allocator_traits::construct(). This cast is not allowed when CFI cast
checks are enabled.

I did this instead of marking __addr() as _LIBCPP_NO_CFI so that we
don't lose CFI checks on get() or the dtor.

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

llvm-svn: 339797

6 years ago[InstCombine] Fix IC trying to create a xor of pointer types.
Amara Emerson [Wed, 15 Aug 2018 17:46:22 +0000 (17:46 +0000)]
[InstCombine] Fix IC trying to create a xor of pointer types.

rdar://42473741

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

llvm-svn: 339796

6 years ago[MemorySSA] Expose the verify as a debug option.
Alina Sbirlea [Wed, 15 Aug 2018 17:34:55 +0000 (17:34 +0000)]
[MemorySSA] Expose the verify as a debug option.

Summary: Expose VerifyMemorySSA as a debug option. If set, passes will call the MSSA->verifyMemorySSA() after calling into the updater's APIs when MemorySSA should be valid.

Reviewers: george.burgess.iv

Subscribers: sanjoy, jlebar, Prazek, llvm-commits

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

llvm-svn: 339795

6 years agoFor FreeBSD, don't define _M in nasty_macros.hpp
Dimitry Andric [Wed, 15 Aug 2018 17:30:32 +0000 (17:30 +0000)]
For FreeBSD, don't define _M in nasty_macros.hpp

Because FreeBSD uses _M in its <sys/types.h>, and it is hard to avoid
including that header, only define _M to NASTY_MACRO for other operating
systems.  This fixes almost 2000 unexpected test failures.

Discussed with Eric Fiselier.

llvm-svn: 339794

6 years ago[AArch64] add tests for poor vector intrinsic lowering via legalization (PR38527...
Sanjay Patel [Wed, 15 Aug 2018 17:06:21 +0000 (17:06 +0000)]
[AArch64] add tests for poor vector intrinsic lowering via legalization (PR38527); NFC

These correspond to the x86 tests added with rL339790 / rL339791, but I widened
the non-fsin tests to v3f32 to show the problem because AArch supports v2f32 ops.

llvm-svn: 339793

6 years ago[RegisterCoalescer] Ensure that both registers have subranges if one does
Krzysztof Parzyszek [Wed, 15 Aug 2018 17:04:58 +0000 (17:04 +0000)]
[RegisterCoalescer] Ensure that both registers have subranges if one does

llvm-svn: 339792

6 years ago[x86] add fabs test for vector intrinsic to potential libcall bug; NFC
Sanjay Patel [Wed, 15 Aug 2018 16:56:09 +0000 (16:56 +0000)]
[x86] add fabs test for vector intrinsic to potential libcall bug; NFC

This is a negative test for x86 because it has custom lowering for fabs.

llvm-svn: 339791

6 years ago[x86] add tests for poor vector intrinsic lowering via legalization (PR38527); NFC
Sanjay Patel [Wed, 15 Aug 2018 16:35:50 +0000 (16:35 +0000)]
[x86] add tests for poor vector intrinsic lowering via legalization (PR38527); NFC

llvm-svn: 339790

6 years ago[AST] Pack the unsigned of PackExpansionType into Type
Bruno Ricci [Wed, 15 Aug 2018 16:28:58 +0000 (16:28 +0000)]
[AST] Pack the unsigned of PackExpansionType into Type

The bit-fields of `Type` have enough space for
the `unsigned NumExpansions` of `PackExpansionType`

Reviewed By: erichkeane

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

llvm-svn: 339789

6 years ago[RegisterCoalescer] Reset VNInfo def when copying segments over
Krzysztof Parzyszek [Wed, 15 Aug 2018 16:21:53 +0000 (16:21 +0000)]
[RegisterCoalescer] Reset VNInfo def when copying segments over

llvm-svn: 339788

6 years ago[AST] Pack the bits of TemplateSpecializationType into Type
Bruno Ricci [Wed, 15 Aug 2018 16:21:17 +0000 (16:21 +0000)]
[AST] Pack the bits of TemplateSpecializationType into Type

Type has enough space for two members of
TemplateSpecializationType. Mechanical patch.

Reviewed By: erichkeane

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

llvm-svn: 339787

6 years ago[WebAssembly] SIMD replace_lane
Derek Schuff [Wed, 15 Aug 2018 16:18:51 +0000 (16:18 +0000)]
[WebAssembly] SIMD replace_lane

Implement and test replace_lane instructions.

Patch by Thomas Lively

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

llvm-svn: 339786

6 years ago[clang-doc] Explicitly cast to unique_ptr
Julie Hockett [Wed, 15 Aug 2018 16:18:46 +0000 (16:18 +0000)]
[clang-doc] Explicitly cast to unique_ptr

Older compilers don't like the implicit cast & move when returning a
unique_ptr to an llvm::Expected type.

llvm-svn: 339785

6 years ago[RegAlloc] Check that subreg liveness tracking applies to given virtual reg
Krzysztof Parzyszek [Wed, 15 Aug 2018 16:07:47 +0000 (16:07 +0000)]
[RegAlloc] Check that subreg liveness tracking applies to given virtual reg

Subregister liveness applies selectively to register classes with certain
properties. Make sure that when it's enabled, it applies to a given virtual
register (in virtual register rewriter).

llvm-svn: 339784

6 years agoReland "[clang-doc] Updating BitcodeReader to use llvm::Error""
Julie Hockett [Wed, 15 Aug 2018 16:02:28 +0000 (16:02 +0000)]
Reland "[clang-doc] Updating BitcodeReader to use llvm::Error""

With explicit unique_ptr casts so that bots with older compilers don't
break.

llvm-svn: 339783

6 years ago[clangd][tests] Rename tests of clangd instance termination
Jan Korous [Wed, 15 Aug 2018 15:58:05 +0000 (15:58 +0000)]
[clangd][tests] Rename tests of clangd instance termination

Just making testnames better reflect their testing scenarios.

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

llvm-svn: 339782

6 years ago[clangd][tests] Fix typo in tests - invalid LSP exit message
Jan Korous [Wed, 15 Aug 2018 15:50:45 +0000 (15:50 +0000)]
[clangd][tests] Fix typo in tests - invalid LSP exit message

Syntactically invalid JSON payload was causing clangd to terminate because of unexpected EOF rather than exit as a response to LSP exit message.

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

llvm-svn: 339781

6 years ago[SystemZ] Add testcase for r339778
Krzysztof Parzyszek [Wed, 15 Aug 2018 15:43:13 +0000 (15:43 +0000)]
[SystemZ] Add testcase for r339778

llvm-svn: 339780

6 years ago[PowerPC] Enhance the selection(ISD::VSELECT) of vector type
Nemanja Ivanovic [Wed, 15 Aug 2018 15:30:36 +0000 (15:30 +0000)]
[PowerPC] Enhance the selection(ISD::VSELECT) of vector type

To make ISD::VSELECT available(legal) so long as there are altivec instruction,
otherwise it's default behavior is expanding.
Use xxsel to match vselect if vsx is open, or use vsel.

In order to do not write many patterns in td file, promote (for vector it's
bitcast) all other type into v4i32 and only pattern match vselect of v4i32 into
vsel or xxsel.

Patch by wuzish
Differential revision: https://reviews.llvm.org/D49531

llvm-svn: 339779

6 years ago[SystemZ] Replace subreg_r with subreg_h
Krzysztof Parzyszek [Wed, 15 Aug 2018 15:21:23 +0000 (15:21 +0000)]
[SystemZ] Replace subreg_r with subreg_h

Change
  subreg_r32  -> subreg_h32
  subreg_r64  -> subreg_h64
  subreg_hr32 -> subreg_hh32

The subregisters subreg_r32 and subreg_r64 were added to emphasize the
fact that modifying these subregisters may clobber the entire register.
This is not necessarily the case for subreg_h32, et al.

However, the ability to compose subreg_h64 with subreg_r32, and with
subreg_h32 and subreg_l32 at the same time makes the compositions be
treated as non-overlapping (leading to problems when tracking subreg
liveness). See D50468 for more details.

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

llvm-svn: 339778

6 years ago[GVN] Fix typo in IsValueFullyAvailableInBlock. NFC.
Marcello Maggioni [Wed, 15 Aug 2018 15:06:53 +0000 (15:06 +0000)]
[GVN] Fix typo in IsValueFullyAvailableInBlock. NFC.

DenseMap insert() method return a pair<iterator, bool>
not pair<iterator, char>
Noticed it and thought I might just fix it ...

llvm-svn: 339777

6 years ago[SystemZ] New CL option to enable subreg liveness
Jonas Paulsson [Wed, 15 Aug 2018 15:04:49 +0000 (15:04 +0000)]
[SystemZ] New CL option to enable subreg liveness

This option is needed to enable subreg liveness tracking during register
allocation.

Review: Ulrich Weigand
https://reviews.llvm.org/D50779

llvm-svn: 339776

6 years ago[LLD][ELF] - Stop using binary input in merge-invalid-size.s test. NFCI.
George Rimar [Wed, 15 Aug 2018 14:59:38 +0000 (14:59 +0000)]
[LLD][ELF] - Stop using binary input in merge-invalid-size.s test. NFCI.

This rewrites the test using yaml.

llvm-svn: 339775

6 years ago[LLD][ELF] - Convert binary input to yaml in sht-group.s test. NFC.
George Rimar [Wed, 15 Aug 2018 14:10:15 +0000 (14:10 +0000)]
[LLD][ELF] - Convert binary input to yaml in sht-group.s test. NFC.

This removes test that used binary input and adds a yaml based test instead.

llvm-svn: 339774

6 years ago[SimplifyCFG] Remove pointer from SmallPtrSet before deletion
Chijun Sima [Wed, 15 Aug 2018 13:56:21 +0000 (13:56 +0000)]
[SimplifyCFG] Remove pointer from SmallPtrSet before deletion

Summary:
Previously, `eraseFromParent()` calls `delete` which invalidates the value of the pointer. Copying the value of the pointer later is undefined behavior in C++11 and implementation-defined (which may cause a segfault on implementations having strict pointer safety) in C++14.

This patch removes the BasicBlock pointer from related SmallPtrSet before `delete` invalidates it in the SimplifyCFG pass.

Reviewers: kuhar, dmgreen, davide, trentxintong

Reviewed By: kuhar, dmgreen

Subscribers: llvm-commits

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

llvm-svn: 339773