platform/upstream/llvm.git
5 years agoWrite new tests for r362121
Michael Trent [Thu, 30 May 2019 20:09:09 +0000 (20:09 +0000)]
Write new tests for r362121

Summary:
The tests for r362121 ran dsymutil against a test binary every time.
This caused problems on lld-x86_64-ubuntu-fast as dsymutil required
a lipo tool be available to process those binaries.

This change rewrites the new test cases in macho-disassemble-g-dsym
to use bespoke test binaries (exe and dwarf) simplifying the test's
runtime dependencies.

The changes to tools/llvm-objdump/MachODump.cpp are unchanged from
r362121

Reviewers: pete, lhames, JDevlieghere

Reviewed By: pete

Subscribers: smeenai, aprantl, rupprecht, llvm-commits

Tags: #llvm

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

llvm-svn: 362141

5 years agoMark test as requiring an ARM target.
Douglas Yung [Thu, 30 May 2019 20:02:51 +0000 (20:02 +0000)]
Mark test as requiring an ARM target.

llvm-svn: 362140

5 years ago[RuntimeDyld] Apply padding and alignment bumps to all sections with stubs, and
Lang Hames [Thu, 30 May 2019 19:59:20 +0000 (19:59 +0000)]
[RuntimeDyld] Apply padding and alignment bumps to all sections with stubs, and
increase the MachO/x86-64 stub alignment to 8.

Stub alignment should be guaranteed for any section containing RuntimeDyld
stubs/GOT-entries. To do this we should pad and align all sections containing
stubs, not just code sections.

This commit also bumps the MachO/x86-64 stub alignment to 8, so that GOT entries
will be aligned.

llvm-svn: 362139

5 years ago[GWP-ASan] Mutex implementation [2].
Mitch Phillips [Thu, 30 May 2019 19:45:32 +0000 (19:45 +0000)]
[GWP-ASan] Mutex implementation [2].

Summary:
See D60593 for further information.
This patch pulls out the mutex implementation and the required definitions file.

We implement our own mutex for GWP-ASan currently, because:

1. We must be compatible with the sum of the most restrictive elements of the supporting allocator's build system. Current targets for GWP-ASan include Scudo (on Linux and Fuchsia), and bionic (on Android).
2. Scudo specifies `-nostdlib++ -nonodefaultlibs`, meaning we can't use `std::mutex` or `mtx_t`.
3. We can't use `sanitizer_common`'s mutex, as the supporting allocators cannot afford the extra maintenance (Android, Fuchsia) and code size (Fuchsia) overheads that this would incur.

In future, we would like to implement a shared base mutex for GWP-ASan, Scudo and sanitizer_common. This will likely happen when both GWP-ASan and Scudo standalone are not in the development phase, at which point they will have stable requirements.

Reviewers: vlad.tsyrklevich, morehouse, jfb

Reviewed By: morehouse

Subscribers: dexonsmith, srhines, cfe-commits, kubamracek, mgorny, cryptoad, jfb, #sanitizers, llvm-commits, vitalybuka, eugenis

Tags: #sanitizers, #llvm, #clang

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

llvm-svn: 362138

5 years ago[NFC][InstCombine] Add unary FNeg tests to fmul.ll
Cameron McInally [Thu, 30 May 2019 19:42:25 +0000 (19:42 +0000)]
[NFC][InstCombine] Add unary FNeg tests to fmul.ll

llvm-svn: 362137

5 years agoAMDGPU/GlobalISel: Add wave scratch offset argument
Matt Arsenault [Thu, 30 May 2019 19:33:18 +0000 (19:33 +0000)]
AMDGPU/GlobalISel: Add wave scratch offset argument

Avoids crashing in PEI in a future change.

llvm-svn: 362136

5 years ago[DAGCombine] ((c1-A)-c2) -> ((c1-c2)-A) constant-fold
Roman Lebedev [Thu, 30 May 2019 19:27:51 +0000 (19:27 +0000)]
[DAGCombine] ((c1-A)-c2) -> ((c1-c2)-A)  constant-fold

Summary: https://rise4fun.com/Alive/B0A

Reviewers: t.p.northover, RKSimon, spatel, craig.topper

Reviewed By: RKSimon

Subscribers: javed.absar, llvm-commits

Tags: #llvm

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

llvm-svn: 362135

5 years ago[DAGCombine] (A-C1)-C2 -> A-(C1+C2) constant-fold
Roman Lebedev [Thu, 30 May 2019 19:27:42 +0000 (19:27 +0000)]
[DAGCombine] (A-C1)-C2 -> A-(C1+C2) constant-fold

Summary: https://rise4fun.com/Alive/Mb1M

Reviewers: RKSimon, craig.topper, spatel, t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, javed.absar, llvm-commits

Tags: #llvm

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

llvm-svn: 362134

5 years ago[DAGCombine] (A+C1)-C2 -> A+(C1-C2) constant-fold
Roman Lebedev [Thu, 30 May 2019 19:27:32 +0000 (19:27 +0000)]
[DAGCombine] (A+C1)-C2 -> A+(C1-C2) constant-fold

Summary:
Direct sibling of D62662, the root cause of the endless combine loop in D62257

https://rise4fun.com/Alive/d3W

Reviewers: RKSimon, craig.topper, spatel, t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, javed.absar, llvm-commits

Tags: #llvm

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

llvm-svn: 362133

5 years ago[DAGCombine] Use FoldConstantArithmetic() to perform C2-(A+C1) -> (C2-C1)-A fold
Roman Lebedev [Thu, 30 May 2019 19:27:26 +0000 (19:27 +0000)]
[DAGCombine] Use FoldConstantArithmetic() to perform C2-(A+C1) -> (C2-C1)-A fold

Summary:
No tests change, and i'm not sure how to test this, but it's better safe than sorry.

Reviewers: spatel, RKSimon, craig.topper, t.p.northover

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 362132

5 years ago[DAGCombine] ((A-c1)+c2) -> (A+(c2-c1)) constant-fold
Roman Lebedev [Thu, 30 May 2019 19:27:19 +0000 (19:27 +0000)]
[DAGCombine] ((A-c1)+c2) -> (A+(c2-c1))  constant-fold

Summary:
This was the root cause of the endless combine loop in D62257

https://rise4fun.com/Alive/d3W

Reviewers: RKSimon, spatel, craig.topper, t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, javed.absar, llvm-commits

Tags: #llvm

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

llvm-svn: 362131

5 years ago[DAGCombine] Use FoldConstantArithmetic() to perform ((c1-A)+c2) -> (c1+c2)-A fold
Roman Lebedev [Thu, 30 May 2019 19:27:10 +0000 (19:27 +0000)]
[DAGCombine] Use FoldConstantArithmetic() to perform ((c1-A)+c2) -> (c1+c2)-A fold

