platform/upstream/llvm.git
13 months ago[docs] Add missing empty line before lists
Simon Pilgrim [Wed, 14 Jun 2023 10:39:12 +0000 (11:39 +0100)]
[docs] Add missing empty line before lists

13 months agoRevert D152630 "[libc] Enable custom logging in LibcTest"
Guillaume Chatelet [Wed, 14 Jun 2023 10:31:49 +0000 (10:31 +0000)]
Revert D152630 "[libc] Enable custom logging in LibcTest"

Failing buildbot https://lab.llvm.org/buildbot/#/builders/73/builds/49707
This reverts commit 9a7b4c934893d6bc571e1ce8efab2127ae5f4e45.

13 months ago[libc] Enable custom logging in LibcTest
Guillaume Chatelet [Wed, 14 Jun 2023 09:18:42 +0000 (09:18 +0000)]
[libc] Enable custom logging in LibcTest

This patch mimics the behavior of Google Test and allow users to log custom messages after all flavors of ASSERT_ / EXPECT_.

Reviewed By: sivachandra, lntue

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

13 months ago[CostModel][X86] Tweak SSE2 v2i64 multiply costs based off D46276 script
Simon Pilgrim [Wed, 14 Jun 2023 10:06:15 +0000 (11:06 +0100)]
[CostModel][X86] Tweak SSE2 v2i64 multiply costs based off D46276 script

It looks like we were trying to account for SLM costs, which are actually handled separately

Fixes #62969

13 months ago[TTI][X86] Recognise PMULUDQ costs for vXi64 multiplies
Simon Pilgrim [Tue, 13 Jun 2023 19:06:21 +0000 (20:06 +0100)]
[TTI][X86] Recognise PMULUDQ costs for vXi64 multiplies

Addresses part of Issue #62969 - if the upper 32-bits of the vXi64 elements are known to be zero, then a multiply simplifies to a single (fast) PMULUDQ instruction

We still have the problem that minRequiredElementSize can't determine that the upper bits are zero for the test case from Issue #62969 - I'll take a look at that next.

13 months ago[mlir][llvm] Add memset support for mem2reg/sroa
Théo Degioanni [Wed, 14 Jun 2023 08:43:10 +0000 (08:43 +0000)]
[mlir][llvm] Add memset support for mem2reg/sroa

This revision introduces support for memset intrinsics in SROA and
mem2reg for the LLVM dialect. This is achieved for SROA by breaking
memsets of aggregates into multiple memsets of scalars, and for mem2reg
by promoting memsets of single integer slots into the value the memset
operation would yield.

The SROA logic supports breaking memsets of static size operating at the
start of a memory slot. The intended most common case is for memsets
covering the entirety of a struct, most often as a way to initialize it
to 0.

The mem2reg logic supports dynamic values and static sizes as input to
promotable memsets. This is achieved by lowering memsets into
`ceil(log_2(n))` LeftShift operations, `ceil(log_2(n))` Or operations
and up to one ZExt operation (for n the byte width of the integer),
computing in registers the integer value the memset would create. Only
byte-aligned integers are supported, more types could easily be added
afterwards.

Reviewed By: gysit

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

13 months agoRevert "[mlir][ArmSME] Add initial dialect with basic lowering of vector.transfer...
Cullen Rhodes [Wed, 14 Jun 2023 09:02:53 +0000 (09:02 +0000)]
Revert "[mlir][ArmSME] Add initial dialect with basic lowering of vector.transfer write to zero"

Apologies I shouldn't have comitted this, need to wait until the planned
MLIR ODM:

  https://discourse.llvm.org/t/rfc-creating-a-armsme-dialect/67208/76

This reverts commit a48fe898857c95a063fa6c201343dca969bc098a.

13 months ago[mlir][ArmSME] Add initial dialect with basic lowering of vector.transfer write to...
Cullen Rhodes [Wed, 14 Jun 2023 08:26:44 +0000 (08:26 +0000)]
[mlir][ArmSME] Add initial dialect with basic lowering of vector.transfer write to zero

This patch adds support for lowering a `vector.transfer_write` of zeroes
and type `vector<[16x16]xi8>` to the SME `zero {za}` instruction [1],
which zeroes the entire accumulator.

This contributes to supporting a path from `linalg.fill` to SME.

[1] https://developer.arm.com/documentation/ddi0602/2022-06/SME-Instructions/ZERO--Zero-a-list-of-64-bit-element-ZA-tiles-

Reviewed By: awarzynski, dcaballe

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

13 months ago[libc] Dispatch memmove to memcpy when buffers are disjoint
Guillaume Chatelet [Tue, 13 Jun 2023 14:41:17 +0000 (14:41 +0000)]
[libc] Dispatch memmove to memcpy when buffers are disjoint

Most of the time `memmove` is called on buffers that are disjoint, in that case we can use `memcpy` which is faster.
The additional test is branchless on x86, aarch64 and RISCV with the zbb extension (bitmanip).
On x86 this patch adds a latency of 2 to 3 cycles.

