OSDN Git Service

android-x86/external-llvm.git
5 years ago[DAGCombiner] Combine OR as ADD when no common bits are set
Bjorn Pettersson [Tue, 23 Apr 2019 10:01:08 +0000 (10:01 +0000)]
[DAGCombiner] Combine OR as ADD when no common bits are set

Summary:
The DAGCombiner is rewriting (canonicalizing) an ISD::ADD
with no common bits set in the operands as an ISD::OR node.

This could sometimes result in "missing out" on some
combines that normally are performed for ADD. To be more
specific this could happen if we already have rewritten an
ADD into OR, and later (after legalizations or combines)
we expose patterns that could have been optimized if we
had seen the OR as an ADD (e.g. reassociations based on ADD).

To make the DAG combiner less sensitive to if ADD or OR is
used for these "no common bits set" ADD/OR operations we
now apply most of the ADD combines also to an OR operation,
when value tracking indicates that the operands have no
common bits set.

Reviewers: spatel, RKSimon, craig.topper, kparzysz

Reviewed By: spatel

Subscribers: arsenm, rampitec, lebedev.ri, jvesely, nhaehnle, hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358965 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64] Add support for MTE intrinsics
Javed Absar [Tue, 23 Apr 2019 09:39:58 +0000 (09:39 +0000)]
[AArch64] Add support for MTE intrinsics

This patch provides intrinsics support for Memory Tagging Extension (MTE),
which was introduced with the Armv8.5-a architecture.
The intrinsics are described in detail in the latest
ACLE Q1 2019 documentation: https://developer.arm.com/docs/101028/latest
Reviewed by: David Spickett
Differential Revision: https://reviews.llvm.org/D60486

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358963 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM][FIX] Add missing f16.lane.vldN/vstN lowering
Diogo N. Sampaio [Tue, 23 Apr 2019 09:36:39 +0000 (09:36 +0000)]
[ARM][FIX] Add missing f16.lane.vldN/vstN lowering

Summary:
Add missing D and Q lane VLDSTLane lowering
for fp16 elements.

Reviewers: efriedma, kosarev, SjoerdMeijer, ostannard

Reviewed By: efriedma

Subscribers: javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358962 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-mc] - Properly set the the address align field of the compressed sections.
George Rimar [Tue, 23 Apr 2019 09:16:53 +0000 (09:16 +0000)]
[llvm-mc] - Properly set the the address align field of the compressed sections.

About the compressed sections spec says:
(https://docs.oracle.com/cd/E37838_01/html/E36783/section_compression.html)
sh_addralign fields of the section header for a compressed section
reflect the requirements of the compressed section.

Currently, llvm-mc always puts uncompressed section alignment to sh_addralign.
It is not correct. zlib styled section contains an Elfxx_Chdr header,
so we should either use 4 or 8 values depending on the target
(Uncompressed section alignment is stored in ch_addralign field of the compression header).

GNU assembler version 2.31.1 also has this issue,
but in 2.32.51 it was already fixed. This is how it was found
during debugging of the https://bugs.llvm.org/show_bug.cgi?id=40482
actually.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358960 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LSR] Limit the recursion for setup cost
David Green [Tue, 23 Apr 2019 08:52:21 +0000 (08:52 +0000)]
[LSR] Limit the recursion for setup cost

In some circumstances we can end up with setup costs that are very complex to
compute, even though the scevs are not very complex to create. This can also
lead to setupcosts that are calculated to be exactly -1, which LSR treats as an
invalid cost. This patch puts a limit on the recursion depth for setup cost to
prevent them taking too long.

Thanks to @reames for the report and test case.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358958 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Bail out of fastisel earlier when computing PIC addresses
Sam Clegg [Tue, 23 Apr 2019 03:43:26 +0000 (03:43 +0000)]
[WebAssembly] Bail out of fastisel earlier when computing PIC addresses

This change partially reverts https://reviews.llvm.org/D54647 in favor
of bailing out during computeAddress instead.

This catches the condition earlier and handles more cases.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358948 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoadd Qiu Chaofan (qiucf@cn.ibm.com) to the CREDITS.txt
Qiu Chaofan [Tue, 23 Apr 2019 02:37:48 +0000 (02:37 +0000)]
add Qiu Chaofan (qiucf@cn.ibm.com) to the CREDITS.txt

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358942 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "Use const DebugLoc&"
Chandler Carruth [Tue, 23 Apr 2019 01:42:07 +0000 (01:42 +0000)]
Revert "Use const DebugLoc&"

This reverts r358910 (git commit 2b744665308fc8d30a3baecb4947f2bd81aa7d30)

While this patch *seems* trivial and safe and correct, it is not. The
copies are actually load bearing copies. You can observe this with MSan
or other ways of checking for use-after-destroy, but otherwise this may
result in ... difficult to debug inexplicable behavior.

I suspect the issue is that the debug location is used after the
original reference to it is removed. The metadata backing it gets
destroyed as its last references goes away, and then we reference it
later through these const references.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358940 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CMake] Replace the sanitizer support in runtimes build with multilib
Petr Hosek [Mon, 22 Apr 2019 23:31:39 +0000 (23:31 +0000)]
[CMake] Replace the sanitizer support in runtimes build with multilib

This is a more generic solution; while the sanitizer support can be used
only for sanitizer instrumented builds, the multilib support can be used
to build other variants such as noexcept which is what we would like to use
in Fuchsia.