Summary: No tests change, and i'm not sure how to test this, but it's better safe than sorry.

Reviewers: spatel, RKSimon, craig.topper, t.p.northover

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 362130

5 years agoReapply: LLVM IR: update Clang tests for byval being a typed attribute.
Tim Northover [Thu, 30 May 2019 18:49:19 +0000 (18:49 +0000)]
Reapply: LLVM IR: update Clang tests for byval being a typed attribute.

Since byval is now a typed attribute it gets sorted slightly differently by
LLVM when the order of attributes is being canonicalized. This updates the few
Clang tests that depend on the old order.

Clang patch is unchanged.

llvm-svn: 362129

5 years agoReapply: IR: add optional type to 'byval' function parameters
Tim Northover [Thu, 30 May 2019 18:48:23 +0000 (18:48 +0000)]
Reapply: IR: add optional type to 'byval' function parameters

When we switch to opaque pointer types we will need some way to describe
how many bytes a 'byval' parameter should occupy on the stack. This adds
a (for now) optional extra type parameter.

If present, the type must match the pointee type of the argument.

The original commit did not remap byval types when linking modules, which broke
LTO. This version fixes that.

Note to front-end maintainers: if this causes test failures, it's probably
because the "byval" attribute is printed after attributes without any parameter
after this change.

llvm-svn: 362128

5 years ago[AMDGPU] Added target-specific attribute amdgpu-max-memory-clause
Tim Renouf [Thu, 30 May 2019 18:46:34 +0000 (18:46 +0000)]
[AMDGPU] Added target-specific attribute amdgpu-max-memory-clause

With LLPC, previous investigation has suggested that si-scheduler
interacts badly with SiFormMemoryClauses on an XNACK target in some
games.

That needs further investigation in the future. In the meantime, this
commit adds a target-specific attribute to allow us to disable
SIFormMemoryClauses by setting it to 1 on a per-function basis for LLPC
to use.

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

Change-Id: Ia0ca12ce79093cbbe86caded723ffb13384ede92
llvm-svn: 362127

5 years ago[LV] Remove the redundant using LoopVectorizationPlanner:VPlanPtr
Florian Hahn [Thu, 30 May 2019 18:46:13 +0000 (18:46 +0000)]
[LV] Remove the redundant using LoopVectorizationPlanner:VPlanPtr

VPlan.h already contains the declaration of VPlanPtr type alias:

using VPlanPtr = std::unique_ptr<VPlan>;

The LoopVectorizationPlanner class also contains the same declaration
of VPlanPtr and therefore LoopVectorize requires a long wording when
its methods return VPlanPtr:

    LoopVectorizationPlanner::VPlanPtr
    LoopVectorizationPlanner::buildVPlanWithVPRecipes(...)

but LoopVectorize.cpp includes VPlan.h (via LoopVectorizationPlanner.h)
and can use VPlanPtr from that header.

Patch by Pavel Samolysov.

Reviewers: hsaito, rengolin, fhahn

Reviewed By: fhahn

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

llvm-svn: 362126

5 years agoFix OMP_TARGET_OFFLOAD parsing
Hansang Bae [Thu, 30 May 2019 18:35:07 +0000 (18:35 +0000)]
Fix OMP_TARGET_OFFLOAD parsing

Current parsing allows trailing string after the permitted value,
MANDATORY|DISABLED|DEFAULT -- e.g., "mandatorynot" is also recognized
as "MANDATORY". Such cases should be recognized as incorrect/unknown
value.

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

llvm-svn: 362125

5 years ago[LoopVectorize] Add FNeg instruction support
Craig Topper [Thu, 30 May 2019 18:19:35 +0000 (18:19 +0000)]
[LoopVectorize] Add FNeg instruction support

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

llvm-svn: 362124

5 years agoReverting change r362121 due to lld-x86_64-ubuntu-fast test failures
Michael Trent [Thu, 30 May 2019 18:17:10 +0000 (18:17 +0000)]
Reverting change r362121 due to lld-x86_64-ubuntu-fast test failures

llvm-svn: 362123

5 years ago[MIR-Canon] Add support for rewriting VRegs that are typed but don't have an RC.
Puyan Lotfi [Thu, 30 May 2019 18:06:28 +0000 (18:06 +0000)]
[MIR-Canon] Add support for rewriting VRegs that are typed but don't have an RC.

