platform/upstream/llvm.git
5 years ago[WebAssembly] Import the stack pointer when building shared libraries
Sam Clegg [Thu, 15 Nov 2018 18:15:54 +0000 (18:15 +0000)]
[WebAssembly] Import the stack pointer when building shared libraries

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

llvm-svn: 346974

5 years ago[X86] Guess that a CPU is Icelake it if reports support for AVX512VBMI2.
Craig Topper [Thu, 15 Nov 2018 18:11:52 +0000 (18:11 +0000)]
[X86] Guess that a CPU is Icelake it if reports support for AVX512VBMI2.

llvm-svn: 346973

5 years ago[WebAssembly] Refactor config setting and checking. NFC.
Sam Clegg [Thu, 15 Nov 2018 18:09:41 +0000 (18:09 +0000)]
[WebAssembly] Refactor config setting and checking. NFC.

This matches the way the ELF backend does it.

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

llvm-svn: 346972

5 years ago[LTO] Load sample profile in LTO link step.
Xin Tong [Thu, 15 Nov 2018 18:06:42 +0000 (18:06 +0000)]
[LTO] Load sample profile in LTO link step.

Summary:
Load sample profile in LTO link step.
ThinLTO calls populateModulePassManager to load the profile

Reviewers: tejohnson, davidxl, danielcdh

Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, llvm-commits

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

llvm-svn: 346971

5 years ago[TTI] Reduction costs only need to include a single extract element cost
Simon Pilgrim [Thu, 15 Nov 2018 17:42:53 +0000 (17:42 +0000)]
[TTI] Reduction costs only need to include a single extract element cost

We were adding the entire scalarization extraction cost for reductions, which returns the total cost of extracting every element of a vector type.

For reductions we don't need to do this - we just need to extract the 0'th element after the reduction pattern has completed.

Fixes PR37731

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

llvm-svn: 346970

5 years ago[AST] Store the string data in StringLiteral in a trailing array of chars
Bruno Ricci [Thu, 15 Nov 2018 17:31:16 +0000 (17:31 +0000)]
[AST] Store the string data in StringLiteral in a trailing array of chars

Use the newly available space in the bit-fields of Stmt and store the
string data in a trailing array of chars after the trailing array
of SourceLocation. This cuts the size of StringLiteral by 2 pointers.

Also refactor slightly StringLiteral::Create and StringLiteral::CreateEmpty
so that StringLiteral::Create is just responsible for the allocation, and the
constructor is responsible for doing all the initialization. This match what
is done for the other classes in general.

This patch should have no other functional changes apart from this.

A concern was raised during review about the interaction between
this patch and serialization abbreviations. I believe however that
there is currently no abbreviation defined for StringLiteral.
The only statements/expressions which have abbreviations are currently
DeclRefExpr, IntegerLiteral, CharacterLiteral and ImplicitCastExpr.

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

Reviewed By: dblaikie, rjmccall

llvm-svn: 346969

5 years ago[InstCombine] fix rotate narrowing bug for non-pow-2 types
Sanjay Patel [Thu, 15 Nov 2018 17:19:14 +0000 (17:19 +0000)]
[InstCombine] fix rotate narrowing bug for non-pow-2 types

llvm-svn: 346968

5 years ago[AST][NFC] Various NFCs in StringLiteral
Bruno Ricci [Thu, 15 Nov 2018 16:42:14 +0000 (16:42 +0000)]
[AST][NFC] Various NFCs in StringLiteral

Factored out of D54166
([AST] Store the string data in StringLiteral in a trailing array of chars):

* For-range loops in containsNonAscii and containsNonAsciiOrNull.
* Comments and style fixes.
* int -> unsigned in mapCharByteWidth since TargetInfo::getCharWidth
  and friends return an unsigned, and StringLiteral manipulates and
  stores CharByteWidth as an unsigned.

llvm-svn: 346967

5 years ago[InstCombine] add rotate narrowing tests with odd types; NFC
Sanjay Patel [Thu, 15 Nov 2018 16:34:26 +0000 (16:34 +0000)]
[InstCombine] add rotate narrowing tests with odd types; NFC

There's a potential miscompile here. It's unlikely in the real
world because this transform is guarded with shouldChangeType(),
but this test file doesn't include a standard data-layout for
some reason (despite including a custom 1), so we can see the bug.

llvm-svn: 346966

5 years ago[SLPVectorizer][X86] Regenerate reduction minmax tests and cleanup check prefixes
Simon Pilgrim [Thu, 15 Nov 2018 16:34:15 +0000 (16:34 +0000)]
[SLPVectorizer][X86] Regenerate reduction minmax tests and cleanup check prefixes

llvm-svn: 346965

5 years ago[SLPVectorizer][X86] Regenerate reduction tests and add PR37731 test
Simon Pilgrim [Thu, 15 Nov 2018 16:08:25 +0000 (16:08 +0000)]
[SLPVectorizer][X86] Regenerate reduction tests and add PR37731 test

Cleanup check prefixes

llvm-svn: 346964

5 years ago[ELF] - Renamed few more AArch64 specific relocation expressions. NFC.
George Rimar [Thu, 15 Nov 2018 15:35:44 +0000 (15:35 +0000)]
[ELF] - Renamed few more AArch64 specific relocation expressions. NFC.

They are AArch64 only, so have to have AARCH64_* prefix.

llvm-svn: 346963

5 years ago[X86] Fix MCNullStreamer support for modules with a CodeView flag
Simon Pilgrim [Thu, 15 Nov 2018 15:17:15 +0000 (15:17 +0000)]
[X86] Fix MCNullStreamer support for modules with a CodeView flag

This fixes -filetype=null support when compiling for a Win32 target and the module has a CodeView flag.

