platform/upstream/llvm.git
22 months ago[clang][deps] Make clang-scan-deps write modules in raw format
Ben Langmuir [Tue, 2 May 2023 20:55:46 +0000 (13:55 -0700)]
[clang][deps] Make clang-scan-deps write modules in raw format

We have no use for debug info for the scanner modules, and writing raw
ast files speeds up scanning ~15% in some cases. Note that the compile
commands produced by the scanner will still build the obj format (if
requested), and the scanner can *read* obj format pcms, e.g. from a PCH.

rdar://108807592

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

22 months ago[Demangle] remove unused status param of itaniumDemangle
Nick Desaulniers [Wed, 3 May 2023 18:51:31 +0000 (11:51 -0700)]
[Demangle] remove unused status param of itaniumDemangle

No call sites interpreted this value meaningfully. Simplify this
interface.

Reviewed By: MaskRay

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

22 months ago[VPlan] Add assignSlot(const VPBasicBlock *) (NFC).
Florian Hahn [Wed, 3 May 2023 18:51:09 +0000 (19:51 +0100)]
[VPlan] Add assignSlot(const VPBasicBlock *) (NFC).

Factor out utility to simplify D147964 as sugested.

22 months ago[C2x] Update 'nullptr' implementation based on CD comments
Aaron Ballman [Wed, 3 May 2023 18:06:04 +0000 (14:06 -0400)]
[C2x] Update 'nullptr' implementation based on CD comments

We filed some CD ballot comments which WG14 considered during the
ballot comment resolution meetings in Jan and Feb 2023, and this
updates our implementation based on the decisions reached. Those
decisions were (paraphrased for brevity):

US 9-034 (REJECTED)
  allow (void *)nullptr to be a null pointer constant
US 10-035 (ACCEPTED)
  accept the following code, as in C++:
  void func(nullptr_t); func(0);
US 22-058 (REJECTED)
  accept the following code, as in C++:
  nullptr_t val; (void)(1 ? val : 0); (void)(1 ? nullptr : 0);
US 23-062 (REJECTED)
  reject the following code, as in C++:
  nullptr_t val; bool b1 = val; bool b2 = nullptr;
US 24-061 (ACCEPTED)
  accept the following code, as in C++:
  nullptr_t val; val = 0;
US 21-068 (ACCEPTED)
  accept the following code, as in C++:
  (nullptr_t)nullptr;
GB-071 (ACCEPTED)
  accept the following code, as in C++:
  nullptr_t val; (void)(val == nullptr);

This patch updates the implementation as appropriate, but is primarily
focused around US 10-035, US 24-061, and US 23-062 in terms of
functional changes.

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

22 months ago[clang][dataflow] Change PruneTriviallyFalseEdges for building CFG
Kinuko Yasuda [Wed, 3 May 2023 11:37:44 +0000 (11:37 +0000)]
[clang][dataflow] Change PruneTriviallyFalseEdges for building CFG

Keeping this false could end up with extra iterations on a lot of loops
that aren't real ones (e.g. they could be a do-while-false for macros),
and makes the analyses very slow.

This patch changes the default for
CFG::BuildOptions.PruneTriviallyFalseEdges to true to avoid it.

Reviewed By: ymandel, xazax.hun, gribozavr2

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

22 months ago[ArgumentPromotion] Bail if any callers are minsize
Arthur Eubanks [Wed, 3 May 2023 16:56:22 +0000 (09:56 -0700)]
[ArgumentPromotion] Bail if any callers are minsize

Argument promotion mostly works on functions with more than one caller (otherwise the function would be inlined or is dead), so there's a good chance that performing this increases code size since we introduce loads at every call site. If any caller is marked minsize, bail.

We could compare the number of loads/stores removed from the function with the number of loads introduced in callers, but that's TODO.

Reviewed By: nikic

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

22 months ago[LTO] Add test for dllimport visibility fix
Matthew Voss [Fri, 21 Apr 2023 17:54:55 +0000 (10:54 -0700)]
[LTO] Add test for dllimport visibility fix

Internal testing showed that the change made in commit 62fcfc5a needed
more test coverage. Specifically, the imported function shouldn't be
externally visibile and the whole test needed to be run in regular LTO
mode.

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

22 months ago[libc] Make printf decimal long doubles use hex
Michael Jones [Wed, 12 Apr 2023 22:39:15 +0000 (15:39 -0700)]
[libc] Make printf decimal long doubles use hex

Decimal long doubles are not commonly used, and aren't currently
supported by the algorithm used for decimal float conversions. To avoid
giving incorrect answers, this patch adds a temporary exception to print
long doubles in hexadecimal even when decimal is requested.

Reviewed By: sivachandra

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

22 months ago[libc] add socket function
Michael Jones [Mon, 24 Apr 2023 23:55:54 +0000 (16:55 -0700)]
[libc] add socket function

This patch adds the function "socket" from the header "sys/socket". It's
a simple syscall wrapper, and I plan on adding the related functions in
a followup patch.

Reviewed By: sivachandra

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

22 months ago[mlir][arith] Add narrowing patterns for index casts
Jakub Kuderski [Wed, 3 May 2023 17:55:01 +0000 (13:55 -0400)]
[mlir][arith] Add narrowing patterns for index casts

These rely on the `ValueBounds` interace and its utility function to
compute constant bounds. This allows us to optimize `linalg.index`
values cast to integer types.

Reviewed By: antiagainst

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

22 months agoAllow scripted thread plans to modify the thread stop description when
Jim Ingham [Tue, 2 May 2023 20:41:07 +0000 (13:41 -0700)]
Allow scripted thread plans to modify the thread stop description when
they are completed.

22 months ago[lldb] Remove distribution_id from ArchSpec
Alex Langford [Tue, 2 May 2023 21:48:10 +0000 (14:48 -0700)]
[lldb] Remove distribution_id from ArchSpec

The qHostInfo packet in the gdb-remote communication protocol specifies
that distribution_id can be set, so lldb handles that. But we store that
in the ArchSpec representing the "Host" platform (whatever platform the
debug server is running on). This field is otherwise unused in ArchSpec,
so it would be a lot easier if we stored that information at the
gdb-remote communication layer.

Sidenote: The distribution_id field is currently unused but I did not
want to remove it in case some folks found it useful (e.g. in downstream
forks).

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

