platform/upstream/llvm.git
2 years ago[GlobalISel] Allow DBG_VALUE to use undefined vregs before LiveDebugValues.
Jack Andersen [Sun, 5 Dec 2021 19:55:20 +0000 (14:55 -0500)]
[GlobalISel] Allow DBG_VALUE to use undefined vregs before LiveDebugValues.

Expanding on D109750.

Since `DBG_VALUE` instructions have final register validity determined in
`LDVImpl::handleDebugValue`, there is no apparent reason to immediately prune
unused register operands as their defs are erased. Consequently, this renders
`MachineInstr::eraseFromParentAndMarkDBGValuesForRemoval` moot; gaining a
substantial performance improvement.

The only necessary changes involve making relevant passes consider invalid
DBG_VALUE vregs uses as valid.

Reviewed By: MatzeB

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

2 years ago[lld-macho] Unreferenced weak dylib symbols shouldn't fetch archive symbols
Jez Ng [Sat, 4 Dec 2021 02:26:32 +0000 (21:26 -0500)]
[lld-macho] Unreferenced weak dylib symbols shouldn't fetch archive symbols

We were fetching archive symbols too eagerly, bloating binary size as well as
just screwing up binaries that expected to look up certain symbols only at
runtime.

Reviewed By: #lld-macho, oontvoo

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

2 years ago[CMake] Installable find modules for terminfo and libffi
Jack Andersen [Sun, 5 Dec 2021 19:45:33 +0000 (14:45 -0500)]
[CMake] Installable find modules for terminfo and libffi

Improves cross-distro portability of LLVM cmake package by resolving paths for
terminfo and libffi via import targets.

When LLVMExports.cmake is generated for installation, it contains absolute
library paths which are likely to be a common cause of portability issues. To
mitigate this, the discovery logic for these dependencies is refactored into
find modules which get installed alongside LLVMConfig.cmake. The result is
cleaner, cmake-friendly management of these dependencies that respect the
environment of the LLVM package importer.

Reviewed By: JDevlieghere

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

2 years agoTest commit to check access.
Jack Andersen [Sun, 5 Dec 2021 19:35:33 +0000 (14:35 -0500)]
Test commit to check access.

2 years agoFix TOSA verifier to emit verbose errors
Mehdi Amini [Sun, 5 Dec 2021 19:16:54 +0000 (19:16 +0000)]
Fix TOSA verifier to emit verbose errors

Also as a test for invalid ops which was missing.

2 years agoFix `-Wunused-variable` warning. NFC.
Michael Liao [Sun, 5 Dec 2021 18:39:48 +0000 (13:39 -0500)]
Fix `-Wunused-variable` warning. NFC.

2 years ago[libc++] Adjust space-alignment in module.modulemap. NFC.
Arthur O'Dwyer [Sun, 5 Dec 2021 18:21:01 +0000 (13:21 -0500)]
[libc++] Adjust space-alignment in module.modulemap. NFC.

2 years ago[libc++] Add missing `#pragma GCC system_header` in a few headers. NFCI.
Arthur O'Dwyer [Sun, 5 Dec 2021 18:08:36 +0000 (13:08 -0500)]
[libc++] Add missing `#pragma GCC system_header` in a few headers. NFCI.

2 years ago[libc++] Fix an include-guard comment. NFC.
Arthur O'Dwyer [Sun, 5 Dec 2021 18:05:21 +0000 (13:05 -0500)]
[libc++] Fix an include-guard comment. NFC.

2 years ago[gn build] port a8025e06fc0f more
Nico Weber [Sun, 5 Dec 2021 18:15:56 +0000 (13:15 -0500)]
[gn build] port a8025e06fc0f more