There were crashes (addrspace-memoperands.mir was only one of them) in MIR that
had operands that came from before register classes were set. With these
operands, creating a replacement vreg (for MIR-Canon's renaming) needs to use
the vreg type rather than the RegisterClass which is not present.

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

llvm-svn: 362122

5 years agoSupport Universal dSYM files in llvm-objdump
Michael Trent [Thu, 30 May 2019 17:56:05 +0000 (17:56 +0000)]
Support Universal dSYM files in llvm-objdump

Summary:
Commonly programmers use llvm-objdump to disassemble Mach-O target
binaries with Mach-O dSYMS. While llvm-objdump allows programmers to
disassemble Universal binaries, it previously did not recognize
Universal dSYM files. This change updates llvm-objdump to support
passing in Universal files via the -dsym option. Now, when
disassembling a Mach-O file either as a stand alone file or as an entry
in a Universal binariy, llvm-objdump will search through a Universal
dSYM for a Mach-O matching the architecture flag of the file being
disassembled.

Reviewers: pete, lhames

Reviewed By: pete

Subscribers: rupprecht, llvm-commits

Tags: #llvm

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

llvm-svn: 362121

5 years ago[NFC] Fix SmallVector::append comments
Jan Korous [Thu, 30 May 2019 17:54:26 +0000 (17:54 +0000)]
[NFC] Fix SmallVector::append comments

Fix the copy-pasted comment.
Remove low-value comments.

llvm-svn: 362120

5 years agoAdd Attribute NoThrow as an Exception Specifier Type
Erich Keane [Thu, 30 May 2019 17:31:54 +0000 (17:31 +0000)]
Add Attribute NoThrow as an Exception Specifier Type

In response to https://bugs.llvm.org/show_bug.cgi?id=33235, it became
clear that the current mechanism of hacking through checks for the
exception specification of a function gets confused really quickly when
there are alternate exception specifiers.

This patch introcues EST_NoThrow, which is the equivilent of
EST_noexcept when caused by EST_noThrow. The existing implementation is
left in place to cover functions with no FunctionProtoType.

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

llvm-svn: 362119

5 years agoCorrect error in revert of r362112.
Kevin P. Neal [Thu, 30 May 2019 17:21:45 +0000 (17:21 +0000)]
Correct error in revert of r362112.

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

llvm-svn: 362118

5 years agoRevert r362112, it broke the bots with the message "Unsupported vector argument or...
Kevin P. Neal [Thu, 30 May 2019 17:10:21 +0000 (17:10 +0000)]
Revert r362112, it broke the bots with the message "Unsupported vector argument or return type"

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

llvm-svn: 362117

5 years agoCode and comment cleanups [NFC]
Greg Clayton [Thu, 30 May 2019 17:03:35 +0000 (17:03 +0000)]
Code and comment cleanups [NFC]

Changes:
- update comments to detail the info can come from .debug_info or .debug_types
- Rename "debug_info_data" to "data" now that we can get data from .debug_info or .debug_types.
- Also call DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(...) instead of manually grabbing abbreviation.

llvm-svn: 362116

5 years ago[libcxx] Add regex test cases from PR40904
Louis Dionne [Thu, 30 May 2019 16:53:05 +0000 (16:53 +0000)]
[libcxx] Add regex test cases from PR40904

llvm-svn: 362115

5 years ago[NFC][Codegen] Potential add/sub constant folding: fixup non-splat tests
Roman Lebedev [Thu, 30 May 2019 16:50:43 +0000 (16:50 +0000)]
[NFC][Codegen] Potential add/sub constant folding: fixup non-splat tests

llvm-svn: 362114

5 years ago[Docs] Modernize references to macOS
J. Ryan Stinnett [Thu, 30 May 2019 16:46:22 +0000 (16:46 +0000)]
[Docs] Modernize references to macOS

Summary:
This updates all places in documentation that refer to "Mac OS X", "OS X", etc.
to instead use the modern name "macOS" when no specific version number is
mentioned.

If a specific version is mentioned, this attempts to use the OS name at the time
of that version:

* Mac OS X for 10.0 - 10.7
* OS X for 10.8 - 10.11
* macOS for 10.12 - present

Reviewers: JDevlieghere

Subscribers: mgorny, christof, arphaman, cfe-commits, lldb-commits, libcxx-commits, llvm-commits

Tags: #clang, #lldb, #libc, #llvm

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

llvm-svn: 362113

5 years ago[FPEnv] Added a special UnrollVectorOp method to deal with the chain on StrictFP...
Kevin P. Neal [Thu, 30 May 2019 16:44:47 +0000 (16:44 +0000)]
[FPEnv] Added a special UnrollVectorOp method to deal with the chain on StrictFP opcodes

This change creates UnrollVectorOp_StrictFP. The purpose of this is to address a failure that consistently occurs when calling StrictFP functions on vectors whose number of elements is 3 + 2n on most platforms, such as PowerPC or SystemZ. The old UnrollVectorOp method does not expect that the vector that it will unroll will have a chain, so it has an assert that prevents it from running if this is the case. This new StrictFP version of the method deals with the chain while unrolling the vector. With this new function in place during vector widending, llc can run vector-constrained-fp-intrinsics.ll for SystemZ successfully.

Submitted by: Drew Wock <drew.wock@sas.com>
Reviewed by: Cameron McInally, Kevin P. Neal
Approved by: Cameron McInally
Differential Revision: http://reviews.llvm.org/D62546

llvm-svn: 362112

5 years agoAdd checks before pointer dereferencing
Hansang Bae [Thu, 30 May 2019 16:32:20 +0000 (16:32 +0000)]
Add checks before pointer dereferencing

This change adds checks before dereferencing a pointer returned from a
function.

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

llvm-svn: 362111

5 years ago[NFC][Codegen] Add better test coverage for potential add/sub constant folding
Roman Lebedev [Thu, 30 May 2019 16:07:19 +0000 (16:07 +0000)]
[NFC][Codegen] Add better test coverage for potential add/sub constant folding

This adds hopefully-full test coverage for all the possible permutations:
First op is one of:
* x + c1
* x - c1
* c1 - x

Second op is one of:
* + c2
* - c2
* c2 -

And thus 3*3=9 patterns.
Some of them show missed constant-folds.

Without previous patch (the revert), these tests were causing endless
dagcombine loop. I really should have thought about this first :S

llvm-svn: 362110

5 years ago[DAGCombine] Revert of recommit of "binop-with-const hoisting" patches
Roman Lebedev [Thu, 30 May 2019 16:07:11 +0000 (16:07 +0000)]
[DAGCombine] Revert of recommit of "binop-with-const hoisting" patches

I was looking into an endless combine loop the uncommitted follow-up patch
was causing, and it appears even these patches can exibit such an
endless loop. The root cause is that we try to hoist one binop (add/sub) with
constant operand, and if we get two such binops both of which are
eligible for this hoisting, we get stuck.

Some cases may highlight missing constant-folds.

Reverts r361871,r361872,r361873,r361874.

llvm-svn: 362109

5 years ago[ELF] Delete dead SHT_NOBITS->SHT_PROGBITS code after r358981
Fangrui Song [Thu, 30 May 2019 15:52:11 +0000 (15:52 +0000)]
[ELF] Delete dead SHT_NOBITS->SHT_PROGBITS code after r358981

After D60131/r358981, we no longer create SHT_NOBITS sections that may
contain ByteCommand (BYTE, SHORT, LONG, QUAD).

llvm-svn: 362108

5 years agoRemove length modifier when using assignment suppression in TimerTest
Antonio Afonso [Thu, 30 May 2019 15:38:05 +0000 (15:38 +0000)]
Remove length modifier when using assignment suppression in TimerTest

Summary:
This is useless and it's giving warnings in the build bots:
/home/motus/netbsd8/netbsd8/llvm/tools/lldb/unittests/Utility/TimerTest.cpp:67:43: warning: use of assignment suppression and length modifier together in gnu_scanf format [-Wformat=]

Reviewers: xiaobai

Subscribers: krytarowski, lldb-commits

Tags: #lldb

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

llvm-svn: 362107

5 years agoRevert "clang support gnu asm goto."
Erich Keane [Thu, 30 May 2019 15:38:02 +0000 (15:38 +0000)]
Revert "clang support gnu asm goto."

This reverts commit 954ec09aed4f2be04bb5f4e10dbb4ea8bd19ef9a.

Reverting due to test failures as requested by Jennifer Yu.

Conflicts:
clang/test/CodeGen/asm-goto.c

llvm-svn: 362106

5 years agoFix a regression in DWARF access speed caused by svn revision 356190
Greg Clayton [Thu, 30 May 2019 15:32:33 +0000 (15:32 +0000)]
Fix a regression in DWARF access speed caused by svn revision 356190

The issue was caused by the error checking code that was added. It was incorrectly adding an extra abbreviation when DWARFEnumState::Complete was received since it would push an extra abbreviation onto the list with the abbreviation code of zero. This cause m_idx_offset in each DWARFAbbreviationDeclarationSet to be set to UINT32_MAX. This valid indicates we must linearly search for attributes, not access them in O(1) time. This caused every DWARFDebugInfoEntry that would try to get its DWARFAbbreviationDeclaration from the CU's DWARFAbbreviationDeclarationSet to always linearly search the abbreviation set for a given abbreviation code. Easy to see why this would cause things to be slow.

This regression was caused by: https://reviews.llvm.org/D59370. I asked to ensure there was no regression is parsing or access speed, but that must not have been done. In my test with 40 DWARF files trying to set a breakpoint by function name and in a header file, I see a 8% speed improvement with this fix.

There was no regression in correctness, just very inefficient access.

Added full unit testing for DWARFAbbreviationDeclarationSet parsing to ensure this doesn't regress.

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

llvm-svn: 362105

5 years ago[NFC][ARM][ParallelDSP] Refactor narrow sequence
Sam Parker [Thu, 30 May 2019 15:26:37 +0000 (15:26 +0000)]
[NFC][ARM][ParallelDSP] Refactor narrow sequence

Most of the code used for finding a 'narrow' sequence is not used,
so I've removed it and simplified the calls from the smlad matcher.

llvm-svn: 362104

5 years agoImprove DWARF parsing and accessing by 1% to 2%
Greg Clayton [Thu, 30 May 2019 15:21:23 +0000 (15:21 +0000)]
Improve DWARF parsing and accessing by 1% to 2%

When LLDB first started we didn't have our mmap of the DWARF data done correctly and if the backing file would change we would get live changes as the file changed and it would cause problems. We now mmap correctly and do not run into these issues. There was legacy code in DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(...) that would always extract the abbrev index each time the function was called to verify that DWARF data hadn't changed and a warning was emitted if it did. We no longer need this and the code was removed. The other thing this function did when it parsed the abbrev index was give us the offset of the first attribute bytes by adding the LEB128 size to the offset. This required an extra parameter to DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(...) which is now removed. I added "lldb::offset_t DWARFDebugInfoEntry::GetFirstAttributeOffset() const" which calculates this when we need it and modified all sites that need the offset to call it.

Now that we aren't decoding and verifying the abbrev index, it speeds up DWARF access by 1% to 2%.

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

llvm-svn: 362103

5 years ago[OpenCL] Fix OpenCL/SPIR version metadata in C++ mode.
Anastasia Stulova [Thu, 30 May 2019 15:18:07 +0000 (15:18 +0000)]
[OpenCL] Fix OpenCL/SPIR version metadata in C++ mode.

C++ is derived from OpenCL v2.0 therefore set the versions
identically.

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

llvm-svn: 362102

5 years ago[analyzer] print() JSONify chain: Fix possible build-bot breaks
Csaba Dabis [Thu, 30 May 2019 15:15:57 +0000 (15:15 +0000)]
[analyzer] print() JSONify chain: Fix possible build-bot breaks

Summary:
Printing constructing_objects could be non-deterministic as it is a map.

llvm-svn: 362101

5 years agoFollow up of r362096
Sjoerd Meijer [Thu, 30 May 2019 15:04:06 +0000 (15:04 +0000)]
Follow up of r362096

The new tests were failing, because I missed dependent patch D60697.
I have removed the failing cases for now, which I will restore once
D60697 is in.

llvm-svn: 362100

5 years ago[ELF] De-template addUndefined() and addWrappedSymbols(). NFC
Fangrui Song [Thu, 30 May 2019 14:50:10 +0000 (14:50 +0000)]
[ELF] De-template addUndefined() and addWrappedSymbols(). NFC

llvm-svn: 362099

5 years ago[analyzer] print() JSONify chain: Fix build-bot breaks
Csaba Dabis [Thu, 30 May 2019 14:48:43 +0000 (14:48 +0000)]
[analyzer] print() JSONify chain: Fix build-bot breaks

Summary:
Printing out a map structure different in different environments so that
this patch generalize the test-case to check for the 'no stmt'-case
anywhere in the Store.

llvm-svn: 362098

5 years ago[ARM] Change the MC names for VMAXNM/VMINNM
Sjoerd Meijer [Thu, 30 May 2019 14:34:29 +0000 (14:34 +0000)]
[ARM] Change the MC names for VMAXNM/VMINNM

Now the NEON ones have a prefix "NEON_", and the VFP ones have a
prefix "VFP_". This is so that the regex in ARMScheduleA57.td can be
made to match both of _those_ classes of VMAXNM without also matching
the MVE ones that are going to be introduced soon. NFCI.

Patch by Simon Tatham.

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

llvm-svn: 362097

5 years ago[ARM] Add CLI support for Armv8.1-M and MVE
Sjoerd Meijer [Thu, 30 May 2019 14:22:26 +0000 (14:22 +0000)]
[ARM] Add CLI support for Armv8.1-M and MVE

Given the existing infrastructure in LLVM side for +fp and +fp.dp,
this is more or less trivial, needing only one tiny source change and
a couple of tests.

Patch by Simon Tatham.

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

llvm-svn: 362096

5 years ago[ELF][test] Update znotext-plt-relocations.s to emit R_X86_64_PC32
Fangrui Song [Thu, 30 May 2019 14:16:29 +0000 (14:16 +0000)]
[ELF][test] Update znotext-plt-relocations.s to emit R_X86_64_PC32

This is a leftover from r325379.

The intention of this test was to check in a non-pic link, R_X86_64_PC32
to a STT_FUNC created a PLT. However, after the llvm-mc change in
r325569, this code path is no longer exercised. Use the r325379 trick to
keep testing R_X86_64_PC32.

llvm-svn: 362095

5 years ago[ARM] LowerVECTOR_SHUFFLE - fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Thu, 30 May 2019 14:01:24 +0000 (14:01 +0000)]
[ARM] LowerVECTOR_SHUFFLE - fix uninitialized variable warnings. NFCI.