22 months ago[RISCV] Pass FeatureBitset to computeTargetABI by const reference. NFC
Craig Topper [Wed, 3 May 2023 17:17:50 +0000 (10:17 -0700)]
[RISCV] Pass FeatureBitset to computeTargetABI by const reference. NFC

22 months ago[Demangle] remove unused params of itaniumDemangle
Nick Desaulniers [Wed, 3 May 2023 16:53:24 +0000 (09:53 -0700)]
[Demangle] remove unused params of itaniumDemangle

No call sites use these parameters, so drop them.
Equivalent to D148940.

Reviewed By: MaskRay

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

22 months ago[analyzer] ArrayBoundCheckerV2: suppress false positives from ctype macros
Donát Nagy [Fri, 28 Apr 2023 16:17:11 +0000 (18:17 +0200)]
[analyzer] ArrayBoundCheckerV2: suppress false positives from ctype macros

The checker alpha.security.ArrayBoundV2 created bug reports in
situations when the (tainted) result of fgetc() or getchar() was passed
to one of the isXXXXX() macros from ctype.h.

This is a common input handling pattern (within the limited toolbox of
the C language) and several open source projects contained code where it
led to false positive reports; so this commit suppresses ArrayBoundV2
reports generated within the isXXXXX() macros.

Note that here even true positive reports would be difficult to
understand, as they'd refer to the implementation details of these
macros.

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

22 months ago[libc] Revert rounding mode changes for hermetic tests
Joseph Huber [Wed, 3 May 2023 16:49:56 +0000 (11:49 -0500)]
[libc] Revert rounding mode changes for hermetic tests

We got rid of the rounding mode here so that the hermetic tests wouldn't
depend on the system fenv.h. But this seemed to cause some bots to
break. Getting rid of this change for now, it should be fine for the CPU
builds.

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

22 months ago[RISCV] Fix intrinsic name in comment for lowerInterleavedLoad/lowerInterleavedStore...
Craig Topper [Wed, 3 May 2023 16:47:53 +0000 (09:47 -0700)]
[RISCV] Fix intrinsic name in comment for lowerInterleavedLoad/lowerInterleavedStore. NFC

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

22 months ago[flang][openacc] Always lower bounds with lb, ub and stride information
Valentin Clement [Wed, 3 May 2023 16:43:32 +0000 (09:43 -0700)]
[flang][openacc] Always lower bounds with lb, ub and stride information

Since we have all the information while lowering, always
add the lowerbound, upperbound and stride information for acc.bounds
create from the Flang frontend.

Reviewed By: razvanlupusoru, jeanPerier

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

22 months ago[libc] Don't use '-nolibc' on the GPU build
Joseph Huber [Wed, 3 May 2023 15:12:34 +0000 (10:12 -0500)]
[libc] Don't use '-nolibc' on the GPU build

We previously changed this to use `nolibc` to allow it to link in
compiler builtins for the CPU build. However, these options are unused
on the GPU and create a lot of noise. Furthermore, we want to use
`nogpulib` to prevent the linking in of the vendor libraries.

Reviewed By: sivachandra

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

22 months ago[libc] Enable the '__support' unit tests to be hermetic
Joseph Huber [Wed, 3 May 2023 14:57:05 +0000 (09:57 -0500)]
[libc] Enable the '__support' unit tests to be hermetic

This patch updates the `__support` unit tests to be built as hermetic
tests. The only tests we needed to disable were because of the use of
`realloc` which is not implemented correctly as it doesn't copy the
memory.

Depends on D149745

Reviewed By: sivachandra

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

22 months ago[libc] Split out FPExceptMatcher from the FP utils
Joseph Huber [Wed, 3 May 2023 13:28:24 +0000 (08:28 -0500)]
[libc] Split out FPExceptMatcher from the FP utils

The FPEceptMatcher.cpp file uses system utilities and includes C++
libraries. This patch pulls it out of the main `FPTestHelpers` target so
we can exclude it from hermetic only tests.

Depends on D149705

Reviewed By: sivachandra

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

22 months ago[libc] Enable the 'stdlib' unit tests to be hermetic
Joseph Huber [Tue, 2 May 2023 23:36:49 +0000 (18:36 -0500)]
[libc] Enable the 'stdlib' unit tests to be hermetic

This changes the `stdlib` tests to the new `add_libc_test` framework.
This applies to all but the exit tests.

Depends on D149691

Reviewed By: sivachandra, michaelrj

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

22 months ago[libc++][chrono] Adds formatter local_time.
Mark de Wever [Fri, 28 Apr 2023 06:13:01 +0000 (08:13 +0200)]
[libc++][chrono] Adds formatter local_time.

Reviewed By: ldionne, #libc

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

22 months ago[libc++][test] Makes pthread a flag.
Mark de Wever [Fri, 28 Apr 2023 15:34:59 +0000 (17:34 +0200)]
[libc++][test] Makes pthread a flag.

Using pthread may affect the compilation too not only the linking.
Therefore pthread is changed from a link flag to a generic flag used for
both compilation and linking.

This fixes an issue when using modules since the use of the pthread flag
makes the BMI files not compatible.

Reviewed By: #libc, ldionne

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

22 months ago[libc++] Formats the forwarded ios headers.
Mark de Wever [Thu, 27 Apr 2023 15:10:07 +0000 (17:10 +0200)]
[libc++] Formats the forwarded ios headers.

Reviewed By: #libc, ldionne

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

22 months ago[libc++] Make std::bind constexpr-friendly
Louis Dionne [Wed, 26 Apr 2023 21:08:18 +0000 (17:08 -0400)]
[libc++] Make std::bind constexpr-friendly

std::bind is supposed to be constexpr-friendly since C++20 and it was
marked as such in our synopsis. However, the tests were not actually
testing any of it and as it happens, std::bind was not really constexpr
friendly. This fixes the issue and makes sure that at least some of the
tests are running in constexpr mode.

Some tests for std::bind check functions that return void, and those
use global variables. These tests haven't been made constexpr-friendly,
however the coverage added by this patch should be sufficient to get
decent confidence.

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

22 months ago[libc++] Soft-fail the two sanitizer jobs that have been failing in CI for a while
Louis Dionne [Wed, 3 May 2023 16:24:18 +0000 (12:24 -0400)]
[libc++] Soft-fail the two sanitizer jobs that have been failing in CI for a while

