platform/upstream/llvm.git
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

5 years ago[CUDA] updated CompileCudaWithLLVM.rst
Artem Belevich [Fri, 16 Nov 2018 01:02:43 +0000 (01:02 +0000)]
[CUDA] updated CompileCudaWithLLVM.rst

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

llvm-svn: 347007

5 years ago[analyzer] ConversionChecker: handle floating point
Kristof Umann [Fri, 16 Nov 2018 01:00:55 +0000 (01:00 +0000)]
[analyzer] ConversionChecker: handle floating point

Extend the alpha.core.Conversion checker to handle implicit converions
where a too large integer value is converted to a floating point type. Each
floating point type has a range where it can exactly represent all integers; we
emit a warning when the integer value is above this range. Although it is
possible to exactly represent some integers which are outside of this range
(those that are divisible by a large enough power of 2); we still report cast
involving those, because their usage may lead to bugs. (For example, if 1<<24
is stored in a float variable x, then x==x+1 holds.)

Patch by: Donát Nagy!

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

llvm-svn: 347006

5 years ago[WebAssembly] Change type of wake count to unsigned int
Heejin Ahn [Fri, 16 Nov 2018 00:48:58 +0000 (00:48 +0000)]
[WebAssembly] Change type of wake count to unsigned int

Summary:
We discussed this at the Nov 12th CG meeting, and decided to use the
unsigned semantics for the wake count.
Corresponding spec change:
https://github.com/WebAssembly/threads/pull/110

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, sunfish, jfb, cfe-commits

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

llvm-svn: 347005

5 years agoRe-apply r346985: [ADT] Drop llvm::Optional clang-specific optimization for trivially...
Tom Stellard [Fri, 16 Nov 2018 00:47:24 +0000 (00:47 +0000)]
Re-apply r346985: [ADT] Drop llvm::Optional clang-specific optimization for trivially copyable types

Remove a test case that was added with the optimization we are now
removing.

llvm-svn: 347004

5 years ago[WebAssembly] Split BBs after throw instructions
Heejin Ahn [Fri, 16 Nov 2018 00:47:18 +0000 (00:47 +0000)]
[WebAssembly] Split BBs after throw instructions

Summary:
`throw` instruction is a terminator in wasm, but BBs were not splitted
after `throw` instructions, causing machine instruction verifier to
fail.

This patch
- Splits BBs after `throw` instructions in WasmEHPrepare and adding an
  unreachable instruction after `throw`, which will be deleted in
  LateEHPrepare pass
- Refactors WasmEHPrepare into two member functions
- Changes the semantics of `eraseBBsAndChildren` in LateEHPrepare pass
  to match that of WasmEHPrepare pass, which is newly added. Now
  `eraseBBsAndChildren` does not delete BBs with remaining predecessors.
- Fixes style nits, making static function names conform to clang-tidy
- Re-enables the test temporarily disabled by rL346840 && rL346845

Reviewers: dschuff

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

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

llvm-svn: 347003

5 years ago[AMDGPU] NFC Test commit
Ron Lieberman [Fri, 16 Nov 2018 00:46:51 +0000 (00:46 +0000)]
[AMDGPU] NFC Test commit

llvm-svn: 347002

5 years agoAMDHSA: More code object v3 fixes:
Konstantin Zhuravlyov [Thu, 15 Nov 2018 23:14:23 +0000 (23:14 +0000)]
AMDHSA: More code object v3 fixes:

  - Make sure IsaInfo::hasCodeObjectV3 returns true only
    for AMDHSA
  - Update assembler metadata tests to use v2 by default

llvm-svn: 347001

5 years ago[clang-tidy] Fix reference to -[NSError init] in AvoidNSErrorInitCheck.h
Stephane Moore [Thu, 15 Nov 2018 22:38:39 +0000 (22:38 +0000)]
[clang-tidy] Fix reference to -[NSError init] in AvoidNSErrorInitCheck.h

llvm-svn: 347000

5 years agoFix compilation failure in unit tests on Windows.
Zachary Turner [Thu, 15 Nov 2018 22:03:49 +0000 (22:03 +0000)]
Fix compilation failure in unit tests on Windows.

llvm-svn: 346999

5 years agoRemove myself as owner of clang-query.
Peter Collingbourne [Thu, 15 Nov 2018 22:02:10 +0000 (22:02 +0000)]
Remove myself as owner of clang-query.