The name CMake target name uses the target name, same as for the regular
runtimes build and the name of the multilib, concatenated with '+'. The
libraries are installed in a subdirectory named after the multilib.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358935 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFully qualify llvm::Optional, some compilers complain otherwise.
Adrian Prantl [Mon, 22 Apr 2019 22:51:34 +0000 (22:51 +0000)]
Fully qualify llvm::Optional, some compilers complain otherwise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358933 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDebugInfo: Emit only one kind of accelerated access/name table
David Blaikie [Mon, 22 Apr 2019 22:45:11 +0000 (22:45 +0000)]
DebugInfo: Emit only one kind of accelerated access/name table

Currently to opt in to debug_names in DWARFv5, the IR must contain
'nameTableKind: Default' which also enables debug_pubnames.

Instead, only allow one of {debug_names, apple_names, debug_pubnames,
debug_gnu_pubnames}.

nameTableKind: Default gives debug_names in DWARFv5 and greater,
debug_pubnames in v4 and earlier - and apple_names when tuning for lldb
on MachO.
nameTableKind: GNU always gives gnu_pubnames

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358931 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SelectionDAG] move splat util functions up from x86 lowering
Sanjay Patel [Mon, 22 Apr 2019 22:43:36 +0000 (22:43 +0000)]
[SelectionDAG] move splat util functions up from x86 lowering

This was supposed to be NFC, but the change in SDLoc
definitions causes instruction scheduling changes.

There's nothing x86-specific in this code, and it can
likely be used from DAGCombiner's simplifyVBinOp().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358930 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTry to work around compile errors with older versions of GCC.
Adrian Prantl [Mon, 22 Apr 2019 22:40:37 +0000 (22:40 +0000)]
Try to work around compile errors with older versions of GCC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358927 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRelax test to check for a valid number instead of a specific number.
Douglas Yung [Mon, 22 Apr 2019 22:31:57 +0000 (22:31 +0000)]
Relax test to check for a valid number instead of a specific number.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358926 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Fix an issue in `op_sel_hi` skipping.
Michael Liao [Mon, 22 Apr 2019 22:05:49 +0000 (22:05 +0000)]
[AMDGPU] Fix an issue in `op_sel_hi` skipping.

Summary:
- Only apply packed literal `op_sel_hi` skipping on operands requiring
  packed literals. Even an instruction is `packed`, it may have operand
  requiring non-packed literal, such as `v_dot2_f32_f16`.

Reviewers: rampitec, arsenm, kzhuravl

Subscribers: jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358922 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[dsymutil] Collect parseable Swift interfaces in the .dSYM bundle.
Adrian Prantl [Mon, 22 Apr 2019 21:33:22 +0000 (21:33 +0000)]
[dsymutil] Collect parseable Swift interfaces in the .dSYM bundle.

When a Swift module built with debug info imports a library without
debug info from a textual interface, the textual interface is
necessary to reconstruct types defined in the library's interface. By
recording the Swift interface files in DWARF dsymutil can collect them
and LLDB can find them.

This patch teaches dsymutil to look for DW_TAG_imported_modules and
records all references to parseable Swift ingterfrace files and copies
them to

  a.out.dSYM/Contents/Resources/<Arch>/<ModuleName>.swiftinterface

<rdar://problem/49751748>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358921 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] Eliminate stores to constant memory
Philip Reames [Mon, 22 Apr 2019 20:28:19 +0000 (20:28 +0000)]
[InstCombine] Eliminate stores to constant memory

If we have a store to a piece of memory which is known constant, then we know the store must be storing back the same value. As a result, the store (or memset, or memmove) must either be down a dead path, or a noop. In either case, it is valid to simply remove the store.

The motivating case for this involves a memmove to a buffer which is constant down a path which is dynamically dead.

Note that I'm choosing to implement the less aggressive of two possible semantics here. We could simply say that the store *is undefined*, and prune the path. Consensus in the review was that the more aggressive form might be a good follow on change at a later date.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358919 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Support] unflake TempFileCollisions test
Bob Haarman [Mon, 22 Apr 2019 19:46:25 +0000 (19:46 +0000)]
[Support] unflake TempFileCollisions test

Summary:
This test was added to verify that createUniqueEntity() does
not enter an infinite loop when all possible names are taken. However,
it also checked that all possible names are generated, which is flaky
(because the names are generated randomly). This change increases the
number of attempts we make to make flakes exceedingly
unlikely (3.88e-62).

Reviewers: fedor.sergeev, rsmith

Reviewed By: fedor.sergeev

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358914 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstSimplify] Move masked.gather w/no active lanes handling to InstSimplify from...
Philip Reames [Mon, 22 Apr 2019 19:30:01 +0000 (19:30 +0000)]
[InstSimplify] Move masked.gather w/no active lanes handling to InstSimplify from InstCombine

In the process, use the existing masked.load combine which is slightly stronger, and handles a mix of zero and undef elements in the mask.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358913 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r358869
Nico Weber [Mon, 22 Apr 2019 19:25:40 +0000 (19:25 +0000)]
gn build: Merge r358869

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358912 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUse const DebugLoc&
Matt Arsenault [Mon, 22 Apr 2019 19:14:27 +0000 (19:14 +0000)]
Use const DebugLoc&

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358910 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Skip debug instructions in assert
Matt Arsenault [Mon, 22 Apr 2019 19:14:26 +0000 (19:14 +0000)]
AMDGPU: Skip debug instructions in assert