Before
```
--------------------------------------------------------------------------------
Benchmark                      Time             CPU   Iterations UserCounters...
--------------------------------------------------------------------------------
BM_Memmove/0/0_median       5.00 ns         5.00 ns           10 bytes_per_cycle=1.25477/s bytes_per_second=2.62933G/s items_per_second=199.87M/s __llvm_libc::memmove,memmove Google A
BM_Memmove/1/0_median       6.21 ns         6.21 ns           10 bytes_per_cycle=3.22173/s bytes_per_second=6.75106G/s items_per_second=160.955M/s __llvm_libc::memmove,memmove Google B
BM_Memmove/2/0_median       8.09 ns         8.09 ns           10 bytes_per_cycle=5.31462/s bytes_per_second=11.1366G/s items_per_second=123.603M/s __llvm_libc::memmove,memmove Google D
BM_Memmove/3/0_median       5.95 ns         5.95 ns           10 bytes_per_cycle=2.71865/s bytes_per_second=5.69687G/s items_per_second=167.967M/s __llvm_libc::memmove,memmove Google L
BM_Memmove/4/0_median       5.63 ns         5.63 ns           10 bytes_per_cycle=2.28294/s bytes_per_second=4.78383G/s items_per_second=177.615M/s __llvm_libc::memmove,memmove Google M
BM_Memmove/5/0_median       5.68 ns         5.68 ns           10 bytes_per_cycle=2.16798/s bytes_per_second=4.54295G/s items_per_second=176.015M/s __llvm_libc::memmove,memmove Google Q
BM_Memmove/6/0_median       7.46 ns         7.46 ns           10 bytes_per_cycle=3.97619/s bytes_per_second=8.332G/s items_per_second=134.044M/s __llvm_libc::memmove,memmove Google S
BM_Memmove/7/0_median       5.40 ns         5.40 ns           10 bytes_per_cycle=1.79695/s bytes_per_second=3.76546G/s items_per_second=185.211M/s __llvm_libc::memmove,memmove Google U
BM_Memmove/8/0_median       5.62 ns         5.62 ns           10 bytes_per_cycle=3.18747/s bytes_per_second=6.67927G/s items_per_second=177.983M/s __llvm_libc::memmove,memmove Google W
BM_Memmove/9/0_median        101 ns          101 ns           10 bytes_per_cycle=9.77359/s bytes_per_second=20.4803G/s items_per_second=9.9333M/s __llvm_libc::memmove,uniform 384 to 4096
```
After
```
BM_Memmove/0/0_median       3.57 ns         3.57 ns           10 bytes_per_cycle=1.71375/s bytes_per_second=3.59112G/s items_per_second=280.411M/s __llvm_libc::memmove,memmove Google A
BM_Memmove/1/0_median       4.52 ns         4.52 ns           10 bytes_per_cycle=4.47557/s bytes_per_second=9.37843G/s items_per_second=221.427M/s __llvm_libc::memmove,memmove Google B
BM_Memmove/2/0_median       5.70 ns         5.70 ns           10 bytes_per_cycle=7.37396/s bytes_per_second=15.4519G/s items_per_second=175.399M/s __llvm_libc::memmove,memmove Google D
BM_Memmove/3/0_median       4.47 ns         4.47 ns           10 bytes_per_cycle=3.4148/s bytes_per_second=7.15563G/s items_per_second=223.743M/s __llvm_libc::memmove,memmove Google L
BM_Memmove/4/0_median       4.53 ns         4.53 ns           10 bytes_per_cycle=2.86071/s bytes_per_second=5.99454G/s items_per_second=220.69M/s __llvm_libc::memmove,memmove Google M
BM_Memmove/5/0_median       4.19 ns         4.19 ns           10 bytes_per_cycle=2.5484/s bytes_per_second=5.3401G/s items_per_second=238.924M/s __llvm_libc::memmove,memmove Google Q
BM_Memmove/6/0_median       5.02 ns         5.02 ns           10 bytes_per_cycle=5.94164/s bytes_per_second=12.4505G/s items_per_second=199.14M/s __llvm_libc::memmove,memmove Google S
BM_Memmove/7/0_median       4.03 ns         4.03 ns           10 bytes_per_cycle=2.47028/s bytes_per_second=5.17641G/s items_per_second=247.906M/s __llvm_libc::memmove,memmove Google U
BM_Memmove/8/0_median       4.70 ns         4.70 ns           10 bytes_per_cycle=3.84975/s bytes_per_second=8.06706G/s items_per_second=212.72M/s __llvm_libc::memmove,memmove Google W
BM_Memmove/9/0_median       90.7 ns         90.7 ns           10 bytes_per_cycle=10.8681/s bytes_per_second=22.7739G/s items_per_second=11.02M/s __llvm_libc::memmove,uniform 384 to 4096
```

Reviewed By: courbet

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

13 months ago[test][hwasan] Allow test for any platform with tagging
Vitaly Buka [Wed, 14 Jun 2023 08:15:59 +0000 (01:15 -0700)]
[test][hwasan] Allow test for any platform with tagging

13 months ago[AMDGPU] Pre-commit test for D152892 (NFC)
Carl Ritson [Wed, 14 Jun 2023 08:13:32 +0000 (17:13 +0900)]
[AMDGPU] Pre-commit test for D152892 (NFC)

13 months ago[PhaseOrdering] Regenerate test checks (NFC)
Nikita Popov [Wed, 14 Jun 2023 08:08:46 +0000 (10:08 +0200)]
[PhaseOrdering] Regenerate test checks (NFC)

Just naming changes.

13 months ago[InstCombine] Handle use count decrement in more cases
Nikita Popov [Wed, 14 Jun 2023 07:18:10 +0000 (09:18 +0200)]
[InstCombine] Handle use count decrement in more cases

These two helpers also decrement the use count of the replaced
operand, so give them the same treatment as eraseInstruction().

13 months ago[test][hwasan] Rename constants in test
Vitaly Buka [Wed, 14 Jun 2023 07:58:05 +0000 (00:58 -0700)]
[test][hwasan] Rename constants in test

13 months ago[Clang] Rename getElementBitCast() -> withElementType() (NFC)
Nikita Popov [Wed, 14 Jun 2023 07:57:01 +0000 (09:57 +0200)]
[Clang] Rename getElementBitCast() -> withElementType() (NFC)

This no longer creates a bitcast, just changes the element type
of the ConstantAddress.

13 months ago[SimpleLoopUnswitch] Unswitch AND/OR conditions of selects
Joshua Cao [Tue, 30 May 2023 03:57:20 +0000 (20:57 -0700)]
[SimpleLoopUnswitch] Unswitch AND/OR conditions of selects

If a select's condition is a AND/OR, we can unswitch invariant operands.
This patch uses existing logic from unswitching AND/OR's for branch
conditions.

This patch fixes the Cost computation for unswitching selects to have
the cost of the entire loop, since unswitching selects do not remove
branches. This is required for this patch because otherwise, there are
cases where unswitching selects of AND/OR is beating out unswitching of
branches.

This patch also prevents unswitching of logical AND/OR selects. This
should instead be done by unswitching of AND/OR branch conditions.

Reviewed By: nikic

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

13 months ago[SimpleLoopUnswitch][NFC] Add tests for and/or conditions of selects
Joshua Cao [Tue, 30 May 2023 04:06:20 +0000 (21:06 -0700)]
[SimpleLoopUnswitch][NFC] Add tests for and/or conditions of selects

13 months ago[mlir][vector][bufferize] Better analysis for vector.transfer_write
Matthias Springer [Wed, 14 Jun 2023 07:31:13 +0000 (09:31 +0200)]
[mlir][vector][bufferize] Better analysis for vector.transfer_write

The destination operand does not bufferize to a memory read if it is completely overwritten.

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

13 months agoFix test Driver/mips-mti-linux.c
Michael Platings [Wed, 14 Jun 2023 07:28:15 +0000 (08:28 +0100)]
Fix test Driver/mips-mti-linux.c

13 months ago[InstCombine] Revisit user of newly one-use instructions
Nikita Popov [Wed, 31 May 2023 14:09:06 +0000 (16:09 +0200)]
[InstCombine] Revisit user of newly one-use instructions