llvm-svn: 362094

5 years ago[NFC][Codegen] Add add+sub/sub+add constant-fold tests for from D62257
Roman Lebedev [Thu, 30 May 2019 13:02:11 +0000 (13:02 +0000)]
[NFC][Codegen] Add add+sub/sub+add constant-fold tests for from D62257

add+sub/sub+add when second operands are constants should be folded
into a single add, just like with add+add.

llvm-svn: 362093

5 years ago[LoopIdiom] Basic OptimizationRemarkEmitter handling
Roman Lebedev [Thu, 30 May 2019 13:02:06 +0000 (13:02 +0000)]
[LoopIdiom] Basic OptimizationRemarkEmitter handling

Summary:
I'm adding ORE to memset/memcpy formation, with tests,
but mainly this is split off from D61144.

Reviewers: reames, anemet, thegameg, craig.topper

Reviewed By: thegameg

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 362092

5 years ago[LoopIdiomRecognize][NFC] Sort includes
Roman Lebedev [Thu, 30 May 2019 13:01:53 +0000 (13:01 +0000)]
[LoopIdiomRecognize][NFC] Sort includes

Split off from D61144

llvm-svn: 362091

5 years ago[ARM] add target arch definitions for 8.1-M and MVE
Sjoerd Meijer [Thu, 30 May 2019 12:57:04 +0000 (12:57 +0000)]
[ARM] add target arch definitions for 8.1-M and MVE