These are inserted after branch relaxation, and for some reason it's
decided to put them in the long branch expansion block. It's probably
not great to rely on the source block address, so this should probably
be switched to being PC relative instead of relying on the block
address

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358909 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Tests] Revise a test as requested by reviewer in D59703
Philip Reames [Mon, 22 Apr 2019 18:51:58 +0000 (18:51 +0000)]
[Tests] Revise a test as requested by reviewer in D59703

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358907 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Tests] Add a negative test for masked.gather part of D59703
Philip Reames [Mon, 22 Apr 2019 18:28:44 +0000 (18:28 +0000)]
[Tests] Add a negative test for masked.gather part of D59703

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358906 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[IPSCCP] Add missing `AssumptionCacheTracker` dependency
Justin Bogner [Mon, 22 Apr 2019 17:38:29 +0000 (17:38 +0000)]
[IPSCCP] Add missing `AssumptionCacheTracker` dependency

Back in August, r340525 introduced a dependency on the assumption
cache tracker in the ipsccp pass, but that commit missed a call to
INITIALIZE_PASS_DEPENDENCY, which leaves the assumption cache
improperly registered if SCCP is the only thing that pulls it in.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358903 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LPM/BPI] Preserve BPI through trivial loop pass pipeline (e.g. LCSSA, LoopSimplify)
Philip Reames [Mon, 22 Apr 2019 17:13:43 +0000 (17:13 +0000)]
[LPM/BPI] Preserve BPI through trivial loop pass pipeline (e.g. LCSSA, LoopSimplify)

Currently, we do not expose BPI to loop passes at all. In the old pass manager, we appear to have been ignoring the fact that LCSSA and/or LoopSimplify didn't preserve BPI, and making it available to the following loop passes anyways.  In the new one, it's invalidated before running any loop pass if either LCSSA or LoopSimplify actually make changes. If they don't make changes, then BPI is valid and available.  So, we go ahead and teach LCSSA and LoopSimplify how to preserve BPI for consistency between old and new pass managers.

This patch avoids an invalidation between the two requires in the following trivial pass pipeline:
opt -passes="requires<branch-prob>,loop(no-op-loop),requires<branch-prob>"
(when the input file is one which requires either LCSSA or LoopSimplify to canonicalize the loops)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358901 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PGO/SamplePGO][NFC] Move the function updateProfWeight from Instruction
Wei Mi [Mon, 22 Apr 2019 17:04:51 +0000 (17:04 +0000)]
[PGO/SamplePGO][NFC] Move the function updateProfWeight from Instruction
to CallInst.

The issue was raised here: https://reviews.llvm.org/D60903#1472783

The function Instruction::updateProfWeight is only used for CallInst in
profile update. From the current interface, it is very easy to think that
the function can also be used for branch instruction. However, Branch
instruction does't need the scaling the function provides for
branch_weights and VP (value profile), in addition, scaling may introduce
inaccuracy for branch probablity.

The patch moves the function updateProfWeight from Instruction class to
CallInst to remove the confusion. The patch also changes the scaling of
branch_weights from a loop to a block because we know that ProfileData
for branch_weights of CallInst will only have two operands at most.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358900 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUse llvm::stable_sort. NFC
Fangrui Song [Mon, 22 Apr 2019 15:53:43 +0000 (15:53 +0000)]
Use llvm::stable_sort. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358897 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove spurious semicolons; NFC.
Aaron Ballman [Mon, 22 Apr 2019 15:31:09 +0000 (15:31 +0000)]
Remove spurious semicolons; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358895 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU/GlobalISel: Fix non-power-of-2 G_EXTRACT sources
Matt Arsenault [Mon, 22 Apr 2019 15:22:46 +0000 (15:22 +0000)]
AMDGPU/GlobalISel: Fix non-power-of-2 G_EXTRACT sources

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358894 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSTLExtras: add stable_sort wrappers
Fangrui Song [Mon, 22 Apr 2019 15:19:13 +0000 (15:19 +0000)]
STLExtras: add stable_sort wrappers

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358893 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: Legalize scalar G_EXTRACT sources
Matt Arsenault [Mon, 22 Apr 2019 15:10:42 +0000 (15:10 +0000)]
GlobalISel: Legalize scalar G_EXTRACT sources

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358892 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-undname: Fix an assert-on-invalid, found by oss-fuzz
Nico Weber [Mon, 22 Apr 2019 15:05:18 +0000 (15:05 +0000)]
llvm-undname: Fix an assert-on-invalid, found by oss-fuzz

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358891 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU: Fix not checking for copy when looking at copy src
Matt Arsenault [Mon, 22 Apr 2019 14:54:39 +0000 (14:54 +0000)]
AMDGPU: Fix not checking for copy when looking at copy src

Effectively reverts r356956. The check for isFullCopy was excessive,
but there still needs to be a check that this is a copy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358890 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU][MC] Corrected parsing of SP3 'neg' modifier
Dmitry Preobrazhensky [Mon, 22 Apr 2019 14:35:47 +0000 (14:35 +0000)]
[AMDGPU][MC] Corrected parsing of SP3 'neg' modifier

See bug 41156: https://bugs.llvm.org/show_bug.cgi?id=41156