Many folds in InstCombine are limited to one-use instructions. For
that reason, if the use-count of an instruction drops to one, it
makes sense to revisit that one user. This is one of the most
common reasons why InstCombine fails to finish in a single iteration.

Doing this revisit actually slightly improves compile-time, because
we save an extra InstCombine iteration in enough cases to make a
visible difference.

This is conceptually NFC, but not NFC in practice, because differences
in worklist order can result in slightly different folding behavior.

The regressed tests in or-shifted-masks.ll now require a sequence of
instcombine,early-cse,instcombine to fold fully. D152876 would make
these fold in a single instcombine run again.

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

13 months ago[11/11][Clang][RISCV] Expand all variants for vset on tuple types
eopXD [Sat, 3 Jun 2023 16:02:37 +0000 (09:02 -0700)]
[11/11][Clang][RISCV] Expand all variants for vset on tuple types

This is the 11th patch of the patch-set. For the cover letter, please
checkout D152069.

Depends on D152078.

This patch also fixes the suffix for non-overloaded variants for
vset on tuple types.

Reviewed By: craig.topper

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

13 months ago[10/11][Clang][RISCV] Expand all variants for vget on tuple types
eopXD [Sat, 3 Jun 2023 15:41:40 +0000 (08:41 -0700)]
[10/11][Clang][RISCV] Expand all variants for vget on tuple types

This is the 10th patch of the patch-set. For the cover letter, please
checkout D152069.

Depends on D152077.

Reviewed By: craig.topper

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

13 months ago[9/11][Clang][RISCV] Expand all variants for indexed strided segment store
eopXD [Sat, 3 Jun 2023 03:25:51 +0000 (20:25 -0700)]
[9/11][Clang][RISCV] Expand all variants for indexed strided segment store

This is the 9th patch of the patch-set. For the cover letter, please
checkout D152069.

Depends on D152076.

This patch expands all variants of indexed strided segment store.
This patch also fixes the trailing suffix in the intrinsics' function
name that representing the return type, adding `x{NF}`.

For the same reason mentioned in [3/11], only full test case for
vsuxseg2ei32, vsoxseg2ei32 is added for now.

Reviewed By: craig.topper

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

13 months ago[8/11][Clang][RISCV] Expand all variants for indexed strided segment load
eopXD [Sat, 3 Jun 2023 03:20:04 +0000 (20:20 -0700)]
[8/11][Clang][RISCV] Expand all variants for indexed strided segment load

This is the 8th patch of the patch-set. For the cover letter, please
checkout D152069.

Depends on D152075.

This patch expands all variants of indexed strided segment load,
including the policy variants. This patch also fixes the trailing suffix
in the intrinsics' function name that representing the return type,
adding `x{NF}`.

For the same reason mentioned in [3/11], only full test case for
vluxseg2ei32, vloxseg2ei32 is added for now.

Reviewed By: craig.topper

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

13 months ago[7/11][Clang][RISCV] Expand all variants for strided segment store
eopXD [Sat, 3 Jun 2023 03:07:08 +0000 (20:07 -0700)]
[7/11][Clang][RISCV] Expand all variants for strided segment store

This is the 7th patch of the patch-set. For the cover letter, please
checkout D152069.

Depends on D152074.

This patch expands all variants for strided segment store. The store
intrinsics does not have any policy variants. This patch also fixes the
trailing suffix in the intrinsics' function name that representing the
return type, adding `x{NF}`.

For the same reason mentioned in [3/11], only full test case for
vssseg2e32 is added for now.

Reviewed By: craig.topper

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

13 months ago[6/11][Clang][RISCV] Expand all variants for strided segment load
eopXD [Sat, 3 Jun 2023 02:58:24 +0000 (19:58 -0700)]
[6/11][Clang][RISCV] Expand all variants for strided segment load

This is the 6th patch of the patch-set. For the cover letter, please
checkout D152069.

Depends on D152073.

This patch expands all variants of strided segment load, including the
policy variants. This patch also fixes the trailing suffix in the
intrinsics' function name that representing the return type, adding
`x{NF}`.

For the same reason mentioned in [3/11], only full test case for
vlsseg2e32 is added.

Reviewed By: craig.topper

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

13 months ago[NFC] skip the test modules-vtable.cppm on windows
Chuanqi Xu [Wed, 14 Jun 2023 07:04:39 +0000 (15:04 +0800)]
[NFC] skip the test modules-vtable.cppm on windows

The new added test has problems on windows since the patch is about ABI
and MSVC ABI is not covered. Skip the test on windows to make the CI
green.

13 months ago[5/11][Clang][RISCV] Expand all variants for unit stride fault-first segment load
eopXD [Tue, 30 May 2023 17:14:06 +0000 (10:14 -0700)]
[5/11][Clang][RISCV] Expand all variants for unit stride fault-first segment load

This is the 5th patch of the patch-set. For the cover letter, please
checkout D152069.

Depends on D152072.

This patch expands all variants of unit stride fault-first segment
load, including the policy variants. This patch also fixes the
trailing suffix in the intrinsics' function name that representing
the return type, adding `x{NF}`.

For the same reason mentioned in [3/11], only full test case for
vlseg2e32ff is added.

Reviewed By: craig.topper

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

13 months ago[CSKY] Add support for half-precision floats
Zi Xuan Wu (Zeson) [Wed, 14 Jun 2023 06:58:48 +0000 (14:58 +0800)]
[CSKY] Add support for half-precision floats

Complete fp16 support by ensuring that load extension / truncate store operations are properly expanded.

13 months ago[NFC][RISCV] rename findFirstNonVersionCharacter with findLastNonVersionCharacter
Piyou Chen [Wed, 14 Jun 2023 06:05:09 +0000 (23:05 -0700)]
[NFC][RISCV] rename findFirstNonVersionCharacter with findLastNonVersionCharacter

Reviewed By: craig.topper

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

13 months ago[mlir][IR] Improve listener notifications for ops without results
Matthias Springer [Wed, 14 Jun 2023 06:41:19 +0000 (08:41 +0200)]
[mlir][IR] Improve listener notifications for ops without results

`RewriterBase::Listener::notifyOperationReplaced` notifies observers that an op is about to be replaced with a range of values. This notification is not very useful for ops without results, because it does not specify the replacement op (and it cannot be deduced from the replacement values). It provides no additional information over the `notifyOperationRemoved` notification.

This revision adds an additional notification when a rewriter replaces an op with another op. By default, this notification triggers the original "op replaced with values" notification, so there is no functional change for existing code.