The only places changed are the uses of getTargetStreamer function - this patch guards both of them with null checks.

Committed on behalf of @eush (Eugene Sharygin)

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

llvm-svn: 346962

5 years ago[clang-tidy] Update checks to play nicely with limited traversal scope added in r346847
Sam McCall [Thu, 15 Nov 2018 15:06:11 +0000 (15:06 +0000)]
[clang-tidy] Update checks to play nicely with limited traversal scope added in r346847

Summary: (See D54204 for original review)

Reviewers: hokein

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 346961

5 years ago[InstSimplify] delete shift-of-zero guard ops around funnel shifts
Sanjay Patel [Thu, 15 Nov 2018 14:53:37 +0000 (14:53 +0000)]
[InstSimplify] delete shift-of-zero guard ops around funnel shifts

This is a problem seen in common rotate idioms as noted in:
https://bugs.llvm.org/show_bug.cgi?id=34924

Note that we are not canonicalizing standard IR (shifts and logic) to the intrinsics yet.
(Although I've written this before...) I think this is the last step before we enable
that transform. Ie, we could regress code by doing that transform without this
simplification in place.

In PR34924, I questioned whether this is a valid transform for target-independent IR,
but I convinced myself this is ok. If we're speculating a funnel shift by turning cmp+br
into select, then SimplifyCFG has already determined that the transform is justified.
It's possible that SimplifyCFG is not taking into account profile or other metadata,
but if that's true, then it's a bug independent of funnel shifts.

Also, we do have CGP code to restore a guard like this around an intrinsic if it can't
be lowered cheaply. But that isn't necessary for funnel shift because the default
expansion in SelectionDAGBuilder includes this same cmp+select.

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

llvm-svn: 346960

5 years ago[RISCV] Mark C.EBREAK instruction as having side effects
Alex Bradbury [Thu, 15 Nov 2018 14:52:24 +0000 (14:52 +0000)]
[RISCV] Mark C.EBREAK instruction as having side effects

C.EBREAK was defined with hasSideEffects = 0, which is incorrect and
inconsistent with the non-compressed instruction form. This patch corrects
this oversight.

This wouldn't cause codegen issues, as compressed instructions are only ever
generated by converting the non-compressed form as an MCInst. But having
correct flags is still worthwhile.

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

llvm-svn: 346959

5 years ago[RISCV] Mark FREM as Expand
Alex Bradbury [Thu, 15 Nov 2018 14:46:11 +0000 (14:46 +0000)]
[RISCV] Mark FREM as Expand

Mark the FREM SelectionDAG node as Expand, which is necessary in order to
support the frem IR instruction on RISC-V. This is expanded into a library
call. Adds the corresponding test. Previously, this would have triggered an
assertion at instruction selection time.

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

llvm-svn: 346958

5 years ago[AST][NFC] Re-add comment in BinaryOperator which was removed by r346954
Bruno Ricci [Thu, 15 Nov 2018 14:30:18 +0000 (14:30 +0000)]
[AST][NFC] Re-add comment in BinaryOperator which was removed by r346954

llvm-svn: 346957

5 years agoStart adding the supporting code to perform out-of-process allocator
Dan Liew [Thu, 15 Nov 2018 14:20:28 +0000 (14:20 +0000)]
Start adding the supporting code to perform out-of-process allocator
enumeration.

Summary:

This patch introduces the local portion (`LocalAddressSpaceView`) of the
`AddressSpaceView` abstraction and modifies the secondary allocator
so that the `ForEachChunk()` method (and its callees) would work in the
out-of-process case when `AddressSpaceView` is `RemoteAddressSpaceView`.

The `AddressSpaceView` abstraction simply maps pointers from a target
process to a pointer in the local process (via its `Load()` method). For
the local (in-process) case this is a no-op. For the remote
(out-of-process) case this is not a no-op. The implementation of the
out-of-process `RemoteAddressSpaceView` is not included in this patch
and will be introduced later.

This patch is considerably simpler than the `ObjectView` abstraction
used in previous patches but lacks the type safety and stricter memory
management of the `ObjectView` abstraction.

This patch does not introduce any tests because with
`LocalAddressSpaceView` it should be a non functional change and unit
tests already cover the secondary allocator.  When
`RemoteAddressSpaceView` is landed tests will be added to ensure that it
functions as expected.

rdar://problem/45284065

Reviewers: kcc, kubamracek, dvyukov, vitalybuka, cryptoad,
george.karpenkov, morehouse

Subscribers: #sanitizers, llvm-commits

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

llvm-svn: 346956

5 years ago[clangd] global-symbol-builder => clangd-indexer
Haojian Wu [Thu, 15 Nov 2018 14:15:19 +0000 (14:15 +0000)]
[clangd] global-symbol-builder => clangd-indexer

llvm-svn: 346955

5 years ago[AST] Pack BinaryOperator
Bruno Ricci [Thu, 15 Nov 2018 14:12:51 +0000 (14:12 +0000)]
[AST] Pack BinaryOperator

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

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

Reviewed By: dblaikie

llvm-svn: 346954

5 years ago[AST] Pack MemberExpr
Bruno Ricci [Thu, 15 Nov 2018 13:56:22 +0000 (13:56 +0000)]
[AST] Pack MemberExpr

Use the newly available space in the bit-fields of Stmt
to store some data from MemberExpr. This saves
one pointer per MemberExpr.

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

Reviewed By: dblaikie

llvm-svn: 346953

5 years ago[AST][NFC] Move the friend decls to the top of MemberExpr
Bruno Ricci [Thu, 15 Nov 2018 13:49:32 +0000 (13:49 +0000)]
[AST][NFC] Move the friend decls to the top of MemberExpr

The norm is to have them at the top, and having them
at the bottom is painful for the reader.

llvm-svn: 346952

5 years ago[AST] Pack UnaryOperator
Bruno Ricci [Thu, 15 Nov 2018 13:30:38 +0000 (13:30 +0000)]
[AST] Pack UnaryOperator

Use the newly available space in the bit-fields of Stmt
to store some data from UnaryOperator.
This saves 8 bytes per UnaryOperator.

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

Reviewed By: dblaikie

llvm-svn: 346951

5 years agoFix warning about unused variable [NFC]
Mikael Holmen [Thu, 15 Nov 2018 13:01:54 +0000 (13:01 +0000)]
Fix warning about unused variable [NFC]

llvm-svn: 346950

5 years agoAdd missed files from prev. commit
Anton Korobeynikov [Thu, 15 Nov 2018 12:35:04 +0000 (12:35 +0000)]
Add missed files from prev. commit

llvm-svn: 346949

5 years ago[MSP430] Add MC layer
Anton Korobeynikov [Thu, 15 Nov 2018 12:29:43 +0000 (12:29 +0000)]
[MSP430] Add MC layer

Reapply r346374 with the fixes for modules build.

Original summary:

This change implements assembler parser, code emitter, ELF object writer
and disassembler for the MSP430 ISA.  Also, more instruction forms are added
to the target description.

Patch by Michael Skvortsov!

llvm-svn: 346948

5 years ago[clangd] Fix no results returned for global symbols in dexp
Haojian Wu [Thu, 15 Nov 2018 12:17:41 +0000 (12:17 +0000)]
[clangd] Fix no results returned for global symbols in dexp

Summary:
For symbols in global namespace (without any scope), we need to
add global scope "" to the fuzzy request.

Reviewers: ioeric

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

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

llvm-svn: 346947

5 years ago[llvm-objdump] Use `auto` declaration in typecasting
Xing GUO [Thu, 15 Nov 2018 11:51:13 +0000 (11:51 +0000)]
[llvm-objdump] Use `auto` declaration in typecasting

Summary:
According to `MaskRay`, use `auto` for type inference, according to coding standards.
Delete some comments, because these comments can be easily inferred from codes.

Reviewers: jhenderson, MaskRay

Reviewed By: jhenderson

Subscribers: llvm-commits

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

llvm-svn: 346946

5 years agoRevert "Introduce shard storage to auto-index."
Kadir Cetinkaya [Thu, 15 Nov 2018 10:34:47 +0000 (10:34 +0000)]
Revert "Introduce shard storage to auto-index."

This reverts commit 6dd1f24aead10a8d375d0311001987198d26e900.

llvm-svn: 346945

5 years agoRevert "clang-format"
Kadir Cetinkaya [Thu, 15 Nov 2018 10:34:43 +0000 (10:34 +0000)]
Revert "clang-format"

This reverts commit 0a37e9c3d88a2e21863657df2f7735fb7e5f746e.

llvm-svn: 346944

5 years agoRevert "Address comments"
Kadir Cetinkaya [Thu, 15 Nov 2018 10:34:39 +0000 (10:34 +0000)]
Revert "Address comments"

This reverts commit 19a39b14eab2b5339325e276262b177357d6b412.

llvm-svn: 346943

5 years agoRevert "Address comments."
Kadir Cetinkaya [Thu, 15 Nov 2018 10:34:35 +0000 (10:34 +0000)]
Revert "Address comments."

This reverts commit b43c4d1c731e07172a382567f3146b3c461c5b69.

llvm-svn: 346942

5 years agoAddress comments.
Kadir Cetinkaya [Thu, 15 Nov 2018 10:31:23 +0000 (10:31 +0000)]
Address comments.

llvm-svn: 346941

5 years agoAddress comments
Kadir Cetinkaya [Thu, 15 Nov 2018 10:31:19 +0000 (10:31 +0000)]
Address comments

llvm-svn: 346940

5 years agoclang-format
Kadir Cetinkaya [Thu, 15 Nov 2018 10:31:15 +0000 (10:31 +0000)]
clang-format

llvm-svn: 346939

5 years agoIntroduce shard storage to auto-index.
Kadir Cetinkaya [Thu, 15 Nov 2018 10:31:10 +0000 (10:31 +0000)]
Introduce shard storage to auto-index.

Reviewers: sammccall, ioeric

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

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

llvm-svn: 346938

5 years ago[RISCV] Introduce the RISCVMatInt::generateInstSeq helper
Alex Bradbury [Thu, 15 Nov 2018 10:11:31 +0000 (10:11 +0000)]
[RISCV] Introduce the RISCVMatInt::generateInstSeq helper

Logic to load 32-bit and 64-bit immediates is currently present in
RISCVAsmParser::emitLoadImm in order to support the li pseudoinstruction. With
the introduction of RV64 codegen, there is a greater benefit of sharing
immediate materialisation logic between the MC layer and codegen. The
generateInstSeq helper allows this by producing a vector of simple structs
representing the chosen instructions. This can then be consumed in the MC
layer to produce MCInsts or at instruction selection time to produce
appropriate SelectionDAG node. Sharing this logic means that both the li
pseudoinstruction and codegen can benefit from future optimisations, and
that this logic can be used for materialising constants during RV64 codegen.

This patch does contain a behaviour change: addi will now be produced on RV64
when no lui is necessary to materialise the constant. In that case addiw takes
x0 as the source register, so is semantically identical to addi.

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

llvm-svn: 346937

5 years ago[X86] Add some custom type legalization rules for truncate with -x86-experimental...
Craig Topper [Thu, 15 Nov 2018 08:23:40 +0000 (08:23 +0000)]
[X86] Add some custom type legalization rules for truncate with -x86-experimental-vector-widening-legalization.

This avoids some nasty shuffles when we have avx512. It will also prevent using zmm truncate instructions when a ymm instruction that zeroes part of an xmm register will do. Also avoid using avx512 truncate instructions when the input is 128 bits or less. These instructions are 2 uops on skx so we can probably find a better single uop shuffle like pshufb.

llvm-svn: 346936

5 years ago[X86] Add -x86-experimental-vector-widening-legalization versions of shuffle-vs-trunc...
Craig Topper [Thu, 15 Nov 2018 08:23:37 +0000 (08:23 +0000)]
[X86] Add -x86-experimental-vector-widening-legalization versions of shuffle-vs-trunc tests.

llvm-svn: 346935

5 years ago[ELF] Fix compilation with GCC 5
Martin Storsjo [Thu, 15 Nov 2018 08:20:18 +0000 (08:20 +0000)]
[ELF] Fix compilation with GCC 5

Remove the default initializer for TrapInstr; all subclasses overwrite
the defaults in their constructors anyway.

This fixes compilation errors like these, with GCC 5.4 on Ubuntu 16.04,
present since SVN r346893:

 In file included from ../tools/lld/ELF/Arch/AArch64.cpp:12:0:
 ../tools/lld/ELF/Target.h:125:49: error: array must be initialized with a brace-enclosed initializer
    std::array<uint8_t, 4> TrapInstr = {0, 0, 0, 0};
                                                  ^
 ../tools/lld/ELF/Target.h:125:49: error: too many initializers for ‘std::array<unsigned char, 4ul>’

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

llvm-svn: 346934

5 years agopropagate __config_site includes when building benchmarks
Eric Fiselier [Thu, 15 Nov 2018 07:29:56 +0000 (07:29 +0000)]
propagate __config_site includes when building benchmarks

llvm-svn: 346933

5 years agoFix a use-after-free of the ABI plugin.
Zachary Turner [Thu, 15 Nov 2018 05:06:59 +0000 (05:06 +0000)]
Fix a use-after-free of the ABI plugin.

This was introduced in r346775.  Previously the ABI shared_ptr
was declared as a function local static meaning it would live
forever.  After the change, someone has to create a strong
reference to it or it will go away.  In this code, we were
calling ABI::FindPlugin(...).get(), so it was being immediately
destroyed and we were holding onto a dangling pointer.

llvm-svn: 346932

5 years ago[WebAssembly] Renumber SIMD bitwise instructions
Thomas Lively [Thu, 15 Nov 2018 03:38:59 +0000 (03:38 +0000)]
[WebAssembly] Renumber SIMD bitwise instructions

Summary: Changed to match https://github.com/WebAssembly/simd/pull/54.

Reviewers: aheejin

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

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

llvm-svn: 346931

5 years agoNFC cleanup: Prefer make_unique over reset(new T())
David Blaikie [Thu, 15 Nov 2018 03:04:23 +0000 (03:04 +0000)]
NFC cleanup: Prefer make_unique over reset(new T())

llvm-svn: 346929

5 years agoFix combining pragma __debug dump & parser_crash with -E
David Blaikie [Thu, 15 Nov 2018 03:04:21 +0000 (03:04 +0000)]
Fix combining pragma __debug dump & parser_crash with -E

Previously these would be transformed into annotation tokens and the
preprocessor would then assume they were real tokens with source
locations and assert/UB.

Other pragmas that produce annotation tokens aren't a problem because
they aren't handled if the parser isn't hooked up - ParsePragma.cpp
registers those handlers & isn't run for pure preprocessing. So they're
treated as unknown pragmas & printed verbatim by the preprocessor.

Perhaps these pragmas should be treated the same way? But they got mixed
in with other __debug pragmas that do need to be handled during
preprocessing.

The third __debug pragma that produces an annotation token is 'captured'
- which had its own fix for this issue - by not inserting the annotation
token in the first place if it detected that it was in preprocessing
mode. I've removed that fix (from Lex/Pragma.cpp) in favor of the more
general one in Frontend/PrintPreprocessedOutput.cpp.

llvm-svn: 346928

5 years agoRewrite-imports on crash: Simplify handling
David Blaikie [Thu, 15 Nov 2018 03:04:19 +0000 (03:04 +0000)]
Rewrite-imports on crash: Simplify handling

-frewrite-imports already implies -frewrite-includes (it piggy-backs
on/extends the implementation) so there's no need to conditionally pass
-frewrite-includes when already using -frewrite-imports (& especially I
don't think these would want to be different between crash reporting and
not crash reporting)

llvm-svn: 346927

5 years agoStmt bits: Make ExprBits relative to StmtBits
David Blaikie [Thu, 15 Nov 2018 03:04:18 +0000 (03:04 +0000)]
Stmt bits: Make ExprBits relative to StmtBits

Seems like it makes it a bit easier to read/validate/update in the
future.

llvm-svn: 346926

5 years agoAMDGPU: Fix check lines in fdot2 test:
Konstantin Zhuravlyov [Thu, 15 Nov 2018 02:42:04 +0000 (02:42 +0000)]
AMDGPU: Fix check lines in fdot2 test:

GCN900 -> GFX900

llvm-svn: 346925

5 years ago[commit-test] Add blank line for test/tools/llvm-objdump/symbol-table-elf.test
Xing GUO [Thu, 15 Nov 2018 02:36:20 +0000 (02:36 +0000)]
[commit-test] Add blank line for test/tools/llvm-objdump/symbol-table-elf.test

Summary: Test commit

Reviewers: Higuoxing

Reviewed By: Higuoxing

Subscribers: llvm-commits, Higuoxing

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

llvm-svn: 346924

5 years agoAMDGPU: Enable code object v3 for AMDHSA only
Konstantin Zhuravlyov [Thu, 15 Nov 2018 02:32:43 +0000 (02:32 +0000)]
AMDGPU: Enable code object v3 for AMDHSA only

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

llvm-svn: 346923

5 years agoFix copy/paste mistake for r346919.
Jonas Devlieghere [Thu, 15 Nov 2018 01:18:16 +0000 (01:18 +0000)]
Fix copy/paste mistake for r346919.

llvm-svn: 346921

5 years agoAdd setting to require hardware breakpoints.
Jonas Devlieghere [Thu, 15 Nov 2018 01:18:15 +0000 (01:18 +0000)]
Add setting to require hardware breakpoints.

When debugging read-only memory we cannot use software breakpoint. We
already have support for hardware breakpoints and users can specify them
with `-H`. However, there's no option to force LLDB to use hardware
breakpoints internally, for example while stepping.

This patch adds a setting target.require-hardware-breakpoint that forces
LLDB to always use hardware breakpoints. Because hardware breakpoints
are a limited resource and can fail to resolve, this patch also extends
error handling in thread plans, where breakpoints are used for stepping.

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

llvm-svn: 346920

5 years ago[reproducer] Post-commit cleanup
Jonas Devlieghere [Thu, 15 Nov 2018 01:05:40 +0000 (01:05 +0000)]
[reproducer] Post-commit cleanup

After committing the initial reproducer feature I noticed a few small
issues which warranted addressing here. It fixes incorrect documentation
in the command object and extract some duplicated code into the debugger
object.

llvm-svn: 346919

5 years ago[WebAssembly] Initial support for shared objects (-shared)
Sam Clegg [Thu, 15 Nov 2018 00:37:21 +0000 (00:37 +0000)]
[WebAssembly] Initial support for shared objects (-shared)

Based on the initial spec proposal:
https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md

The llvm/codegen side of this is still missing but I believe this change is
still worth landing as an incremental step

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

llvm-svn: 346918

5 years agoWork around C++03 decltype limitations
Eric Fiselier [Thu, 15 Nov 2018 00:27:06 +0000 (00:27 +0000)]
Work around C++03 decltype limitations

llvm-svn: 346917

5 years ago[X86] Don't mark SEXTLOADS with narrow types as Custom with -x86-experimental-vector...
Craig Topper [Thu, 15 Nov 2018 00:21:41 +0000 (00:21 +0000)]
[X86] Don't mark SEXTLOADS with narrow types as Custom with -x86-experimental-vector-widening-legalization.

The narrow types end up requesting widening, but generic legalization will end up scalaring and using a build_vector to do the widening.

llvm-svn: 346916

5 years agoCGDecl::emitStoresForConstant fix synthesized constant's name
JF Bastien [Thu, 15 Nov 2018 00:19:18 +0000 (00:19 +0000)]
CGDecl::emitStoresForConstant fix synthesized constant's name

Summary: The name of the synthesized constants for constant initialization was using mangling for statics, which isn't generally correct and (in a yet-uncommitted patch) causes the mangler to assert out because the static ends up trying to mangle function parameters and this makes no sense. Instead, mangle to `"__const." + FunctionName + "." + DeclName`.

Reviewers: rjmccall

Subscribers: dexonsmith, cfe-commits

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

llvm-svn: 346915

5 years agoGet tests compiling with -Wunused-local-typedef
Eric Fiselier [Thu, 15 Nov 2018 00:11:02 +0000 (00:11 +0000)]
Get tests compiling with -Wunused-local-typedef

llvm-svn: 346914

5 years ago[MachineOutliner][NFC] Check if CandidatesForRepeatedSeq < 2
Jessica Paquette [Thu, 15 Nov 2018 00:02:24 +0000 (00:02 +0000)]
[MachineOutliner][NFC] Check if CandidatesForRepeatedSeq < 2

There's no reason to call getOutliningCandidateInfo with a single candidate.

llvm-svn: 346913

5 years ago[libcxx] [test] Fix Clang -Wunused-local-typedef warnings.
Stephan T. Lavavej [Wed, 14 Nov 2018 23:23:55 +0000 (23:23 +0000)]
[libcxx] [test] Fix Clang -Wunused-local-typedef warnings.

C++11's [hash.requirements] never required these typedefs from users.

llvm-svn: 346912

5 years ago[libcxx] [test] Include <cassert> for assert().
Stephan T. Lavavej [Wed, 14 Nov 2018 23:23:51 +0000 (23:23 +0000)]
[libcxx] [test] Include <cassert> for assert().

This fixes compiler errors with MSVC's STL.

llvm-svn: 346911

5 years ago[libcxx] [test] Fix MSVC warning C4800.
Stephan T. Lavavej [Wed, 14 Nov 2018 23:23:46 +0000 (23:23 +0000)]
[libcxx] [test] Fix MSVC warning C4800.

This was implicitly converting [1, 3] to bool, which triggers
an MSVC warning. The test should just pass `true`, which is
simpler, has the same behavior, and avoids the warning. (This
is a library test, not a compiler test, and the conversion happens
before calling `push_back`, so passing [1, 3] isn't interesting
in any way. This resembles a previous change to stop passing
`1 == 1` in the `vector<bool>` tests.)

llvm-svn: 346910

5 years ago[X86] Remove unused variable
Benjamin Kramer [Wed, 14 Nov 2018 23:13:27 +0000 (23:13 +0000)]
[X86] Remove unused variable

llvm-svn: 346909

5 years ago[X86] Support v2i32/v4i16/v8i8 load/store using f64 on 32-bit targets under -x86...
Craig Topper [Wed, 14 Nov 2018 23:02:09 +0000 (23:02 +0000)]
[X86] Support v2i32/v4i16/v8i8 load/store using f64 on 32-bit targets under -x86-experimental-vector-widening-legalization.

On 64-bit targets the type legalizer will use i64 to legalize these. But when i64 isn't legal, the type legalizer won't try an FP type. So do it manually instead.

There are a few regressions in here due to some v2i32 operations like mul and div now being reassembled into a full vector just to store instead of storing the pieces. But this was already occuring in 64-bit mode so its not a new issue.

llvm-svn: 346908

5 years ago[codeview] Make "clang -g" emit codeview by default when targetting MSVC
Reid Kleckner [Wed, 14 Nov 2018 22:59:27 +0000 (22:59 +0000)]
[codeview] Make "clang -g" emit codeview by default when targetting MSVC

Summary:
If you're using the Microsoft ABI, chances are that you want PDBs and
codeview debug info. Currently, everyone has to remember to specific
-gcodeview by default, when it would be nice if the standard -g option
did the right thing by default.

Also, do some related cleanup of -cc1 options. When targetting the MS
C++ ABI, we probably shouldn't pass -debugger-tuning=gdb. We were also
passing -gcodeview twice, which is silly.

Reviewers: smeenai, zturner

Subscribers: aprantl, JDevlieghere, llvm-commits

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

llvm-svn: 346907

5 years agoRemove the expectedFlakeyDsym decorator. It's not useful anymore.
Adrian Prantl [Wed, 14 Nov 2018 22:54:43 +0000 (22:54 +0000)]
Remove the expectedFlakeyDsym decorator. It's not useful anymore.

llvm-svn: 346906

5 years agoAttempt to show progress bar in benchmark tests
Eric Fiselier [Wed, 14 Nov 2018 22:49:42 +0000 (22:49 +0000)]
Attempt to show progress bar in benchmark tests

llvm-svn: 346905

5 years agoExclude check-cxx-benchmarks from the global test target.
Eric Fiselier [Wed, 14 Nov 2018 22:48:43 +0000 (22:48 +0000)]
Exclude check-cxx-benchmarks from the global  test target.

llvm-svn: 346904

5 years ago[X86] Update masked expandload/compressstore test names
Simon Pilgrim [Wed, 14 Nov 2018 22:44:08 +0000 (22:44 +0000)]
[X86] Update masked expandload/compressstore test names

llvm-svn: 346903

5 years ago[InstSimplify] add more tests for funnel shift with select; NFC
Sanjay Patel [Wed, 14 Nov 2018 22:34:25 +0000 (22:34 +0000)]
[InstSimplify] add more tests for funnel shift with select; NFC

The cases are just different enough that we should have
complete tests to avoid bugs from typos in the code.

llvm-svn: 346902

5 years ago[MachineOutliner][NFC] Don't compute liveness if X16/X17/NZCV are unused
Jessica Paquette [Wed, 14 Nov 2018 22:23:38 +0000 (22:23 +0000)]
[MachineOutliner][NFC] Don't compute liveness if X16/X17/NZCV are unused

Using the MBB flags, we can tell if X16/X17/NZCV are unused in a block,
and also not live out.

If this holds for all MBBs, then we can avoid checking for liveness on
that candidate. Furthermore, if it holds for an individual candidate's
MBB, then we can avoid checking for liveness on that candidate.

llvm-svn: 346901

5 years agoupdate xcode project file for reproducers.
Jason Molenda [Wed, 14 Nov 2018 22:14:07 +0000 (22:14 +0000)]
update xcode project file for reproducers.

llvm-svn: 346900

5 years agoRemove unused getMDNodeFwdRefOrNull interfaces (NFC)
Teresa Johnson [Wed, 14 Nov 2018 21:57:51 +0000 (21:57 +0000)]
Remove unused getMDNodeFwdRefOrNull interfaces (NFC)

Summary:
Followup from D53596/r346891. Remove the getMDNodeFwdRefOrNull interface
to the MDLoader since it is no longer used. Also improve error messages
when the internal implementation is used within the MDLoader.

Reviewers: steven_wu

Subscribers: llvm-commits

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

llvm-svn: 346899

5 years ago[X86][SSE] Add SSE2/SSE42 masked load/store tests
Simon Pilgrim [Wed, 14 Nov 2018 21:31:50 +0000 (21:31 +0000)]
[X86][SSE] Add SSE2/SSE42 masked load/store tests

Now that the load/store tests are split the impact of running the tests on multiple (illegal) targets is a lot less impactful

llvm-svn: 346896

5 years agoBias physical register immediate assignments
Nirav Dave [Wed, 14 Nov 2018 21:11:53 +0000 (21:11 +0000)]
Bias physical register immediate assignments

The machine scheduler currently biases register copies to/from
physical registers to be closer to their point of use / def to
minimize their live ranges. This change extends this to also physical
register assignments from immediate values.

This causes a reduction in reduction in overall register pressure and
minor reduction in spills and indirectly fixes an out-of-registers
assertion (PR39391).

Most test changes are from minor instruction reorderings and register
name selection changes and direct consequences of that.

Reviewers: MatzeB, qcolombet, myatsina, pcc

Subscribers: nemanjai, jvesely, nhaehnle, eraman, hiraditya,
  javed.absar, arphaman, jfb, jsji, llvm-commits

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

llvm-svn: 346894

5 years ago[ELF] Make TrapInstr and Filler byte arrays. NFC.
Simon Atanasyan [Wed, 14 Nov 2018 21:05:20 +0000 (21:05 +0000)]
[ELF] Make TrapInstr and Filler byte arrays. NFC.

The uint32_t type does not clearly convey that these fields are interpreted
in the target endianness. Converting them to byte arrays should make this
more obvious and less error-prone.

Patch by James Clarke

Differential Revision: http://reviews.llvm.org/D54207

llvm-svn: 346893

5 years ago[c++20] Implement P0482R6: enable -fchar8_t by default in C++20 mode.
Richard Smith [Wed, 14 Nov 2018 21:04:34 +0000 (21:04 +0000)]
[c++20] Implement P0482R6: enable -fchar8_t by default in C++20 mode.

This unfortunately results in a substantial breaking change when
switching to C++20, but it's not yet clear what / how much we should
do about that. We may want to add a compatibility conversion from
u8 string literals to const char*, similar to how C++98 provided a
compatibility conversion from string literals to non-const char*,
but that's not handled by this patch.

The feature can be disabled in C++20 mode with -fno-char8_t.

llvm-svn: 346892

5 years ago[ThinLTO] Fix a crash in lazy loading of Metadata
Teresa Johnson [Wed, 14 Nov 2018 20:58:04 +0000 (20:58 +0000)]
[ThinLTO] Fix a crash in lazy loading of Metadata

This is a revised version of D41474.

When the debug location is parsed in BitcodeReader::parseFunction, the
scope and inlinedAt MDNodes are obtained via MDLoader->getMDNodeFwdRefOrNull(),
which will create a forward ref if they were not yet loaded.
Specifically, if one of these MDNodes is in the module level metadata
block, and this is during ThinLTO importing, that metadata block is
lazily loaded.

Most places in that invoke getMDNodeFwdRefOrNull have a corresponding call
to resolveForwardRefsAndPlaceholders which will take care of resolving them.
E.g. places that call getMetadataFwdRefOrLoad, or at the end of parsing a
function-level metadata block, or at the end of the initial lazy load of
module level metadata in order to handle invocations of getMDNodeFwdRefOrNull
for named metadata and global object attachments. However, the calls for
the scope/inlinedAt of debug locations are not backed by any such call to
resolveForwardRefsAndPlaceholders.

To fix this, change the scope and inlinedAt parsing to instead use
getMetadataFwdRefOrLoad, which will ensure the forward refs to lazily
loaded metadata are resolved.

Fixes PR35472.

llvm-svn: 346891

5 years ago[X86] Split masked load/store test files
Simon Pilgrim [Wed, 14 Nov 2018 20:44:59 +0000 (20:44 +0000)]
[X86] Split masked load/store test files

llvm-svn: 346889

5 years agoRename cxx-benchmark-unittests target and convert to LIT.
Eric Fiselier [Wed, 14 Nov 2018 20:38:46 +0000 (20:38 +0000)]
Rename cxx-benchmark-unittests target and convert to LIT.

This patch renames the cxx-benchmark-unittests to check-cxx-benchmarks
and converts the target to use LIT in order to make the tests run faster
and provide better output.

In particular this runs each benchmark in a suite one by one, allowing
more parallelism while ensuring output isn't garbage with multiple threads.

Additionally, it adds the CMake flag '-DLIBCXX_BENCHMARK_TEST_ARGS=<list>'
to specify what options are passed when running the benchmarks.

llvm-svn: 346888

5 years ago[X86] Update masked load/store test names
Simon Pilgrim [Wed, 14 Nov 2018 20:25:50 +0000 (20:25 +0000)]
[X86] Update masked load/store test names

llvm-svn: 346887

5 years agoAMDGPU: Additional pattern for i16 median3 matching
Aakanksha Patil [Wed, 14 Nov 2018 20:10:41 +0000 (20:10 +0000)]
AMDGPU: Additional pattern for i16 median3 matching

min(max(a, b), max(min(a, b), c))

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

llvm-svn: 346886

5 years agoMark @llvm.trap cold
Vedant Kumar [Wed, 14 Nov 2018 19:53:41 +0000 (19:53 +0000)]
Mark @llvm.trap cold

A call to @llvm.trap can be expected to be cold (i.e. unlikely to be
reached in a normal program execution).

Outlining paths which unconditionally trap is an important memory
saving. As the hot/cold splitting pass (imho) should not treat all
noreturn calls as cold, explicitly mark @llvm.trap cold so that it can
be outlined.

Split out of https://reviews.llvm.org/D54244.

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

llvm-svn: 346885

5 years ago[Support] Teach YAMLIO about polymorphic types
Scott Linder [Wed, 14 Nov 2018 19:39:59 +0000 (19:39 +0000)]
[Support] Teach YAMLIO about polymorphic types

Add support for "polymorphic" types to YAMLIO.

PolymorphicTraits can dynamically switch between other traits (Scalar, Map, or
Sequence). When inputting, the PolymorphicTraits type is told which type to
become, and when outputting the PolymorphicTraits type is asked which type it
currently is.

Also add support for TaggedScalarTraits to allow dynamically differentiating
between multiple scalar types using YAML tags.

Serialize empty maps as "{}" and empty sequences as "[]", so that types
are preserved when round-tripping PolymorphicTraits. This change has
equivalent semantics, but may break e.g. tests which compare output
verbatim.

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

llvm-svn: 346884

5 years ago[ThinLTO] Update handling of vararg functions to match inliner
Teresa Johnson [Wed, 14 Nov 2018 19:30:13 +0000 (19:30 +0000)]
[ThinLTO] Update handling of vararg functions to match inliner

Summary:
Previously we marked all vararg functions as non-inlinable in the
function summary, which prevented their importing. However, the
corresponding inliner restriction was loosened in r321940/r342675
to only apply to functions calling va_start. Adjust the summary
flag computation to match.

Reviewers: davidxl

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits

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

llvm-svn: 346883

5 years ago[AST] Fix typo in MicrosoftMangle
Shoaib Meenai [Wed, 14 Nov 2018 19:16:22 +0000 (19:16 +0000)]
[AST] Fix typo in MicrosoftMangle

Correct the spelling from Artifical to Artificial.

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

llvm-svn: 346882

5 years ago[InstSimplify] add tests for funnel shift with select; NFC
Sanjay Patel [Wed, 14 Nov 2018 19:12:54 +0000 (19:12 +0000)]
[InstSimplify] add tests for funnel shift with select; NFC

llvm-svn: 346881

5 years ago[WebAssembly] Add support for dylink section in object format
Sam Clegg [Wed, 14 Nov 2018 18:36:24 +0000 (18:36 +0000)]
[WebAssembly] Add support for dylink section in object format

See https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md.

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

llvm-svn: 346880

5 years ago[X86] Allow pmulh to be formed from narrow vXi16 vectors under -x86-experimental...
Craig Topper [Wed, 14 Nov 2018 18:16:21 +0000 (18:16 +0000)]
[X86] Allow pmulh to be formed from narrow vXi16 vectors under -x86-experimental-vector-widening-legalization

Narrower vectors will be widened to 128 bits without changing the element size. And generic type legalization can already handle widening mulhu/mulhs.

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

llvm-svn: 346879

5 years ago[libcxx] [test] Fix running tests on macOS with python3
Alexander Richardson [Wed, 14 Nov 2018 17:58:55 +0000 (17:58 +0000)]
[libcxx] [test] Fix running tests on macOS with python3

Summary:
The result of subprocess.check_output() is bytes in python3 which we need
to convert to str(). Simplify this by using the executeCommand() helper.

Reviewers: ldionne, EricWF

Reviewed By: ldionne

Subscribers: christof, libcxx-commits

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

llvm-svn: 346878

5 years ago[PPC64] Long branch thunks.
Sean Fertile [Wed, 14 Nov 2018 17:56:43 +0000 (17:56 +0000)]
[PPC64] Long branch thunks.

On PowerPC64, when a function call offset is too large to encode in a call
instruction the address is stored in a table in the data segment. A thunk is
used to load the branch target address from the table relative to the
TOC-pointer and indirectly branch to the callee. When linking position-dependent
code the addresses are stored directly in the table, for position-independent
code the table is allocated and filled in at load time by the dynamic linker.

For position-independent code the branch targets could have gone in the .got.plt
but using the .branch_lt section for both position dependent and position
independent binaries keeps it consitent and helps keep this PPC64 specific logic
seperated from the target-independent code handling the .got.plt.

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

llvm-svn: 346877

5 years ago[NFC] Change address __tls_getaddr is defined at so it does not need a thunk.
Sean Fertile [Wed, 14 Nov 2018 17:56:38 +0000 (17:56 +0000)]
[NFC] Change address __tls_getaddr is defined at so it does not need a thunk.

Minor update to a ppc64 tls test so that it won't need to use a thunk once the
range-extending thunk patch is landed.

llvm-svn: 346876

5 years ago[InstCombine] Remove a couple of asserts based on incorrect assumptions
Mandeep Singh Grang [Wed, 14 Nov 2018 17:55:07 +0000 (17:55 +0000)]
[InstCombine] Remove a couple of asserts based on incorrect assumptions

Summary:
These asserts are based on the assumption that the order of true/false operands in a select and those in the compare would always be the same.
This fixes PR39595.

Reviewers: craig.topper, spatel, dmgreen

Reviewed By: craig.topper

Subscribers: llvm-commits

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

llvm-svn: 346874

5 years agoFix some compilation failures introduced in recent patches.
Zachary Turner [Wed, 14 Nov 2018 17:22:09 +0000 (17:22 +0000)]
Fix some compilation failures introduced in recent patches.

This fixes two compilation failures:

  1) Designated initializers are C++20.  We can't use them in LLVM.
  2) thread_result_t is not a pointer type on all platforms, so
     returning nullptr is an error.