They are not failing on local Docker images, so something must be wrong
with our GCE instances.

22 months ago[flang][runtime] Initialize LHS temporary in AssignTemporary.
Slava Zakharin [Tue, 2 May 2023 18:08:12 +0000 (11:08 -0700)]
[flang][runtime] Initialize LHS temporary in AssignTemporary.

If LHS is of derived type that needs initialization, then it must be
initialized before doing the assignment. Otherwise, the assignment
might behave incorrectly based on uninitialized components that are
descriptors themselves.

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

22 months ago[InstCombine] Add folds for `(icmp spred (ssub.sat X, Y), 0)` -> `X spred Y`
Noah Goldstein [Wed, 3 May 2023 16:10:30 +0000 (11:10 -0500)]
[InstCombine] Add folds for `(icmp spred (ssub.sat X, Y), 0)` -> `X spred Y`

Alive2 links:
    eq: https://alive2.llvm.org/ce/z/Fv3mvc
    ne: https://alive2.llvm.org/ce/z/AEuEXU
    sle: https://alive2.llvm.org/ce/z/mfKGUS
    sge: https://alive2.llvm.org/ce/z/tX3_M4
    sgt: https://alive2.llvm.org/ce/z/x7VgnZ
    slt: https://alive2.llvm.org/ce/z/rQN4TM

Reviewed By: nikic

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

22 months ago[InstCombine] Add tests for `(icmp pred (ssub.sat X, Y), 0)`; NFC
Noah Goldstein [Sat, 29 Apr 2023 16:55:57 +0000 (11:55 -0500)]
[InstCombine] Add tests for `(icmp pred (ssub.sat X, Y), 0)`; NFC

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

22 months agoRevert "[AMDGPU] Define data layout entries for buffers"
Krzysztof Drewniak [Wed, 3 May 2023 16:08:52 +0000 (16:08 +0000)]
Revert "[AMDGPU] Define data layout entries for buffers"

This reverts commit f9c1ede2543b37fabe9f2d8f8fed5073c475d850.

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

22 months agoRevert "[Pipeline] Don't limit ArgumentPromotion to -O3"
Arthur Eubanks [Wed, 3 May 2023 15:52:30 +0000 (08:52 -0700)]
Revert "[Pipeline] Don't limit ArgumentPromotion to -O3"

This reverts commit 5b386b864c7619897c51a1da97d78f1cf6f3eff6.

Causes noticeable size increases under -Oz.

22 months ago[clang][BFloat] Avoid redefining bfloat16_t in arm_neon.h
Dimitry Andric [Wed, 3 May 2023 15:53:59 +0000 (17:53 +0200)]
[clang][BFloat] Avoid redefining bfloat16_t in arm_neon.h

As of https://reviews.llvm.org/D79708, clang-tblgen generates `arm_neon.h`,
`arm_sve.h` and `arm_bf16.h`, and all those generated files will contain a
typedef of `bfloat16_t`. However, `arm_neon.h` and `arm_sve.h` include
`arm_bf16.h` immediately before their own typedef:

    #include <arm_bf16.h>
    typedef __bf16 bfloat16_t;

With a recent version of clang (I used 16.0.1) this results in warnings:

    /usr/lib/clang/16/include/arm_neon.h:38:16: error: redefinition of typedef 'bfloat16_t' is a C11 feature [-Werror,-Wtypedef-redefinition]

Since `arm_bf16.h` is very likely supposed to be the one true place where
`bfloat16_t` is defined, I propose to delete the duplicate typedefs from the
generated `arm_neon.h` and `arm_sve.h`.

Reviewed By: sdesmalen, simonbutcher

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

22 months agoRevert "Revert "[AMDGPU] Update LiveVariables in SILowerControlFlow""
Mateja Marjanovic [Wed, 3 May 2023 15:35:08 +0000 (17:35 +0200)]
Revert "Revert "[AMDGPU] Update LiveVariables in SILowerControlFlow""

Accidental error.

This reverts commit 2e823da8dc652b23738e2d3b8e7e7f21335816eb.

22 months agoRevert "[AMDGPU][NFC] Preserve PDTWrapperPass in UnifyDivergentExitNodes"
Anshil Gandhi [Wed, 3 May 2023 15:34:11 +0000 (09:34 -0600)]
Revert "[AMDGPU][NFC] Preserve PDTWrapperPass in UnifyDivergentExitNodes"

This reverts commit 40ed87a0515dd72047ec8e78dcf0d8084d0891dd.

22 months ago[AMDGPU][GlobalISel] Check exact width in get*ClassForBitWidth and widen if necessary
Mateja Marjanovic [Wed, 3 May 2023 15:32:22 +0000 (17:32 +0200)]
[AMDGPU][GlobalISel] Check exact width in get*ClassForBitWidth and widen if necessary

Instead of checking if the given bitwidth is less or equal to a bitwidth of an existing RegClass,
check if it has the exact same value.

For LLVM vector types that don't have a corresponding Register Class, widen them during legalization.
That goes for G_EXTRACT_VECTOR_ELT, G_INSERT_VECTOR_ELT and G_BUILD_VECTOR.

Differential revision: https://reviews.llvm.org/D148096
Reviewers: foad, arsenm

22 months agoRevert "[AMDGPU][GlobalISel] Widen the vector operand in G_BUILD/INSERT/EXTRACT_VECTOR"
Mateja Marjanovic [Wed, 3 May 2023 15:24:07 +0000 (17:24 +0200)]
Revert "[AMDGPU][GlobalISel] Widen the vector operand in G_BUILD/INSERT/EXTRACT_VECTOR"

This reverts commit b25c7cafcbe1b52ea2d1ff5e5c2f13674b5f297d.

22 months ago[AMDGPU] Define data layout entries for buffers
Krzysztof Drewniak [Tue, 7 Feb 2023 20:37:55 +0000 (20:37 +0000)]
[AMDGPU] Define data layout entries for buffers

Per discussion at
https://discourse.llvm.org/t/representing-buffer-descriptors-in-the-amdgpu-target-call-for-suggestions/68798,
we define two new address spaces for AMDGCN targets.