This new API is useful for the transform dialect, which needs to track op replacements. (Updated in a subsequent revision.)

Also includes minor documentation improvements.

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

13 months ago[4/11][Clang][RISCV] Expand all variants for unit stride segment store
eopXD [Tue, 30 May 2023 16:50:51 +0000 (09:50 -0700)]
[4/11][Clang][RISCV] Expand all variants for unit stride segment store

This is the 4th patch of the patch-set. For the cover letter, please
checkout D152069.

Depends on D152071.

This patch expands all variants for unit stride segment store. The
store intrinsics does not have any policy variants. This patch also
fixes the trailing suffix in the intrinsics' function name that
representing the return type, adding `x{NF}`.

For the same reason mentioned in [3/11], only full test case for
vsseg2e32 is added.

Reviewed By: craig.topper

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

13 months ago[3/11][Clang][RISCV] Expand all variants for unit stride segment load
eopXD [Tue, 30 May 2023 15:32:48 +0000 (08:32 -0700)]
[3/11][Clang][RISCV] Expand all variants for unit stride segment load

This is the 3rd patch of the patch-set. For the cover letter, please
checkout D152069.

Depends on D152070.

This patch expands all variants of unit stride segment load, including
the policy variants. This patch also fixes the trailing suffix in the
intrinsics' function name that representing the return type, adding
`x{NF}`.

Currently the tuple type co-exists with the non-tuple type intrinsics.
Since the co-existance is temporary, this patch only adds test cases of
all variants for vlseg2e32 to show the capability done.

Test cases of other data type and NF will be added in the patch-set
when the replacement happens.

Reviewed By: craig.topper

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

13 months ago[2/11][Clang][RISCV] Expand all variants of RVV intrinsic tuple types
eopXD [Sun, 28 May 2023 13:14:11 +0000 (06:14 -0700)]
[2/11][Clang][RISCV] Expand all variants of RVV intrinsic tuple types

This is the 2nd patch of the patch-set. For the cover letter, please
checkout D152069.

Depends on D152069.

This patch also removes redundant checks related to tuples and dedicate
the check to happen in `RVVType::verifyType`.

Reviewed By: craig.topper

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

13 months ago[flang][openacc] Lower gang dim to MLIR
Valentin Clement [Wed, 14 Jun 2023 06:20:11 +0000 (23:20 -0700)]
[flang][openacc] Lower gang dim to MLIR

Lower gang dim from the parse tree to the new MLIR
representation.

Depends on D151972

Reviewed By: razvanlupusoru, jeanPerier

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

13 months ago[Orc][Coff] Skip registration of voltbl sections
River Riddle [Fri, 9 Jun 2023 21:08:41 +0000 (14:08 -0700)]
[Orc][Coff] Skip registration of voltbl sections

We're getting asserts for duplicate section registration during
linking which stems back to these sections. From previous
discussions, it seems like these are metadata sections that can
be dropped. See the discussion in D116474 and
https://bugs.llvm.org/show_bug.cgi?id=45111.

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

13 months ago[Docs] Multilib design
Michael Platings [Tue, 6 Jun 2023 17:56:59 +0000 (18:56 +0100)]
[Docs] Multilib design

Reviewed By: peter.smith, MaskRay

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

13 months ago[Driver] BareMetal ToolChain multilib layering
Michael Platings [Wed, 1 Feb 2023 15:48:46 +0000 (15:48 +0000)]
[Driver] BareMetal ToolChain multilib layering

This enables layering baremetal multilibs on top of each other.
For example a multilib containing only a no-exceptions libc++ could be
layered on top of a multilib containing C libs. This avoids the need
to duplicate the C library for every libc++ variant.

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

13 months ago[Driver] Enable selecting multiple multilibs
Michael Platings [Tue, 31 Jan 2023 15:45:16 +0000 (15:45 +0000)]
[Driver] Enable selecting multiple multilibs

This will enable layering multilibs on top of each other.
For example a multilib containing only a no-exceptions libc++ could be
layered on top of a multilib containing C libs. This avoids the need
to duplicate the C library for every libc++ variant.

This change doesn't expose the functionality externally, it only opens
the functionality up to be potentially used by ToolChain classes.

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

13 months ago[Driver] Enable multilib.yaml in the BareMetal ToolChain
Michael Platings [Tue, 7 Feb 2023 16:19:23 +0000 (16:19 +0000)]
[Driver] Enable multilib.yaml in the BareMetal ToolChain

The default location for multilib.yaml is lib/clang-runtimes, without
any target-specific suffix. This will allow multilibs for different
architectures to share a common include directory.

To avoid breaking the arm-execute-only.c CHECK-NO-EXECUTE-ONLY-ASM
test, add a ForMultilib argument to getARMTargetFeatures.

Since the presence of multilib.yaml can change the exact location of a
library, relax the baremetal.cpp test.

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

13 months ago[Driver] Add -print-multi-flags-experimental option
Michael Platings [Thu, 9 Mar 2023 19:38:26 +0000 (19:38 +0000)]
[Driver] Add -print-multi-flags-experimental option

This option causes the flags used for selecting multilibs to be printed.
This is an experimental feature that is documented in detail in D143587.

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

13 months ago[Driver] Multilib YAML parsing
Michael Platings [Tue, 6 Jun 2023 14:31:46 +0000 (15:31 +0100)]
[Driver] Multilib YAML parsing

The format includes a ClangMinimumVersion entry to avoid a potential
source of subtle errors if an older version of Clang were to be used
with a multilib.yaml that requires a newer Clang to work correctly.
This feature is comparable to CMake's cmake_minimum_required.

Reviewed By: peter.smith

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

13 months ago[HWASAN] Implement munmap interceptor for HWASAN
Kirill Stoimenov [Sat, 10 Jun 2023 00:16:48 +0000 (00:16 +0000)]
[HWASAN] Implement munmap interceptor for HWASAN

Reviewed By: vitalybuka

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

13 months ago[LoongArch] Ignore warnings when there is no environment in triple
Wang Rui [Wed, 14 Jun 2023 05:21:25 +0000 (13:21 +0800)]
[LoongArch] Ignore warnings when there is no environment in triple

In Rust bare-metal targets, there is no environment component in triple name. This patch ignores warnings that look like:

```
warning: triple-implied ABI conflicts with provided target-abi ‘lp64s', using target-abi
```

Reviewed By: SixWeining, xen0n

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

13 months ago[ABI] [C++20] [Modules] Don't generate vtable if the class is defined in other module...
Chuanqi Xu [Wed, 14 Jun 2023 04:45:34 +0000 (12:45 +0800)]
[ABI] [C++20] [Modules] Don't generate vtable if the class is defined in other module unit

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