Reviewers: artem.tamazov, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358888 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TargetLowering][AMDGPU][X86] Improve SimplifyDemandedBits bitcast handling
Simon Pilgrim [Mon, 22 Apr 2019 14:04:35 +0000 (14:04 +0000)]
[TargetLowering][AMDGPU][X86] Improve SimplifyDemandedBits bitcast handling

This patch adds support for BigBitWidth -> SmallBitWidth bitcasts, splitting the DemandedBits/Elts accordingly.

The AMDGPU backend needed an extra  (srl (and x, c1 << c2), c2) -> (and (srl(x, c2), c1) combine to encourage BFE creation, I investigated putting this in DAGCombine but it caused a lot of noise on other targets - some improvements, some regressions.

The X86 changes are all definite wins.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358887 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] make variable name less ambiguous; NFC
Sanjay Patel [Mon, 22 Apr 2019 13:42:50 +0000 (13:42 +0000)]
[DAGCombiner] make variable name less ambiguous; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358886 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] prepare shuffle-of-splat to handle more patterns; NFC
Sanjay Patel [Mon, 22 Apr 2019 13:36:07 +0000 (13:36 +0000)]
[DAGCombiner] prepare shuffle-of-splat to handle more patterns; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358884 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LLVM-C] Add accessors to the default floating-point metadata node
Robert Widmann [Mon, 22 Apr 2019 13:13:22 +0000 (13:13 +0000)]
[LLVM-C] Add accessors to the default floating-point metadata node

Summary: Add a getter and setter pair for floating-point accuracy metadata.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358883 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NewPM] Add Option handling for SimpleLoopUnswitch
Serguei Katkov [Mon, 22 Apr 2019 10:35:07 +0000 (10:35 +0000)]
[NewPM] Add Option handling for SimpleLoopUnswitch

This patch enables passing options to SimpleLoopUnswitch via the passes pipeline.

Reviewers: chandlerc, fedor.sergeev, leonardchan, philip.pfaffe
Reviewed By: fedor.sergeev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D60676

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358880 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Regenerate uitofp i8 to float conversion tests.
Simon Pilgrim [Mon, 22 Apr 2019 10:19:09 +0000 (10:19 +0000)]
[AMDGPU] Regenerate uitofp i8 to float conversion tests.

Prep work for D60462

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358879 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NewPM] Add dummy Test for LoopVectorize option parsing.
Serguei Katkov [Mon, 22 Apr 2019 09:53:26 +0000 (09:53 +0000)]
[NewPM] Add dummy Test for LoopVectorize option parsing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358878 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[ConstantRange] Rename make{Guaranteed -> Exact}NoWrapRegion() NFC"
Nikita Popov [Mon, 22 Apr 2019 09:01:38 +0000 (09:01 +0000)]
Revert "[ConstantRange] Rename make{Guaranteed -> Exact}NoWrapRegion() NFC"

This reverts commit 7bf4d7c07f2fac862ef34c82ad0fef6513452445.

After thinking about this more, this isn't right, the range is not exact
in the same sense as makeExactICmpRegion(). This needs a separate
function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358876 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ConstantRange] Rename make{Guaranteed -> Exact}NoWrapRegion() NFC
Nikita Popov [Mon, 22 Apr 2019 08:36:05 +0000 (08:36 +0000)]
[ConstantRange] Rename make{Guaranteed -> Exact}NoWrapRegion() NFC

Following D60632 makeGuaranteedNoWrapRegion() always returns an
exact nowrap region. Rename the function accordingly. This is in
line with the naming of makeExactICmpRegion().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358875 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Reject 512-bit types in getRegForInlineAsmConstraint when AVX512 is not enabled...
Craig Topper [Mon, 22 Apr 2019 06:12:02 +0000 (06:12 +0000)]
[X86] Reject 512-bit types in getRegForInlineAsmConstraint when AVX512 is not enabled. Same for 256 bit and AVX.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358872 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Remove a lot of reduntant 'JITLink_' prefixes. NFC.
Lang Hames [Mon, 22 Apr 2019 03:03:09 +0000 (03:03 +0000)]
[JITLink] Remove a lot of reduntant 'JITLink_' prefixes. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358869 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cmake] Add llvm-jit to LLVM_TEST_DEPENDS
Fangrui Song [Mon, 22 Apr 2019 02:23:09 +0000 (02:23 +0000)]
[cmake] Add llvm-jit to LLVM_TEST_DEPENDS

Otherwise llvm-jit would say "utils/lit/lit/llvm/subst.py:127: note: Did not find llvm-jitlink in ..."

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358867 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Fix section start address calculation in eh-frame recorder.
Lang Hames [Mon, 22 Apr 2019 01:35:16 +0000 (01:35 +0000)]
[JITLink] Fix section start address calculation in eh-frame recorder.

Section atoms are not sorted, so we need to scan the whole section to find the
start address.

No test case: Found by inspection, and any reproduction would depend on pointer
ordering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358865 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAttemp get llvm-jitlink building on Windows
Nico Weber [Sun, 21 Apr 2019 23:50:24 +0000 (23:50 +0000)]
Attemp get llvm-jitlink building on Windows

By removing an include of dlfcn.h that looks unused.

And clang-format a too-long line while here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358864 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Add an option to dump relocated section content.
Lang Hames [Sun, 21 Apr 2019 20:34:19 +0000 (20:34 +0000)]
[JITLink] Add an option to dump relocated section content.