I haven't been involved with the project for years, so it's probably
best for someone else to be the code owner.

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

llvm-svn: 346998

5 years ago[CMake] Explicitly list Linux targets for Fuchsia toolchain
Petr Hosek [Thu, 15 Nov 2018 21:55:59 +0000 (21:55 +0000)]
[CMake] Explicitly list Linux targets for Fuchsia toolchain

Not all Linux targets use the ${arch}-linux-gnu spelling, so instead
specify the list of Linux explicitly.

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

llvm-svn: 346997

5 years agoFix parens warning in assert in ASTMatchFinder
Erich Keane [Thu, 15 Nov 2018 21:35:35 +0000 (21:35 +0000)]
Fix parens warning in assert in ASTMatchFinder

Change-Id: Ie34f9c6846b98fba87449e73299519fc2346bac1
llvm-svn: 346996

5 years ago[X86] Remove ANY_EXTEND special case from canReduceVMulWidth
Craig Topper [Thu, 15 Nov 2018 21:19:32 +0000 (21:19 +0000)]
[X86] Remove ANY_EXTEND special case from canReduceVMulWidth

Removing this code doesn't affect any lit tests so it doesn't appear to be tested anymore. I assume it was when it was added, but I guess something else changed? Code coverage report also says its unused.

I mostly didn't like that it seemed to count the sign bits as if it was a sign_extend, but then set isPositive as if it was a zero_extend. It feels like we should have picked one interpretation?

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

llvm-svn: 346995

5 years agoImplement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD
Nathan Lanza [Thu, 15 Nov 2018 20:58:09 +0000 (20:58 +0000)]
Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD

Summary:
This commit implements basic DidAttach and DidLaunch for the windows
DynamicLoader plugin which allow us to load shared libraries from the
inferior.

Reviewers: sas, zturner

Reviewed By: zturner

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

llvm-svn: 346994

5 years agoForce SHELL to be cmd.exe on Windows for the test suite
Nathan Lanza [Thu, 15 Nov 2018 20:56:44 +0000 (20:56 +0000)]
Force SHELL to be cmd.exe on Windows for the test suite

Summary:
Windows make will search for other shells and choose those over cmd
if available (e.g. C:\cygdrive\bin\sh.exe). This shell has numerous
issues with path handling (/ vs \\ vs \ and C:). So default to using
cmd.exe which is known to work.

Reviewers: zturner, sas, xiaobai

Reviewed By: zturner

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

llvm-svn: 346993

5 years ago[AMDGPU] Update code object metadata format documentation
Scott Linder [Thu, 15 Nov 2018 20:46:55 +0000 (20:46 +0000)]
[AMDGPU] Update code object metadata format documentation

* Add amdhsa prefix to names to allow other tools to use the metadata
  without collision.
* Make names consistent.
* Simplify structure.
* Change note record ID.
* Switch from YAML to MsgPack format.
* Document metadata assembler directive.

Patch By: t-tye (Tony Tye)
Differential Revision: https://reviews.llvm.org/D53445

llvm-svn: 346992

5 years agoA unit test file moved.
Jason Molenda [Thu, 15 Nov 2018 20:28:55 +0000 (20:28 +0000)]
A unit test file moved.

llvm-svn: 346991

5 years agoRevert "[ADT] Drop llvm::Optional clang-specific optmization for trivially copyable...
Tom Stellard [Thu, 15 Nov 2018 20:27:11 +0000 (20:27 +0000)]
Revert "[ADT] Drop llvm::Optional clang-specific optmization for trivially copyable types"

This reverts commit r346985.

It looks like one of the unittests also needs to be updated, reverting while I investigate.

llvm-svn: 346990

5 years agoDisable filesystem benchmark when libstdc++ doesn't support it
Eric Fiselier [Thu, 15 Nov 2018 19:53:43 +0000 (19:53 +0000)]
Disable filesystem benchmark when libstdc++ doesn't support it

llvm-svn: 346989

5 years agoAdd a check whether or not a str is utf8 prior to emplacing
Nathan Lanza [Thu, 15 Nov 2018 19:49:57 +0000 (19:49 +0000)]
Add a check whether or not a str is utf8 prior to emplacing