The root cause is that clang will generate vtable as strong symbol now
even if the corresponding class is defined in other module units. After
I check the wording in Itanium ABI, I find this is not inconsistent.
Itanium ABI 5.2.3
(https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable) says:

> The virtual table for a class is emitted in the same object containing
> the definition of its key function, i.e. the first non-pure virtual
> function that is not inline at the point of class definition.

So the current behavior is incorrect. This patch tries to address this.
Also I think we need to do a similar change for MSVC ABI. But I don't
find the formal wording. So I don't address this in this patch.

Reviewed By: rjmccall, iains, dblaikie

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

13 months ago[scudo] Fix bound checks in MemMap and ReservedMemory methods
Fabio D'Urso [Wed, 14 Jun 2023 03:54:08 +0000 (03:54 +0000)]
[scudo] Fix bound checks in MemMap and ReservedMemory methods

Reviewed By: Chia-hungDuan

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

13 months ago[lldb] Fix Debugger whitespace and formatting (NFC)
Jonas Devlieghere [Wed, 14 Jun 2023 03:48:05 +0000 (20:48 -0700)]
[lldb] Fix Debugger whitespace and formatting (NFC)

Remove trailing whitespace and fix formatting.

13 months ago[lldb] Include <atomic> in LLDBAssert
Jonas Devlieghere [Wed, 14 Jun 2023 03:50:14 +0000 (20:50 -0700)]
[lldb] Include <atomic> in LLDBAssert

13 months ago[lldb] Print lldbassert to debugger diagnostics
Jonas Devlieghere [Wed, 14 Jun 2023 03:24:18 +0000 (20:24 -0700)]
[lldb] Print lldbassert to debugger diagnostics

When hitting an lldbassert in a non-assert build, we emit a blurb
including the assertion, the triggering file and line and a pretty
backtrace leading up to the issue. Currently, this is all printed to
stderr. That's fine on the command line, but when used as library, for
example from Xcode, this information doesn't make it to the user. This
patch uses the diagnostic infrastructure to report LLDB asserts as
diagnostic events.

The patch is slightly more complicated than I would've liked because of
layering. lldbassert is part of Utility while the debugger diagnostics
are implemented in Core.

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

13 months ago[flang][openacc][NFC] Remove unused genObjectList function
Valentin Clement [Wed, 14 Jun 2023 03:43:44 +0000 (20:43 -0700)]
[flang][openacc][NFC] Remove unused genObjectList function

genObjectList is not used anymore. Just remove it.

Depends on D151975

Reviewed By: razvanlupusoru

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

13 months ago[flang][openacc] Add parsing support for dim in gang clause
Valentin Clement [Wed, 14 Jun 2023 03:33:20 +0000 (20:33 -0700)]
[flang][openacc] Add parsing support for dim in gang clause

Add parsing supprot for dim in gang clause

Depends on D151971

Reviewed By: razvanlupusoru, jeanPerier

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

13 months ago[mlir][flang][openacc] Use new firstprivate representation for compute construct
Valentin Clement [Wed, 14 Jun 2023 03:32:04 +0000 (20:32 -0700)]
[mlir][flang][openacc] Use new firstprivate representation for compute construct

Use the new firstprivate representation on the comupte construct.

Reviewed By: razvanlupusoru, jeanPerier

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

13 months ago[flang] Fix flang-aarch64-latest-gcc build failure
Kelvin Li [Wed, 14 Jun 2023 02:57:47 +0000 (22:57 -0400)]
[flang] Fix flang-aarch64-latest-gcc build failure

The failure is due to mismatch of the SmallVector parameter and the
return when built by gcc.

13 months ago[gn] Fix case of directory I added in 9239cde390e
Nico Weber [Wed, 14 Jun 2023 03:08:43 +0000 (20:08 -0700)]
[gn] Fix case of directory I added in 9239cde390e

13 months ago[gn build] Port 2700da5fe28d (lld/unittests etc)
Nico Weber [Wed, 14 Jun 2023 02:41:34 +0000 (19:41 -0700)]
[gn build] Port 2700da5fe28d (lld/unittests etc)

13 months agoRevert "[RISCV] Fold binary op into select if profitable."
Craig Topper [Wed, 14 Jun 2023 01:01:22 +0000 (18:01 -0700)]
Revert "[RISCV] Fold binary op into select if profitable."

This reverts commit d0189584631e587279ee5f0af5feb94d8045bb31.

Build failures have been reported in the Linux kernel.

13 months ago[InstCombine] Transform `(binop1 (binop2 (lshift X,Amt),Mask),(lshift Y,Amt))`
Noah Goldstein [Wed, 14 Jun 2023 00:32:19 +0000 (19:32 -0500)]
[InstCombine] Transform `(binop1 (binop2 (lshift X,Amt),Mask),(lshift Y,Amt))`

If `Mask` and `Amt` are not constants and `binop1` and `binop2` are
the same we can transform to:
`(binop (lshift (binop X, Y), Amt), Mask)`

If `binop` is `add`, `lshift` must be `shl`.

If `Mask` and `Amt` are constants `C` and `C1` respectively.
We can transform to:
`(lshift1 (binop1 (binop2 X, (inv_lshift1 C, C1), Y)), C1)`

Saving an instruction IFF:
`lshift1` is same opcode as `lshift2`
Either `bitwise1` and/or `bitwise2` is `and`.

Proofs(1/2): https://alive2.llvm.org/ce/z/BjN-m_
Proofs(2/2): https://alive2.llvm.org/ce/z/bZn5QB

This is to help fix the regression caused in D151807

Reviewed By: nikic

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

13 months ago[InstCombine] Add tests for (binop (binop (lshift X,Amt),Mask),(lshift Y,Amt)); NFC
Noah Goldstein [Fri, 9 Jun 2023 17:54:51 +0000 (12:54 -0500)]
[InstCombine] Add tests for (binop (binop (lshift X,Amt),Mask),(lshift Y,Amt)); NFC

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

13 months agoTargetTransformInfo: Add addrspacesMayAlias
Matt Arsenault [Sat, 10 Jun 2023 17:03:22 +0000 (13:03 -0400)]
TargetTransformInfo: Add addrspacesMayAlias

For some reason we used to only handle address space aliasing through
chaining a target specific AA pass. We need never-fail simple queries
in order to lower memmove intrinsics based purely on the address
spaces.

I also think it would be better if BasicAA checked this, rather than
relying on the target AA passes. Currently we go through the more
expensive AA analyses before getting to the trivial address space
checks.