This adds:
- LLVM subtarget features to make all the new instructions conditional on,
- CPU and FPU names for use on clang's command line, with default FPUs set
  so that "armv8.1-m.main+fp" and "armv8.1-m.main+fp.dp" will select the right
  FPU features,
- architecture extension names "mve" and "mve.fp",
- ABI build attribute support for v8.1-M (a new value for Tag_CPU_arch) and MVE
  (a new actual tag).

Patch mostly by Simon Tatham.

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

llvm-svn: 362090

5 years ago[llvm-readobj] - Rewrite reloc-types.test to use YAML. NFCI.
George Rimar [Thu, 30 May 2019 12:39:05 +0000 (12:39 +0000)]
[llvm-readobj] - Rewrite reloc-types.test to use YAML. NFCI.

This change rewrites and splits reloc-types.test
to use yaml2obj instead of precompiled binaries.
That allowed to remove 7 precompiled objects from the inputs.

I took the existent objects, used obj2yaml on them, simplified the result and
used yaml2obj in the test case with the result.

Notes:
* I converted, but did not remove relocs.obj.elf-i386, relocs.obj.elf-x86_64 or relocs.obj.elf-mips objects
because found they are used in other tests.
* I was unable to convert relocs.obj.elf-ppc64, because obj2yaml hangs on this file for me.
* I was unable to convert relocs.obj.macho-arm, relocs.obj.macho-i386 and relocs.obj.macho-x86_64
because the output produced by obj2yaml does not seem to be correct.
* Because of the above I did not remove the script for creating all
of those objects: test\tools\llvm-readobj\Inputs\relocs.py

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

llvm-svn: 362089

5 years ago[ARM] Introduce separate features for FP registers
Sjoerd Meijer [Thu, 30 May 2019 12:37:05 +0000 (12:37 +0000)]
[ARM] Introduce separate features for FP registers

The MVE extension in Arm v8.1-M permits the use of some move, load and
store isntructions which access the FP registers, even if there's no
actual FP support in the processor (in particular, if you have the
integer-only version of MVE).

Therefore, we need separate subtarget features to condition those
instructions on, which are implied by both FP and MVE but are not part
of either.

Patch mostly by Simon Tatham.

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

llvm-svn: 362088

5 years ago[OpenCL] Support logical vector operators in C++ mode
Sven van Haastregt [Thu, 30 May 2019 12:35:19 +0000 (12:35 +0000)]
[OpenCL] Support logical vector operators in C++ mode

Support logical operators on vectors in C++ for OpenCL mode, to
preserve backwards compatibility with OpenCL C.

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

llvm-svn: 362087

5 years agoDWARFASTParserClang: Delete dead code
Pavel Labath [Thu, 30 May 2019 11:24:16 +0000 (11:24 +0000)]
DWARFASTParserClang: Delete dead code

This removes places where DW_AT_decl_file/line/column was being parsed,
but not used.

llvm-svn: 362086

5 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Thu, 30 May 2019 10:44:36 +0000 (10:44 +0000)]
Fix Wdocumentation warning. NFCI.

llvm-svn: 362085

5 years ago[llvm-readobj] - An attemp to fix BB.
George Rimar [Thu, 30 May 2019 10:42:47 +0000 (10:42 +0000)]
[llvm-readobj] - An attemp to fix BB.

BB failed:
http://lab.llvm.org:8011/builders/clang-armv7-linux-build-cache/builds/15062/steps/build%20stage%201/logs/stdio

Error was:
/home/buildslave/buildslave/clang-armv7-linux-build-cache/llvm/tools/llvm-readobj/ELFDumper.cpp:3540:7:
error: non-constant-expression cannot be narrowed from type 'llvm::support::detail::packed_endian_specific_integral<unsigned long long,
llvm::support::endianness::little, 1>::value_type' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
      StrTabSec->sh_size};

llvm-svn: 362084

5 years ago[CostModel][X86] Add bool vector and/or/xor cost tests
Simon Pilgrim [Thu, 30 May 2019 10:41:04 +0000 (10:41 +0000)]
[CostModel][X86] Add bool vector and/or/xor cost tests

llvm-svn: 362083

5 years ago[llvm-readobj/llvm-readelf] - Implement GNU style dumper of the SHT_GNU_verdef section.
George Rimar [Thu, 30 May 2019 10:36:52 +0000 (10:36 +0000)]
[llvm-readobj/llvm-readelf] - Implement GNU style dumper of the SHT_GNU_verdef section.

It was not implemented yet, we had only LLVM style dumper implemented.
Section description is here: https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/symversion.html

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

llvm-svn: 362082

5 years ago[X86][SSE] Improve bool vector extload (PR26091)
Simon Pilgrim [Thu, 30 May 2019 10:25:20 +0000 (10:25 +0000)]
[X86][SSE] Improve bool vector extload (PR26091)

We already have good codegen for (vXiY *ext(vXi1 bitcast(iX))) cases, this patch uses it for loads of vXi1 types as well - changing the load into a iX integer load, and bitcasting so that combineToExtendBoolVectorInReg can then use it.

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

llvm-svn: 362081

5 years ago[llvm-readobj/llvm-readelf] - Implement GNU style dumper of the SHT_GNU_verneed section.
George Rimar [Thu, 30 May 2019 10:14:41 +0000 (10:14 +0000)]
[llvm-readobj/llvm-readelf] - Implement GNU style dumper of the SHT_GNU_verneed section.

It was not implemented yet, we had only LLVM style dumper implemented.
Section description is here: https://refspecs.linuxfoundation.org/LSB_2.0.1/LSB-Core/LSB-Core/symverrqmts.html

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

llvm-svn: 362080

5 years agoRevert "asm goto: fix out-of-bounds read of Constraints after rC362045"
Fangrui Song [Thu, 30 May 2019 10:05:52 +0000 (10:05 +0000)]
Revert "asm goto: fix out-of-bounds read of Constraints after rC362045"

It was fixed by rC362062.

llvm-svn: 362079