The -dump-relocated-section-content option will dump the contents of each
section after relocations are applied, and before any checks are run or
code executed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358863 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Re-run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
Nico Weber [Sun, 21 Apr 2019 20:14:21 +0000 (20:14 +0000)]
gn build: Re-run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358862 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r358749
Nico Weber [Sun, 21 Apr 2019 20:08:45 +0000 (20:08 +0000)]
gn build: Merge r358749

Since the symlinks list for llvm-symbolizer is now never empty,
the :symlinks target no longer needs an explicit dep on :llvm-symbolizer
-- there will be at least one dep on a symlink, and each symlink depends
on :llvm-symbolizer already.

Since llvm-symbolizer:symlinks now produces symlinks that check-llvm
uses, make llvm/test depend on the symlink target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358861 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r358818 (JITLink)
Nico Weber [Sun, 21 Apr 2019 19:45:37 +0000 (19:45 +0000)]
gn build: Merge r358818 (JITLink)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358860 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cmake] Fix bug in r358779 - [CMake] Pass monorepo build settings in cross compile
Don Hinton [Sun, 21 Apr 2019 19:20:13 +0000 (19:20 +0000)]
[cmake] Fix bug in r358779 - [CMake] Pass monorepo build settings in cross compile

Escape semicolons in the targets list so that cmake doesn't expand
them to spaces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358859 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-undname: Fix hex escapes in wchar_t, char16_t, char32_t strings
Nico Weber [Sun, 21 Apr 2019 17:19:27 +0000 (17:19 +0000)]
llvm-undname: Fix hex escapes in wchar_t, char16_t, char32_t strings

llvm-undname used to put '\x' in front of every pair of nibbles, but
u"\xD7\xFF" produces a string with 6 bytes: \xD7 \0 \xFF \0 (and \0\0). Correct
for a single character (plus terminating \0) is u\xD7FF instead.
Now, wchar_t, char16_t, and char32_t strings roundtrip from source to
clang-cl (and cl.exe) and then llvm-undname.

(...at least as long as it's not a string like L"\xD7FF" L"foo" which
gets demangled as L"\xD7FFfoo", where the compiler then considers the
"f" as part of the hex escape. That seems ok.)

Also add a comment saying that the "almost-valid" char32_t string I
added in my last commit is actually produced by compilers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358857 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-undname: Fix stack overflow on almost-valid
Nico Weber [Sun, 21 Apr 2019 16:58:25 +0000 (16:58 +0000)]
llvm-undname: Fix stack overflow on almost-valid

If a unsigned with all 4 bytes non-0 was passed to outputHex(), there
were two off-by-ones in it:

- Both MaxPos and Pos left space for the final \0, which left the buffer
  one byte to small. Set MaxPos to 16 instead of 15 to fix.

- The `assert(Pos >= 0);` was after a `Pos--`, move it up one line.

Since valid Unicode codepoints are <= 0x10ffff, this could never really
happen in practice.

Found by oss-fuzz.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358856 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ConstantRange] Add saturating add/sub methods
Nikita Popov [Sun, 21 Apr 2019 15:23:05 +0000 (15:23 +0000)]
[ConstantRange] Add saturating add/sub methods

Add support for uadd_sat and friends to ConstantRange, so we can
handle uadd.sat and friends in LVI. The implementation is forwarding
to the corresponding APInt methods with appropriate bounds.

One thing worth pointing out here is that the handling of wrapping
ranges is not maximally accurate. A simple example is that adding 0
to a wrapped range will return a full range, rather than the original
wrapped range. The tests also only check that the non-wrapping
envelope is correct and minimal.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358855 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ConstantRange] Add getNonEmpty() constructor
Nikita Popov [Sun, 21 Apr 2019 15:22:54 +0000 (15:22 +0000)]
[ConstantRange] Add getNonEmpty() constructor

ConstantRanges have an annoying special case: If upper and lower are
the same, it can be either an empty or a full set. When constructing
constant ranges nearly always a full set is intended, but this still
requires an explicit check in many places.

This revision adds a getNonEmpty() constructor that disambiguates this
case: If upper and lower are the same, a full set is created.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358854 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64] add tests with multiple binop+splat vals; NFC
Sanjay Patel [Sun, 21 Apr 2019 15:01:19 +0000 (15:01 +0000)]
[AArch64] add tests with multiple binop+splat vals; NFC

See D60890 for context.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358853 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-undname: Fix stack overflow on invalid found by oss-fuzz
Nico Weber [Sun, 21 Apr 2019 14:25:07 +0000 (14:25 +0000)]
llvm-undname: Fix stack overflow on invalid found by oss-fuzz

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358852 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Fix build after r358837
Nico Weber [Sun, 21 Apr 2019 14:07:13 +0000 (14:07 +0000)]
gn build: Fix build after r358837

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358851 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Rewrite isLegalT2AddressImmediate
David Green [Sun, 21 Apr 2019 09:54:29 +0000 (09:54 +0000)]
[ARM] Rewrite isLegalT2AddressImmediate

This does two main things, firstly adding some at least basic addressing modes
for i64 types, and secondly treats floats and doubles sensibly when there is no
fpu. The floating point change can help codesize in some cases, especially with
D60294.