src/ryu/*.cpp includes files relative to src, so src/ needs
to be passes as -I flag now.

2 years ago[libc++][doc] Update format implementation status.
Mark de Wever [Sun, 5 Dec 2021 16:44:24 +0000 (17:44 +0100)]
[libc++][doc] Update format implementation status.

2 years ago[llvm] Use range-based for loops (NFC)
Kazu Hirata [Sun, 5 Dec 2021 16:33:02 +0000 (08:33 -0800)]
[llvm] Use range-based for loops (NFC)

2 years ago[InstSimplify] fix logic fold of 'or' for vectors
Sanjay Patel [Sun, 5 Dec 2021 14:47:17 +0000 (09:47 -0500)]
[InstSimplify] fix logic fold of 'or' for vectors

Reduce code duplication for commutative pattern matching
and fix a miscompile.

We can't safely propagate an undef element in this transform:
https://alive2.llvm.org/ce/z/s5xy55

2 years ago[InstSimplify] add/adjust tests for 'or' logic fold; NFC
Sanjay Patel [Sun, 5 Dec 2021 14:28:11 +0000 (09:28 -0500)]
[InstSimplify] add/adjust tests for 'or' logic fold; NFC

The last test shows a miscompile:
https://alive2.llvm.org/ce/z/s5xy55

2 years ago[InstCombine] add tests for icmp with mul op with known bits; NFC
Sanjay Patel [Fri, 3 Dec 2021 14:14:41 +0000 (09:14 -0500)]
[InstCombine] add tests for icmp with mul op with known bits; NFC

D114962

2 years agoFollow-up for D113741: fix DebugInfo/Generic/lexical_block_static.ll on MachO
Kristina Bessonova [Sun, 5 Dec 2021 13:31:25 +0000 (15:31 +0200)]
Follow-up for D113741: fix DebugInfo/Generic/lexical_block_static.ll on MachO

2 years agoRemove duplicate comment
Nilay Vaish [Sun, 5 Dec 2021 13:02:32 +0000 (14:02 +0100)]
Remove duplicate comment

The same comment appears in the very next line.

Reviewed By: #libc, ldionne

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

2 years ago[gn build] (semiautomaticallly) port a8025e06fc0f (libc++ ryu)
Nico Weber [Sun, 5 Dec 2021 12:52:43 +0000 (07:52 -0500)]
[gn build] (semiautomaticallly) port a8025e06fc0f (libc++ ryu)

2 years agoMicrosoft's floating-point to_chars powered by Ryu and Ryu Printf
Mark de Wever [Tue, 9 Feb 2021 16:52:41 +0000 (17:52 +0100)]
Microsoft's floating-point to_chars powered by Ryu and Ryu Printf

Microsoft would like to contribute its implementation of floating-point to_chars to libc++. This uses the impossibly fast Ryu and Ryu Printf algorithms invented by Ulf Adams at Google. Upstream repos: https://github.com/microsoft/STL and https://github.com/ulfjack/ryu .

Licensing notes: MSVC's STL is available under the Apache License v2.0 with LLVM Exception, intentionally chosen to match libc++. We've used Ryu under the Boost Software License.

This patch contains minor changes from Jorg Brown at Google, to adapt the code to libc++. He verified that it works in Google's Linux-based environment, but then I applied more changes on top of his, so any compiler errors are my fault. (I haven't tried to build and test libc++ yet.) Please tell me if we need to do anything else in order to follow https://llvm.org/docs/DeveloperPolicy.html#attribution-of-changes .

Notes:

* libc++'s integer charconv is unchanged (except for a small refactoring). MSVC's integer charconv hasn't been tuned for performance yet, so you're not missing anything.
* Floating-point from_chars isn't part of this patch because Jorg found that MSVC's implementation (derived from our CRT's strtod) was slower than Abseil's. If you're unable to use Abseil or another implementation due to licensing or technical considerations, Microsoft would be delighted if you used MSVC's from_chars (and you can just take it, or ask us to provide a patch like this). Ulf is also working on a novel algorithm for from_chars.
* This assumes that float is IEEE 32-bit, double is IEEE 64-bit, and long double is also IEEE 64-bit.
* I have added MSVC's charconv tests (the whole thing: integer/floating from_chars/to_chars), but haven't adapted them to libcxx's harness at all. (These tests will be available in the microsoft/STL repo soon.)
* Jorg added int128 codepaths. These were originally present in upstream Ryu, and I removed them from microsoft/STL purely for performance reasons (MSVC doesn't support int128; Clang on Windows does, but I found that x64 intrinsics were slightly faster).
* The implementation is split into 3 headers. In MSVC's STL, charconv contains only Microsoft-written code. xcharconv_ryu.h contains code derived from Ryu (with significant modifications and additions). xcharconv_ryu_tables.h contains Ryu's large lookup tables (they were sufficiently large to make editing inconvenient, hence the separate file). The xmeow.h convention is MSVC's for internal headers; you may wish to rename them.
* You should consider separately compiling the lookup tables (see https://github.com/microsoft/STL/issues/172 ) for compiler throughput and reduced object file size.
* See https://github.com/StephanTLavavej/llvm-project/commits/charconv for fine-grained history. (If necessary, I can perform some rebase surgery to show you what Jorg changed relative to the microsoft/STL repo; currently that's all fused into the first commit.)

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

2 years ago[libc++][ci] Disable generating debug information.
Mark de Wever [Sun, 5 Dec 2021 12:22:58 +0000 (13:22 +0100)]
[libc++][ci] Disable generating debug information.

In the bootstrap build generating debug information causes an ICE.
This is a work-around for llvm.org/PR52584

2 years ago[VPlan] Separate ctors for VPWidenIntOrFpInduction. (NFC)
Florian Hahn [Sun, 5 Dec 2021 12:14:58 +0000 (12:14 +0000)]
[VPlan] Separate ctors for VPWidenIntOrFpInduction. (NFC)

VPWidenIntOrFpInductionRecipes can either be constructed with a PHI and
an optional cast or a PHI and a trunc instruction. Reflect this in 2
separate constructors. This also simplifies a follow-up change.

2 years agoReland [DwarfDebug] Support emitting function-local declaration for a lexical block
Kristina Bessonova [Sat, 4 Dec 2021 15:12:47 +0000 (17:12 +0200)]
Reland [DwarfDebug] Support emitting function-local declaration for a lexical block

This is another attempt to make function-local declarations
(like static variables, structs/classes and other) be correctly
emitted within a lexical (bracketed) block.

Fixes https://bugs.llvm.org/show_bug.cgi?id=19238.

Reviewed By: dblaikie

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

2 years agoReland [DwarfDebug] Move emission of global vars, types and imports to endModule()
Kristina Bessonova [Sat, 4 Dec 2021 12:08:10 +0000 (14:08 +0200)]
Reland [DwarfDebug] Move emission of global vars, types and imports to endModule()

This patch proposes to move emission of global variables, types,
imported entities, etc from DwarfDebug::beginModule() to DwarfDebug::endModule().
Effectively, this changes nothing but the order of debug entities which
will be as follows:
* subprograms (including related context, local variables/labels,
  local imported entities; related types can be created as a part of
  the emission of local entities of an abstract subprogram);
* global variables (including related context and types);
* retained types and enums;
* non-local-scoped imported entities;
* basic types;
* other types left (as a part of local variables attributes emission).

Note that the order of emitted compile units may also be changed as now we emit
units that contain subprograms first and then all other non-empty units.

The motivation behind this change is the following:
(1) DwarfDebug::beginModule() is run at the very beginning of backend's pipeline,
    from this time IR can be significantly changed by target-specific passes.
    If it happens for debug metadata of global entities, those changes will not
    be reflected in the emitted DWARF.
(2) imported subprogram names should refer to an abstract subprogram if it exists,
    but it isn't known in DwarfDebug::beginModule() (it's possible to make some
    guesses based on location info, but it's not quite reliable);
(3) aforementioned entities if they are scoped within a bracketed block
    (subject of D113741) couldn't be emitted in DwarfDebug::beginModule()
    (they need parent emitted first). Another problem is if to try to gather
    some information about local entities and defer their emission
    (till subprogram's processing or DwarfDebug::endModule()) all the gathered
    details might be irrelevant / invalid by the time the entities are being
    emitted (because of (1)).

Reviewed By: dblaikie

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

2 years ago[X86][FP16] Replace vXi16 to vXf16 instead of v8f16
Phoebe Wang [Sun, 5 Dec 2021 11:17:12 +0000 (19:17 +0800)]
[X86][FP16] Replace vXi16 to vXf16 instead of v8f16

Fixes pr52561

Reviewed By: LuoYuanke

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

2 years ago[MemoryLocation] Use getForArgument in getForSource/getForDest. (NFC)
Florian Hahn [Sun, 5 Dec 2021 11:12:44 +0000 (11:12 +0000)]
[MemoryLocation] Use getForArgument in getForSource/getForDest. (NFC)

getForArgument already knows how to extract a memory location for all
memory intrinsics. Use it instead of duplicating the logic.

2 years ago[JITLink][ELF][x86-64] Adjust addends for R_X86_64_PLT32 relocations.
Lang Hames [Sun, 5 Dec 2021 09:31:03 +0000 (20:31 +1100)]
[JITLink][ELF][x86-64] Adjust addends for R_X86_64_PLT32 relocations.

R_X86_64_PLT32 explicitly represents the '-4' PC-adjustment in the relocation's
addend, but JITLink's x86_64::Branch32PCRel includes the PC-adjustment
implicitly. We have been zeroing the addend to account for the difference, but
this breaks for branches to non-zero offsets past labels. This patch updates the
relocation parsing code to unconditionally adjust the offset by '+4' instead.
For branches directly to labels the result is still 0, for branches to offsets
past labels the result is the correct addend for x86_64::Branch32PCRel.

2 years ago[DAG] Create fptoui.sat from clamped fptosi
David Green [Sun, 5 Dec 2021 09:25:52 +0000 (09:25 +0000)]
[DAG] Create fptoui.sat from clamped fptosi

As an extension to D111976, this converts clamp fptosi, clamped between
0 and (2^n)-1 to a fptoui.sat. This can greatly help on targets with
conversions that naturally saturate, such as Arm.

X86 disables the transform as some of the test cases increases in size.
A fptoui.sat necessitates a fp clamp without native support, so there is
little use in converting if the instruction is just going to be
expanded.

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

2 years ago[JITLink][ELF][x86-64] Use the right edge-naming function for debugging output.
Lang Hames [Sun, 5 Dec 2021 06:12:39 +0000 (17:12 +1100)]
[JITLink][ELF][x86-64] Use the right edge-naming function for debugging output.

Graph edges use the generic x86-64 edge set (the ELF specific edges are only
used during parsing).

2 years ago[llvm-jitlink] Allow -entry option to find hidden symbols.
Lang Hames [Fri, 3 Dec 2021 23:15:15 +0000 (10:15 +1100)]
[llvm-jitlink] Allow -entry option to find hidden symbols.

This is useful when debugging failures in object files compiled with
visibility=hidden.

2 years agoFix `-Wunused-variable` warning. NFC.
Michael Liao [Sat, 4 Dec 2021 23:20:21 +0000 (18:20 -0500)]
Fix `-Wunused-variable` warning. NFC.

2 years ago[gn build] port f1585a4b47cc
Nico Weber [Sun, 5 Dec 2021 03:29:05 +0000 (22:29 -0500)]
[gn build] port f1585a4b47cc

2 years ago[Support] Use final filename for Caching buffer identifier
Leonard Grey [Sun, 5 Dec 2021 03:24:58 +0000 (22:24 -0500)]
[Support] Use final filename for Caching buffer identifier

Mach-O LLD uses the buffer identifier of the memory buffer backing an object
file to generate stabs which are used by `dsymutil` to find the object file for
dSYM generation.

When using thinLTO, these buffers are provided by the cache which initially
saves them to disk as temporary files beginning with "Thin-" but renames them
to persistent files beginning with "llvmcache-" before the buffer is provided
to the cache user.

However, the buffer is created before the file is renamed and is given the temp
file's name as an identifier. This causes the generated stabs to point to
nonexistent files.

This change names the buffer with the eventual persistent filename. I think
this is safe because failing to rename the temp file is a fatal error.

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

2 years ago[lldb] Fix a warning
Kazu Hirata [Sun, 5 Dec 2021 02:34:29 +0000 (18:34 -0800)]
[lldb] Fix a warning

This patch fixes:

  lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp:386:13:
  error: comparison between NULL and non-pointer ('lldb::addr_t' (aka
  'unsigned long') and NULL) [-Werror,-Wnull-arithmetic]

2 years ago[flang] OPEN(RECL=) handling for sequential formatted I/O
Peter Klausler [Fri, 3 Dec 2021 00:36:09 +0000 (16:36 -0800)]
[flang] OPEN(RECL=) handling for sequential formatted I/O

RECL= is required for direct access I/O, but is permitted
as well for sequential I/O, where it is defined by the
standard to specify a maximum record (line) length.
The standard does not say what should happen when an
sequential formatted input record appears whose length is
unequal to RECL= when it is specified.

Precedents from other compilers are unclear: one raises an error,
some honor RECL= as an effective truncation, and a few ignore the
situation.  On output, all other compilers tested raised an
error when an attempt is made to emit a record longer than RECL=.

This patch treats RECL= as effective truncation on input and
as a hard limit with error on output, and also ensures that
RECL= can be set *longer* than the actual input record lengths.

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

2 years ago[PowerPC] Drop stdlib paths in freestanding tests
Zhihao Yuan [Wed, 24 Nov 2021 00:38:53 +0000 (16:38 -0800)]
[PowerPC] Drop stdlib paths in freestanding tests

When targeting FreeBSD on a Linux host with a copy
of system libc++, Clang prepends /usr/include/c++/v1
to the search paths even with -ffreestanding, and
fails to compile a program with a
single #include <xmmintrin.h>

Dropping the path with -nostdlibinc.

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

2 years ago[MemoryLocation] Support missing atomic intrinsics in getForArg.
Florian Hahn [Sat, 4 Dec 2021 22:18:38 +0000 (22:18 +0000)]
[MemoryLocation] Support missing atomic intrinsics in getForArg.

getForArgument is missing support for atomic memory transfer
intrinsics. In terms of accessed locations they behave like regular
memory transfer intrinsics and we already support them as such in
getForSource/getForDest.

2 years ago[mlir] Add InlinerInterface to bufferization dialect
Butygin [Thu, 28 Oct 2021 16:04:35 +0000 (19:04 +0300)]
[mlir] Add InlinerInterface to bufferization dialect

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

2 years ago[clang-format][NFC] Use member directly
Björn Schäpers [Fri, 3 Dec 2021 15:59:34 +0000 (16:59 +0100)]
[clang-format][NFC] Use member directly

Instead of passing it as argument to the member function.

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

2 years ago[clang-format][NFC] Use range based for for fake l parens
Björn Schäpers [Fri, 3 Dec 2021 15:40:52 +0000 (16:40 +0100)]
[clang-format][NFC] Use range based for for fake l parens

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

2 years ago[clang-format][NFC] Early return when nothing to do
Björn Schäpers [Fri, 3 Dec 2021 15:38:10 +0000 (16:38 +0100)]
[clang-format][NFC] Early return when nothing to do

Do not compute SkipFirstExtraIndent just to see that there are no fake l
parens.

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

2 years ago[clang-format][NFC] Move static variable in scope
Björn Schäpers [Fri, 3 Dec 2021 08:25:45 +0000 (09:25 +0100)]
[clang-format][NFC] Move static variable in scope

Let only the JS/TS users pay for the initialistation.

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

2 years ago[clang-format][NFC] Use range based for
Björn Schäpers [Fri, 3 Dec 2021 07:47:38 +0000 (08:47 +0100)]
[clang-format][NFC] Use range based for

That's much easier to read.

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

2 years ago[clang-format][NFC] Reorder conditions
Björn Schäpers [Fri, 3 Dec 2021 07:45:56 +0000 (08:45 +0100)]
[clang-format][NFC] Reorder conditions

Prefer to check the local variables first before dereferencing the
pointer.

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

2 years ago[clang-format][NFC] Merge two calls of isOneOf
Björn Schäpers [Fri, 3 Dec 2021 07:29:47 +0000 (08:29 +0100)]
[clang-format][NFC] Merge two calls of isOneOf

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

2 years ago[clang-format][NFC] Rename variable so no shadowing happens
Björn Schäpers [Fri, 3 Dec 2021 07:25:23 +0000 (08:25 +0100)]
[clang-format][NFC] Rename variable so no shadowing happens

In the loop there is also a Node.

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

2 years ago[clang-format][NFC] Prefer pass by reference
Björn Schäpers [Fri, 3 Dec 2021 07:24:02 +0000 (08:24 +0100)]
[clang-format][NFC] Prefer pass by reference

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

2 years ago[InstSimplify] Add logic 'or' fold to -1
Mehrnoosh Heidarpour [Fri, 3 Dec 2021 15:04:43 +0000 (10:04 -0500)]
[InstSimplify] Add logic 'or' fold to -1

Adding the following folding opportunity:
(~A | B) | (A ^ B) --> -1

https://alive2.llvm.org/ce/z/PMtdYB

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

2 years ago[flang] Fix folding of EXPONENT() intrinsic function
Peter Klausler [Thu, 2 Dec 2021 20:34:37 +0000 (12:34 -0800)]
[flang] Fix folding of EXPONENT() intrinsic function

The definition of the EXPONENT() intrinsic function differs by one
from the real arithmetic folding templates concept of an unbiased
exponent, and also needs special handling for zero.  Fix, and add
more tests.

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

2 years agoWindows: support `DoLoadImage`
Saleem Abdulrasool [Mon, 29 Nov 2021 04:05:31 +0000 (20:05 -0800)]
Windows: support `DoLoadImage`

This implements `DoLoadImage` and `UnloadImage` in the Windows platform
plugin modelled after the POSIX platform plugin.  This was previously
unimplemented and resulted in a difficult to decipher error without any
logging.

This implementation is intended to support enables the use of LLDB's
Swift REPL on Windows.

Paths which are added to the library search path are persistent and
applied to all subsequent loads.  This can be adjusted in the future by
storing all the cookies and restoring the path prior to returning from
the helper.  However, the dynamic path count makes this a bit more
challenging.

Reviewed By: @JDevlieghere
Differential Revision: https://reviews.llvm.org/D77287

2 years ago[XRay] fix more -Wformat warnings
Dimitry Andric [Tue, 23 Nov 2021 20:21:02 +0000 (21:21 +0100)]
[XRay] fix more -Wformat warnings

Building xray with recent clang on a 64-bit system results in a number
of -Wformat warnings:

    compiler-rt/lib/xray/xray_allocator.h:70:11: warning: format specifies type 'int' but the argument has type '__sanitizer::uptr' (aka 'unsigned long') [-Wformat]
              RoundedSize, B);
              ^~~~~~~~~~~
    compiler-rt/lib/xray/xray_allocator.h:119:11: warning: format specifies type 'int' but the argument has type '__sanitizer::uptr' (aka 'unsigned long') [-Wformat]
              RoundedSize, B);
              ^~~~~~~~~~~

Since `__sanitizer::uptr` has the same size as `size_t`, these can be
fixed by using the printf specifier `%zu`.

    compiler-rt/lib/xray/xray_basic_logging.cpp:348:46: warning: format specifies type 'int' but the argument has type '__sanitizer::tid_t' (aka 'unsigned long long') [-Wformat]
          Report("Cleaned up log for TID: %d\n", GetTid());
                                          ~~     ^~~~~~~~
                                          %llu
    compiler-rt/lib/xray/xray_basic_logging.cpp:353:62: warning: format specifies type 'int' but the argument has type '__sanitizer::tid_t' (aka 'unsigned long long') [-Wformat]
          Report("Skipping buffer for TID: %d; Offset = %llu\n", GetTid(),
                                           ~~                    ^~~~~~~~
                                           %llu

Since `__sanitizer::tid_t` is effectively declared as `unsigned long
long`, these can be fixed by using the printf specifier `%llu`.

    compiler-rt/lib/xray/xray_basic_logging.cpp:354:14: warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
                 TLD.BufferOffset);
                 ^~~~~~~~~~~~~~~~

Since `BufferOffset` is declared as `size_t`, this one can be fixed by
using `%zu` as a printf specifier.

    compiler-rt/lib/xray/xray_interface.cpp:172:50: warning: format specifies type 'int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]
        Report("Unsupported sled kind '%d' @%04x\n", Sled.Address, int(Sled.Kind));
                                       ~~            ^~~~~~~~~~~~
                                       %lu

Since ``xray::SledEntry::Address` is declared as `uint64_t`, this one
can be fixed by using `PRIu64`, and adding `<cinttypes>`.

    compiler-rt/lib/xray/xray_interface.cpp:308:62: warning: format specifies type 'long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
        Report("System page size is not a power of two: %lld\n", PageSize);
                                                        ~~~~     ^~~~~~~~
                                                        %zu
    compiler-rt/lib/xray/xray_interface.cpp:359:64: warning: format specifies type 'long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
        Report("Provided page size is not a power of two: %lld\n", PageSize);
                                                          ~~~~     ^~~~~~~~
                                                          %zu

Since `PageSize` is declared as `size_t`, these can be fixed by using
`%zu` as a printf specifier.

Reviewed By: vitalybuka

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

2 years ago[llvm-c] Avoid deprecated APIs in tests
Nikita Popov [Sat, 4 Dec 2021 17:54:36 +0000 (18:54 +0100)]
[llvm-c] Avoid deprecated APIs in tests

Avoid the use of deprecated (opaque pointer incompatible) APIs
in C API tests, in preparation for header deprecation. Add a
LLVMGetGEPSourceElementType() to cover a bit of functionality
that is necessary for the echo test.

This change is split out from https://reviews.llvm.org/D114936.

2 years ago[CodeGen] Use range-based for loops (NFC)
Kazu Hirata [Sat, 4 Dec 2021 16:48:04 +0000 (08:48 -0800)]
[CodeGen] Use range-based for loops (NFC)

2 years ago[NewPM] Test more options in pipeline test (NFC)
Nikita Popov [Sat, 4 Dec 2021 16:24:07 +0000 (17:24 +0100)]
[NewPM] Test more options in pipeline test (NFC)

As suggested on D115098, this tests the positioning of
HotColdSplitting, IROutliner and MergeFunctions in the optimization
pipeline.

2 years ago[NewPM] Fix MergeFunctions scheduling
Nikita Popov [Sat, 4 Dec 2021 12:14:15 +0000 (13:14 +0100)]
[NewPM] Fix MergeFunctions scheduling

MergeFunctions (as well as HotColdSplitting an IROutliner) are
incorrectly scheduled under the new pass manager. The code makes
it look like they run towards the end of the module optimization
pipeline (as they should), while in reality the run at the start.
This is because the OptimizePM populated around them is only
scheduled later.

I'm fixing this by moving these three passes until after OptimizePM
to avoid splitting the function pass pipeline. It doesn't seem
important to me that some of the function passes run after these
late module passes.

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

2 years agoAttributor: Fix typo in function name
Matt Arsenault [Sat, 4 Dec 2021 16:17:39 +0000 (11:17 -0500)]
Attributor: Fix typo in function name

2 years agoOpenMP: Un-xfail tests that pass now
Matt Arsenault [Sat, 4 Dec 2021 16:24:28 +0000 (11:24 -0500)]
OpenMP: Un-xfail tests that pass now

729bf9b26b657df8ddad2e5a63377e6afb349a18 should have fixed these

2 years agoRevert "[DwarfDebug] Support emitting function-local declaration for a lexical block"
Kristina Bessonova [Sat, 4 Dec 2021 16:03:46 +0000 (18:03 +0200)]
Revert "[DwarfDebug] Support emitting function-local declaration for a lexical block"

This reverts commits
ee691970a9a85470948ada623c31f0ab8773617c (D113741),
79d3132998b2828be8f7d2ec411f91fb11b3e01f (D114705)

due to lldb and dexter test failures.

2 years agoAMDGPU: Enable fixed function ABI by default
Matt Arsenault [Sat, 14 Aug 2021 23:10:46 +0000 (19:10 -0400)]
AMDGPU: Enable fixed function ABI by default

Code using indirect calls is broken without this, and there isn't
really much value in supporting the old attempt to vary the argument
placement based on uses. This resulted in more argument shuffling code
anyway.

Also have the option stop implying all inputs need to be passed. This
will no rely on the amdgpu-no-* attributes to avoid passing
unnecessary values.

2 years ago[BasicAA] Add atomic mem intrinsic tests.
Florian Hahn [Sat, 4 Dec 2021 15:20:03 +0000 (15:20 +0000)]
[BasicAA] Add atomic mem intrinsic tests.

2 years agoAMDGPU: Assume all amdhsa kernarg passed implicit arguments by default
Matt Arsenault [Tue, 26 Oct 2021 01:30:42 +0000 (21:30 -0400)]
AMDGPU: Assume all amdhsa kernarg passed implicit arguments by default

Previously we would require adding an attribute to kernels to enable
the inputs passed in the kernarg segment, accessed by
llvm.amdgcn.implicitarg.ptr. This violates the principle of being
correct by default. Some OpenMP testcases were broken recently since
it wasn't correctly setting this attribute, and no known frontends are
setting this to anything other than the maximum.

Most of the test changes are from load widening of argument loads
since there now more implied dereferenceable bytes.

2 years agoAMDGPU: Optimize out implicit kernarg argument allocation if unused
Matt Arsenault [Mon, 25 Oct 2021 19:30:55 +0000 (15:30 -0400)]
AMDGPU: Optimize out implicit kernarg argument allocation if unused

We already annotate whether llvm.amdgcn.implicitarg.ptr is known to be
unused. Start using it to avoid allocating the implicit arguments if
unneeded.

2 years ago[DwarfDebug] Support emitting function-local declaration for a lexical block
Kristina Bessonova [Sat, 4 Dec 2021 15:12:47 +0000 (17:12 +0200)]
[DwarfDebug] Support emitting function-local declaration for a lexical block

This is another attempt to make function-local declarations
(like static variables, structs/classes and other) be correctly
emitted within a lexical (bracketed) block.

Fixes https://bugs.llvm.org/show_bug.cgi?id=19238.

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

2 years agoApply the permutation map on each affine nest
Hugo Pompougnac [Sat, 4 Dec 2021 01:42:23 +0000 (07:12 +0530)]
Apply the permutation map on each affine nest

When using -test-loop-permutation="permutation-map=...", applies the
permutation map on each affine nest in the function (and not only the
first one). If the size of the permutation map and the size of a nest
are not consistent, do nothing on this particular nest (instead of
making MLIR crash).

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

2 years ago[DwarfDebug] Move emission of global vars, types and imports to endModule()
Kristina Bessonova [Sat, 4 Dec 2021 12:08:10 +0000 (14:08 +0200)]
[DwarfDebug] Move emission of global vars, types and imports to endModule()

This patch proposes to move emission of global variables, types,
imported entities, etc from DwarfDebug::beginModule() to DwarfDebug::endModule().
Effectively, this changes nothing but the order of debug entities which
will be as follows:
* subprograms (including related context, local variables/labels,
  local imported entities; related types can be created as a part of
  the emission of local entities of an abstract subprogram);
* global variables (including related context and types);
* retained types and enums;
* non-local-scoped imported entities;
* basic types;
* other types left (as a part of local variables attributes emission).

Note that the order of emitted compile units may also be changed as now we emit
units that contain subprograms first and then all other non-empty units.

The motivation behind this change is the following:
(1) DwarfDebug::beginModule() is run at the very beginning of backend's pipeline,
    from this time IR can be significantly changed by target-specific passes.
    If it happens for debug metadata of global entities, those changes will not
    be reflected in the emitted DWARF.
(2) imported subprogram names should refer to an abstract subprogram if it exists,
    but it isn't known in DwarfDebug::beginModule() (it's possible to make some
    guesses based on location info, but it's not quite reliable);
(3) aforementioned entities if they are scoped within a bracketed block
    (subject of D113741) couldn't be emitted in DwarfDebug::beginModule()
    (they need parent emitted first). Another problem is if to try to gather
    some information about local entities and defer their emission
    (till subprogram's processing or DwarfDebug::endModule()) all the gathered
    details might be irrelevant / invalid by the time the entities are being
    emitted (because of (1)).

Reviewed By: dblaikie

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

2 years agotsan: disable dlopen_static_tls.cpp test on aarch64
Dmitry Vyukov [Sat, 4 Dec 2021 11:23:37 +0000 (12:23 +0100)]
tsan: disable dlopen_static_tls.cpp test on aarch64

Fails on bots: https://lab.llvm.org/buildbot#builders/184/builds/1580

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

2 years ago[Passes] Move AggressiveInstCombine after InstCombine
Anton Afanasyev [Mon, 1 Nov 2021 13:48:52 +0000 (16:48 +0300)]
[Passes] Move AggressiveInstCombine after InstCombine

Swap AIC and IC neighbouring in pipeline. This looks more natural and even
almost has no effect for now (three slightly touched tests of test-suite). Also
this could be the first step towards merging AIC (or its part) to -O2 pipeline.

After several changes in AIC (like D108091, D108201, D107766, D109515, D109236)
there've been observed several regressions (like PR52078, PR52253, PR52289)
that were fixed in different passes (see D111330, D112721) by extending their
functionality, but these regressions were exposed since changed AIC prevents IC
from making some of early optimizations.

This is common problem and it should be fixed by just moving AIC after IC
which looks more logically by itself: make aggressive instruction combining
only after failed ordinary one.

Fixes PR52289

Reviewed By: spatel, RKSimon

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

2 years ago[AMDGPU] Change llvm.amdgcn.image.bvh.intersect.ray to take vec3 args
Jay Foad [Thu, 2 Dec 2021 12:26:59 +0000 (12:26 +0000)]
[AMDGPU] Change llvm.amdgcn.image.bvh.intersect.ray to take vec3 args

The ray_origin, ray_dir and ray_inv_dir arguments should all be vec3 to
match how the hardware instruction works.

Don't change the API of the corresponding OpenCL builtins.

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

2 years ago[IR,TableGen] Add support for vec3 intrinsic arguments
Jay Foad [Thu, 2 Dec 2021 12:25:00 +0000 (12:25 +0000)]
[IR,TableGen] Add support for vec3 intrinsic arguments

Add generic support for vec3 types, and in particular define
llvm_v3f32_ty which will be used by AMDGPU's
llvm.amdgcn.image.bvh.intersect.ray intrinsic.

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

2 years ago[AMDGPU] Generate checks for llvm.amdgcn.image.bvh.intersect.ray
Jay Foad [Thu, 2 Dec 2021 13:17:14 +0000 (13:17 +0000)]
[AMDGPU] Generate checks for llvm.amdgcn.image.bvh.intersect.ray

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

2 years ago[PhaseOrdering] Add test for incorrect merge function scheduling
Nikita Popov [Fri, 3 Dec 2021 22:26:54 +0000 (23:26 +0100)]
[PhaseOrdering] Add test for incorrect merge function scheduling

Add an -enable-merge-functions option to allow testing of function
merging as it will actually happen in the optimization pipeline.
Based on that add a test where we currently produce two identical
functions without merging them due to incorrect pass scheduling
under the new pass manager.

2 years ago[clang-tidy][NFC] Move CachedGlobList to GlobList.h
Carlos Galvez [Sat, 4 Dec 2021 08:36:50 +0000 (08:36 +0000)]
[clang-tidy][NFC] Move CachedGlobList to GlobList.h

Currently it's hidden inside ClangTidyDiagnosticConsumer,
so it's hard to know it exists.

Given that there are multiple uses of globs in clang-tidy,
it makes sense to have these classes publicly available
for other use cases that might benefit from it.

Also, add unit test by converting the existing tests
for GlobList into typed tests.

Reviewed By: salman-javed-nz

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

2 years ago[Test][PhaseOrdering] Precommit test for PR52289
Anton Afanasyev [Sat, 4 Dec 2021 07:58:16 +0000 (10:58 +0300)]
[Test][PhaseOrdering] Precommit test for PR52289

2 years ago[sanitizer] Hook up LZW into stack store
Vitaly Buka [Tue, 23 Nov 2021 05:23:46 +0000 (21:23 -0800)]
[sanitizer] Hook up LZW into stack store

Depends on D114503.

Reviewed By: morehouse

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

2 years ago[CodeGen] Use range-based for loops (NFC)
Kazu Hirata [Sat, 4 Dec 2021 04:45:59 +0000 (20:45 -0800)]
[CodeGen] Use range-based for loops (NFC)

2 years ago[Sparc] Create an error when `__builtin_longjmp` is used
Tee KOBAYASHI [Sat, 4 Dec 2021 04:23:09 +0000 (23:23 -0500)]
[Sparc] Create an error when `__builtin_longjmp` is used

Support for builtin setjmp/longjmp was removed by https://reviews.llvm.org/D51487. An
error should be created when compiling C code using __builtin_setjmp or __builtin_longjmp.

Reviewed By: dcederman

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

2 years ago[mlir] Support collecting logs from notifyMatchFailure().
Chia-hung Duan [Sat, 4 Dec 2021 04:35:24 +0000 (04:35 +0000)]
[mlir] Support collecting logs from notifyMatchFailure().

Let the user registers their own handler to processing the matching
failure information.

Reviewed By: rriddle

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

2 years agoUse LLVM_ATTRIBUTE_UNUSED to silent warning for static function used in assert only...
Mehdi Amini [Sat, 4 Dec 2021 04:23:21 +0000 (04:23 +0000)]
Use LLVM_ATTRIBUTE_UNUSED to silent warning for static function used in assert only (NFC)

2 years agoSplit the locking of the queue and the threads vector in the ThreadPool implementation
Mehdi Amini [Fri, 3 Dec 2021 21:51:55 +0000 (21:51 +0000)]
Split the locking of the queue and the threads vector in the ThreadPool implementation

This allows to release the QueueLock early and create Thread
independently of the queue processing.

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

2 years ago[mlir][linalg][bufferize] Implement equivalence analysis
Matthias Springer [Sat, 4 Dec 2021 02:49:07 +0000 (11:49 +0900)]
[mlir][linalg][bufferize] Implement equivalence analysis

Instead of checking buffer equivalence during bufferization, gather buffer equivalence information right after the analysis. This is in preparation of decoupling bufferization from BufferizationAliasInfo.

This change also fixes equivalence analysis for scf.if op results, which was not fully implemented. scf.if op results are equivalent to their corresponding yield values if both yield values are equivalent.

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

2 years agoFix build for ThreadPool when using -DLLVM_ENABLE_THREADS=OFF
Mehdi Amini [Sat, 4 Dec 2021 02:19:53 +0000 (02:19 +0000)]
Fix build for ThreadPool when using -DLLVM_ENABLE_THREADS=OFF

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

2 years ago[MLIR] Fix affine.for unroll for multi-result upper bound maps
Uday Bondhugula [Sat, 4 Dec 2021 01:49:16 +0000 (07:19 +0530)]
[MLIR] Fix affine.for unroll for multi-result upper bound maps

Fix affine.for unroll for multi-result upper bound maps: these can't be
unrolled/unroll-and-jammed in cases where the trip count isn't known to
be a multiple of the unroll factor.

Fix and clean up repeated/unnecessary checks/comments at helper callees.

Also, fix clang-tidy variable naming warnings and redundant includes.

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

2 years ago[mlir][linalg][bufferize][NFC] Add inPlaceAnalysis overload
Matthias Springer [Sat, 4 Dec 2021 01:27:23 +0000 (10:27 +0900)]
[mlir][linalg][bufferize][NFC] Add inPlaceAnalysis overload

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

2 years ago[mlir] Allow shape dimensions larger than 2^32
River Riddle [Sat, 4 Dec 2021 01:09:30 +0000 (01:09 +0000)]
[mlir] Allow shape dimensions larger than 2^32

Internally we use int64_t to hold shapes, but for some
reason the parser was limiting shapes to unsigned. This
change updates the parser to properly handle int64_t shape
dimensions.

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

2 years ago[MLIR] Improve error message on missing getArgument() override on pass
Uday Bondhugula [Mon, 29 Nov 2021 22:59:27 +0000 (04:29 +0530)]
[MLIR] Improve error message on missing getArgument() override on pass

Improve error message while registering a pass with a missing getArgument() override.

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

2 years ago[MLIR] NFC. Rename test cases in test/mlir-cpu-runner per convention
Uday Bondhugula [Sun, 28 Nov 2021 08:47:10 +0000 (14:17 +0530)]
[MLIR] NFC. Rename test cases in test/mlir-cpu-runner per convention

Test case files at most places in MLIR uses hyphens and not underscores.
A counter-pattern was somehow started to use underscores in some places.
Rename test cases in test/mlir-cpu-runner to use hyphens so that it's
consistent at least within its directory.

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

2 years ago[LICM] Remove profile driven restriction on hoisting
Philip Reames [Sat, 4 Dec 2021 01:11:58 +0000 (17:11 -0800)]
[LICM] Remove profile driven restriction on hoisting

This reverts change 2c391a5/D87551.  As noted in the llvm-dev thread "LICM as canonical form" sent earlier today, introducing this was a major design change made without sufficient cause.

A profile driven LICM is not an unreasonable design, it simply is not what we have.  Switching to such a model requires a lot more work than just this patch, and broad aggeement that is the right direction for the optimizer as a whole.

Worth noting is that all the tests included in the reverted changed are probably handled if we allow running unconstrained LICM, and later run LoopSink.  As such, we have no public examples which motivate a profit based hoisting approach.

2 years ago[mlir][linalg][bufferize][NFC] Use same OpBuilder throughout bufferization
Matthias Springer [Sat, 4 Dec 2021 00:55:31 +0000 (09:55 +0900)]
[mlir][linalg][bufferize][NFC] Use same OpBuilder throughout bufferization

Also set insertion point right before calling `bufferize`. No need to put an InsertionGuard anymore.

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

2 years agoImprove error message when declarativeAssembly contains invalid literals
Mehdi Amini [Sat, 4 Dec 2021 00:26:49 +0000 (00:26 +0000)]
Improve error message when declarativeAssembly contains invalid literals

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

2 years ago[NFC][sanitizer] Add test for command line flag for enable-noundef-analysis.
Kevin Athey [Wed, 24 Nov 2021 00:26:43 +0000 (16:26 -0800)]
[NFC][sanitizer] Add test for command line flag for enable-noundef-analysis.

A simple unit test to demonstrate the flags working correctly.

Reviewed By: vitalybuka

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

2 years ago[mlir][sparse] Adding a stress test
wren romano [Thu, 18 Nov 2021 01:40:06 +0000 (17:40 -0800)]
[mlir][sparse] Adding a stress test

Addresses https://bugs.llvm.org/show_bug.cgi?id=52410
Depends on D114192

Reviewed By: aartbik, mehdi_amini

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

2 years ago[NFC] const-ify some methods on CommandReturnObject
Jordan Rupprecht [Fri, 3 Dec 2021 22:49:42 +0000 (14:49 -0800)]
[NFC] const-ify some methods on CommandReturnObject

2 years ago[gn build] (semiautomatically) port 98bb198693ca
Nico Weber [Fri, 3 Dec 2021 22:48:27 +0000 (17:48 -0500)]
[gn build] (semiautomatically) port 98bb198693ca

2 years ago[ELF][test] Fix typo in aarch64-cortex-a53-843419-recognize.s
Fangrui Song [Fri, 3 Dec 2021 22:38:56 +0000 (14:38 -0800)]
[ELF][test] Fix typo in aarch64-cortex-a53-843419-recognize.s

2 years agoRevert "[mlir][tosa] Add tosa.conv2d as fully_connected canonicalization"
natashaknk [Fri, 3 Dec 2021 22:34:59 +0000 (14:34 -0800)]
Revert "[mlir][tosa] Add tosa.conv2d as fully_connected canonicalization"

This reverts commit 13bdb7ab4a7acaea7144a042fe583d45fbb9b5c4. The commit introduced/uncovered an unintended bug in models containing Conv2D.

Reviewed By: mravishankar

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

2 years ago[clang][ARM] relax -mtp=cp15 for non-thumb cases
Nick Desaulniers [Fri, 3 Dec 2021 21:59:46 +0000 (13:59 -0800)]
[clang][ARM] relax -mtp=cp15 for non-thumb cases

Building -march=armv6k Linux kernels with -mtp=cp15 fails to
compile:

error: hardware TLS register is not supported for the arm
sub-architecture

@ardb found docs for ARM1176JZF-S (ARMv6K) that reference hard thread
pointer.

Relax our ARMv6 check for cases where we're targeting ARM via -marm (vs
Thumb1 via -mthumb).  This more closely matches the KConfig requirements
for where we plan to use these (ie. ARMv6K, ARMv7 (arm or thumb2)).

As @peter.smith mentions:
  on armv5 we can write the instruction to read/write to CP15 C13 with
  the ThreadID opcode. However on no armv5 implementation will the CP15
  C13 have a Thread ID register. The GCC intent seems to be whether the
  instruction is encodable rather than check what the CPU supports.

Link: https://github.com/ClangBuiltLinux/linux/issues/1502
Link: https://developer.arm.com/documentation/ddi0301/h/system-control-coprocessor/system-control-processor-registers/c13--thread-and-process-id-registers
Reviewed By: ardb, peter.smith

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

2 years agoThreadPool: grow the pool only as needed
Benoit Jacob [Fri, 3 Dec 2021 21:40:28 +0000 (21:40 +0000)]
ThreadPool: grow the pool only as needed

On my 96-core cloudtop 'machine', it seems unnecessary to always start
96 threads upfront... particularly as the ThreadPool is created even
with -mlir-disable-threading. Things like the resuling spew in GDB and
the obfuscated output of `(gdb) info threads` are my motivation here,
but it probably also doesn't hurt for at least some efficiency metrics to
avoid creating many threads upfront.

Reviewed By: mehdi_amini

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

2 years ago[DebugInfo] Check DIEnumerator bit width when comparing for equality
Arthur Eubanks [Fri, 3 Dec 2021 19:01:25 +0000 (11:01 -0800)]
[DebugInfo] Check DIEnumerator bit width when comparing for equality

As mentioned in D106585, this causes non-determinism, which can also be
shown by this test case being flaky without this patch.

We were using the APSInt's bit width for hashing, but not for checking
for equality. APInt::isSameValue() does not check bit width.

Reviewed By: rnk

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

2 years ago[test-release.sh] Do not run chrpath on AIX.
Amy Kwan [Fri, 3 Dec 2021 21:35:57 +0000 (15:35 -0600)]
[test-release.sh] Do not run chrpath on AIX.

Upon testing the use of test-release.sh on AIX, the script initially fails
because chrpath is not present on AIX. This patch adds checks for AIX and allows
the script to continue running to completion.

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

2 years ago[sanitizer] Add Lempel–Ziv–Welch encoder/decoder
Vitaly Buka [Wed, 1 Dec 2021 00:33:06 +0000 (16:33 -0800)]
[sanitizer] Add Lempel–Ziv–Welch encoder/decoder

It's very simple, fast and efficient for the stack depot compression if used on entire pointers.

Reviewed By: morehouse, kstoimenov

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

2 years ago[NFC][sanitizer] Iterator adaptors for Leb128 encoding
Vitaly Buka [Tue, 30 Nov 2021 23:29:03 +0000 (15:29 -0800)]
[NFC][sanitizer] Iterator adaptors for Leb128 encoding

It's similar to back_insert_iterator

Needed for D114924

Reviewed By: morehouse, kstoimenov

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