OSDN Git Service

android-x86/external-llvm.git
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

5 years ago[X86] Don't turn (and (shl X, C1), C2) into (shl (and X, (C1 >> C2), C2) if the origi...
Craig Topper [Sat, 20 Apr 2019 04:38:53 +0000 (04:38 +0000)]
[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.

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

5 years ago[X86] Turn (and (anyextend (shl X, C1), C2)) into (shl (and (anyextend X), (C1 >...
Craig Topper [Sat, 20 Apr 2019 04:38:49 +0000 (04:38 +0000)]
[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.

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

5 years ago[llvm-objdump] Simplify --{start,stop}-address
Fangrui Song [Sat, 20 Apr 2019 02:10:48 +0000 (02:10 +0000)]
[llvm-objdump] Simplify --{start,stop}-address

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

5 years ago[WebAssembly] Object: Improve error messages on invalid section
Sam Clegg [Sat, 20 Apr 2019 00:11:46 +0000 (00:11 +0000)]
[WebAssembly] Object: Improve error messages on invalid section

Also add a test.

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

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

5 years agoRevert "Revert "[GlobalISel] Add legalization support for non-power-2 loads and stores""
Amara Emerson [Fri, 19 Apr 2019 23:54:44 +0000 (23:54 +0000)]
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.

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

5 years ago[GlobalISel][AArch64] Legalize + select G_FRINT
Jessica Paquette [Fri, 19 Apr 2019 23:41:52 +0000 (23:41 +0000)]
[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

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

5 years ago[WebAssembly] FastISel: Don't fallback to SelectionDAG after BuildMI in selectCall
Sam Clegg [Fri, 19 Apr 2019 22:43:32 +0000 (22:43 +0000)]
[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

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

5 years ago[GVN+LICM] Use line 0 locations for better crash attribution
Vedant Kumar [Fri, 19 Apr 2019 22:36:40 +0000 (22:36 +0000)]
[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

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

5 years agoUpdate GN files to build with r358103
Vitaly Buka [Fri, 19 Apr 2019 22:27:50 +0000 (22:27 +0000)]
Update GN files to build with r358103

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

5 years agoRemove the EnableEarlyCSEMemSSA set of options from the legacy
Eric Christopher [Fri, 19 Apr 2019 22:18:53 +0000 (22:18 +0000)]
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

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

5 years ago[AArch64] Fix checks for AArch64MCExpr::VK_SABS flag.
Eli Friedman [Fri, 19 Apr 2019 21:58:10 +0000 (21:58 +0000)]
[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

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

5 years ago[GlobalISel] Add IRTranslator support for G_FRINT
Jessica Paquette [Fri, 19 Apr 2019 21:46:12 +0000 (21:46 +0000)]
[GlobalISel] Add IRTranslator support for G_FRINT

Add it as a simple intrinsic, update arm64-irtranslator.ll.

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

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

5 years agoAttempt to fix buildbot failure in commit 1bb57bac959ac163fd7d8a76d734ca3e0ecee6ab.
Amy Huang [Fri, 19 Apr 2019 21:44:30 +0000 (21:44 +0000)]
Attempt to fix buildbot failure in commit 1bb57bac959ac163fd7d8a76d734ca3e0ecee6ab.

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

5 years ago[GlobalISel] Add a G_FRINT opcode
Jessica Paquette [Fri, 19 Apr 2019 21:44:16 +0000 (21:44 +0000)]
[GlobalISel] Add a G_FRINT opcode

Equivalent to SelectionDAG's frint node.

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

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

5 years ago[X86] Add test case for D60801. NFC
Craig Topper [Fri, 19 Apr 2019 21:39:16 +0000 (21:39 +0000)]
[X86] Add test case for D60801. NFC

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

5 years ago[MS] Emit S_HEAPALLOCSITE debug info
Amy Huang [Fri, 19 Apr 2019 21:09:11 +0000 (21:09 +0000)]
[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

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

5 years ago[CMake] Pass monorepo build settings in cross compile
Chris Bieneman [Fri, 19 Apr 2019 20:08:55 +0000 (20:08 +0000)]
[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.

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

5 years ago[gn] Support dots in CMake paths in the sync script
Petr Hosek [Fri, 19 Apr 2019 18:29:17 +0000 (18:29 +0000)]
[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

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

5 years ago[LICM & MemorySSA] Make limit flags pass tuning options.
Alina Sbirlea [Fri, 19 Apr 2019 17:46:50 +0000 (17:46 +0000)]
[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

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

5 years agoRevert "[GlobalISel] Add legalization support for non-power-2 loads and stores"
Amara Emerson [Fri, 19 Apr 2019 17:42:13 +0000 (17:42 +0000)]
Revert "[GlobalISel] Add legalization support for non-power-2 loads and stores"

This introduces some runtime failures which I'll need to investigate further.

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

5 years ago[GlobalISel][AArch64] Legalize vector G_FPOW
Jessica Paquette [Fri, 19 Apr 2019 16:28:08 +0000 (16:28 +0000)]
[GlobalISel][AArch64] Legalize vector G_FPOW

This instruction is legalized in the same way as G_FSIN, G_FCOS, G_FLOG10, etc.

Update legalize-pow.mir and arm64-vfloatintrinsics.ll to reflect the change.

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

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

5 years ago[NewPassManager] Adding pass tuning options: loop vectorize.
Alina Sbirlea [Fri, 19 Apr 2019 16:11:59 +0000 (16:11 +0000)]
[NewPassManager] Adding pass tuning options: loop vectorize.

Summary:
Trying to add the plumbing necessary to add tuning options to the new pass manager.
Testing with the flags for loop vectorize.

Reviewers: chandlerc

Subscribers: sanjoy, mehdi_amini, jlebar, steven_wu, dexonsmith, dang, llvm-commits

Tags: #llvm

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

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

5 years ago[dsymutil] DwarfLinker: delete unused parameter
Fangrui Song [Fri, 19 Apr 2019 15:45:25 +0000 (15:45 +0000)]
[dsymutil] DwarfLinker: delete unused parameter

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

5 years ago[SelectionDAG] soften splat mask assert/unreachable (PR41535)
Sanjay Patel [Fri, 19 Apr 2019 15:31:11 +0000 (15:31 +0000)]
[SelectionDAG] soften splat mask assert/unreachable (PR41535)

These are general queries, so they should not die when given
a degenerate input like an all undef mask. Callers should be
able to deal with an op that will eventually be simplified away.

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

5 years agollvm-undname: Attempt to fix leak-on-invalid found by oss-fuzz
Nico Weber [Fri, 19 Apr 2019 14:13:11 +0000 (14:13 +0000)]
llvm-undname: Attempt to fix leak-on-invalid found by oss-fuzz

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

5 years agogn build: Merge r358722
Nico Weber [Fri, 19 Apr 2019 13:18:41 +0000 (13:18 +0000)]
gn build: Merge r358722

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

5 years agogn build: Merge r358691
Nico Weber [Fri, 19 Apr 2019 13:16:26 +0000 (13:16 +0000)]
gn build: Merge r358691

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

5 years ago[LTO] Add plumbing to save stats during LTO on Darwin.
Florian Hahn [Fri, 19 Apr 2019 12:36:41 +0000 (12:36 +0000)]
[LTO] Add plumbing to save stats during LTO on Darwin.

Gold and ld on Linux already support saving stats, but the
infrastructure is missing on Darwin. Unfortunately it seems like the
configuration from lib/LTO/LTO.cpp is not used.

This patch adds a new LTOStatsFile option and adds plumbing in Clang to
use it on Darwin, similar to the way remarks are handled.

Currnetly the handling of LTO flags seems quite spread out, with a bunch
of duplication. But I am not sure if there is an easy way to improve
that?

Reviewers: anemet, tejohnson, thegameg, steven_wu

Reviewed By: steven_wu

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

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

5 years agoChange \r\n -> \n for llvm-symbolizer/help.test after rL358749
Fangrui Song [Fri, 19 Apr 2019 12:28:36 +0000 (12:28 +0000)]
Change \r\n -> \n for llvm-symbolizer/help.test after rL358749

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

5 years ago[llvm-symbolizer] Add llvm-addr2line
Igor Kudrin [Fri, 19 Apr 2019 10:17:52 +0000 (10:17 +0000)]
[llvm-symbolizer] Add llvm-addr2line

This adds an alias for llvm-symbolizer with different defaults so that
it can be used as a drop-in replacement for GNU's addr2line.

If a substring "addr2line" is found in the tool's name:
  * it defaults "-i", "-f" and "-C" to OFF;
  * it uses "--output-style=GNU" by default.

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

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

5 years ago[llvm-symbolizer] Unhide and document the "-output-style" option
Igor Kudrin [Fri, 19 Apr 2019 10:14:18 +0000 (10:14 +0000)]
[llvm-symbolizer] Unhide and document the "-output-style" option

With the latest changes, the option gets useful for users of
llvm-symbolizer, not only for the upcoming llvm-addr2line.

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

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

5 years ago[llvm-symbolizer] Make the output with -output-style=GNU closer to addr2line's
Igor Kudrin [Fri, 19 Apr 2019 10:12:56 +0000 (10:12 +0000)]
[llvm-symbolizer] Make the output with -output-style=GNU closer to addr2line's

This patch addresses two differences in the output of llvm-symbolizer
and GNU's addr2line:

* llvm-symbolizer prints an empty line after the report for an address.

* With "-f -i=0", llvm-symbolizer replaces the name of an inlined
  function with the name from the symbol table, i. e., the top caller
  function in the inlining chain. addr2line preserves the name of the
  inlined function.

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

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

5 years ago[AMDGPU] Regenerate extractelt->truncate test.
Simon Pilgrim [Fri, 19 Apr 2019 09:49:04 +0000 (09:49 +0000)]
[AMDGPU] Regenerate extractelt->truncate test.

Prep work for D60462

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

5 years ago[CodeGen] Add "const" to MachineInstr::mayAlias
Bjorn Pettersson [Fri, 19 Apr 2019 09:08:38 +0000 (09:08 +0000)]
[CodeGen] Add "const" to MachineInstr::mayAlias

Summary:
The basic idea here is to make it possible to use
MachineInstr::mayAlias also when the MachineInstr
is const (or the "Other" MachineInstr is const).

The addition of const in MachineInstr::mayAlias
then rippled down to the need for adding const
in several other places, such as
TargetTransformInfo::getMemOperandWithOffset.

Reviewers: hfinkel

Reviewed By: hfinkel

Subscribers: hfinkel, MatzeB, arsenm, jvesely, nhaehnle, hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

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

5 years ago[PATCH] [MachineScheduler] Check pending instructions when an instruction is scheduled
James Molloy [Fri, 19 Apr 2019 09:00:55 +0000 (09:00 +0000)]
[PATCH] [MachineScheduler] Check pending instructions when an instruction is scheduled

Pending instructions that may have been blocked from being available by the HazardRecognizer may no longer may not be blocked any more when an instruction is scheduled; pending instructions should be re-checked in this case.

This is primarily aimed at VLIW targets with large parallelism and esoteric constraints.

No testcase as no in-tree targets have this behavior.

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

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

5 years ago[MergeFunc] Delete unused FunctionNode::release()
Fangrui Song [Fri, 19 Apr 2019 08:03:20 +0000 (08:03 +0000)]
[MergeFunc] Delete unused FunctionNode::release()

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

5 years ago[MergeFunc] removeUsers: call remove() only on direct users
Fangrui Song [Fri, 19 Apr 2019 07:57:51 +0000 (07:57 +0000)]
[MergeFunc] removeUsers: call remove() only on direct users

removeUsers uses a work list to collect indirect users and call remove()
on those functions. However it has a bug (`if (!Visited.insert(UU).second)`).

Actually, we don't have to collect indirect users.
After the merge of F and G, G's callers will be considered (added to
Deferred). If G's callers can be merged, G's callers' callers will be
considered.

Update the test unnamed-addr-reprocessing.ll to make it clear we can
still merge indirect callers.

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

5 years ago[AMDGPU] Ignore non-SUnits edges
Piotr Sobczak [Fri, 19 Apr 2019 06:19:14 +0000 (06:19 +0000)]
[AMDGPU] Ignore non-SUnits edges

Summary:
Ignore edges to non-SUnits (e.g. ExitSU) when checking
for low latency instructions.

When calling the function isLowLatencyInstruction(),
an ExitSU could be on the list of successors, not necessarily
a regular SU. In other places in the code there is a check
"Succ->NodeNum >= DAGSize" to prevent further processing of
ExitSU as "Succ->getInstr()" is NULL in such a case.
Also, 8 out of 9 cases of "SUnit *Succ = SuccDep.getSUnit())"
has the guard, so it is clearly an omission here.

Change-Id: Ica86f0327c7b2e6bcb56958e804ea6c71084663b

Reviewers: nhaehnle

Reviewed By: nhaehnle

Subscribers: MatzeB, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits

Tags: #llvm

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

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

5 years ago[CallSite removal] Move the legacy PM, call graph, and some inliner
Chandler Carruth [Fri, 19 Apr 2019 05:59:42 +0000 (05:59 +0000)]
[CallSite removal]  Move the legacy PM, call graph, and some inliner
code to `CallBase`.

This patch focuses on the legacy PM, call graph, and some of inliner and legacy
passes interacting with those APIs from `CallSite` to the new `CallBase` class.
No interesting changes.

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

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

5 years ago[MergeFunc] Use less_first() as the comparator of Schwartzian transform
Fangrui Song [Fri, 19 Apr 2019 05:49:29 +0000 (05:49 +0000)]
[MergeFunc] Use less_first() as the comparator of Schwartzian transform

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

5 years ago[X86] Turn (and (shl X, C1), C2) into (shl (and X, (C1 >> C2), C2) if the AND could...
Craig Topper [Fri, 19 Apr 2019 05:48:13 +0000 (05:48 +0000)]
[X86] Turn (and (shl X, C1), C2) into (shl (and X, (C1 >> C2), C2) if the AND could match a movzx.

Could get further improvements by recognizing (i64 and (anyext (i32 shl))).

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

5 years ago[X86] Add test cases for turning (and (shl X, C1), C2) into (shl (and X, (C1 >> C2...
Craig Topper [Fri, 19 Apr 2019 05:48:09 +0000 (05:48 +0000)]
[X86] Add test cases for turning (and (shl X, C1), C2) into (shl (and X, (C1 >> C2), C2) when the AND could match to a movzx.

We already reorder when C1 >> C2 would allow a smaller immediate encoding.

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

5 years ago[X86] Make sure we copy the HandleSDNode back to N before executing the default code...
Craig Topper [Fri, 19 Apr 2019 04:52:21 +0000 (04:52 +0000)]
[X86] Make sure we copy the HandleSDNode back to N before executing the default code after the switch in matchAddressRecursively

Summary:
There are two places where we create a HandleSDNode in address matching in order to handle the case where N is changed by CSE. But if we end up not matching, we fall back to code at the bottom of the switch that really would like N to point to something that wasn't CSEd away. So we should make sure we copy the handle back to N on any paths that can reach that code.

This appears to be the true reason we needed to check DELETED_NODE in the negation matching. In pr32329.ll we had two subtracts back to back. We recursed through the first subtract, and onto the second subtract. The second subtract called matchAddressRecursively on its LHS which caused that subtract to CSE. We ultimately failed the match and ended up in the default code. But N was pointing at the old node that had been deleted, but the default code didn't know that and took it as the base register. Then we unwound back to the first subtract and tried to access this bogus base reg requiring the check for deleted node. With this patch we now use the CSE result as the base reg instead.

matchAdd has been broken since sometime in 2015 when it was pulled out of the switch into a helper function. The assignment to N at the end was still there, but N was passed by value and not by reference so the update didn't go anywhere.

Reviewers: niravd, spatel, RKSimon, bkramer

Reviewed By: niravd

Subscribers: llvm-commits, hiraditya

Tags: #llvm

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

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

5 years ago[DWARF] Use hasFileAtIndex to properly verify DWARF 5 after rL358732
Fangrui Song [Fri, 19 Apr 2019 03:34:28 +0000 (03:34 +0000)]
[DWARF] Use hasFileAtIndex to properly verify DWARF 5 after rL358732

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

5 years ago[llvm] Prevent duplicate files in debug line header in dwarf 5: another attempt
Ali Tamur [Fri, 19 Apr 2019 02:26:56 +0000 (02:26 +0000)]
[llvm] Prevent duplicate files in debug line header in dwarf 5: another attempt

Another attempt to land the changes in debug line header to prevent duplicate
files in Dwarf 5. I rolled back my previous commit because of a mistake in
generating the object file in a test. Meanwhile, I addressed some offline
comments and changed the implementation; the largest difference is that
MCDwarfLineTableHeader does not keep DwarfVersion but gets it as a parameter. I
also merged the patch to fix two lld tests that will strt to fail into this
patch.

Original Commit:

https://reviews.llvm.org/D59515

Original Message:
Motivation: In previous dwarf versions, file name indexes started from 1, and
the primary source file was not explicit. Dwarf 5 standard (6.2.4) prescribes
the primary source file to be explicitly given an entry with an index number 0.

The current implementation honors the specification by just duplicating the
main source file, once with index number 0, and later maybe with another
index number. While this is compliant with the letter of the standard, the
duplication causes problems for consumers of this information such as lldb.
(Some files are duplicated, where only some of them have a line table although
all refer to the same file)

With this change, dwarf 5 debug line section files always start from 0, and
the zeroth entry is not duplicated whenever possible. This requires different
handling of dwarf 4 and dwarf 5 during generation (e.g. when a function returns
an index zero for a file name, it signals an error in dwarf 4, but not in dwarf
5) However, I think the minor complication is worth it, because it enables all
consumers (lldb, gdb, dwarfdump, objdump, and so on) to treat all files in the
file name list homogenously.

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

5 years ago[APInt] Optimize umul_ov
Fangrui Song [Fri, 19 Apr 2019 02:06:06 +0000 (02:06 +0000)]
[APInt] Optimize umul_ov

Change two costly udiv() calls to lshr(1)*RHS + left-shift + plus

On one 64-bit umul_ov benchmark, I measured an obvious improvement: 12.8129s -> 3.6257s

Note, there may be some value to special case 64-bit (the most common
case) with __builtin_umulll_overflow().

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

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

5 years agoMergeFunc: preserve COMDAT information when creating a thunk
Saleem Abdulrasool [Fri, 19 Apr 2019 01:48:36 +0000 (01:48 +0000)]
MergeFunc: preserve COMDAT information when creating a thunk

We would previously drop the COMDAT on the thunk we generated when replacing a
function body with the forwarding thunk. This would result in a function that
may have been multiply emitted and multiply merged to be emitted with the same
name without the COMDAT. This is a hard error with PE/COFF where the COMDAT is
used for the deduplication of Value Witness functions for Swift.

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

5 years ago[LoopUnroll] Move list of params into a struct [NFCI].
Alina Sbirlea [Thu, 18 Apr 2019 23:43:49 +0000 (23:43 +0000)]
[LoopUnroll] Move list of params into a struct [NFCI].

Summary: Cleanup suggested in review of r358304.

Reviewers: sanjoy, efriedma

Subscribers: jlebar, zzheng, dmgreen, llvm-commits

Tags: #llvm

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

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

5 years ago[AArch64] add tests for mul-by-element; NFC
Sanjay Patel [Thu, 18 Apr 2019 21:48:46 +0000 (21:48 +0000)]
[AArch64] add tests for mul-by-element; NFC

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

5 years agoImplement sys::fs::copy_file using the macOS copyfile(3) API
Adrian Prantl [Thu, 18 Apr 2019 21:22:50 +0000 (21:22 +0000)]
Implement sys::fs::copy_file using the macOS copyfile(3) API
to support APFS clones.

This patch adds a Darwin-specific implementation of
llvm::sys::fs::copy_file() that uses the macOS copyfile(3) API to
support APFS copy-on-write clones, which should be faster and much
more space efficient.

https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/APFS_Guide/ToolsandAPIs/ToolsandAPIs.html

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

This reapplies 358628 with an additional bugfix handling the case
where the destination file already exists. (Caught by the clang testsuite).

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

5 years ago[GlobalISel][AArch64] Legalize/select G_(S/Z/ANY)_EXT for v8s8s
Jessica Paquette [Thu, 18 Apr 2019 21:15:48 +0000 (21:15 +0000)]
[GlobalISel][AArch64] Legalize/select G_(S/Z/ANY)_EXT for v8s8s

This adds legalization for G_SEXT, G_ZEXT, and G_ANYEXT for v8s8s.

We were falling back on G_ZEXT in arm64-vabs.ll before, preventing us from
selecting the @llvm.aarch64.neon.sabd.v8i8 intrinsic.

This adds legalizer support for those 3, which gives us selection via the
importer. Update the relevant tests (legalize-ext.mir, select-int-ext.mir) and
add a GISel line to arm64-vabs.ll.

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

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

5 years ago[GlobalISel][AArch64] Legalize v8s8 loads
Jessica Paquette [Thu, 18 Apr 2019 21:13:58 +0000 (21:13 +0000)]
[GlobalISel][AArch64] Legalize v8s8 loads

Add legalizer support for loads of v8s8 and update legalize-load-store.mir.

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

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

5 years agollvm-undname: Fix two more asserts-on-invalid, found by oss-fuzz
Nico Weber [Thu, 18 Apr 2019 19:52:32 +0000 (19:52 +0000)]
llvm-undname: Fix two more asserts-on-invalid, found by oss-fuzz

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

5 years agollvm-undname: Fix two asserts-on-invalid
Nico Weber [Thu, 18 Apr 2019 19:30:21 +0000 (19:30 +0000)]
llvm-undname: Fix two asserts-on-invalid

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

5 years ago[GuardWidening] Wire up a NPM version of the LoopGuardWidening pass
Philip Reames [Thu, 18 Apr 2019 19:17:14 +0000 (19:17 +0000)]
[GuardWidening] Wire up a NPM version of the LoopGuardWidening pass

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

5 years ago[NFC] FMF propagation for GlobalIsel
Michael Berg [Thu, 18 Apr 2019 18:48:57 +0000 (18:48 +0000)]
[NFC] FMF propagation for GlobalIsel

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

5 years ago[BlockExtractor] Extend the file format to support the grouping of basic blocks
Quentin Colombet [Thu, 18 Apr 2019 18:28:30 +0000 (18:28 +0000)]
[BlockExtractor] Extend the file format to support the grouping of basic blocks

Prior to this patch, each basic block listed in the extrack-blocks-file
would be extracted to a different function.

This patch adds the support for comma separated list of basic blocks
to form group.

When the region formed by a group is not extractable, e.g., not single
entry, all the blocks of that group are left untouched.

Let us see this new format in action (comments are not part of the
file format):
;; funcName bbName[,bbName...]
   foo      bb1        ;; Extract bb1 in its own function
   foo      bb2,bb3    ;; Extract bb2,bb3 in their own function
   bar      bb1,bb4    ;; Extract bb1,bb4 in their own function
   bar      bb2        ;; Extract bb2 in its own function

Assuming all regions are extractable, this will create one function and
thus one call per region.

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

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