Summary:
Highlighing junk data on VSCode can send a query for evaluate which
fails. In particular cases on Windows, this the error message can end
up as a c-string of [-35,-35,-35,-35,...]. Attempting to emplace this
as the error message causes an assert failure.

Prior to emplacing the error message, confirm that it is valid UTF8 to
eliminate errors such as mentione above.

Reviewers: xiaobai, clayborg

Reviewed By: clayborg

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

llvm-svn: 346988

5 years ago[ADT] Drop llvm::Optional clang-specific optmization for trivially copyable types
Tom Stellard [Thu, 15 Nov 2018 19:32:24 +0000 (19:32 +0000)]
[ADT] Drop llvm::Optional clang-specific optmization for trivially copyable types

Summary:
This fixes libLLVM.so ABI mismatches between llvm compiled with clang
and llvm compiled with gcc (PR39427).

Reviewers: bkramer, sylvestre.ledru, mgorny, hans

Reviewed By: bkramer, hans

Subscribers: dexonsmith, kristina, llvm-commits

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

llvm-svn: 346985

5 years agoUpgrade Google Benchmark library to ToT
Eric Fiselier [Thu, 15 Nov 2018 19:22:53 +0000 (19:22 +0000)]
Upgrade Google Benchmark library to ToT

llvm-svn: 346984

5 years ago[X86] Minor cleanup to getExtendInVec. NFCI
Craig Topper [Thu, 15 Nov 2018 19:20:22 +0000 (19:20 +0000)]
[X86] Minor cleanup to getExtendInVec. NFCI

Use unsigned to calculate the subvector index to avoid a cast.

Remove an unnecessary condition and replace it with a stronger assert.

Use the InVT variable we updated when we extracted instead of grabbing it from the In SDValue.

llvm-svn: 346983

5 years ago[InstCombine] adjust rotate direction in tests; NFC
Sanjay Patel [Thu, 15 Nov 2018 19:15:41 +0000 (19:15 +0000)]
[InstCombine] adjust rotate direction in tests; NFC

Copy/paste errors - all of the changed tests rotated left before.

llvm-svn: 346982

5 years agoPort the Darwin universal binary testcase to x86_64.
Adrian Prantl [Thu, 15 Nov 2018 19:15:03 +0000 (19:15 +0000)]
Port the Darwin universal binary testcase to x86_64.

Xcode 10 doesn't ship with an i386 SDK any more. This patch ports the
testcase from an i386/x86_64 -> x86_64/x86_64h universal binary.

rdar://problem/46099343

llvm-svn: 346981

5 years ago[X86] Add -x86-experimental-vector-widening support to reduceVMULWidth and combineMul...
Craig Topper [Thu, 15 Nov 2018 18:59:31 +0000 (18:59 +0000)]
[X86] Add -x86-experimental-vector-widening support to reduceVMULWidth and combineMulToPMADDWD

In reduceVMULWidth, we no longer need to worry about extending the vector to 128 bits first. Regular widening of extends, muls and shuffles will take care of that for us.

In combineMulToPMADDWD, we can handle v2i32 multiplies and allow the VPMADDWD to be widened to v4i32 during type legalization by adding custom widening like we do have for AVG/ADDUS/SUBUS. I had to modify that code a little to allow different and output VTs.

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

llvm-svn: 346980

5 years ago[WebAssembly] Fix return type of nextByte
Thomas Lively [Thu, 15 Nov 2018 18:56:49 +0000 (18:56 +0000)]
[WebAssembly] Fix return type of nextByte

Summary:
The old return type did not allow for correct error reporting and was
causing a compiler warning.

Reviewers: aheejin

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

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

llvm-svn: 346979

5 years ago[BinaryFormat] Add MsgPackTypes
Scott Linder [Thu, 15 Nov 2018 18:50:01 +0000 (18:50 +0000)]
[BinaryFormat] Add MsgPackTypes

Add data structure to represent MessagePack "documents" and convert
to/from both MessagePack and YAML encodings.

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

llvm-svn: 346978

5 years ago[InstCombine] add tests for funnel shift (rotate) canonicalization; NFC
Sanjay Patel [Thu, 15 Nov 2018 18:19:56 +0000 (18:19 +0000)]
[InstCombine] add tests for funnel shift (rotate) canonicalization; NFC

llvm-svn: 346975

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