Most backends seems to not consider the exact VT in isLegalAddressingMode,
instead switching on type size. That is now what this does when the target does
not have an fpu (as the float data will be loaded using LDR's). i64's currently
use the address range of an LDRD (even though they may be legalised and loaded
with an LDR). This is at least better than marking them all as illegal
addressing modes.

I have not attempted to do much with vectors yet. That will need changing once
MVE is added.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358845 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add the rounding control operand to the printing for some scalar FMA instructions.
Craig Topper [Sun, 21 Apr 2019 07:12:56 +0000 (07:12 +0000)]
[X86] Add the rounding control operand to the printing for some scalar FMA instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358844 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CachePruning] Simplify comparator
Fangrui Song [Sun, 21 Apr 2019 06:17:40 +0000 (06:17 +0000)]
[CachePruning] Simplify comparator

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358843 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Add dependency on MCParser to unit test after rL358818
Fangrui Song [Sun, 21 Apr 2019 06:12:00 +0000 (06:12 +0000)]
[JITLink] Add dependency on MCParser to unit test after rL358818

This is required by -DBUILD_SHARED_LIBS=on builds for createMCAsmParser.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358842 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Don't form masked vfpclass instruction from and+vfpclass unless the fpclass...
Craig Topper [Sun, 21 Apr 2019 05:18:04 +0000 (05:18 +0000)]
[X86] Don't form masked vfpclass instruction from and+vfpclass unless the fpclass only has a single use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358841 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Remove an overly strict error check in JITLink's eh-frame parser.
Lang Hames [Sun, 21 Apr 2019 04:48:32 +0000 (04:48 +0000)]
[JITLink] Remove an overly strict error check in JITLink's eh-frame parser.

The error check required FDEs to refer to the most recent CIE, but the eh-frame
spec allows them to refer to any previously seen CIE. This patch removes the
offending check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358840 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[BinaryFormat] Fix bitfield-ordering of MachO::relocation_info on big-endian.
Lang Hames [Sun, 21 Apr 2019 03:14:43 +0000 (03:14 +0000)]
[BinaryFormat] Fix bitfield-ordering of MachO::relocation_info on big-endian.

Hopefully this will fix the JITLink regression test failures on big-endian
testers (e.g.
http://lab.llvm.org:8011/builders/clang-s390x-linux-lnt/builds/12702)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358839 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Factor basic common GOT and stub creation code into its own class.
Lang Hames [Sun, 21 Apr 2019 03:14:42 +0000 (03:14 +0000)]
[JITLink] Factor basic common GOT and stub creation code into its own class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358838 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[gn] Move Features.inc to clangd, create a config for it
Petr Hosek [Sun, 21 Apr 2019 01:09:15 +0000 (01:09 +0000)]
[gn] Move Features.inc to clangd, create a config for it

ClangdLSPServer and clangd unittests now include Features.inc so we
need to append the target_gen_dir that contains it to their
include_dirs. To do so, we use a public config that's applied to
any target that depends on the features one.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358837 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Add dependencies on MCDissassembler and Target to unit test.
Lang Hames [Sun, 21 Apr 2019 00:35:58 +0000 (00:35 +0000)]
[JITLink] Add dependencies on MCDissassembler and Target to unit test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358836 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-undname: Improve string literal demangling with embedded \0 chars
Nico Weber [Sat, 20 Apr 2019 23:59:06 +0000 (23:59 +0000)]
llvm-undname: Improve string literal demangling with embedded \0 chars

- Don't assert when a string looks like a u32 string to the heuristic
  but doesn't have a length that's 0 mod 4.  Instead, classify those
  as u16 with embedded \0 chars. Found by oss-fuzz.
- Print embedded nul bytes as \0 instead of \x00.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358835 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoftime-trace: Trace the name of the currently active pass as well.
Nico Weber [Sat, 20 Apr 2019 23:22:45 +0000 (23:22 +0000)]
ftime-trace: Trace the name of the currently active pass as well.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358834 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Add yet more detail to MachO/x86-64 unsupported relocation errors.
Lang Hames [Sat, 20 Apr 2019 22:59:43 +0000 (22:59 +0000)]
[JITLink] Add yet more detail to MachO/x86-64 unsupported relocation errors.

Knowing the address/symbolnum field values makes it easier to identify the
unsupported relocation, and provides enough information for the full bit
pattern of the relocation to be reconstructed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358833 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink][ORC] Add JITLink to the list of dependencies for ORC.
Lang Hames [Sat, 20 Apr 2019 22:15:57 +0000 (22:15 +0000)]
[JITLink][ORC] Add JITLink to the list of dependencies for ORC.

The new ObjectLinkingLayer in ORC depends on JITLink.

This should fix the build error at
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/9621

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358832 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Fix a bad formatv format string.
Lang Hames [Sat, 20 Apr 2019 22:06:12 +0000 (22:06 +0000)]
[JITLink] Fix a bad formatv format string.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358831 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Disable MachO/x86-64 regression test if the X86 target is not built.
Lang Hames [Sat, 20 Apr 2019 21:32:49 +0000 (21:32 +0000)]
[JITLink] Disable MachO/x86-64 regression test if the X86 target is not built.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358830 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r358800. Breaks Obsequi from the test suite.
Amara Emerson [Sat, 20 Apr 2019 21:25:00 +0000 (21:25 +0000)]
Revert r358800. Breaks Obsequi from the test suite.

The last attempt fixed gcc and consumer-typeset, but Obsequi seems to fail with
a different issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358829 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Add llvm-jitlink to the list of available tools in lit.
Lang Hames [Sat, 20 Apr 2019 20:05:30 +0000 (20:05 +0000)]
[JITLink] Add llvm-jitlink to the list of available tools in lit.