5 years ago[ELF] Implement Local Dynamic style TLSDESC for x86-64
Fangrui Song [Thu, 30 May 2019 10:00:20 +0000 (10:00 +0000)]
[ELF] Implement Local Dynamic style TLSDESC for x86-64

For the Local Dynamic case of TLSDESC, _TLS_MODULE_BASE_ is defined as a
special TLS symbol that makes:

1) Without relaxation: it produces a dynamic TLSDESC relocation that
computes 0. Adding @dtpoff to access a TLS symbol.
2) With LD->LE relaxation: _TLS_MODULE_BASE_@tpoff = 0 (lowest address in
the TLS block). Adding @tpoff to access a TLS symbol.

For 1), this saves dynamic relocations and GOT slots as otherwise
(General Dynamic) we would create an R_X86_64_TLSDESC and reserve two
GOT slots for each symbol.

Add ElfSym::TlsModuleBase and change the signature of getTlsTpOffset()
to special case _TLS_MODULE_BASE_.

Reviewed By: ruiu

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

llvm-svn: 362078

5 years agoFix sphinx warning about missing footnote.
Simon Pilgrim [Thu, 30 May 2019 09:40:35 +0000 (09:40 +0000)]
Fix sphinx warning about missing footnote.

llvm-svn: 362077

5 years agoFix MSVC "not all control paths return a value" warning.
Simon Pilgrim [Thu, 30 May 2019 09:39:45 +0000 (09:39 +0000)]
Fix MSVC "not all control paths return a value" warning.

llvm-svn: 362076

5 years agoDWARFASTParserClang: Move attribute parsing into a single function
Pavel Labath [Thu, 30 May 2019 09:39:36 +0000 (09:39 +0000)]
DWARFASTParserClang: Move attribute parsing into a single function

Summary:
The ParseTypeFromDWARF function consists of a huge switch on the kind of
type being parsed. Each case in this switch starts with parsing the
attributes of the current DIE. A lot of these attributes are specific to
one kind of a type, but a lot of them are common too, leading to code
duplication.

This patch reduces the duplication (and the size of ParseTypeFromDWARF)
by moving the attribute parsing to a separate function. It creates a
struct (ParsedTypeAttributes), which contains a parsed form of all
attributes which are useful for parsing any kind of a type. The parsing
code for a specific type kind can then access the fields which are
relevant for that specific case.

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 362075

5 years ago[llvm-objcopy] Remove %p format specifiers
Eugene Leviant [Thu, 30 May 2019 09:09:01 +0000 (09:09 +0000)]
[llvm-objcopy] Remove %p format specifiers

On 32-bit machines %p expects 32 bit values, however
addresses in llvm-objcopy are always 64 bits.

llvm-svn: 362074

5 years ago[AArch64][SVE2] Asm: support SVE2 vector splice (constructive)
Cullen Rhodes [Thu, 30 May 2019 08:51:39 +0000 (08:51 +0000)]
[AArch64][SVE2] Asm: support SVE2 vector splice (constructive)

Summary:
The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: SjoerdMeijer

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

llvm-svn: 362073

5 years ago[AArch64][SVE2] Asm: support SVE2 load instructions
Cullen Rhodes [Thu, 30 May 2019 08:44:27 +0000 (08:44 +0000)]
[AArch64][SVE2] Asm: support SVE2 load instructions

Summary:
Patch adds support for the following instructions:
    * LDNT1SB, LDNT1B, LDNT1SH, LDNT1H, LDNT1SW, LDNT1W, LDNT1D

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: SjoerdMeijer

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

llvm-svn: 362072

5 years ago[AArch64][SVE2] Asm: support FCVTX/FLOGB instructions
Cullen Rhodes [Thu, 30 May 2019 08:35:12 +0000 (08:35 +0000)]
[AArch64][SVE2] Asm: support FCVTX/FLOGB instructions

Summary:

Patch completes SVE2 support for:

    SVE Floating Point Unary Operations - Predicated Group

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: SjoerdMeijer

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

llvm-svn: 362071

5 years ago[AArch64][SVE2] Asm: add ext (immediate offset, constructive) instruction
Cullen Rhodes [Thu, 30 May 2019 08:25:17 +0000 (08:25 +0000)]
[AArch64][SVE2] Asm: add ext (immediate offset, constructive) instruction

Summary:
The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: chill

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

llvm-svn: 362070

5 years agoMake CompileUnit::GetSupportFiles return a const list
Pavel Labath [Thu, 30 May 2019 08:21:25 +0000 (08:21 +0000)]
Make CompileUnit::GetSupportFiles return a const list

There's no reason for anyone to modify a list from outside of a symbol
file (as that would break a lot of invariants that symbol files depend
on).

Make the function return a const FileSpecList and fix up a couple of
places that were needlessly binding non-const references to the result
of this function.

llvm-svn: 362069

5 years ago[ARM] Add an MVE execution domain
Sjoerd Meijer [Thu, 30 May 2019 08:07:06 +0000 (08:07 +0000)]
[ARM] Add an MVE execution domain

MVE architecturally specifies a 'beat' system in which a vector
instruction executed now will complete its actual operation over the
next four cycles, so it can overlap with the execution of the previous
and next MVE instruction.

This makes it generally an advantage to avoid moving values back and
forth between MVE registers and anywhere else, if there's any sensible
way to do the same processing in whatever register type the values
already occupied.

That's just what the 'execution domain' system is supposed to achieve.
So here we add a new execution domain which will contain all the MVE
vector instructions when they are added.

Patch by: Simon Tatham

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

llvm-svn: 362068

5 years agoasm goto: fix out-of-bounds read of Constraints after rC362045
Fangrui Song [Thu, 30 May 2019 08:03:02 +0000 (08:03 +0000)]
asm goto: fix out-of-bounds read of Constraints after rC362045

When parsing goto labels, Names and Exprs are expanded but Constraints
is not, this may cause a out-of-bounds read later in:

// GCCAsmStmt::GCCAsmStmt
// `constraints` has only `NumExprs - NumLabels` elements
  Constraints = new (C) StringLiteral*[NumExprs];
  std::copy(constraints, constraints + NumExprs, Constraints);

llvm-svn: 362067

5 years ago[TableGen] AsmMatcher: allow repeated input operands
Sjoerd Meijer [Thu, 30 May 2019 07:38:09 +0000 (07:38 +0000)]
[TableGen] AsmMatcher: allow repeated input operands

If an assembly instruction has to mention an input operand name twice,
for example the MVE VMOV instruction that accesses two lanes of the
same vector by writing 'vmov r1, r2, q0[3], q0[1]', then the obvious
way to write its AsmString is to include the same operand (here $Qd)
twice. But this causes the AsmMatcher generator to omit that
instruction completely from the match table, on the basis that the
generator isn't clever enough to deal with the duplication.