13 months agoDAG: Fix typo in GET_FPENV legality check
Matt Arsenault [Mon, 12 Jun 2023 12:15:42 +0000 (08:15 -0400)]
DAG: Fix typo in GET_FPENV legality check

This made GET_FPENV unusable since the DAG builder would always emit
the mem version.

13 months ago[RISCV] Minor style changes to performCombineVMergeAndVOps [nfc]
Philip Reames [Wed, 14 Jun 2023 00:07:17 +0000 (17:07 -0700)]
[RISCV] Minor style changes to performCombineVMergeAndVOps [nfc]

Making the code a bit easier to follow, so that merging an upcoming change is more straight forward.

13 months ago[mlir][Vector] Add basic scalable vectorization support to Linalg vectorizer
Diego Caballero [Sat, 10 Jun 2023 00:36:33 +0000 (00:36 +0000)]
[mlir][Vector] Add basic scalable vectorization support to Linalg vectorizer

For now, only elementwise operations are supported. Operations that perform any
kind of data permutation require changes in the representation of scalable
dimensions in VectorType.

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

13 months ago[SLP][NFC] Precommit test that exposes a bug in ShuffleBuilder.
Vasileios Porpodas [Tue, 13 Jun 2023 19:39:23 +0000 (12:39 -0700)]
[SLP][NFC] Precommit test that exposes a bug in ShuffleBuilder.

ShuffleBuilder generates a zero mask here:
`[[TMP6:%.*]] = shufflevector <2 x float> [[TMP3]], <2 x float> poison, <4 x i32> zeroinitializer`
But the correct mask is `0,0,1,1`, or we should have reused `TMP4`.

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

13 months ago[Attributor][NFC] Make the MustBeExecutedContextExplorer optional
Johannes Doerfert [Tue, 13 Jun 2023 23:39:49 +0000 (16:39 -0700)]
[Attributor][NFC] Make the MustBeExecutedContextExplorer optional

For a lightweight pass we do not want to instantiate or use the
MustBeExecutedContextExplorer. This simply allows such a configuration.
While at it, the explorer is now allocated with the bump allocator.

13 months ago[RISCV] Canonicalize towards vmerge w/passthrough representation
Philip Reames [Tue, 13 Jun 2023 23:19:02 +0000 (16:19 -0700)]
[RISCV] Canonicalize towards vmerge w/passthrough representation

This is the first patch in a series to change how we represent tail agnostic, tail undefined, and tail undisturbed operations. In current code, we tend to use an unsuffixed pseudo for undefined (despite calling it TA most places in code), and the _TU form for both agnostic and undisturbed (via the policy operand).

The key observation behind this patch is that we can represent tail undefined via a pseudo with a passthrough operand if that operand is IMPLICIT_DEF (aka undef). We already have a few instances of this in tree - see vmv.s.x and vslide* - but we can do this more universally. Once complete, we will be able to delete roughly ~1/3 of our vector pseudo classes.

A bit more information on the overall goal can be found in this discourse post: https://discourse.llvm.org/t/riscv-transition-in-vector-pseudo-structure-policy-variants/71295.

This patch doesn't actually remove the legacy unsuffixed pseudo as there's still some path from intrinsic lowering which uses it. (I have not yet located it.) This also means we don't have to modify any of the lookup tables which makes the migration simpler. We can defer deleting the tables and pseudos until one final change once all the instructions have been migrated.

There are a couple of regressions in the tests. At first, these concerned me, but it turns out that all of them are differences in expansion of a single source level instruction. I think we can safely ignore this for the moment. I did explore changing the handling of IMPLICIT_DEF in ScheduleDAG, but that causes an absolutely *massive* test diff with minimal profit. I really don't think it's worth doing.

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

13 months ago[Attributor][FIX] Ensure unknown accesses are honored
Johannes Doerfert [Tue, 13 Jun 2023 21:47:14 +0000 (14:47 -0700)]
[Attributor][FIX] Ensure unknown accesses are honored

If we had an unknown access but already some prior knowledge (known), we
could have ended up ignoring the unknown access all together. The
problem is that we track unknown not as all locations but separately.
This patch bridges the gap and expands the unknown bits to "all bits"
when we add an access.

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

13 months ago[Attributor][NFC] Precommit test for #63291
Johannes Doerfert [Tue, 13 Jun 2023 21:55:51 +0000 (14:55 -0700)]
[Attributor][NFC] Precommit test for #63291

See: https://github.com/llvm/llvm-project/issues/63291

13 months ago[RISCV] Introduce the concept of DLEN(data path width) into getLMULCost.
Craig Topper [Tue, 13 Jun 2023 23:09:25 +0000 (16:09 -0700)]
[RISCV] Introduce the concept of DLEN(data path width) into getLMULCost.

SiFive's x280 CPU has a vector unit that VLEN/2 bits wide. This
means that LMUL=1 operations take 2 to process all VLEN bits.

This patch adds a DLenFactor tuning parameter and applies it to
TuneSiFive7. getLMULCost has been updated to use this factor in
its calculations. I've added an x280 command line to one cost
model test to demonstrate the effect.

Reviewed By: arcbbb

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

13 months ago[lldb][NFCI] Remove StructuredData::Dictionary::GetValueForKeyAsString overloads...
Alex Langford [Sat, 10 Jun 2023 00:06:22 +0000 (17:06 -0700)]
[lldb][NFCI] Remove StructuredData::Dictionary::GetValueForKeyAsString overloads involving ConstString

In an effort to keep the ConstString StringPool small, I plan on
removing use of ConstString in StructuredData. The only class that
really uses it is StructuredData::Dictionary.

This one was fairly easy to remove, I plan on removing the others in
follow-up changes.

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

13 months ago[lldb] Default can_create to true in GetChildAtIndex (NFC)
Dave Lee [Mon, 29 May 2023 02:16:49 +0000 (19:16 -0700)]
[lldb] Default can_create to true in GetChildAtIndex (NFC)

Existing callers of `GetChildAtIndex` pass true for can_create. This change
makes true the default value, callers don't have to pass an opaque true.

See also D151966 for the same change to `GetChildMemberWithName`.

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

13 months ago[Bazel] Fix build
Pranav Kant [Tue, 13 Jun 2023 22:43:56 +0000 (22:43 +0000)]
[Bazel] Fix build

13 months ago[lldb][NFCI] Change return type of Properties::GetExperimentalSettingsName
Alex Langford [Fri, 2 Jun 2023 00:06:06 +0000 (17:06 -0700)]
[lldb][NFCI] Change return type of Properties::GetExperimentalSettingsName