Should fix the 'llvm-jitlink command not found' errors that are appearing on
some builders.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358828 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Add BinaryFormat to JITLink's dependencies.
Lang Hames [Sat, 20 Apr 2019 19:48:45 +0000 (19:48 +0000)]
[JITLink] Add BinaryFormat to JITLink's dependencies.

Hopefully this will fix the missing dependence on llvm::identify_magic that is
showing up on some PPC bots. E.g.

http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/9617

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358827 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Add more detail to MachO/x86-64 "unsupported relocation" errors.
Lang Hames [Sat, 20 Apr 2019 18:50:13 +0000 (18:50 +0000)]
[JITLink] Add more detail to MachO/x86-64 "unsupported relocation" errors.

The extra information here will be helpful in diagnosing errors, like the
ones currently occuring on the PPC big-endian bots. :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358826 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Add check to JITLink unit test to bail out for unsupported targets.
Lang Hames [Sat, 20 Apr 2019 18:30:17 +0000 (18:30 +0000)]
[JITLink] Add check to JITLink unit test to bail out for unsupported targets.

This should prevent spurious JITLink unit test failures for builds that do not
support the target(s) required by the tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358825 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Silence some MSVC implicit cast warnings.
Lang Hames [Sat, 20 Apr 2019 18:30:16 +0000 (18:30 +0000)]
[JITLink] Silence some MSVC implicit cast warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358824 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Add llvm-jitlink subdirectory to tools/LLVMBuild.txt
Lang Hames [Sat, 20 Apr 2019 17:58:29 +0000 (17:58 +0000)]
[JITLink] Add llvm-jitlink subdirectory to tools/LLVMBuild.txt

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358823 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Use memset instead of bzero.
Lang Hames [Sat, 20 Apr 2019 17:49:58 +0000 (17:49 +0000)]
[JITLink] Use memset instead of bzero.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358822 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Silence a narrowing conversion warning.
Lang Hames [Sat, 20 Apr 2019 17:37:09 +0000 (17:37 +0000)]
[JITLink] Silence a narrowing conversion warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358821 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Update BuildingAJIT tutorials to account for API changes in r358818.
Lang Hames [Sat, 20 Apr 2019 17:35:28 +0000 (17:35 +0000)]
[JITLink] Update BuildingAJIT tutorials to account for API changes in r358818.

DynamicLibrarySearchGenerator::GetForCurrentProcess now takes a char (the global
prefix) rather than a DataLayout reference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358820 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[JITLink] Fix a missing header and bad prototype.
Lang Hames [Sat, 20 Apr 2019 17:29:57 +0000 (17:29 +0000)]
[JITLink] Fix a missing header and bad prototype.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358819 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoInitial implementation of JITLink - A replacement for RuntimeDyld.
Lang Hames [Sat, 20 Apr 2019 17:10:34 +0000 (17:10 +0000)]
Initial implementation of JITLink - A replacement for RuntimeDyld.

Summary:

JITLink is a jit-linker that performs the same high-level task as RuntimeDyld:
it parses relocatable object files and makes their contents runnable in a target
process.

JITLink aims to improve on RuntimeDyld in several ways:

(1) A clear design intended to maximize code-sharing while minimizing coupling.

RuntimeDyld has been developed in an ad-hoc fashion for a number of years and
this had led to intermingling of code for multiple architectures (e.g. in
RuntimeDyldELF::processRelocationRef) in a way that makes the code more
difficult to read, reason about, extend. JITLink is designed to isolate
format and architecture specific code, while still sharing generic code.

(2) Support for native code models.

RuntimeDyld required the use of large code models (where calls to external
functions are made indirectly via registers) for many of platforms due to its
restrictive model for stub generation (one "stub" per symbol). JITLink allows
arbitrary mutation of the atom graph, allowing both GOT and PLT atoms to be
added naturally.

(3) Native support for asynchronous linking.

JITLink uses asynchronous calls for symbol resolution and finalization: these
callbacks are passed a continuation function that they must call to complete the
linker's work. This allows for cleaner interoperation with the new concurrent
ORC JIT APIs, while still being easily implementable in synchronous style if
asynchrony is not needed.

To maximise sharing, the design has a hierarchy of common code:

(1) Generic atom-graph data structure and algorithms (e.g. dead stripping and
 |  memory allocation) that are intended to be shared by all architectures.
 |
 + -- (2) Shared per-format code that utilizes (1), e.g. Generic MachO to
       |  atom-graph parsing.
       |
       + -- (3) Architecture specific code that uses (1) and (2). E.g.
                JITLinkerMachO_x86_64, which adds x86-64 specific relocation
                support to (2) to build and patch up the atom graph.

To support asynchronous symbol resolution and finalization, the callbacks for
these operations take continuations as arguments:

  using JITLinkAsyncLookupContinuation =
      std::function<void(Expected<AsyncLookupResult> LR)>;

  using JITLinkAsyncLookupFunction =
      std::function<void(const DenseSet<StringRef> &Symbols,
                         JITLinkAsyncLookupContinuation LookupContinuation)>;

  using FinalizeContinuation = std::function<void(Error)>;

  virtual void finalizeAsync(FinalizeContinuation OnFinalize);