But you need to have _some_ way of dealing with an instruction like
this - and in this case, where the mnemonic is shared with many other
instructions that the AsmMatcher does handle, it would be very painful
to take it out of the AsmMatcher system completely.

A nicer way is to add a custom AsmMatchConverter routine, and let that
deal with the problem if the autogenerated converter can't. But that
doesn't work, because TableGen leaves the instruction out of its table
_even_ if you provide a custom converter.

Solution: this change, which makes TableGen relax the restriction on
duplicated operands in the case where there's a custom converter.

Patch by: Simon Tatham

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

llvm-svn: 362066

5 years ago[CMake] Use find_package(LLVM) instead of LLVMConfig
Petr Hosek [Thu, 30 May 2019 07:34:39 +0000 (07:34 +0000)]
[CMake] Use find_package(LLVM) instead of LLVMConfig

This addresses an issues introduced in r362047.

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

llvm-svn: 362065

5 years ago[TableGen] New default operand "undef_tied_input"
Sjoerd Meijer [Thu, 30 May 2019 07:30:37 +0000 (07:30 +0000)]
[TableGen] New default operand "undef_tied_input"

This is a new special identifier which you can use as a default in
OperandWithDefaultOps. The idea is that you use it for an input
operand of an instruction that's tied to an output operand, and its
semantics are that (in the default case) the input operand's value is
not used at all.

The detailed effect is that when instruction selection emits the
instruction in the form of a pre-regalloc MachineInstr, it creates an
IMPLICIT_DEF node to use as that input.

If you're creating an MCInst with explicit register names, then the
right handling would be to set the input operand to the same register
as the output one (honouring the tie) and to add the 'undef' flag
indicating that that register is deemed to acquire a new don't-care
definition just before we read it. But I haven't done that in this
commit, because there was no need to - no Tablegen backend seems to
autogenerate default fields in an MCInst.

Patch by: Simon Tatham

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

llvm-svn: 362064

5 years ago[lldb-server] Support 'g' packets
Pavel Labath [Thu, 30 May 2019 07:25:22 +0000 (07:25 +0000)]
[lldb-server] Support 'g' packets

Differential Revision: https://reviews.llvm.org/D62221
Patch by Guilherme Andrade <guiandrade@google.com>.

llvm-svn: 362063

5 years ago[AST] asm goto labels don't have constraints, don't try to copy them.
Benjamin Kramer [Thu, 30 May 2019 07:21:08 +0000 (07:21 +0000)]
[AST] asm goto labels don't have constraints, don't try to copy them.

Found by asan.

llvm-svn: 362062

5 years ago[runtimes] Use _LIBCPP_HAS_COMMENT_LIB_PRAGMA in all relevant files
Petr Hosek [Thu, 30 May 2019 06:57:27 +0000 (06:57 +0000)]
[runtimes] Use _LIBCPP_HAS_COMMENT_LIB_PRAGMA in all relevant files

These two sources were omitted in r362055.

llvm-svn: 362061

5 years ago[LoopVectorize] Precommit tests for D62510. NFC
Craig Topper [Thu, 30 May 2019 06:48:13 +0000 (06:48 +0000)]
[LoopVectorize] Precommit tests for D62510. NFC

llvm-svn: 362060

5 years agoMark CodeGen/asm-goto.c as x86 specific after r362045
Fangrui Song [Thu, 30 May 2019 06:48:13 +0000 (06:48 +0000)]
Mark CodeGen/asm-goto.c as x86 specific after r362045

llvm-svn: 362059

5 years ago[libcxx][libcxxabi] Remove the unused CMake checks
Petr Hosek [Thu, 30 May 2019 06:08:56 +0000 (06:08 +0000)]
[libcxx][libcxxabi] Remove the unused CMake checks

These seemed to have been used in the past but were since removed
by the add_compile_flags_if_supported functions that combine these
these checks and adding the flag, but the original checks were never
removed.

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

llvm-svn: 362058

5 years ago[runtimes] Use -Wunknown-pragmas for the pragma check
Petr Hosek [Thu, 30 May 2019 05:38:06 +0000 (05:38 +0000)]
[runtimes] Use -Wunknown-pragmas for the pragma check

This is a follow up to r362055, we need -Wunknown-pragmas otherwise
the check is going to succeed it the pragma isn't supported.

llvm-svn: 362057

5 years ago[LV] Inform about exactly reason of loop illegality
Florian Hahn [Thu, 30 May 2019 05:03:12 +0000 (05:03 +0000)]
[LV] Inform about exactly reason of loop illegality

Currently, only the following information is provided by LoopVectorizer
in the case when the CF of the loop is not legal for vectorization:

 LV: Can't vectorize the instructions or CFG
    LV: Not vectorizing: Cannot prove legality.

But this information is not enough for the root cause analysis; what is
exactly wrong with the loop should also be printed:

 LV: Not vectorizing: The exiting block is not the loop latch.

Patch by Pavel Samolysov.

Reviewers: mkuper, hsaito, rengolin, fhahn

Reviewed By: fhahn

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

llvm-svn: 362056

5 years ago[runtimes] Check if pragma comment(lib, ...) is supported first
Petr Hosek [Thu, 30 May 2019 04:40:21 +0000 (04:40 +0000)]
[runtimes] Check if pragma comment(lib, ...) is supported first

This fixes the issue introduced by r362048 where we always use
pragma comment(lib, ...) for dependent libraries when the compiler
is Clang, but older Clang versions don't support this pragma so
we need to check first if it's supported before using it.

llvm-svn: 362055

5 years agoAdd the `objc_class_stub` attribute.
John McCall [Thu, 30 May 2019 04:09:01 +0000 (04:09 +0000)]
Add the `objc_class_stub` attribute.

Swift requires certain classes to be not just initialized lazily on first
use, but actually allocated lazily using information that is only available
at runtime.  This is incompatible with ObjC class initialization, or at least
not efficiently compatible, because there is no meaningful class symbol
that can be put in a class-ref variable at load time.  This leaves ObjC
code unable to access such classes, which is undesirable.

objc_class_stub says that class references should be resolved by calling
a new ObjC runtime function with a pointer to a new "class stub" structure.
Non-ObjC compilers (like Swift) can simply emit this structure when ObjC
interop is required for a class that cannot be statically allocated,
then apply this attribute to the `@interface` in the generated ObjC header
for the class.

This attribute can be thought of as a generalization of the existing
`objc_runtime_visible` attribute which permits more efficient class
resolution as well as supporting the additon of categories to the class.
Subclassing these classes from ObjC is currently not allowed.

Patch by Slava Pestov!

llvm-svn: 362054

