platform/upstream/llvm.git
15 months ago[mlir][doc] Fix the EBNF description of mlir syntax in language reference doc
Yan Xin [Thu, 11 May 2023 08:36:52 +0000 (09:36 +0100)]
[mlir][doc] Fix the EBNF description of mlir syntax in language reference doc

According to the EBNF syntax described in the 'Common syntax' chapter,
literal characters should be surrounded by backticks (`). However, in
some sections of this document, single quotes (') are used instead.
So, fix them.

Reviewed By: mehdi_amini

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

15 months ago[NFC][AMDGPU] Pre-commit test.
Thomas Symalla [Thu, 11 May 2023 07:11:14 +0000 (09:11 +0200)]
[NFC][AMDGPU] Pre-commit test.

15 months ago[X86] Add lowering of fminimum/fmaximum for vector operands.
Serguei Katkov [Thu, 4 May 2023 10:16:00 +0000 (17:16 +0700)]
[X86] Add lowering of fminimum/fmaximum for vector operands.

Reviewed By: e-kud
Differential Revision: https://reviews.llvm.org/D149844

15 months agoSupport critical edge splitting for jump tables
Matthias Braun [Fri, 9 Dec 2022 01:15:41 +0000 (17:15 -0800)]
Support critical edge splitting for jump tables

Add support for splitting critical edges coming from an indirect jump
using a jump table ("switch jumps").

This introduces the `TargetInstrInfo::getJumpTableIndex` callback to
allows targets to return an index into `MachineJumpTableInfo` for a
given indirect jump. It also updates to
`MachineBasicBlock::SplitCriticalEdge` to allow splitting of critical
edges by rewriting jump table entries.

This is largely based on work done by Zhixuan Huan in D132202.

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

15 months ago[clang][CodeGenPGO] Don't use an invalid index when region counts disagree
Nathan Lanza [Thu, 11 May 2023 02:48:43 +0000 (22:48 -0400)]
[clang][CodeGenPGO] Don't use an invalid index when region counts disagree

If we're using an old instrprof profile and the user passes we can get
Decls with children decl counts not matching the what the profile was
written against. In a particular case I was debugging we have 24 decls
in the AST and 22 decls in the profile. Avoid crashing in this case.

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

15 months ago[AIX] enable enable OrcCAPITest, NFC
Chen Zheng [Thu, 11 May 2023 02:35:16 +0000 (22:35 -0400)]
[AIX] enable enable OrcCAPITest, NFC

After enhancement for XCOFF integrated assembler mode, now OrcCAPITest
can be enabled on AIX.

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

15 months ago[C++] Don't filter using declaration when we perform qualified look up
Chuanqi Xu [Sat, 6 May 2023 08:53:55 +0000 (16:53 +0800)]
[C++] Don't filter using declaration when we perform qualified look up

Close https://github.com/llvm/llvm-project/issues/62174

And this was originally a try to close
https://github.com/llvm/llvm-project/issues/62158.

I don't feel this is the correct fix. I just think it is not bad as an
ad-hoc patch. And let's discuss things in the higher-level in the above
GitHub issue link.

Reviewed By: erichkeane

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

15 months ago[libc][rpc] Allocate a single block of shared memory instead of three
Jon Chesterfield [Thu, 11 May 2023 02:04:55 +0000 (03:04 +0100)]
[libc][rpc] Allocate a single block of shared memory instead of three

Allows moving the pointer swap between server and client into reset.
Single allocation simplifies whatever allocates the client/server, currently
the libc loaders.

Reviewed By: jhuber6

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

15 months agoRemove accidentally committed empty file
Teresa Johnson [Thu, 11 May 2023 01:44:58 +0000 (18:44 -0700)]
Remove accidentally committed empty file

Removes an empty file inadvertently included with
b8d2f7177c39af7be371ba7f46cb00b9c63ef8f5.

15 months ago[mlir][Linalg] Use ReifyRankedShapedTypeOpInterface for pad transforms.
Hanhan Wang [Tue, 9 May 2023 21:25:53 +0000 (14:25 -0700)]
[mlir][Linalg] Use ReifyRankedShapedTypeOpInterface for pad transforms.

The information is not tied to tensor.empty op and tensor.extract_slice
op. We can infer smallest static bounding box for pad transform if
they implement ReifyRankedShapedTypeOpInterface. The revision extends
the usability for downstream projects. No tests are added because the
existing tests cover the change, and most of MLIR
ReifyRankedShapedTypeOpInterface ops are covered in the tests, except
tensor.generate and bufferization.alloc_tensor ops.

Reviewed By: mravishankar

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

15 months ago[OpenMP][Flang][Semantics] Add semantics support for USE_DEVICE_ADDR clause on OMP...
Raghu Maddhipatla [Thu, 4 May 2023 04:47:42 +0000 (23:47 -0500)]
[OpenMP][Flang][Semantics] Add semantics support for USE_DEVICE_ADDR clause on OMP TARGET DATA directive.

Reviewed By: kiranchandramohan

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

15 months ago[ORC-RT] Add REQUIRES: jit-compatible-osx-swift-runtime to testcase.
Lang Hames [Wed, 10 May 2023 23:59:26 +0000 (16:59 -0700)]
[ORC-RT] Add REQUIRES: jit-compatible-osx-swift-runtime to testcase.

Swift and ObjC testcases require a jit-compatible runtime.

rdar://109162598

15 months ago[libc] Fix RPC interface when sending and recieving aribtrary packets
Joseph Huber [Wed, 10 May 2023 23:14:51 +0000 (18:14 -0500)]
[libc] Fix RPC interface when sending and recieving aribtrary packets

The interface exported by the RPC library allows users to simply send
and recieve fixed sized packets without worrying about the data motion
underneath. However, this was broken in the current implementation. We
can think of the send and recieve implementations in terms of waiting
for ownership of the buffer, using the buffer, and posting ownership to
the other side. Our implementation of `recv` was incorrect in the
following scenarios.

recv -> send // we still own the buffer and should give away ownership
recv -> close // The other side is not waiting for data, this will
                 result in multiple openings of the same port

This patch attempts to fix this with an admittedly hacky fix where we
track if the previous implementation was a recv and post conditionally.

Reviewed By: JonChesterfield

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

15 months agoPrioritize using a segment with the name TEXT instead off fileoff 0
Jason Molenda [Wed, 10 May 2023 23:39:20 +0000 (16:39 -0700)]
Prioritize using a segment with the name TEXT instead off fileoff 0

lldb needs to find the virtual address of the mach header of a
binary.  It first scans for a segment which starts at file offset
0, and uses the vmaddr of that segment.  If no segment starts at
fileoff 0, it looks for a segment named __TEXT.

This patch changes the order of those, to first search for the TEXT
segment.  We have a situation where binaries exist that have the
DATA segment first, which does not have the vmaddr of the mach header,
it merely happens to come first in the binary file.  It's an unusual
arrangement, but not breaking any rules of Mach-O.  So lldb needs
to handle this.

Differential Revision: https://reviews.llvm.org/D150239
rdar://109128418

15 months ago[libc][rpc] Allocate locks array within process
Jon Chesterfield [Wed, 10 May 2023 23:39:54 +0000 (00:39 +0100)]
[libc][rpc] Allocate locks array within process

Replaces the globals currently used. Worth changing to a bitmap
before allowing runtime number of ports >> 64. One bit per port is likely
to be cheap enough that sizing for the worst case is always fine, otherwise
in the future we can change to dynamically allocating it.

Reviewed By: jhuber6

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

15 months ago[FS-AFDO] Do not load non-FS profile in MIR loader.
Hongtao Yu [Wed, 10 May 2023 23:10:39 +0000 (16:10 -0700)]
[FS-AFDO] Do not load non-FS profile in MIR loader.

I was seeing a regression when enabling FS discriminators on an non-FS CSSPGO build. This is because a probe can get a zero-valued discriminator at a specific pass and that could lead to accidentally loading the corresponding base counter in the non-FS profile, while a non-zeo discriminator would end up getting zero samples. This could in turn undo the sample distribution effort done by previous BFI maintenance work and the probe distribution factor work for pseudo probes specifically. To mitigate that I'm disabling loading a non-FS profile against FS discriminators. The problem should also exist with non-CS AutoFDO, so I'm doing this for it too.

Reviewed By: wenlei

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

15 months ago[libc] Prevent changing ownership of the port once opened
Joseph Huber [Mon, 8 May 2023 14:04:14 +0000 (09:04 -0500)]
[libc] Prevent changing ownership of the port once opened

The Port type has stipuations that the same exact mask used to open it
needs to close it. This can currently be violated by calling its move
constructor to put it somewhere else. We still need the move constructor
to handle the open and closing functions. So, we simply make these
constructors private and only allow a few classes to have move
priviledges on it.

Reviewed By: JonChesterfield, lntue

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

15 months agoAdopt Properties to store operations inherent Attributes in the Tensor dialect
Mehdi Amini [Fri, 21 Apr 2023 07:11:28 +0000 (01:11 -0600)]
Adopt Properties to store operations inherent Attributes in the Tensor dialect

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

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

15 months agoAdopt Properties to store operations inherent Attributes in the SPIRV dialect
Mehdi Amini [Fri, 21 Apr 2023 07:09:46 +0000 (01:09 -0600)]
Adopt Properties to store operations inherent Attributes in the SPIRV dialect

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

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

15 months agoAdopt Properties to store operations inherent Attributes in the SparseTensor dialect
Mehdi Amini [Fri, 21 Apr 2023 07:09:12 +0000 (01:09 -0600)]
Adopt Properties to store operations inherent Attributes in the SparseTensor dialect

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

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

15 months agoAdopt Properties to store operations inherent Attributes in the Shape dialect
Mehdi Amini [Fri, 21 Apr 2023 07:08:35 +0000 (01:08 -0600)]
Adopt Properties to store operations inherent Attributes in the Shape dialect

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

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

15 months agoAdopt Properties to store operations inherent Attributes in the SCF dialect
Mehdi Amini [Fri, 21 Apr 2023 07:06:48 +0000 (01:06 -0600)]
Adopt Properties to store operations inherent Attributes in the SCF dialect

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

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

15 months ago[libc++][PSTL] Add missing includes to PSTL headers
Ian Anderson [Mon, 8 May 2023 04:39:40 +0000 (23:39 -0500)]
[libc++][PSTL] Add missing includes to PSTL headers

Several PSTL headers included by <algorithm> are missing includes for things they use.
Switch some quoted includes to angle includes.

(Issues found from running `check-cxx` with https://reviews.llvm.org/D144322)

Reviewed By: ldionne, #libc

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

15 months ago[libc++] Consistently enable __CORRECT_ISO_CPP_WCHAR_H_PROTO in mbstate.
Jordan Rupprecht [Wed, 10 May 2023 22:43:37 +0000 (15:43 -0700)]
[libc++] Consistently enable __CORRECT_ISO_CPP_WCHAR_H_PROTO in mbstate.

In libc++'s `wchar.h`, before we forward to the system `wchar.h`, we set `__CORRECT_ISO_CPP_WCHAR_H_PROTO` to ensure it defines the correct signature (e.g. `extern "C++" const wchar_t *wmemchr` and not `extern wchar_t *wmemchr`). After D148542, there are cases where we include the system `wchar.h` from within `__mbstate_t.h` without setting that, and so we get a function type mismatch if we transitively include `wchar.h` through multiple headers in a modules-enabled build. Consistently setting it here resolves those build errors.

Alternative 1: we could put this in `__config` instead. I chose to put it here for a more limited scope.

Alternative 2: we could patch `wchar.h` itself to work correctly and remove references `__CORRECT_ISO_CPP_WCHAR_H_PROTO` from libc++ entirely. It does already set it, but with an additional condition that it is being built by GCC >= 4.4. Clang does pretend to be GCC via `__GNUC__` etc. which can be controlled via `-fgnuc-version` command line flags, but that might have other consequences.

Reviewed By: ldionne, #libc, MaskRay

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

15 months agoWhen the Debugger runs HandleProcessEvent it should allow
Jim Ingham [Wed, 10 May 2023 22:40:40 +0000 (15:40 -0700)]
When the Debugger runs HandleProcessEvent it should allow
selecting the "Most relevant" frame.

If you don't do that, then the correct frame gets selected, but it
happens AFTER the frame info gets printed in the stop message, so
you don't see the selected frame.

The test for this hid the issue because it ran `frame info` and
checked the result of that.  That happens after the recognizer selects
the frame, and so it was right.  But if the recognizer is working
correctly it will have already done the same printing in the stop
message, and this way we also verify that the stop message was right.

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

15 months ago[FS-AFDO] Fix a pseudo probe test issue.
Hongtao Yu [Wed, 10 May 2023 22:32:28 +0000 (15:32 -0700)]
[FS-AFDO] Fix a pseudo probe test issue.

15 months agoRevert "[RISCV] Fix extract_vector_elt on i1 at idx 0 being inverted"
Philip Reames [Wed, 10 May 2023 22:02:28 +0000 (15:02 -0700)]
Revert "[RISCV] Fix extract_vector_elt on i1 at idx 0 being inverted"

This reverts commit d9683a70fef48cfaee2c83147a3b26f4f90162a2.  A regression was reported in the review, revert until author is back from conference and can investigate.

15 months ago[MemProf] Update hot/cold information after importing
Teresa Johnson [Wed, 10 May 2023 20:14:22 +0000 (13:14 -0700)]
[MemProf] Update hot/cold information after importing

The support added by D149215 to remove memprof metadata and attributes
if we don't link with an allocator supporting hot/cold operator new
interfaces did not update imported code. Move the update handling later
in the ThinLTO backend to just after importing, and update the test to
check this case.

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

15 months ago[Hexagon] Add patterns for bspap/bitreverse for scalar vectors
Krzysztof Parzyszek [Wed, 3 May 2023 23:22:31 +0000 (16:22 -0700)]
[Hexagon] Add patterns for bspap/bitreverse for scalar vectors

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

15 months ago[TableGen] Print message about dropped patterns with -debug
Krzysztof Parzyszek [Wed, 3 May 2023 22:52:12 +0000 (15:52 -0700)]
[TableGen] Print message about dropped patterns with -debug

A selection pattern can be silently dropped if type inference fails to
deduce some types. Print a message when that happens, and -debug was
applied.

15 months ago[scudo] Lock FallbackTSD before draining it
Chia-hung Duan [Wed, 10 May 2023 20:34:36 +0000 (20:34 +0000)]
[scudo] Lock FallbackTSD before draining it

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

15 months ago[libc++][NFC] Remove duplicate declaration of __iter_value_type
Louis Dionne [Wed, 10 May 2023 21:28:02 +0000 (17:28 -0400)]
[libc++][NFC] Remove duplicate declaration of __iter_value_type

The exact same declaration exists a few lines above.

15 months ago[scudo] Drain caches when release with M_PURGE_ALL
Chia-hung Duan [Wed, 10 May 2023 20:11:08 +0000 (20:11 +0000)]
[scudo] Drain caches when release with M_PURGE_ALL

This will drain both quarantine and local caches.

Reviewed By: cferris

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

15 months ago[scudo] Skip releaseToOSMaybe if there's no byte in freelist
Chia-hung Duan [Wed, 10 May 2023 02:40:48 +0000 (02:40 +0000)]
[scudo] Skip releaseToOSMaybe if there's no byte in freelist

In primary32, the unused region will have max/min region index with 0
value and it's an invalid index. Skip releaseToOSMaybe in both primary32
and primary64 even it's M_PURGE_ALL.

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

15 months ago[Headers][doc] Add "shift" intrinsic descriptions to avx2intrin.h
Paul Robinson [Wed, 10 May 2023 17:36:36 +0000 (10:36 -0700)]
[Headers][doc] Add "shift" intrinsic descriptions to avx2intrin.h

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

15 months ago[Flang] Syntax support for OMP Allocators Construct
Ethan Luis McDonough [Wed, 10 May 2023 19:50:41 +0000 (14:50 -0500)]
[Flang] Syntax support for OMP Allocators Construct

OpenMP 5.2 introduces a Fortran specific construct that aims to replace the executable allocate directive.  This patch seeks to add parser support for the directive as well as the allocator clause with the [[ https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5-2.pdf#section.6.6 | extended align/complex ]] modifier.

Reviewed By: kiranchandramohan

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

15 months ago[libc++][NFC] Fix slightly incorrect instructions for testing with Ninja
Louis Dionne [Wed, 10 May 2023 19:50:25 +0000 (15:50 -0400)]
[libc++][NFC] Fix slightly incorrect instructions for testing with Ninja

15 months ago[lldb] Mark most SBAPI methods involving private types as protected or private
Alex Langford [Mon, 8 May 2023 23:31:27 +0000 (16:31 -0700)]
[lldb] Mark most SBAPI methods involving private types as protected or private

Many SB classes have public constructors or methods involving types that
are private. Some are more obvious (e.g. containing lldb_private in the
name) than others (lldb::FooSP is usually std::shared_pointer<lldb_private::Foo>).

This commit explicitly does not address FileSP, so I'm leaving that one
alone for now.

Some of these were for other SB classes to use and should have been made
protected/private with a friend class entry added. Some of these were
public for some of the swig python helpers to use. I put all of those
functions into a class and made them static methods. The relevant SB
classes mark that class as a friend so they can access those
private/protected members.

I've also removed an outdated SBStructuredData test (can you guess which
constructor it was using?) and updated the other relevant tests.

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

15 months ago[Libomptarget] Fix AMDGPU Note handling after D150022
Joseph Huber [Wed, 10 May 2023 19:11:50 +0000 (14:11 -0500)]
[Libomptarget] Fix AMDGPU Note handling after D150022

Summary:
The changes in https://reviews.llvm.org/D150022 changed the API for this
function that we query. Simply pass in the alignment from the associated
header to fix.

15 months ago[LangRef] Fix sphinx label syntax
Felipe de Azevedo Piovezan [Wed, 10 May 2023 18:59:03 +0000 (14:59 -0400)]
[LangRef] Fix sphinx label syntax

15 months agoReapply "[RISCV][InsertVSETVLI] Avoid VL toggles for extractelement patterns"
Philip Reames [Wed, 10 May 2023 18:08:14 +0000 (11:08 -0700)]
Reapply "[RISCV][InsertVSETVLI] Avoid VL toggles for extractelement patterns"

The original change had a bug where it allowed SEW mutation.  This is wrong in multiple ways, but an easy example is that the slide amount is in units of SEW, and thus that changing SEW changes the slide offset.

I'd reverted this in 33314693 intending to more majorly rework the patch because in addition to the bug, I'd noticed a potential oppurtunity to increase scope.  After implementing that variant, and realizing it triggered nowhere, I decided to go back to the prior patch with the minimal fix.

Note there's no separate test case for the fix.  This is because we already had multiple, and I just didn't realize the impact of the original test diff.  Adding one more test would have been unlikely to catch that human error.

Original commit message..

Noticed this while looking at some SLP output. If we have an extractelement, we're probably using a slidedown into an destination with no contents. Given this, we can allow the slideup to use a larger VL and clobber tail elements of the destination vector. Doing this allows us to avoid vsetvli toggles in many fixed length vector examples.

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

15 months ago[Corosplit] Prepend entry_value in swift async dbg values
Felipe de Azevedo Piovezan [Wed, 3 May 2023 16:29:58 +0000 (12:29 -0400)]
[Corosplit] Prepend entry_value in swift async dbg values

When the coroutine splitter splits swift coroutines, variables in the new
funclets are now described in terms of the frame pointer, which is always placed
at a ABI-specified register whose contents are valid upon function entry. As
such, debug intrinsics must be prepended by the `entry_value` operation.

Depends on D149778

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

15 months ago[Verifier] Allow DW_OP_LLVM_entry_value in IR
Felipe de Azevedo Piovezan [Tue, 25 Apr 2023 14:56:10 +0000 (10:56 -0400)]
[Verifier] Allow DW_OP_LLVM_entry_value in IR

A follow up patch will make the CoroSplit pass introduce such operations in the
IR level when it is safe to do so.

Depends on D149748

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

15 months ago[FS-AFDO] Load pseudo probe profile on MIR
Hongtao Yu [Wed, 10 May 2023 17:28:33 +0000 (10:28 -0700)]
[FS-AFDO] Load pseudo probe profile on MIR

This change enables loading pseudo-probe based profile on MIR. Different from the IR profile loader, callsites are excluded from MIR profile loading since they are not assinged a FS discriminator. Using zero as the discriminator is not accurate and would undo the distribution work done by the IR loader based on pseudo probe distribution factor. We reply on block probes only for FS profile loading.

Some refactoring is done to the IR profile loader so that `getProbeWeight` can be shared by both loaders.

Reviewed By: wenlei

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

15 months ago[FS-AFDO] Generate pseudo-probe-based profiles with FS-discriminators.
Hongtao Yu [Mon, 10 Apr 2023 18:06:27 +0000 (11:06 -0700)]
[FS-AFDO] Generate pseudo-probe-based profiles with FS-discriminators.

This change enables generating pseudo-probe-based FS-AFDO profiles. The change is straightforward based-on previous change {D147651} by just injecting FS-discriminators into various profile generation spot.

Reviewed By: wenlei

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

15 months ago[PseudoProbe] Encode/Decode FS discriminator
Hongtao Yu [Wed, 5 Apr 2023 18:35:17 +0000 (11:35 -0700)]
[PseudoProbe] Encode/Decode FS discriminator

Encoding FS discriminators for block probes. Decoding them correspondingly.

The encoding/decoding of FS discriminators are conditional, only for probes with a non-zero discriminator. This saves encoding size, also ensures downwards-compatiblity.

Reviewed By: wenlei

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

15 months ago[PseudoProbe] Clean up dwarf discriminator and avoid duplicating factor.
Hongtao Yu [Mon, 17 Apr 2023 20:44:39 +0000 (13:44 -0700)]
[PseudoProbe] Clean up dwarf discriminator and avoid duplicating factor.

A pseudo probe is created with dwarf line information shared with its nearest instruction. If the instruction comes with a dwarf discriminator, it will be shared with the probe as well. This can confuse the later FS-AFDO discriminator assignment pass. To fix this, I'm cleaning up the discriminator fields for probes when they are inserted.

I also notice another possibility to change the discriminator field of pseudo probes in the pipeline before the FS discriminator assignment pass. That is the loop unroller, which assigns duplication factor to instruction being vectorized. I'm disabling that for pseudo probe intrinsics specifically, also for callsites with probes.

Reviewed By: wenlei

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

15 months ago[CodeGen] Fix nomerge attribute not working in tail calls.
Zequan Wu [Thu, 23 Mar 2023 18:42:23 +0000 (14:42 -0400)]
[CodeGen] Fix nomerge attribute not working in tail calls.

In D79537, `nomerge` was made to only apply to non-tail calls. This fixes it by also applying it to tail calls.

For ARM, I only made the new MI to inherit the flag under `TCRETURNdi` and `TCRETURNri`, because that's the place tail calls got replaced. Not sure if there's any other place needed.

Fixes #61545.

Reviewed By: rnk

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

15 months ago[lldb][NFCI] Replace dw_form_t with llvm::dwarf::Form
Alex Langford [Tue, 9 May 2023 21:34:20 +0000 (14:34 -0700)]
[lldb][NFCI] Replace dw_form_t with llvm::dwarf::Form

LLDB currently defines `dw_form_t` as a `uint16_t` which makes sense.
However, LLVM also defines a similar type `llvm::dwarf::Form` which is
an enum backed by a `uint16_t`. Switching to the llvm implementation
means that we can more easily interoperate with the LLVM DWARF code.

Additionally, we get some type checking out of this: I found that
DWARFAttribute had a method called `FormAtIndex` that returned a
`dw_attr_t`. Although `dw_attr_t` is also a `uint16_t` under the hood,
the type checking benefits here are undeniable: If this had returned a
something of different signedness/width, we could have had some bad
bugs.

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

15 months agoRevert "[RISCV][InsertVSETVLI] Avoid VL toggles for extractelement patterns"
Philip Reames [Wed, 10 May 2023 17:49:30 +0000 (10:49 -0700)]
Revert "[RISCV][InsertVSETVLI] Avoid VL toggles for extractelement patterns"

This reverts commit 657d20dc75252f0c8415ada5214affccc3c98efe.  A correctness problem was reported against the review and the fix warrants re-review.

15 months agoReland [clang] Make predefined expressions string literals under -fms-extensions
Arthur Eubanks [Sun, 7 May 2023 18:24:48 +0000 (11:24 -0700)]
Reland [clang] Make predefined expressions string literals under -fms-extensions

MSVC makes these string literals [1][2].

[1] https://godbolt.org/z/6vnTzbExx
[2] https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170

Fixes #114

Initial commit didn't check if there was a function name when stepping through expressions ignoring parens.

Reviewed By: aaron.ballman

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

15 months agofix typos to cycle bots
Nico Weber [Wed, 10 May 2023 17:53:47 +0000 (19:53 +0200)]
fix typos to cycle bots

15 months ago[clang][modules] Avoid unnecessary writes of .timestamp files
Jan Svoboda [Wed, 10 May 2023 17:41:16 +0000 (10:41 -0700)]
[clang][modules] Avoid unnecessary writes of .timestamp files

Clang currently updates the mtime of .timestamp files on each load of the corresponding .pcm file. This is not necessary. In a given build session, Clang only needs to write the .timestamp file once, when we first validate the input files. This patch makes it so that we only touch the .timestamp file when it's older than the build session, alleviating some filesystem contention in clang-scan-deps.

Reviewed By: benlangmuir

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

15 months ago[RISCV] Add support for V extenstion in SiFive7
Michael Maitland [Thu, 27 Apr 2023 20:08:27 +0000 (13:08 -0700)]
[RISCV] Add support for V extenstion in SiFive7

Add scheduling information for vector extension in SiFive7,
while using new LMUL & SEW scheduling constructs.

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

15 months agolibclang: add missing `struct` in the declaration
Saleem Abdulrasool [Wed, 10 May 2023 17:31:53 +0000 (10:31 -0700)]
libclang: add missing `struct` in the declaration

When building with compilers that do not support the Blocks extension,
we would fail to compile due to the missing type specifier on the
`typedef`.  This should repair those builds.

Fixes: #62640

15 months ago[libcxx] Fix pstl __init_ identifier after 9c4717a
Aaron Siddhartha Mondal [Wed, 10 May 2023 17:19:37 +0000 (19:19 +0200)]
[libcxx] Fix pstl __init_ identifier after 9c4717a

Reviewed By: ldionne, #libc

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

15 months ago[RISCV] Remove redundant F and D extension implication from V. NFC
Craig Topper [Wed, 10 May 2023 17:00:41 +0000 (10:00 -0700)]
[RISCV] Remove redundant F and D extension implication from V. NFC

We recently added implications for F and D to Zve32f and Zve64d
which V implies. So these have become redundant.

15 months agolibclang: declare blocks interfaces always
Saleem Abdulrasool [Wed, 10 May 2023 15:49:35 +0000 (08:49 -0700)]
libclang: declare blocks interfaces always

The implementation of these methods is not reliant on the availability
of the Blocks extension in the compiler.  However, when building on
Windows, the interface declaration is important for the attribution of
the DLL storage.  Without the attribution, the method implementation is
built but not made available as part of the ABI.  Use a check for the
blocks extension to determine how method signature is viewed rather than
controlling whether it is part of the interface.

15 months agoRevert "[SCEV] Replace IsAvailableOnEntry with block disposition"
Manoj Gupta [Wed, 10 May 2023 16:38:06 +0000 (09:38 -0700)]
Revert "[SCEV] Replace IsAvailableOnEntry with block disposition"

This reverts commit 103fc0f629aa6218783f65dff0197f257137cade.
Causes a clang crash in ChromeOS builds.
Testcase provided at D149344.

15 months ago[SLP][NFC] Rename a couple of variables and replace an if-else with an std::min
Vasileios Porpodas [Wed, 10 May 2023 02:07:21 +0000 (19:07 -0700)]
[SLP][NFC] Rename a couple of variables and replace an if-else with an std::min

- Rename `LimitForRegisterSize` to `MaxVFOnly` to make the meaning of the limit less ambiguous
- Rename `OpsWidth` to `ActualVF`, which makes it clear that this is the VF we are using for vectorization.
- Replace the if-else code for the initialization of OpsWidth with an std::min.

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

15 months ago[Object] Fix handling of Elf_Nhdr with sh_addralign=8
Fangrui Song [Wed, 10 May 2023 16:36:58 +0000 (09:36 -0700)]
[Object] Fix handling of Elf_Nhdr with sh_addralign=8

The generic ABI says:

> Padding is present, if necessary, to ensure 8 or 4-byte alignment for the next note entry (depending on whether the file is a 64-bit or 32-bit object). Such padding is not included in descsz.

Our parsing code currently aligns n_namesz. Fix the bug by aligning the start
offset of the descriptor instead. This issue has been benign because the primary
uses of sh_addralign=8 notes are `.note.gnu.property`, where
`sizeof(Elf_Nhdr) + sizeof("GNU") = 16` (already aligned by 8).

In practice, many 64-bit systems incorrectly use sh_addralign=4 notes.
We can use sh_addralign (= p_align) to decide the descriptor padding.
Treat an alignment of 0 and 1 as 4. This approach matches modern GNU readelf
(since 2018).

We have a few tests incorrectly using sh_addralign=0. We may make our behavior
stricter after fixing these tests.

Linux kernel dumped core files use `p_align=0` notes, so we need to support the
case for compatibility.

Reviewed By: jhenderson

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

15 months ago[gn build] Port f041b3472a87
LLVM GN Syncbot [Wed, 10 May 2023 16:23:50 +0000 (16:23 +0000)]
[gn build] Port f041b3472a87

15 months ago[libc++][PSTL] Move the remaining configuration into __config
Nikolas Klauser [Tue, 9 May 2023 18:51:40 +0000 (11:51 -0700)]
[libc++][PSTL] Move the remaining configuration into __config

Reviewed By: ldionne, #libc

Spies: sstefan1, jplehr, arichardson, libcxx-commits, miyuki

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

15 months agoRevert "[lli] Honor -mtriple option in -jit-kind=orc mode."
Nico Weber [Wed, 10 May 2023 15:59:02 +0000 (17:59 +0200)]
Revert "[lli] Honor -mtriple option in -jit-kind=orc mode."

This reverts commit 624dcd8d53c1ffe10fbc936b186a98ec7fa1c865.
Breaks check-llvm on Windows, see https://reviews.llvm.org/D149996#4332381

15 months agoAMDGPU: Factor out GFX9.4 common features into a feature set
Konstantin Zhuravlyov [Wed, 10 May 2023 15:20:59 +0000 (11:20 -0400)]
AMDGPU: Factor out GFX9.4 common features into a feature set

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

15 months agoAMDGPU: Add basic gfx942 target
Konstantin Zhuravlyov [Wed, 10 May 2023 15:20:06 +0000 (11:20 -0400)]
AMDGPU: Add basic gfx942 target

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

15 months agoAMDGPU: Add basic gfx941 target
Konstantin Zhuravlyov [Wed, 10 May 2023 15:18:42 +0000 (11:18 -0400)]
AMDGPU: Add basic gfx941 target

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

15 months ago[mlir][openacc] Cleanup acc.kernels from old data clause operands
Valentin Clement [Wed, 10 May 2023 15:35:06 +0000 (08:35 -0700)]
[mlir][openacc] Cleanup acc.kernels from old data clause operands

Remove old clause operands from acc.kernels operation since
the new dataOperands is now in place.
private and firstprivate will receive some redesign but are
not part of the new dataOperands.

Depends on D150224

Reviewed By: vzakhari

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

15 months ago[mlir][openacc] Cleanup acc.serial from old data clause operands
Valentin Clement [Wed, 10 May 2023 15:32:55 +0000 (08:32 -0700)]
[mlir][openacc] Cleanup acc.serial from old data clause operands

Remove old clause operands from acc.serial operation since
the new dataOperands is now in place.
private and firstprivate will receive some redesign but are
not part of the new dataOperands.

Depends on D150207

Reviewed By: vzakhari

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

15 months ago[flang][openacc] Preserve user order for entry data operand on compute construct
Valentin Clement [Wed, 10 May 2023 15:31:35 +0000 (08:31 -0700)]
[flang][openacc] Preserve user order for entry data operand on compute construct

The order of operand in clauses that are decomposed was not
preserved. This patch change how operands are handled and preserve
the user ordering for the entry data operation on the acc.parallel
operation.

Reviewed By: vzakhari

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

15 months ago[mlir][openacc][NFC] Add missing check lines for acc.update tests
Valentin Clement [Wed, 10 May 2023 15:23:27 +0000 (08:23 -0700)]
[mlir][openacc][NFC] Add missing check lines for acc.update tests

D149909 was missing the check lines in the ops.mlir lit test.

Reviewed By: vzakhari

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

15 months ago[flang][openacc] Preserve user order for entry data operand on data construct
Valentin Clement [Wed, 10 May 2023 15:22:05 +0000 (08:22 -0700)]
[flang][openacc] Preserve user order for entry data operand on data construct

The order of operand in clauses that are decomposed was not
preserved. This patch change how operands are handled and preserve
the user ordering for the entry data operation on the acc.data
operation.

Reviewed By: vzakhari

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

15 months ago[RISCV] Enable signed truncation check transforms for i8
Yingwei Zheng [Wed, 10 May 2023 14:53:24 +0000 (22:53 +0800)]
[RISCV] Enable signed truncation check transforms for i8

This patch enables signed truncation check transforms for i8 on rv32 when XVT is i64 and Zbb is enabled.

It is a small improvement of D149977.

Reviewed By: craig.topper

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

15 months agoRevert "[clang] [test] Narrow down MSVC specific behaviours from "any windows" to...
Nico Weber [Wed, 10 May 2023 14:49:18 +0000 (16:49 +0200)]
Revert "[clang] [test] Narrow down MSVC specific behaviours from "any windows" to only MSVC/clang-cl"

This reverts commit 7f037e5645bd62fca6fc7c3e77962aafe2bc8b27.
Breaks tests, see https://reviews.llvm.org/D149997#4331937

15 months agoAdd support of the next Ubuntu (Ubuntu 23.10 - Mantic Minotaur)
Sylvestre Ledru [Wed, 10 May 2023 14:31:53 +0000 (16:31 +0200)]
Add support of the next Ubuntu (Ubuntu 23.10 - Mantic Minotaur)

15 months agoAdopt Properties to store operations inherent Attributes in the Quant dialect
Mehdi Amini [Fri, 21 Apr 2023 06:55:47 +0000 (00:55 -0600)]
Adopt Properties to store operations inherent Attributes in the Quant dialect

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

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

15 months agoAdopt Properties to store operations inherent Attributes in the PDLInterp dialect
Mehdi Amini [Fri, 21 Apr 2023 06:55:02 +0000 (00:55 -0600)]
Adopt Properties to store operations inherent Attributes in the PDLInterp dialect

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

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

15 months agoAdopt Properties to store operations inherent Attributes in the PDL dialect
Mehdi Amini [Fri, 21 Apr 2023 06:54:25 +0000 (00:54 -0600)]
Adopt Properties to store operations inherent Attributes in the PDL dialect

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

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

15 months agoAdopt Properties to store operations inherent Attributes in the OpenMP dialect
Mehdi Amini [Fri, 21 Apr 2023 06:53:41 +0000 (00:53 -0600)]
Adopt Properties to store operations inherent Attributes in the OpenMP dialect

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

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

15 months agoAdopt Properties to store operations inherent Attributes in the OpenACC dialect
Mehdi Amini [Fri, 21 Apr 2023 06:53:04 +0000 (00:53 -0600)]
Adopt Properties to store operations inherent Attributes in the OpenACC dialect

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

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

15 months agoclang-format: [JS] support import/export type
Jan Kuhle [Wed, 10 May 2023 13:11:50 +0000 (15:11 +0200)]
clang-format: [JS] support import/export type

Contributed by @jankuehle!

Users can choose to only import/export the type of the symbol (not value nor namespace) by adding a `type` keyword, e.g.:

```
import type {x} from 'y';
import {type x} from 'y';
export type {x};
export {type x};
```

Previously, this was not handled and would:
- Terminate import sorting
- Remove the space before the curly bracket in `export type {`

With this change, both formatting and import sorting work as expected.

Reviewed By: MyDeveloperDay, krasimir

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

15 months agoRevert "[SimpleLoopUnswitch] unswitch selects"
Benjamin Kramer [Wed, 10 May 2023 13:11:34 +0000 (15:11 +0200)]
Revert "[SimpleLoopUnswitch] unswitch selects"

This reverts commit 21f226fc4591db6e98faf380137a42067c909582. Crashes on
this test case:

define void @test2() nounwind {
entry:
  br label %bb.nph

bb.nph:                                           ; preds = %entry
  %and.i13521 = and <4 x i1> undef, undef
  br label %for.body

for.body:                                         ; preds = %for.body, %bb.nph
  %or.i = select <4 x i1> %and.i13521, <4 x i32> undef, <4 x i32> undef
  br i1 false, label %for.body, label %for.end

for.end:                                          ; preds = %for.body, %entry
  ret void
}

15 months ago[AArch64] Emit FNMADD instead of FNEG(FMADD)
Matt Devereau [Wed, 10 May 2023 00:55:01 +0000 (00:55 +0000)]
[AArch64] Emit FNMADD instead of FNEG(FMADD)

Emit FNMADD instead of FNEG(FMADD) for optimization levels
above Oz when fast-math flags (nsz+contract) permit it.

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

15 months agoAdd -no-canonical-prefixes to test that matches the binary name
Benjamin Kramer [Wed, 10 May 2023 11:17:35 +0000 (13:17 +0200)]
Add -no-canonical-prefixes to test that matches the binary name

15 months ago[MLIR][LLVM] Support inlining of LLVM atomic operations.
Johannes de Fine Licht [Wed, 10 May 2023 10:44:04 +0000 (10:44 +0000)]
[MLIR][LLVM] Support inlining of LLVM atomic operations.

These don't require any special handling, apart checking for unsupported
metadata, which is already implemented.

Reviewed By: gysit

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

15 months ago[tidy] Expose getID to tidy checks
Kadir Cetinkaya [Wed, 10 May 2023 07:47:17 +0000 (09:47 +0200)]
[tidy] Expose getID to tidy checks

This also fixes a possible use-after-free in the IdentifierNamingCheck.

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

15 months agoReapply "[SystemZ] Bugfix in expansion of memmem operations."
Jonas Paulsson [Wed, 10 May 2023 09:42:36 +0000 (11:42 +0200)]
Reapply "[SystemZ] Bugfix in expansion of memmem operations."

The new test case showed that the NoPHIs flag needs to be cleared.

Original commit message:

[SystemZ] Bugfix in expansion of memmem operations.

Since NC, OC, and XC clobber CC, the EXRL_Pseudo targeting these must also be
marked to do so.

Original patch by uweigand.

Reviewed by: uweigand

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

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

15 months ago[gn build] Port 62a090f958ce
LLVM GN Syncbot [Wed, 10 May 2023 10:39:33 +0000 (10:39 +0000)]
[gn build] Port 62a090f958ce

15 months ago[clangd] Initialize clang-tidy modules only once
Kadir Cetinkaya [Wed, 10 May 2023 08:43:16 +0000 (10:43 +0200)]
[clangd] Initialize clang-tidy modules only once

This is showing up on our profiles with ~100ms contribution @95th% for
buildAST latencies.
The patch is unlikely to address it all, but should help with some low-hanging
fruit.

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

15 months ago[lldb][NFCI] Remove n^2 loops and simplify iterator usage
Felipe de Azevedo Piovezan [Tue, 9 May 2023 18:58:29 +0000 (14:58 -0400)]
[lldb][NFCI] Remove n^2 loops and simplify iterator usage

The code inside Broadcaster makes usage of iterators using olden C++ coding
style. Hidden in this old style is a couple of N^2 loops: we iterate over a map
(sequentially), removing the first element that matches some predicate. The
search is _always_ done from the start of the map, which implies that, if the
map has N elements and if all matches happen on the second half of the map, then
we visit the first N/2 elements exactly N/2 * N/2 times.

Ideally some of the code here would benefit from `std::map`s own "erase_if", but
this is only available with C++20:
https://en.cppreference.com/w/cpp/container/map/erase_if

We spent quite some time trying to make these loops more elegant, but it is
surprisingly tricky to do so.

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

15 months ago[NFC] [C++20] [Modules] Code cleanups when checking modules in ADL
Chuanqi Xu [Wed, 10 May 2023 09:53:45 +0000 (17:53 +0800)]
[NFC] [C++20] [Modules] Code cleanups when checking modules in ADL

The original code uses getTopLevelModuleName to compare if the module
matches. This is an overkill. Since in one program there will only be at
most one module name. So it is good enough to compare the module
directly. So that we can save some string comparisons.

15 months ago[C++20] [Modules] Don't generate unused variables in other module units
Chuanqi Xu [Sat, 6 May 2023 09:32:39 +0000 (17:32 +0800)]
[C++20] [Modules] Don't generate unused variables in other module units
even if its initializer has side effects

Close https://github.com/llvm/llvm-project/issues/61892

The variables whose initializer has side effects will be emitted even if
it is not used. But it shouldn't be true after we introduced modules.
The variables in other modules shouldn't be emitted if it is not used
even if its initializer has size effects.

Also this patch rename `Decl::isInCurrentModuleUnit` to
`Decl::isInAnotherModuleUnit` to make it closer to the semantics.

15 months ago[AMDGPU][MC] Clean up DPP bound_ctrl handling
Diana Picus [Wed, 26 Apr 2023 12:12:43 +0000 (14:12 +0200)]
[AMDGPU][MC] Clean up DPP bound_ctrl handling

At the moment, we set the BC bit in DPP for both bound_ctrl:0 and
bound_ctrl:1, for compatibility with sp3 (see PR35397). However, this
hack is only needed for GFX8. For newer GFXs, sp3 behaves as expected,
i.e. it sets the bit when bound_ctrl:1 and clears it when bound_ctrl:0.

This patch updates LLVM to do the same for GFX11 or newer. We preserve
the current behaviour for GFX9 and 10 so we don't break any existing
code.

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

15 months agoRevert "[SystemZ] Bugfix in expansion of memmem operations."
Jonas Paulsson [Wed, 10 May 2023 09:23:34 +0000 (11:23 +0200)]
Revert "[SystemZ] Bugfix in expansion of memmem operations."

Sorry - mir test fails with expensive checks on build bot.

Seems to relate to the fact that there are no PHIs in the .mir input, but after
they are created the verifyer reports "Found PHI instruction with NoPHIs property
set".

This reverts commit 00454a17f361d677d5423905c888daca1a80661a.

15 months ago[SystemZ] Bugfix in expansion of memmem operations.
Jonas Paulsson [Wed, 10 May 2023 09:02:07 +0000 (11:02 +0200)]
[SystemZ] Bugfix in expansion of memmem operations.

Since NC, OC, and XC clobber CC, the EXRL_Pseudo targeting these must also be
marked to do so.

Original patch by uweigand.

Reviewed by: uweigand

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

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

15 months ago[libc] Add optimized memcpy for RISCV
Guillaume Chatelet [Wed, 10 May 2023 08:34:05 +0000 (08:34 +0000)]
[libc] Add optimized memcpy for RISCV

This patch adds two versions of memcpy optimized for architectures where unaligned accesses are either illegal or extremely slow.
It is currently enabled for RISCV 64 and RISCV 32 but it could be used for ARM 32 architectures as well.

Here is the before / after output of `libc.benchmarks.memory_functions.opt_host --benchmark_filter=BM_Memcpy` on a quad core Linux starfive RISCV 64 board running at 1.5GHz.

Before:
```
Run on (4 X 1500 MHz CPU s)
CPU Caches:
  L1 Instruction 32 KiB (x4)
  L1 Data 32 KiB (x4)
  L2 Unified 2048 KiB (x1)
------------------------------------------------------------------------
Benchmark              Time             CPU   Iterations UserCounters...
------------------------------------------------------------------------
BM_Memcpy/0/0        474 ns          474 ns      1483776 bytes_per_cycle=0.243492/s bytes_per_second=348.318M/s items_per_second=2.11097M/s __llvm_libc::memcpy,memcpy Google A
BM_Memcpy/1/0        210 ns          209 ns      3649536 bytes_per_cycle=0.233819/s bytes_per_second=334.481M/s items_per_second=4.77519M/s __llvm_libc::memcpy,memcpy Google B
BM_Memcpy/2/0       1814 ns         1814 ns       396288 bytes_per_cycle=0.247899/s bytes_per_second=354.622M/s items_per_second=551.402k/s __llvm_libc::memcpy,memcpy Google D
BM_Memcpy/3/0       89.3 ns         89.2 ns      7459840 bytes_per_cycle=0.217415/s bytes_per_second=311.014M/s items_per_second=11.2071M/s __llvm_libc::memcpy,memcpy Google L
BM_Memcpy/4/0        134 ns          134 ns      3815424 bytes_per_cycle=0.226584/s bytes_per_second=324.131M/s items_per_second=7.44567M/s __llvm_libc::memcpy,memcpy Google M
BM_Memcpy/5/0       52.8 ns         52.6 ns     11001856 bytes_per_cycle=0.194893/s bytes_per_second=278.797M/s items_per_second=19.0284M/s __llvm_libc::memcpy,memcpy Google Q
BM_Memcpy/6/0        180 ns          180 ns      4101120 bytes_per_cycle=0.231884/s bytes_per_second=331.713M/s items_per_second=5.55957M/s __llvm_libc::memcpy,memcpy Google S
BM_Memcpy/7/0        195 ns          195 ns      3906560 bytes_per_cycle=0.232951/s bytes_per_second=333.239M/s items_per_second=5.1217M/s __llvm_libc::memcpy,memcpy Google U
BM_Memcpy/8/0        152 ns          152 ns      4789248 bytes_per_cycle=0.227507/s bytes_per_second=325.452M/s items_per_second=6.58187M/s __llvm_libc::memcpy,memcpy Google W
BM_Memcpy/9/0       6036 ns         6033 ns       118784 bytes_per_cycle=0.249158/s bytes_per_second=356.423M/s items_per_second=165.75k/s __llvm_libc::memcpy,uniform 384 to 4096
```

After:
```
BM_Memcpy/0/0        126 ns          126 ns      5770240 bytes_per_cycle=1.04707/s bytes_per_second=1.46273G/s items_per_second=7.9385M/s __llvm_libc::memcpy,memcpy Google A
BM_Memcpy/1/0       75.1 ns         75.0 ns     10204160 bytes_per_cycle=0.691143/s bytes_per_second=988.687M/s items_per_second=13.3289M/s __llvm_libc::memcpy,memcpy Google B
BM_Memcpy/2/0        333 ns          333 ns      2174976 bytes_per_cycle=1.39297/s bytes_per_second=1.94596G/s items_per_second=3.00002M/s __llvm_libc::memcpy,memcpy Google D
BM_Memcpy/3/0       49.6 ns         49.5 ns     16092160 bytes_per_cycle=0.710161/s bytes_per_second=1015.89M/s items_per_second=20.1844M/s __llvm_libc::memcpy,memcpy Google L
BM_Memcpy/4/0       57.7 ns         57.7 ns     11213824 bytes_per_cycle=0.561557/s bytes_per_second=803.314M/s items_per_second=17.3228M/s __llvm_libc::memcpy,memcpy Google M
BM_Memcpy/5/0       48.0 ns         47.9 ns     16437248 bytes_per_cycle=0.346708/s bytes_per_second=495.97M/s items_per_second=20.8571M/s __llvm_libc::memcpy,memcpy Google Q
BM_Memcpy/6/0       67.5 ns         67.5 ns     10616832 bytes_per_cycle=0.614173/s bytes_per_second=878.582M/s items_per_second=14.8142M/s __llvm_libc::memcpy,memcpy Google S
BM_Memcpy/7/0       84.7 ns         84.6 ns     10480640 bytes_per_cycle=0.819077/s bytes_per_second=1.14424G/s items_per_second=11.8174M/s __llvm_libc::memcpy,memcpy Google U
BM_Memcpy/8/0       61.7 ns         61.6 ns     11191296 bytes_per_cycle=0.550078/s bytes_per_second=786.893M/s items_per_second=16.2279M/s __llvm_libc::memcpy,memcpy Google W
BM_Memcpy/9/0        981 ns          981 ns       703488 bytes_per_cycle=1.52333/s bytes_per_second=2.12807G/s items_per_second=1019.81k/s __llvm_libc::memcpy,uniform 384 to 4096
```

It is not as good as glibc for now so there's room for improvement. I suspect a path pumping 16 bytes at once given the doubled numbers for large copies.
```
BM_Memcpy/0/1        146 ns         82.5 ns      8576000 bytes_per_cycle=1.35236/s bytes_per_second=1.88922G/s items_per_second=12.1169M/s glibc memcpy,memcpy Google A
BM_Memcpy/1/1        112 ns         63.7 ns     10634240 bytes_per_cycle=0.628018/s bytes_per_second=898.387M/s items_per_second=15.702M/s glibc memcpy,memcpy Google B
BM_Memcpy/2/1        315 ns          180 ns      4079616 bytes_per_cycle=2.65229/s bytes_per_second=3.7052G/s items_per_second=5.54764M/s glibc memcpy,memcpy Google D
BM_Memcpy/3/1       85.3 ns         43.1 ns     15854592 bytes_per_cycle=0.774164/s bytes_per_second=1107.45M/s items_per_second=23.2249M/s glibc memcpy,memcpy Google L
BM_Memcpy/4/1        105 ns         54.3 ns     13427712 bytes_per_cycle=0.7793/s bytes_per_second=1114.8M/s items_per_second=18.4109M/s glibc memcpy,memcpy Google M
BM_Memcpy/5/1       77.1 ns         43.2 ns     16476160 bytes_per_cycle=0.279808/s bytes_per_second=400.269M/s items_per_second=23.1428M/s glibc memcpy,memcpy Google Q
BM_Memcpy/6/1        112 ns         62.7 ns     11236352 bytes_per_cycle=0.676078/s bytes_per_second=967.137M/s items_per_second=15.9387M/s glibc memcpy,memcpy Google S
BM_Memcpy/7/1        131 ns         65.5 ns     11751424 bytes_per_cycle=0.965616/s bytes_per_second=1.34895G/s items_per_second=15.2762M/s glibc memcpy,memcpy Google U
BM_Memcpy/8/1        104 ns         55.0 ns     12314624 bytes_per_cycle=0.583336/s bytes_per_second=834.468M/s items_per_second=18.1937M/s glibc memcpy,memcpy Google W
BM_Memcpy/9/1        932 ns          466 ns      1480704 bytes_per_cycle=3.17342/s bytes_per_second=4.43321G/s items_per_second=2.14679M/s glibc memcpy,uniform 384 to 4096
```

Reviewed By: sivachandra

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

15 months ago[NFC] [C++20] [Modules] Refactor Sema::isModuleUnitOfCurrentTU into
Chuanqi Xu [Wed, 10 May 2023 03:54:04 +0000 (11:54 +0800)]
[NFC] [C++20] [Modules] Refactor Sema::isModuleUnitOfCurrentTU into
Decl::isInCurrentModuleUnit

Refactor `Sema::isModuleUnitOfCurrentTU` to `Decl::isInCurrentModuleUnit`
to make code simpler a little bit. Note that although this patch
introduces a FIXME, this is an existing issue and this patch just tries
to describe it explicitly.

15 months agoReland "[PowerPC] Add target feature requirement to builtins"
Qiu Chaofan [Wed, 10 May 2023 07:42:03 +0000 (15:42 +0800)]
Reland "[PowerPC] Add target feature requirement to builtins"

This relands D143467 after fixing build failure with GCC.

15 months ago[SimpleLoopUnswitch] unswitch selects
Joshua Cao [Sat, 15 Apr 2023 23:04:58 +0000 (16:04 -0700)]
[SimpleLoopUnswitch] unswitch selects

The old LoopUnswitch pass unswitched selects, but the changes were never
ported to the new SimpleLoopUnswitch.

We unswitch by turning:

```
S = select %cond, %a, %b
```

into:

```
head:
br %cond, label %then, label %tail

then:
br label %tail

tail:
S = phi [ %a, %then ], [ %b, %head ]
```

Unswitch selects are always nontrivial, since the successors do not exit
the loop and the loop body always needs to be cloned.

Unswitch selects always need to freeze the conditional if the
conditional could be poison or undef. Selects don't propagate
poison/undef, and branches on poison/undef causes UB.

Reviewed By: nikic, kachkov98, vitalybuka

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

15 months ago[test] Clean up Driver/check-time-trace*
Fangrui Song [Wed, 10 May 2023 07:19:46 +0000 (00:19 -0700)]
[test] Clean up Driver/check-time-trace*

Rename check-time-trace* to ftime-trace*.
Avoid deprecated %T.