In addition to its headline features, JITLink also makes other improvements:

  - Dead stripping support: symbols that are not used (e.g. redundant ODR
    definitions) are discarded, and take up no memory in the target process
    (In contrast, RuntimeDyld supported pointer equality for weak definitions,
    but the redundant definitions stayed resident in memory).

  - Improved exception handling support. JITLink provides a much more extensive
    eh-frame parser than RuntimeDyld, and is able to correctly fix up many
    eh-frame sections that RuntimeDyld currently (silently) fails on.

  - More extensive validation and error handling throughout.

This initial patch supports linking MachO/x86-64 only. Work on support for
other architectures and formats will happen in-tree.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358818 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Disable argument copy elision for arguments passed via pointers
Craig Topper [Sat, 20 Apr 2019 15:26:44 +0000 (15:26 +0000)]
[X86] Disable argument copy elision for arguments passed via pointers

Summary:
If you pass two 1024 bit vectors in IR with AVX2 on Windows 64. Both vectors will be split in four 256 bit pieces. The four pieces of the first argument will be passed indirectly using 4 gprs. The second argument will get passed via pointers in memory.

The PartOffsets stored for the second argument are all in terms of its original 1024 bit size. So the PartOffsets for each piece are 32 bytes apart. So if we consider it for copy elision we'll only load an 8 byte pointer, but we'll move the address 32 bytes. The stack object size we create for the first part is probably wrong too.

This issue was encountered by ISPC. I'm working on getting a reduce test case, but wanted to go ahead and get feedback on the fix.

Reviewers: rnk

Reviewed By: rnk

Subscribers: dbabokin, llvm-commits, hiraditya

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358817 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CorrelatedValuePropagation] Mark subs that we know not to wrap with nuw/nsw.
Luqman Aden [Sat, 20 Apr 2019 13:14:18 +0000 (13:14 +0000)]
[CorrelatedValuePropagation] Mark subs that we know not to wrap with nuw/nsw.

Summary:
Teach CorrelatedValuePropagation to also handle sub instructions in addition to add. Relatively simple since makeGuaranteedNoWrapRegion already understood sub instructions. Only subtle change is which range is passed as "Other" to that function, since sub isn't commutative.

Note that CorrelatedValuePropagation::processAddSub is still hidden behind a default-off flag as IndVarSimplify hasn't yet been fixed to strip the added nsw/nuw flags and causes a miscompile. (PR31181)

Reviewers: sanjoy, apilipenko, nikic

Reviewed By: nikic

Subscribers: hiraditya, jfb, jdoerfert, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358816 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ExecutionDomainFix] Optimize a binary search insertion
Fangrui Song [Sat, 20 Apr 2019 13:00:50 +0000 (13:00 +0000)]
[ExecutionDomainFix] Optimize a binary search insertion

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358815 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-symbolizer] Fix section index at the end of a section
Fangrui Song [Sat, 20 Apr 2019 13:00:09 +0000 (13:00 +0000)]
[llvm-symbolizer] Fix section index at the end of a section

This is very minor issue. The returned section index is only used by
DWARFDebugLine as an llvm::upper_bound input and the use case shouldn't
cause any behavioral change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358814 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[IndVarSimplify] Generate full checks for some LFTR tests; NFC
Nikita Popov [Sat, 20 Apr 2019 12:05:53 +0000 (12:05 +0000)]
[IndVarSimplify] Generate full checks for some LFTR tests; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358813 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[IndVarSimplify] Add tests for PR31181; NFC
Nikita Popov [Sat, 20 Apr 2019 12:05:43 +0000 (12:05 +0000)]
[IndVarSimplify] Add tests for PR31181; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358812 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ADT] Avoid warning in bsearch testcase
Sam McCall [Sat, 20 Apr 2019 11:48:11 +0000 (11:48 +0000)]
[ADT] Avoid warning in bsearch testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358811 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objdump] Fix End in disassemblyObject after rL358806
Fangrui Song [Sat, 20 Apr 2019 07:48:41 +0000 (07:48 +0000)]
[llvm-objdump] Fix End in disassemblyObject after rL358806

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358809 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CVP] Add tests for sub nowrap inference; NFC
Nikita Popov [Sat, 20 Apr 2019 07:43:15 +0000 (07:43 +0000)]
[CVP] Add tests for sub nowrap inference; NFC

These are baseline tests for D60036.

Patch by Luqman Aden.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358808 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Fix stack probing on x32 (PR41477)
Nikita Popov [Sat, 20 Apr 2019 07:25:46 +0000 (07:25 +0000)]
[X86] Fix stack probing on x32 (PR41477)

Fix for https://bugs.llvm.org/show_bug.cgi?id=41477. On the x32 ABI
with stack probing a dynamic alloca will result in a WIN_ALLOCA_32
with a 32-bit size. The current implementation tries to copy it into
RAX, resulting in a physreg copy error. Fix this by copying to EAX
instead. Also fix incorrect opcodes or registers used in subs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358807 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objdump] Don't disassemble symbols before SectionAddr
Fangrui Song [Sat, 20 Apr 2019 07:19:24 +0000 (07:19 +0000)]
[llvm-objdump] Don't disassemble symbols before SectionAddr

This was caught by UBSAN

tools/llvm-objdump/X86/macho-disassembly-g-dsym.test
tools/llvm-objdump/X86/hex-displacement.test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358806 91177308-0d34-0410-b5e6-96231b3b80d8