The first is address space 7, a non-integral address space (which was
already in the data layout) that has 160-bit pointers (which are
256-bit aligned) and uses a 32-bit offset. These pointers combine a
128-bit buffer descriptor and a 32-bit offset, and will be usable with
normal LLVM operations (load, store, GEP). However, they will be
rewritten out of existence before code generation.

The second of these is address space 8, the address space for "buffer
resources". These will be used to represent the resource arguments to
buffer instructions, and new buffer intrinsics will be defined that
take them instead of <4 x i32> as resource arguments. ptr
addrspace(8). These pointers are 128-bits long (with the same
alignment). They must not be used as the arguments to getelementptr or
otherwise used in address computations, since they can have
arbitrarily complex inherent addressing semantics that can't be
represented in LLVM. Even though, like their address space 7 cousins,
these pointers have deterministic ptrtoint/inttoptr semantics, they
are defined to be non-integral in order to prevent optimizations that
rely on pointers being a [0, [addr_max]] value from applying to them.

Future work includes:
- Defining new buffer intrinsics that take ptr addrspace(8) resources.
- A late rewrite to turn address space 7 operations into buffer
intrinsics and offset computations.

This commit also updates the "fallback address space" for buffer
intrinsics to the buffer resource, and updates the alias analysis
table.

Depends on D143437

Reviewed By: arsenm

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

22 months agoRevert "[AMDGPU] Update LiveVariables in SILowerControlFlow"
Mateja Marjanovic [Wed, 3 May 2023 15:16:48 +0000 (17:16 +0200)]
Revert "[AMDGPU] Update LiveVariables in SILowerControlFlow"

This reverts commit 069f027e1e6b1db9e3e6dcf4193c670e2be3d5d5.

22 months ago[AMDGPU][GlobalISel] Widen the vector operand in G_BUILD/INSERT/EXTRACT_VECTOR
Mateja Marjanovic [Wed, 12 Apr 2023 09:34:26 +0000 (11:34 +0200)]
[AMDGPU][GlobalISel] Widen the vector operand in G_BUILD/INSERT/EXTRACT_VECTOR

Widen the vector operand type in G_BUILD_VECTOR, G_INSERT_VECTOR_ELT,
G_EXTRACT_VECTOR_ELT to the nearest larger RegClass.

22 months ago[AMDGPU] Update LiveVariables in SILowerControlFlow
Jay Foad [Wed, 3 May 2023 14:56:45 +0000 (15:56 +0100)]
[AMDGPU] Update LiveVariables in SILowerControlFlow

Update kills in one place that was missed. Fixes a test failure that
would otherwise be introduced by D149651.

22 months ago[libc++][PSTL] Remove configurations flags
Nikolas Klauser [Tue, 2 May 2023 16:26:59 +0000 (09:26 -0700)]
[libc++][PSTL] Remove configurations flags

Some configurations flags are always the same. We can just remove them to make the code a bit cleaner.

Reviewed By: ldionne, #libc

Spies: pcwang-thead, libcxx-commits, miyuki

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

22 months ago[SelectionDAG][NFCI] Use common logic for identifying MMI vars
Felipe de Azevedo Piovezan [Tue, 2 May 2023 16:53:36 +0000 (12:53 -0400)]
[SelectionDAG][NFCI] Use common logic for identifying MMI vars

After function argument lowering, but prior to instruction selection,
dbg declares pointing to function arguments are lowered using special
logic.

Later, during instruction selection (both "fast" and regular ISel), this
logic is "repeated" in order to identify which intrinsics have already
been lowered. This is bad for two reasons:

1. The logic is not _really_ repeated, the code is different, which
could lead to duplicate lowering of the intrinsic.
2. Even if the logic were repeated properly, this is still code
duplication.

This patch addresses these issues by storing all preprocessed
dbg.declare intrinsics in a set inside FuncInfo; the set is queried upon
instruction selection.

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

22 months ago[AArch64] Add more efficient bitwise vector reductions.
Sp00ph [Wed, 3 May 2023 14:56:16 +0000 (15:56 +0100)]
[AArch64] Add more efficient bitwise vector reductions.

Improves the codegen for VECREDUCE_{AND,OR,XOR} operations on AArch64.
Currently, these are fully scalarized, except if the vector is a <N x i1>. This
patch improves the codegen down to O(log(N)) where N is the length of the
vector for vectors whose elements are not i1, by repeatedly applying the
bitwise operations to the two halves of the vector. <N x i1> bitwise reductions
are handled using VECREDUCE_{UMAX,UMIN,ADD} instead.

I had to update quite a few codegen tests with these changes, with a general
downward trend in instruction count. Since the vector reductions already have
tests, I haven't added any new tests myself.

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

22 months ago[RISCV] Use vslidedown for undef sub-sequences in generic build_vector
Philip Reames [Wed, 3 May 2023 14:37:03 +0000 (07:37 -0700)]
[RISCV] Use vslidedown for undef sub-sequences in generic build_vector

This is a follow up to D149263 which extends the generic vslide1down handling to use vslidedown (without the one) for undef elements, and in particular for undef sub-sequences. This both removes the domain crossing, and for undef subsequences results in fewer instructions over all.

Differential Revision: https://reviews.llvm.org/D149658#inline-1446673

22 months ago[RISCV] Use vslide1down lowering for two element non-constant build_vectors
Philip Reames [Wed, 3 May 2023 14:30:22 +0000 (07:30 -0700)]
[RISCV] Use vslide1down lowering for two element non-constant build_vectors

When the values are in GPRs, the vslide1down lowering is always better. We need to greatly improve the splat-and-mask cost model to handle constants in a meaningful way, so for now, limit this to non-constant vectors.

This does send the "partially constant" case down the vslide1down path. This could cause some regressions, though I don't see any in practice.

The cost modeling for the general case is annoyingly tricky. We have a great amount of inconsistency around immediate operands, and as a result, the exact constant and exact lowering choice matters a lot. I'm hoping that we get a "good enough" result without modeling this exactly, but we may need to do something analogous to getIntMatCost (i.e. a search w/costing).

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

22 months ago[RISCV] Add MC support of RISCV zcmt Extension
WuXinlong [Tue, 2 May 2023 08:34:03 +0000 (16:34 +0800)]
[RISCV] Add MC support of RISCV zcmt Extension