llvm-svn: 346873

5 years ago[clangd] Delete unused includes.
Kadir Cetinkaya [Wed, 14 Nov 2018 17:07:39 +0000 (17:07 +0000)]
[clangd] Delete unused includes.

llvm-svn: 346872

5 years ago[InstCombine] fix formatting for matchBSwap(); NFC
Sanjay Patel [Wed, 14 Nov 2018 16:03:36 +0000 (16:03 +0000)]
[InstCombine] fix formatting for matchBSwap(); NFC

We should have a similar function for matching rotate and/or
funnel shift, so tidy up the related existing call.

llvm-svn: 346871

5 years ago[VPlan, SLP] Use SmallPtrSet for Candidates.
Florian Hahn [Wed, 14 Nov 2018 15:58:40 +0000 (15:58 +0000)]
[VPlan, SLP] Use SmallPtrSet for Candidates.

This slightly improves the candidate handling in getBest().

llvm-svn: 346870

5 years ago[SimplifyCFG] Regenerate preserve-branchweights.ll test. NFC
John Brawn [Wed, 14 Nov 2018 15:27:07 +0000 (15:27 +0000)]
[SimplifyCFG] Regenerate preserve-branchweights.ll test. NFC

Regenerate this test using update_test_checks.py in preparation for an
upcomming commit, to make it not depend on the names of instructions.

llvm-svn: 346869

5 years ago[TTI] getOperandInfo - a broadcast shuffle means the result is OK_UniformValue
Simon Pilgrim [Wed, 14 Nov 2018 15:04:08 +0000 (15:04 +0000)]
[TTI] getOperandInfo - a broadcast shuffle means the result is OK_UniformValue

llvm-svn: 346868