Most users of this stick it into a StringRef. The one user that doesn't
just tries to get the length out of it, which we can precompute by
putting it in a constexpr StringLiteral.

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

13 months ago[sanitizer] Adjust code path of ChooseExternalSymbolizer for Windows
Wu, Yingcong [Tue, 13 Jun 2023 21:51:46 +0000 (14:51 -0700)]
[sanitizer] Adjust code path of ChooseExternalSymbolizer for Windows

If `path` is null, `user_path` must also be null. With the current code path, the message of explicitly disabling symbolizer will never be reported. This patch adjusts the if-else structure to make that message can be reported.

Reviewed By: cchen15, MaskRay

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

13 months ago[-Wtcb-enforcement] Disable on unevaluated code.
Artem Dergachev [Tue, 13 Jun 2023 20:39:45 +0000 (13:39 -0700)]
[-Wtcb-enforcement] Disable on unevaluated code.

It doesn't make sense for this warning to warn about things
that don't impact runtime behavior.

13 months ago[llvm-objdump/mac] Add support for LC_ATOM_INFO
Keith Smiley [Tue, 13 Jun 2023 18:32:30 +0000 (11:32 -0700)]
[llvm-objdump/mac] Add support for LC_ATOM_INFO

This is a new load command first supported in Xcode 15's tools

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

13 months ago[libc++] Refactor __debug_three_way_comp
Louis Dionne [Mon, 12 Jun 2023 21:16:32 +0000 (14:16 -0700)]
[libc++] Refactor __debug_three_way_comp

This makes __debug_three_way_comp consistent with __debug_less and
in particular gets rid of a potential use-after-move caused by the
use of std::forward. In the previous version of the code, we would
call `__do_compare_assert` after forwarding the arguments into the
comparator, which could end up using the arguments after they've been
moved from.

This also simplifies how we call `__do_compare_assert` by using
`if constexpr` and adds a missing test for proxy iterators in
lexicographical_compare_three_way, which could have found this
issue.

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

13 months ago[InstSimplify] Fold all global variables with initializers
Anshil Gandhi [Tue, 13 Jun 2023 21:14:11 +0000 (15:14 -0600)]
[InstSimplify] Fold all global variables with initializers

Allow computing size of interposable or externally initializable global variables.

Reviewed By: nikic

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

13 months ago[RDF] Allow individual units in PhysicalRegisterInfo::alias
Krzysztof Parzyszek [Sat, 3 Jun 2023 17:32:45 +0000 (10:32 -0700)]
[RDF] Allow individual units in PhysicalRegisterInfo::alias

13 months ago[test][asan] Remove XFAIL after D152604
Vitaly Buka [Tue, 13 Jun 2023 21:03:32 +0000 (14:03 -0700)]
[test][asan] Remove XFAIL after D152604

13 months ago[flang][openacc] Relax rule for end directive on combined construct
Valentin Clement [Tue, 13 Jun 2023 20:57:43 +0000 (13:57 -0700)]
[flang][openacc] Relax rule for end directive on combined construct

Make the keyword `loop` optional for the end driective on combined
construct. This done to extend compatibility with other compiler that
allow this.

Reviewed By: razvanlupusoru

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

13 months agoUpdated the 'getting involved' documentation for Flang to correct the technical call...
Anton Rydahl [Tue, 13 Jun 2023 19:40:11 +0000 (20:40 +0100)]
Updated the 'getting involved' documentation for Flang to correct the technical call details

modified:   flang/docs/GettingInvolved.md

Reviewed By: NimishMishra

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

13 months agoRevert "[lldb] Fix failure in TestStackCoreScriptedProcess on x86_64"
Med Ismail Bennani [Tue, 13 Jun 2023 20:45:59 +0000 (13:45 -0700)]
Revert "[lldb] Fix failure in TestStackCoreScriptedProcess on x86_64"

This reverts commit 4177b490358432a457935ba5d6d076ae60de588f, since I
landed it by mistake.

13 months ago[lldb] Fix failure in TestStackCoreScriptedProcess on x86_64
Med Ismail Bennani [Tue, 13 Jun 2023 18:43:17 +0000 (11:43 -0700)]
[lldb] Fix failure in TestStackCoreScriptedProcess on x86_64

This patch should address the failure of TestStackCoreScriptedProcess
that is happening specifically on x86_64.

It turns out that in 1370a1cb5b97, I changed the way we extract integers
from a `StructuredData::Dictionary` and in order to get a stop info from
the scripted process, we call a method that returns a `SBStructuredData`
containing the stop reason data.