5 years ago[X86] Add ENQCMD instructions
Pengfei Wang [Thu, 30 May 2019 03:59:16 +0000 (03:59 +0000)]
[X86] Add ENQCMD instructions

For more details about these instructions, please refer to the latest
ISE document:
https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference.

Patch by Tianqing Wang (tianqing)

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

llvm-svn: 362053

5 years ago[Driver] Render target options (e.g. -fuse-init-array) for -fembed-bitcode
Fangrui Song [Thu, 30 May 2019 02:30:04 +0000 (02:30 +0000)]
[Driver] Render target options (e.g. -fuse-init-array) for -fembed-bitcode

Modern ELF platforms use -fuse-init-array to emit .init_array instead of
.ctors .  ld.bfd and gold --ctors-in-init-array merge .init_array and
.ctors into .init_array but lld doesn't do that.

If crtbegin*.o crtend*.o don't provide .ctors/.dtors, such .ctors in
user object files can lead to crash (see PR42002. The first and the last
elements in .ctors/.dtors are ignored - they are traditionally provided
by crtbegin*.o crtend*.o).

Call addClangTargetOptions() to ensure -fuse-init-array is rendered on
modern ELF platforms. On Hexagon, this renders -target-feature
+reserved-r19 for -ffixed-r19.

Reviewed By: compnerd

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

llvm-svn: 362052

5 years ago[PowerPC] Set the default PLT mode on musl to Secure PLT
Fangrui Song [Thu, 30 May 2019 02:13:15 +0000 (02:13 +0000)]
[PowerPC] Set the default PLT mode on musl to Secure PLT

The musl libc only supports Secure PLT.

Patch by A. Wilcox!

Reviewed By: jhibbits

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

llvm-svn: 362051

5 years ago[Driver] -static-pie: add -z text
Fangrui Song [Thu, 30 May 2019 01:55:43 +0000 (01:55 +0000)]
[Driver] -static-pie: add -z text

This matches gcc -static-pie. The intention is to prevent dynamic
relocations in read-only segments.

In ld.bfd and gold, -z notext is the default. If text relocations are needed:

* -z notext: allow and emit DF_TEXTREL.
  DF_TEXTREL is not emitted if there is no text relocation.
* -z text: error

In lld, -z text is the default (this change is a no-op).

* -z text: error on text relocations
* -z notext: allow text relocations, and emit DF_TEXTREL no matter whether
  text relocations exist.

Reviewed By: sivachandra

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

llvm-svn: 362050

5 years agoDWARFDebugInfoEntry: delete unused Extract() and rename FastExtract() to Extract()
Fangrui Song [Thu, 30 May 2019 01:51:16 +0000 (01:51 +0000)]
DWARFDebugInfoEntry: delete unused Extract() and rename FastExtract() to Extract()

The function Extract() is almost a duplicate of FastExtract() but is not used.
Delete it and rename FastExtract() to Extract().

Reviewed By: JDevlieghere

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

llvm-svn: 362049

5 years ago[runtimes] Support ELF dependent libraries feature
Petr Hosek [Thu, 30 May 2019 01:34:41 +0000 (01:34 +0000)]
[runtimes] Support ELF dependent libraries feature

As of r360984, LLD supports dependent libraries feature for ELF.
libunwind, libc++abi and libc++ have library dependencies: libdl librt
and libpthread, which means that when libunwind and libc++ are being
statically linked (using -static-libstdc++ flag), user has to manually
specify -ldl -lpthread which is onerous.

This change includes the lib pragma to specify the library dependencies
directly in the source that uses those libraries. This doesn't make any
difference when using linkers that don't support dependent libraries.
However, when using LLD that has dependent libraries feature, users no
longer have to manually specifying library dependencies when using
static linking, linker will pick the library automatically.

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

llvm-svn: 362048

5 years ago[CMake] Set LLVM_PATH in the runtimes build
Petr Hosek [Thu, 30 May 2019 01:24:31 +0000 (01:24 +0000)]
[CMake] Set LLVM_PATH in the runtimes build

This avoids using llvm-config for inferring various paths within the
runtimes build. We also set LLVM_INCLUDE_DIR variable that's used by
these builds and move assignment of LLVM_BINARY_DIR and LLVM_LIBRARY_DIR
to the same location for consistency.

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

llvm-svn: 362047

5 years ago[BitstreamWriter][NFC] Remove obsolete comment.
Jan Korous [Thu, 30 May 2019 01:08:38 +0000 (01:08 +0000)]
[BitstreamWriter][NFC] Remove obsolete comment.

The Abbv parameter was just a raw pointer when the comment was written.

llvm-svn: 362046

5 years agoclang support gnu asm goto.
Jennifer Yu [Thu, 30 May 2019 01:05:46 +0000 (01:05 +0000)]
clang support gnu asm goto.
Syntax:
  asm [volatile] goto ( AssemblerTemplate
                      :
                      : InputOperands
                      : Clobbers
                      : GotoLabels)

https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html

New llvm IR is "callbr" for inline asm goto instead "call" for inline asm
For:
asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop);
IR:
callbr void asm sideeffect "testl $0, $0; jne ${1:l};", "r,X,X,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* blockaddress(@foo, %label_true), i8* blockaddress(@foo, %loop)) #1
          to label %asm.fallthrough [label %label_true, label %loop], !srcloc !3

asm.fallthrough:

Compiler need to generate:
1> a dummy constarint 'X' for each label.
2> an unique fallthrough label for each asm goto stmt " asm.fallthrough%number".

Diagnostic
1> duplicate asm operand name are used in output, input and label.
2> goto out of scope.

llvm-svn: 362045

5 years ago[crashlog] Add a missing call to decode.
Davide Italiano [Thu, 30 May 2019 00:35:43 +0000 (00:35 +0000)]
[crashlog] Add a missing call to decode.

<rdar://problem/51139357>

llvm-svn: 362044

5 years ago[Commands] Remove commented out code
Alex Langford [Wed, 29 May 2019 23:25:44 +0000 (23:25 +0000)]
[Commands] Remove commented out code

llvm-svn: 362042

5 years ago[llvm-objcopy][MachO] Print an error message on use of unsupported options
Seiya Nuta [Wed, 29 May 2019 22:21:12 +0000 (22:21 +0000)]
[llvm-objcopy][MachO] Print an error message on use of unsupported options

Summary:
It is better to print an error message instead of silently ignoring unsupported options.

As mentioned in https://reviews.llvm.org/D57045, this is not the best solution and we should print which flag is not supported at some time.

Reviewers: alexshap, rupprecht, jhenderson, jakehehrlich

Reviewed By: alexshap, rupprecht, jakehehrlich

Subscribers: jakehehrlich, llvm-commits

Tags: #llvm

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

llvm-svn: 362040