This patch add the instructions of zcmt extension.
[[ https://github.com/riscv/riscv-code-size-reduction/releases/tag/v1.0.0-RC5.7 | spac is here ]]
Which includes two instructions (cm.jt&cm.jalt) and a CSR Reg JVT

co-author: @Scott Egerton

Reviewed By: kito-cheng, craig.topper

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

22 months ago[llvm-objdump][COFF] Keep columns aligned in the console output when exports ordinals...
Alexandre Ganea [Wed, 3 May 2023 13:55:32 +0000 (09:55 -0400)]
[llvm-objdump][COFF] Keep columns aligned in the console output when exports ordinals are large.

22 months ago[LLD][COFF] Fix incorrect pattern in test
Alexandre Ganea [Tue, 2 May 2023 23:58:18 +0000 (19:58 -0400)]
[LLD][COFF] Fix incorrect pattern in test

The previous pattern was matching the RVA `0` to the first character of `0x1010`. Make sure now that the entire export entry is matched.

22 months ago[AArch64] Combine concat through rshrn
David Green [Wed, 3 May 2023 13:48:50 +0000 (14:48 +0100)]
[AArch64] Combine concat through rshrn

This tries to push the concat in trunc(concat(rshr, rshr)) into the leaves, so
that we can generate rshrn(concat). This helps improve the codegen for small
types, using the existing rshrn patterns.

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

22 months agoRevert "[clang] Reject flexible array member in a union in C++"
Mariya Podchishchaeva [Wed, 3 May 2023 13:24:52 +0000 (09:24 -0400)]
Revert "[clang] Reject flexible array member in a union in C++"

This reverts commit 22e2db6010b029ebd4c6d3d1fd30224d8b3109ef.

Broke buildbots on Windows. It seems standard headers on Windows contain
flexible array members in unions

22 months ago[mlir][tblgen] Fix emitting wrong index for `either` directive.
Chia-hung Duan [Wed, 3 May 2023 00:07:27 +0000 (00:07 +0000)]
[mlir][tblgen] Fix emitting wrong index for `either` directive.

Reviewed By: jpienaar

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

22 months ago[clang] Reject flexible array member in a union in C++
Mariya Podchishchaeva [Wed, 3 May 2023 10:10:39 +0000 (06:10 -0400)]
[clang] Reject flexible array member in a union in C++

It was rejected in C, and in a strange way accepted in C++. However, the
support was never properly tested and fully implemented, so just reject
it in C++ mode as well.

This change also fixes crash on attempt to initialize union with flexible
array member. Due to missing check on union, there was a null expression
added to init list that caused crash later.

Fixes https://github.com/llvm/llvm-project/issues/61746

Reviewed By: aaron.ballman

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

22 months ago[AArch64] Additional tests for rshrn patterns. NFC
David Green [Wed, 3 May 2023 12:15:27 +0000 (13:15 +0100)]
[AArch64] Additional tests for rshrn patterns. NFC

See D149636

22 months ago[LLD][ELF] Fix --check-dynamic-relocations for 32-bit targets
Andrew Ng [Wed, 26 Apr 2023 09:18:04 +0000 (10:18 +0100)]
[LLD][ELF] Fix --check-dynamic-relocations for 32-bit targets

OutputSection::checkDynRelAddends() incorrectly reports an internal
linker error for large addends on 32-bit targets. This is caused by the
lack of sign extension in DynamicReloc::computeAddend() for 32-bit
addends.

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

22 months agoFix MSVC "not all control paths return a value" warning. NFC.
Simon Pilgrim [Wed, 3 May 2023 09:23:41 +0000 (10:23 +0100)]
Fix MSVC "not all control paths return a value" warning. NFC.

22 months ago[ShrinkWrap] Use underlying object to rule out stack access.
Florian Hahn [Wed, 3 May 2023 08:28:04 +0000 (09:28 +0100)]
[ShrinkWrap] Use underlying object to rule out stack access.

Allow shrink-wrapping past memory accesses that only access globals or
function arguments. This patch uses getUnderlyingObject to try to
identify the accessed object by a given memory operand. If it is a
global or an argument, it does not access the stack of the current
function and should not block shrink wrapping.

Note that the caller's stack may get accessed when passing an argument
via the stack, but not the stack of the current function.

This addresses part of the TODO from D63152.

Reviewed By: thegameg

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

22 months ago[flang][hlfir] Lower vector subscripted RHS designators
Jean Perier [Wed, 3 May 2023 07:19:12 +0000 (09:19 +0200)]
[flang][hlfir] Lower vector subscripted RHS designators

Lower vector subscripted designators as values when they appear outside
of the assignment left-hand side and input IO contexts.

This matches Fortran semantics where vector subscripted designators cannot
be written to outside of the two contexts mentioned above: they are
passed/taken by value where they appear.

This patch uses the added hlfir.element_addr to lower vector designators
in lowering. But when reaching the end of the designator lowering, the
hlfir.element_addr is turned into an hlfir.elemental when lowering is
not asking for the hlfir.elemental_addr.

This approach allows lowering vector subscripted in the same way in
while visiting the designator, and only adapt to the context at the
edge.

The part where lowering uses the hlfir.elemental_addr will be
done in further patch as it requires lowering assignments in the
new hlfir.region_assign op, and there is not codegen yet for these
new operations.

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

22 months ago[flang][hlfir] Add hlfir.elemental_addr for vector subscripted assignment
Jean Perier [Wed, 3 May 2023 07:15:55 +0000 (09:15 +0200)]
[flang][hlfir] Add hlfir.elemental_addr for vector subscripted assignment

See the operation description in HLFIROps.td.

Depends on D149442

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

22 months ago[flang][hlfir] Add hlfir.region_assign and its hlfir.yield terminator
Jean Perier [Wed, 3 May 2023 07:07:32 +0000 (09:07 +0200)]
[flang][hlfir] Add hlfir.region_assign and its hlfir.yield terminator

hlfir.region_assign is a Region based version of hlfir.assign: the
right-hand side and left-hand-side are evaluated in their own region,
and an optional region can be added to implement user defined
assignment.

This will be used for:
 - assignments inside where and forall
 - user defined assignments
 - assignments to vector subscripted entities.

Rational:

Forall and Where lowering requires solving an expression/assignment
evaluation scheduling problem based on data dependencies between the
variables being assigned and the one used in the expressions.
Keeping left-hand side and right-hand side in their own region will
make it really easy to analyse the dependency and move around the
expression evaluation as a whole. Operation DAGs are hard to scissor out
when the LHS and RHS evaluation are lowered in the same block. The pass
dealing with further forall/where lowering in HLFIR will need to
succeed. It is not acceptable for them to fail splitting the RHS/LHS
evaluation code. Keeping them in independent block is an approach that
cannot fail.

For user defined assignments, having a region allows implementing all
the call details in lowering, and even to allow inlining of the user
assignment, before it is decided if a temporary for the LHS or RHS is
required or not.

The operation description mention "hlfir.elemental_addr" (operation that
will be used for vector subscripted LHS) and "ordered assignment trees"
(concept/inetrface that will be used to represent forall/where structure
in HLFIR). These will be pushed in follow-up patch, but I do not want t
scissor out the descriptions.

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

22 months ago[llvm-readobj][AMDGPU] Bypass MD verification for PAL
pvanhout [Wed, 15 Mar 2023 09:52:43 +0000 (10:52 +0100)]
[llvm-readobj][AMDGPU] Bypass MD verification for PAL

Small split change from D146023.

Migrate elf-notes to v4 and fix llvm-readobj to work with PAL metadata.

Reviewed By: kzhuravl

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

22 months agoFix MLIR properties generic printing to honor eliding large attributes
Mehdi Amini [Wed, 3 May 2023 06:41:04 +0000 (23:41 -0700)]
Fix MLIR properties generic printing to honor eliding large attributes

There was a discrepancy where the flag was honored when passed through the
command line, but not when passed through the API, which was leading to a
python test failing.

22 months agoRevert "[openmp] [test] Set __COMPAT_LAYER=RunAsInvoker when running tests on Windows"
Martin Storsjö [Thu, 27 Apr 2023 12:51:49 +0000 (15:51 +0300)]
Revert "[openmp] [test] Set __COMPAT_LAYER=RunAsInvoker when running tests on Windows"

This reverts commit 63f0fdc2628dfb2f52ed5a92e579f99261d946ed.

Since f1431bbfb17cd7167adda9fc8521bb6eec52c300, this environment
variable is always set up by lit itself, so individual test suites
don't need to set it.

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

22 months ago[libc] Use -nolibc -nostdlib++ -nostartfiles for hermetic test link.
Siva Chandra Reddy [Tue, 2 May 2023 19:52:14 +0000 (19:52 +0000)]
[libc] Use -nolibc -nostdlib++ -nostartfiles for hermetic test link.

We previously used a more stricter -nostdlib option which was also removing
compiler-rt/libgcc.

Reviewed By: jhuber6

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

22 months agoUpdate BUILD file for bazel.
Wenzhi Cui [Wed, 3 May 2023 06:07:42 +0000 (08:07 +0200)]
Update BUILD file for bazel.

llvm::CodeGen was missing so add them to deps

Reviewed By: csigg

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

22 months agoFix MLIR Python test after 9fbe3b511bf703d0d
Mehdi Amini [Wed, 3 May 2023 05:30:02 +0000 (22:30 -0700)]
Fix MLIR Python test after 9fbe3b511bf703d0d

Some mid-air collision between a change in the generic format and this
new python test.

22 months ago[mlir][tosa] Fold log(exp) to no-op
Kai Sasaki [Wed, 3 May 2023 05:05:59 +0000 (14:05 +0900)]
[mlir][tosa] Fold log(exp) to no-op

Element-wise log(exp) does no operation so that we can fold it into no-op effectively.

Reviewed By: eric-k256

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

22 months ago[docs] Prefer --target= -masm=intel to -target -mllvm -x86-asm-syntax=intel
Fangrui Song [Wed, 3 May 2023 05:08:05 +0000 (22:08 -0700)]
[docs] Prefer --target= -masm=intel to -target -mllvm -x86-asm-syntax=intel

22 months ago[RISCV] Return false from isShuffleMaskLegal for i1 vectors.
Craig Topper [Wed, 3 May 2023 04:49:07 +0000 (21:49 -0700)]
[RISCV] Return false from isShuffleMaskLegal for i1 vectors.

We don't have i1 vector shuffle lowering.

22 months agoRevert part of D149033 b/c original code is correct
Shengchen Kan [Tue, 2 May 2023 09:43:32 +0000 (17:43 +0800)]
Revert part of D149033 b/c original code is correct

This reverts part of D149033 and  rG8f966cedea594d9a91e585e88a80a42c04049e6c. The added test case
is kept to avoid future regression.

Reviewed By: vzakhari, vdonaldson

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

22 months agoAdopt Properties to store operations inherent Attributes in the Arith dialect
Mehdi Amini [Tue, 11 Apr 2023 02:59:16 +0000 (20:59 -0600)]
Adopt Properties to store operations inherent Attributes in the Arith dialect

This is part of an on-going migration to adopt Properties inside MLIR.

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

22 months agoAdopt Properties to store operations inherent Attributes in the Func dialect
Mehdi Amini [Mon, 10 Apr 2023 20:33:33 +0000 (13:33 -0700)]
Adopt Properties to store operations inherent Attributes in the Func dialect

This is part of an on-going migration to adopt Properties inside MLIR.

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

22 months agoAdopt Properties to store operations inherent Attributes in TOSA
Mehdi Amini [Mon, 10 Apr 2023 19:02:52 +0000 (12:02 -0700)]
Adopt Properties to store operations inherent Attributes in TOSA

This is part of an on-going migration to adopt Properties inside MLIR.

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

22 months agoFix a typo in head comment of `CurPPLexer`.
Zhouyi Zhou [Wed, 3 May 2023 02:47:22 +0000 (19:47 -0700)]
Fix a typo in head comment of `CurPPLexer`.

In head comment of CurPPLexer field of class Preprocessor,
'The current top of the stack what we're lexing from' should be
'The current top of the stack that we're lexing from'.

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

22 months ago[AMDGPU][NFC] Preserve PDTWrapperPass in UnifyDivergentExitNodes
Anshil Gandhi [Wed, 3 May 2023 02:26:23 +0000 (20:26 -0600)]
[AMDGPU][NFC] Preserve PDTWrapperPass in UnifyDivergentExitNodes

Reviewed By: arsenm

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

22 months ago[gn] Actually reformat files after adding CodeGen deps
Nico Weber [Wed, 3 May 2023 00:46:23 +0000 (20:46 -0400)]
[gn] Actually reformat files after adding CodeGen deps

This should've been part of 8221c316d524695.

22 months ago[gn build] Port rest of 9cfeba5b12b6 (LowLevelType->Support)
Nico Weber [Wed, 3 May 2023 00:40:49 +0000 (20:40 -0400)]
[gn build] Port rest of 9cfeba5b12b6 (LowLevelType->Support)

This adds all the CodeGen deps all over the place.

I ran

    git show 9cfeba5b12b6 > foo2.txt

to get the original patch into a text file and then ran

    #!/usr/bin/env python3
    import os
    in_cmake = False
    for l in open('foo2.txt'):
      if l.startswith('+++ b/'):
        cmake = l[len('+++ b/'):-1]
        in_cmake = 'CMakeLists.txt' in cmake
      if not in_cmake:
        continue
      prefix = 'llvm/utils/gn/secondary/'
      gn_file = os.path.join(prefix, os.path.dirname(cmake), 'BUILD.gn')
      if l.startswith('+ '):
        add = l[1:].strip()
        if add == 'CodeGen':
          try:
            with open(gn_file) as f:
                contents = f.read()
          except:
            print(f'skipping {gn_file}')
            continue
          contents = contents.replace(' deps = [', ' deps = ["//llvm/lib/CodeGen",')
          with open(gn_file, 'w') as f:
              f.write(contents)

to update all the GN files.

(I manually removed the dep on CodeGen that this added to llvm-min-tblgen.)

Finally, I ran

    git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format

to fix up the formatting.

22 months ago[gn] reformat all gn files
Nico Weber [Wed, 3 May 2023 00:42:03 +0000 (20:42 -0400)]
[gn] reformat all gn files

I ran:

    git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format

22 months ago[NFC] Add a test case to make sure EarlyCSE preserves !prof when one
Mingming Liu [Fri, 28 Apr 2023 00:49:41 +0000 (17:49 -0700)]
[NFC] Add a test case to make sure EarlyCSE preserves !prof when one
instruction CSE'ed another.

- This should be a part of D148877. Before that patch, !prof is not added to known-id-set [1], and turns out unknown types of metadata are dropped in the implementation [2].
  - This test is mainly added to make sure there won't be regressions for this kind of pattern. The pattern is observed it in application code; looks like the result of indirect call is used as function arguments initially; after the function is inlined load-after-store CSE opportunity is exposed.

  [1] https://github.com/llvm/llvm-project/blob/f478721231bdb71ba8f0f6fb21673b9b7f652add/llvm/lib/Transforms/Utils/Local.cpp#L2727-L2741
  [2] https://github.com/llvm/llvm-project/blob/ade3c6a6a88ed3a9b06c076406f196da9d3cc1b9/llvm/lib/Transforms/Utils/Local.cpp#L2639

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

22 months ago[NFC][EarlyCSE]Modify test case to ensure branch weights are preserved with cse.
Mingming Liu [Thu, 27 Apr 2023 22:55:29 +0000 (15:55 -0700)]
[NFC][EarlyCSE]Modify test case to ensure branch weights are preserved with cse.

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

22 months ago[RISCV] Enable strict fp for RISC-V in clang.
Yeting Kuo [Wed, 3 May 2023 00:32:08 +0000 (08:32 +0800)]
[RISCV] Enable strict fp for RISC-V in clang.

Reviewed By: craig.topper

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

22 months ago[lldb] Remove FileSpec::GetLastPathComponent
Alex Langford [Tue, 2 May 2023 17:05:36 +0000 (10:05 -0700)]
[lldb] Remove FileSpec::GetLastPathComponent

As far as I can tell, this just computes the filename of the FileSpec,
which is already conveniently stored in m_filename. We can use
FileSpec::GetFilename() instead.

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

22 months ago[lldb] Minor cleanups at callsites of FileSpec::GetFileNameExtension
Alex Langford [Tue, 2 May 2023 17:48:53 +0000 (10:48 -0700)]
[lldb] Minor cleanups at callsites of FileSpec::GetFileNameExtension

FileSpec::GetFileNameExtension returns a StringRef. In some cases we
are calling it and then storing the result in a local. To prevent
cases where we store the StringRef, mutate the Filespec, and then try to
use the stored StringRef afterwards, I've audited the callsites and made
adjustments to mitigate: Either marking the FileSpec it comes from as
const (to avoid mutations) or by not storing the StringRef in a local if
it makes sense not to.

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

22 months ago[gn build] Port some of 9cfeba5b12b6 (LowLevelType->Support, llvm-tblgen->CodeGen)
Nico Weber [Wed, 3 May 2023 00:07:59 +0000 (20:07 -0400)]
[gn build] Port some of 9cfeba5b12b6 (LowLevelType->Support, llvm-tblgen->CodeGen)

Doesn't yet add all the CodeGen deps all over the place.

22 months ago[gn build] Port 3e3a926be8a9
Nico Weber [Wed, 3 May 2023 00:07:59 +0000 (20:07 -0400)]
[gn build] Port 3e3a926be8a9

22 months ago[gn] Unbreak sync_source_lists_from_cmake on mac after Xcode update
Nico Weber [Wed, 19 Apr 2023 18:34:31 +0000 (14:34 -0400)]
[gn] Unbreak sync_source_lists_from_cmake on mac after Xcode update

Apparently `\b` stopped working with --pickaxe-regex for some reason.

22 months ago[gn] Port 631bfdbee5b4 (GenVT.inc)
Nico Weber [Tue, 2 May 2023 23:36:53 +0000 (19:36 -0400)]
[gn] Port 631bfdbee5b4 (GenVT.inc)

22 months ago[gn] port 243e8f8d23ac71 (llvm-min-tblgen)
Nico Weber [Tue, 2 May 2023 23:59:21 +0000 (19:59 -0400)]
[gn] port 243e8f8d23ac71 (llvm-min-tblgen)

22 months ago[libc] Add 'UNIT_TEST_ONLY' and 'HERMETIC_TEST_ONLY' to 'add_libc_test'
Joseph Huber [Tue, 2 May 2023 20:54:29 +0000 (15:54 -0500)]
[libc] Add 'UNIT_TEST_ONLY' and 'HERMETIC_TEST_ONLY' to 'add_libc_test'

The `add_libc_test` option allows us to enable both kinds of tests in a
single option. However, some tests cannot be made hermetic with the
current approach. Such as tests that rely on system utilities or
libraries. This patch adds two options `UNIT_TEST_ONLY` and
`HERMETIC_TEST_ONLY` to offer more fine-grained control over which
version gets built. This makes it explicit which version a test supports
and why.

Depends on D149662

Reviewed By: sivachandra

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

22 months ago[libc] Enable the 'string' unit tests to be hermetic
Joseph Huber [Tue, 2 May 2023 16:58:47 +0000 (11:58 -0500)]
[libc] Enable the 'string' unit tests to be hermetic

This changes over the string unit tests to the new `add_libc_test`
framework. The one test that wasn't changes was the memory utils because
it overran the static buffer used for the hermetic test's bump pointer.

Depends on D149656

Reviewed By: sivachandra

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

22 months ago[libc] Remove use of 'assert' from the string tests
Joseph Huber [Tue, 2 May 2023 15:29:13 +0000 (10:29 -0500)]
[libc] Remove use of 'assert' from the string tests

Currently we use `assert` as a stand-in for the typical test assertions.
This is because these functions exist outside of the base test class so
we can't use the typical assertion methods. The presence of these
asserts makes it difficult to compile these tests in a standalone
format. This patch removes all occurrences.

Reviewed By: sivachandra

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

22 months ago[LLDB] Add/Remove xfail for some API tests on Windows
Muhammad Omair Javaid [Tue, 2 May 2023 23:03:10 +0000 (04:03 +0500)]
[LLDB] Add/Remove xfail for some API tests on Windows

This patch add or removes XFAIL decorator from various tests which were marked
xfail for windows.

since 44363f2 various tests have started passing but introduced a couple of new failures.
Weight is in favor of new XPasses and I have removed XFail decorator from them. Also
some new tests have started failing for which we need to file separate bugs. I have
marked them xfail for now and will add the bug id after investigating the issue.

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

22 months agoValueTracking: Sign handling for minnum/maxnum
Matt Arsenault [Tue, 18 Apr 2023 11:36:46 +0000 (07:36 -0400)]
ValueTracking: Sign handling for minnum/maxnum

If we know one operand is positive for maxnum, or one is negative
for minnum, the result will have the same sign.

22 months ago[gn] port fa43608d1649 (riscv_sifive_vector.td)
Nico Weber [Tue, 2 May 2023 22:59:47 +0000 (18:59 -0400)]
[gn] port fa43608d1649 (riscv_sifive_vector.td)

22 months agoRevert "[Demangle] make llvm::demangle take std::string_view rather than const std...
Nick Desaulniers [Tue, 2 May 2023 22:54:09 +0000 (15:54 -0700)]
Revert "[Demangle] make llvm::demangle take std::string_view rather than const std::string&"

This reverts commit c117c2c8ba4afd45a006043ec6dd858652b2ffcc.

itaniumDemangle calls std::strlen with the results of
std::string_view::data() which may not be NUL-terminated. This causes
lld/test/wasm/why-extract.s  to fail when "expensive checks" are enabled
via -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON. See D149675 for further
discussion. Back this out until the individual demanglers are converted
to use std::string_view.

22 months ago[mlir][linalg] check if a function has a body during detensorizing
Okwan Kwon [Tue, 2 May 2023 20:37:14 +0000 (13:37 -0700)]
[mlir][linalg] check if a function has a body during detensorizing

A func may not have a body.

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

22 months ago[MemProf] Use profiled lifetime access density directly
Teresa Johnson [Tue, 2 May 2023 20:03:41 +0000 (13:03 -0700)]
[MemProf] Use profiled lifetime access density directly

Now that the runtime tracks the lifetime access density directly, we can
use that directly in the threshold checks instead of less accurately
computing from other statistics.

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

22 months ago[libc][bazel] static link test targets
Michael Jones [Tue, 2 May 2023 18:24:19 +0000 (11:24 -0700)]
[libc][bazel] static link test targets

This solves issues caused by the symbols for internal components being
marked as hidden. When dynamically linked, the tests of internal
components, such as printf_parser_test, fail due to the symbols being
unavailable.

Reviewed By: sivachandra

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

22 months ago[lldb-vscode] Implement RestartRequest
Jorge Gorbe Moya [Tue, 11 Apr 2023 01:37:03 +0000 (18:37 -0700)]
[lldb-vscode] Implement RestartRequest

This is an optional request, but supporting it makes the experience
better when re-launching a big binary that takes significant time to
parse: instead of tearing down and re-create the whole session we just
need to kill the current process and launch a new one.

Some non-obvious comments that might help review this change:

* After killing the process, we get an "exited" event for it. Because
  the process no longer exists some interesting things can occur that
  manifest as flaky failures if not dealt with:

  - `EventIsProcessEvent` relies on `SBEvent::GetBroadcasterClass`,
    which can crash if the broadcaster is no longer there: the event
    only holds a weak_ptr to its broadcaster, and `GetBroadcasterClass`
    uses it without checking.

    Other `EventIs*` functions look at the flavor of the EventData, so I
    have modified EventIsProcessEvent to do that.

  - We keep the PID of the old process so we can detect its "exited"
    event and not terminate the whole session. But sometimes the
    SBProcess we get from the event won't have a PID, for some reason.

* I have factored out the code to launch a process out to a new
  LaunchProcess function, so it can be used from both `request_launch`
  and `request_restart`.

* The restart_runInTerminal test has the same problem with debug builds
  as the original runInTerminal test: when attaching to the launcher
  instance of lldb-vscode it takes a long time to parse its debug info.
  I have used the same workaround to disable that particular test for
  debug builds.

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

22 months ago[clang] Build the ToT Clang in Release mode in the Clang/libcxx CI pipeline
Louis Dionne [Tue, 2 May 2023 21:12:04 +0000 (17:12 -0400)]
[clang] Build the ToT Clang in Release mode in the Clang/libcxx CI pipeline

This is an attempt to reduce the insane amount of network we use when
uploading Clang binaries to Buildkite for other jobs to use. We think
that removing debug information will result in much smaller binaries.