1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
Commit Graph

177758 Commits

Author SHA1 Message Date
Lang Hames
e7ec9fc434 [JITLink] Add dependencies on MCDissassembler and Target to unit test.
llvm-svn: 358836
2019-04-21 00:35:58 +00:00
Nico Weber
592e87fcac 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.

llvm-svn: 358835
2019-04-20 23:59:06 +00:00
Nico Weber
0ba2ed34ca ftime-trace: Trace the name of the currently active pass as well.
Differential Revision: https://reviews.llvm.org/D60782

llvm-svn: 358834
2019-04-20 23:22:45 +00:00
Lang Hames
388a0f276e [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.

llvm-svn: 358833
2019-04-20 22:59:43 +00:00
Lang Hames
8eb7dc6cb8 [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

llvm-svn: 358832
2019-04-20 22:15:57 +00:00
Lang Hames
95c8b8f8ef [JITLink] Fix a bad formatv format string.
llvm-svn: 358831
2019-04-20 22:06:12 +00:00
Lang Hames
053740b601 [JITLink] Disable MachO/x86-64 regression test if the X86 target is not built.
llvm-svn: 358830
2019-04-20 21:32:49 +00:00
Amara Emerson
4cebcd0399 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.

llvm-svn: 358829
2019-04-20 21:25:00 +00:00
Lang Hames
1ab2f5937d [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.

llvm-svn: 358828
2019-04-20 20:05:30 +00:00
Lang Hames
a887c59e4e [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

llvm-svn: 358827
2019-04-20 19:48:45 +00:00
Lang Hames
10cceb6e9d [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. :)

llvm-svn: 358826
2019-04-20 18:50:13 +00:00
Lang Hames
064aac5cac [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.

llvm-svn: 358825
2019-04-20 18:30:17 +00:00
Lang Hames
b448b59b2a [JITLink] Silence some MSVC implicit cast warnings.
llvm-svn: 358824
2019-04-20 18:30:16 +00:00
Lang Hames
06dc42e6b7 [JITLink] Add llvm-jitlink subdirectory to tools/LLVMBuild.txt
llvm-svn: 358823
2019-04-20 17:58:29 +00:00
Lang Hames
e86d3b65d6 [JITLink] Use memset instead of bzero.
llvm-svn: 358822
2019-04-20 17:49:58 +00:00
Lang Hames
91cc6aa927 [JITLink] Silence a narrowing conversion warning.
llvm-svn: 358821
2019-04-20 17:37:09 +00:00
Lang Hames
14f7b1d72a [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.

llvm-svn: 358820
2019-04-20 17:35:28 +00:00
Lang Hames
6dfb930f8e [JITLink] Fix a missing header and bad prototype.
llvm-svn: 358819
2019-04-20 17:29:57 +00:00
Lang Hames
171c1e7cd2 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

llvm-svn: 358818
2019-04-20 17:10:34 +00:00
Craig Topper
a84e232f6d [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

llvm-svn: 358817
2019-04-20 15:26:44 +00:00
Luqman Aden
3de4f211cc [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

llvm-svn: 358816
2019-04-20 13:14:18 +00:00
Fangrui Song
5a6d72c18b [ExecutionDomainFix] Optimize a binary search insertion
llvm-svn: 358815
2019-04-20 13:00:50 +00:00
Fangrui Song
ae033f7c31 [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.

llvm-svn: 358814
2019-04-20 13:00:09 +00:00
Nikita Popov
c8ff4f9460 [IndVarSimplify] Generate full checks for some LFTR tests; NFC
llvm-svn: 358813
2019-04-20 12:05:53 +00:00
Nikita Popov
468a932789 [IndVarSimplify] Add tests for PR31181; NFC
llvm-svn: 358812
2019-04-20 12:05:43 +00:00
Sam McCall
cd2e6380fb [ADT] Avoid warning in bsearch testcase
llvm-svn: 358811
2019-04-20 11:48:11 +00:00
Fangrui Song
45c9e0a35b [llvm-objdump] Fix End in disassemblyObject after rL358806
llvm-svn: 358809
2019-04-20 07:48:41 +00:00
Nikita Popov
c9858aaa9c [CVP] Add tests for sub nowrap inference; NFC
These are baseline tests for D60036.

Patch by Luqman Aden.

llvm-svn: 358808
2019-04-20 07:43:15 +00:00
Nikita Popov
26057f3875 [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.

llvm-svn: 358807
2019-04-20 07:25:46 +00:00
Fangrui Song
1bdbff2ffe [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

llvm-svn: 358806
2019-04-20 07:19:24 +00:00
Craig Topper
c93a8c7318 [X86] Don't turn (and (shl X, C1), C2) into (shl (and X, (C1 >> C2), C2) if the original AND can represented by MOVZX.
The MOVZX doesn't require an immediate to be encoded at all. Though it does use
a 2 byte opcode so its the same size as a 1 byte immediate. But it has a
separate source and dest register so can help avoid copies.

llvm-svn: 358805
2019-04-20 04:38:53 +00:00
Craig Topper
d238d74c5c [X86] Turn (and (anyextend (shl X, C1), C2)) into (shl (and (anyextend X), (C1 >> C2), C2) if the AND could match a movzx.
There's one slight regression in here because we don't check that the immediate
already allowed movzx before the shift. I'll fix that next.

llvm-svn: 358804
2019-04-20 04:38:49 +00:00
Fangrui Song
6a3e843a40 [llvm-objdump] Simplify --{start,stop}-address
llvm-svn: 358803
2019-04-20 02:10:48 +00:00
Sam Clegg
af3749ae7f [WebAssembly] Object: Improve error messages on invalid section
Also add a test.

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

llvm-svn: 358801
2019-04-20 00:11:46 +00:00
Amara Emerson
8abbc39fc7 Revert "Revert "[GlobalISel] Add legalization support for non-power-2 loads and stores""
We were shifting the wrong component of a split load when trying to combine them
back into a single value.

llvm-svn: 358800
2019-04-19 23:54:44 +00:00
Jessica Paquette
d57f5959df [GlobalISel][AArch64] Legalize + select G_FRINT
Exactly the same as G_FCEIL, G_FABS, etc.

Add tests for the fp16/nofp16 behaviour, update arm64-vfloatintrinsics, etc.

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

llvm-svn: 358799
2019-04-19 23:41:52 +00:00
Sam Clegg
ed23d6653e [WebAssembly] FastISel: Don't fallback to SelectionDAG after BuildMI in selectCall
My understanding is that once BuildMI has been called we can't fallback
to SelectionDAG.

This change moves the fallback for when getRegForValue() fails for
that target of an indirect call.  This was failing in -fPIC mode when
the callee is GlobalValue.

Add a test case that tickles this.

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

llvm-svn: 358793
2019-04-19 22:43:32 +00:00
Vedant Kumar
8f7976f381 [GVN+LICM] Use line 0 locations for better crash attribution
This is a follow-up to r291037+r291258, which used null debug locations
to prevent jumpy line tables.

Using line 0 locations achieves the same effect, but works better for
crash attribution because it preserves the right inline scope.

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

llvm-svn: 358791
2019-04-19 22:36:40 +00:00
Vitaly Buka
e7a16d2932 Update GN files to build with r358103
llvm-svn: 358790
2019-04-19 22:27:50 +00:00
Eric Christopher
ffcbe1a0a8 Remove the EnableEarlyCSEMemSSA set of options from the legacy
and new pass managers. They were default to true and not being
used.

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

llvm-svn: 358789
2019-04-19 22:18:53 +00:00
Eli Friedman
1ee278d235 [AArch64] Fix checks for AArch64MCExpr::VK_SABS flag.
VK_SABS is part of the SymLoc bitfield in the variant kind which should
be compared for equality, not by checking the VK_SABS bit.

As far as I know, the existing code happened to produce the correct
results in all cases, so this is just a cleanup.

Patch by Stephen Crane.

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

llvm-svn: 358788
2019-04-19 21:58:10 +00:00
Jessica Paquette
5317d933b8 [GlobalISel] Add IRTranslator support for G_FRINT
Add it as a simple intrinsic, update arm64-irtranslator.ll.

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

llvm-svn: 358787
2019-04-19 21:46:12 +00:00
Amy Huang
2c899cec57 Attempt to fix buildbot failure in commit 1bb57bac959ac163fd7d8a76d734ca3e0ecee6ab.
llvm-svn: 358786
2019-04-19 21:44:30 +00:00
Jessica Paquette
6966425d24 [GlobalISel] Add a G_FRINT opcode
Equivalent to SelectionDAG's frint node.

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

llvm-svn: 358785
2019-04-19 21:44:16 +00:00
Craig Topper
efadd66099 [X86] Add test case for D60801. NFC
llvm-svn: 358784
2019-04-19 21:39:16 +00:00
Amy Huang
5ecc3adfcb [MS] Emit S_HEAPALLOCSITE debug info
Summary:
This emits labels around heapallocsite calls and S_HEAPALLOCSITE debug
info in codeview. Currently only changes FastISel, so emitting labels still
needs to be implemented in SelectionDAG.

Reviewers: hans, rnk

Subscribers: aprantl, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 358783
2019-04-19 21:09:11 +00:00
Chris Bieneman
71e0dfe09e [CMake] Pass monorepo build settings in cross compile
This allows the cross compiled build targets to configure the LLVM tools and sub-projects that are part of the main build.

This is needed for generating native non llvm *-tablegen tools when cross compiling clang in the monorepo build environment.

llvm-svn: 358779
2019-04-19 20:08:55 +00:00
Petr Hosek
070eff6077 [gn] Support dots in CMake paths in the sync script
Some file paths use dots to pick up sources from parent directories.

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

llvm-svn: 358774
2019-04-19 18:29:17 +00:00
Alina Sbirlea
2423cbba94 [LICM & MemorySSA] Make limit flags pass tuning options.
Summary:
Make the flags in LICM + MemorySSA tuning options in the old and new
pass managers.

Subscribers: mehdi_amini, jlebar, Prazek, george.burgess.iv, llvm-commits

Tags: #llvm

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

llvm-svn: 358772
2019-04-19 17:46:50 +00:00
Amara Emerson
771972a5c7 Revert "[GlobalISel] Add legalization support for non-power-2 loads and stores"
This introduces some runtime failures which I'll need to investigate further.

llvm-svn: 358771
2019-04-19 17:42:13 +00:00