TestStackCoreScriptedProcess` was failing specifically on x86_64 because
the stop info dictionary contains the signal number, that the `Scripted
Thread` was trying to extract as a signed integer where it was actually
parsed as an unsigned integer. That caused `GetValueForKeyAsInteger` to
return the default value parameter, `LLDB_INVALID_SIGNAL_NUMBER`.

This patch address the issue by extracting the signal number with the
appropriate type and re-enables the test.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
13 months ago[lldb] Improve corefile saving ergonomics
Med Ismail Bennani [Tue, 13 Jun 2023 18:21:08 +0000 (11:21 -0700)]
[lldb] Improve corefile saving ergonomics

This patch improves the way the user can save the process state into a
corefile by adding completion handler that would provide tab completion
for the corefile path and also resolves the corefile path to expand
relative path.

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

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
13 months ago[mlir][openacc] Add gang dim operand to acc.loop operation
Valentin Clement [Tue, 13 Jun 2023 20:39:06 +0000 (13:39 -0700)]
[mlir][openacc] Add gang dim operand to acc.loop operation

OpenACC 3.3 introduces a dim argument on the gang clause. This patch
adds a new operand for it on the acc.loop and update the custom
gang clause parser/printer for it.

Depends on D151970

Reviewed By: razvanlupusoru, jeanPerier

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

13 months ago[LLD] Allow usage of LLD as a library
Alexandre Ganea [Tue, 13 Jun 2023 20:22:51 +0000 (16:22 -0400)]
[LLD] Allow usage of LLD as a library

As discussed in https://github.com/llvm/llvm-project/issues/53475 this patch allows using LLD-as-a-lib. It also lets clients link only the drivers that they want (see unit tests).

This also adds the unit test infra as in the other LLVM projects. Among the test coverage, I've added the original issue from @krzysz00, see: https://github.com/ROCmSoftwarePlatform/D108850-lld-bug-reproduction

Important note: this doesn't allow (yet) linking in parallel. This will come a bit later, in subsequent patches, for COFF at last.

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

13 months ago[Passes] Remove some legacy printer passes
Arthur Eubanks [Tue, 13 Jun 2023 20:17:32 +0000 (13:17 -0700)]
[Passes] Remove some legacy printer passes

MemDepPrinter doesn't have a new PM equivalent, but MemDep is soft deprecated anyway and adding one should be easy if somebody wants to.

13 months ago[BOLT][NFCI] Remove redundant instance of MCAsmBackend
Maksim Panchenko [Tue, 13 Jun 2023 01:21:58 +0000 (18:21 -0700)]
[BOLT][NFCI] Remove redundant instance of MCAsmBackend

Use instance of MCAsmBackend from BinaryContext instead of creating a
new one.

Reviewed By: Amir

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

13 months ago[LoopSink] Allow sinking to PHI-use
Wenlei He [Tue, 13 Jun 2023 04:20:19 +0000 (21:20 -0700)]
[LoopSink] Allow sinking to PHI-use

This change allows sinking defs from loop preheader with PHI-use into loop body. Loop sink can now see through PHI-use and select incoming blocks of value being used as candidate sink destination.

It makes loop sink more effective so more LICM can be undone if proven unprofitable with profile info. It addresses the motivating case in D87551, without resorting to profile guided LICM which breaks canonicalization.

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

13 months ago[flang] Add PowerPC vec_add, vec_and, vec_mul, vec_sub and vec_xor intrinsics
Kelvin Li [Mon, 29 May 2023 20:10:12 +0000 (16:10 -0400)]
[flang] Add PowerPC vec_add, vec_and, vec_mul, vec_sub and vec_xor intrinsics

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

13 months ago[MS] Fix passing aligned records by value in some cases
Reid Kleckner [Mon, 12 Jun 2023 20:50:50 +0000 (13:50 -0700)]
[MS] Fix passing aligned records by value in some cases

It's not exactly clear what the meaning of TypeInfo::AlignRequirement
is, so go directly to the ASTRecordLayout for records and check the
required alignment there. Compare that number with the stack alignment
value of 4.

This fixes cases when the alignment attribute does not appear directly
on the record [1], or when the attribute on the record is underaligned
[2].

[1]: `struct Foo { int __declspec(align(16)) x; };`
[2]: `struct __declspec(align(1)) Bar { int x; };`

Fixes https://llvm.org/pr63257

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

13 months ago[SelectionDAG] Don't allow type legalization to create noop VP_TRUNCATE.
Craig Topper [Tue, 13 Jun 2023 19:46:26 +0000 (12:46 -0700)]
[SelectionDAG] Don't allow type legalization to create noop VP_TRUNCATE.

Type legalization may need to promote the result to the same type
as the input. Instead of forming a vp_truncate with the same
source and dest type, don't create any vp_truncate.

Handling in getNode like is done for ISD::TRUNCATE.

13 months ago[CMake][BLAKE3] Fix unused -mavx512vl warning when CMAKE_OSX_ARCHITECTURES=arm64
Fangrui Song [Tue, 13 Jun 2023 19:45:34 +0000 (12:45 -0700)]
[CMake][BLAKE3] Fix unused -mavx512vl warning when CMAKE_OSX_ARCHITECTURES=arm64

This fixes
```
% ninja -C out/play LLVMSupport
ninja: Entering directory `out/play'
[151/158] Building ASM object lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o
clang: warning: argument unused during compilation: '-mavx512vl' [-Wunused-command-line-argument]
```

and applies `disable_blake3_x86_simd()`.

This fixes the root cause of commit 5160f6fefb0021a0b23e99c7cf621a330241c211 ("broke cross-builds of llvm from x86_64 to arm64 mac"...)

13 months ago[test][sanitizer] Fix test on windows
Vitaly Buka [Tue, 13 Jun 2023 19:26:41 +0000 (12:26 -0700)]
[test][sanitizer] Fix test on windows

13 months agoEnable zbb for riscv android
AdityaK [Tue, 13 Jun 2023 19:22:46 +0000 (12:22 -0700)]
Enable zbb for riscv android

Differential Revision: https://reviews.llvm.org/D152729
Reviewers: enh, pirama, jrtc27

13 months ago[LLD][COFF] Allow overwriting directives exports with cmd-line exports
Alexandre Ganea [Tue, 13 Jun 2023 19:12:55 +0000 (15:12 -0400)]
[LLD][COFF] Allow overwriting directives exports with cmd-line exports

MSVC link.exe allows overriding exports on the cmd-line with exports seen in OBJ directives. The typical case is what is described in #62329.

Before this patch, trying to override an export with `/export` or `/def` would generate a duplicate warning. This patches tries to replicate the MSVC behavior. A second override on the cmd-line would still generate the warning.

There's still a case which we don't cover: MSVC link.exe is able to demangle an exported OBJ directive function, and match it with a unmangled export function in a .def file. In the meanwhile, one can use the mangled export in the .def to cover that case.

This fixes #62329

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

13 months ago[test][sanitizer] Fix test on windows
Vitaly Buka [Tue, 13 Jun 2023 19:26:41 +0000 (12:26 -0700)]
[test][sanitizer] Fix test on windows

13 months ago[BOLT][NFC] Change signature of MCPlusBuilder::isUnsupportedBranch()
Maksim Panchenko [Sat, 6 May 2023 20:27:48 +0000 (13:27 -0700)]
[BOLT][NFC] Change signature of MCPlusBuilder::isUnsupportedBranch()

Make MCPlusBuilder::isUnsupportedBranch() take MCInst, not opcode.

Reviewed By: Amir

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

13 months agoScalarizer: limit scalarization for small element types
Nicolai Hähnle [Fri, 2 Dec 2022 02:15:13 +0000 (03:15 +0100)]
Scalarizer: limit scalarization for small element types

Scalarization can expose optimization opportunities for the individual
elements of a vector, and can therefore be beneficial on targets like
GPUs that tend to operate on scalars anyway.

However, notably with 16-bit operations it is often beneficial to keep
<2 x i16 / half> vectors around since there are packed instructions for
those.

Refactor the code to operate on "fragments" of split vectors. The
fragments are usually scalars, but may themselves be smaller vectors
when the scalarizer-min-bits option is used. If the split is uneven,
the last fragment is a shorter remainder.

This is almost NFC when the new option is unused, but it happens to
clean up some code in the fully scalarized case as well.

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

13 months ago[gn build] Port 474a2b9367ad
LLVM GN Syncbot [Tue, 13 Jun 2023 19:06:20 +0000 (19:06 +0000)]
[gn build] Port 474a2b9367ad