platform/upstream/llvm.git
22 months ago[llvm-driver] Mark some tests unsupported
Alex Brachet [Sat, 7 Jan 2023 17:45:26 +0000 (17:45 +0000)]
[llvm-driver] Mark some tests unsupported

These tests rely on making symlinks to unkown tool names which will
fail when in the llvm-driver build.

22 months ago[lldb] clang-format PathMappingList.cpp
Kazu Hirata [Sat, 7 Jan 2023 17:38:44 +0000 (09:38 -0800)]
[lldb] clang-format PathMappingList.cpp

This patch clang-formats AppendPathComponents in PathMappingList.cpp.

Without this patch, clang-format would indent the body of the
following function by four spaces.

22 months ago[BPF] generate btf_decl_tag records for params of extern functions
Eduard Zingerman [Sat, 7 Jan 2023 17:29:02 +0000 (09:29 -0800)]
[BPF] generate btf_decl_tag records for params of extern functions

After frontend changes in the following commit:
"BPF: preserve btf_decl_tag for parameters of extern functions"
same mechanics could be used to get the list of function parameters
and associated btf_decl_tag entries for both extern and non-extern
functions.

This commit extracts this mechanics as a separate auxiliary function
BTFDebug::processDISubprogram(). The function is called for both
extern and non-extern functions in order to generated corresponding
BTF_DECL_TAG records.

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

22 months ago[AVR] Fix incorrect decoding of RJMP and RCALL
Ben Shi [Sat, 7 Jan 2023 06:33:24 +0000 (14:33 +0800)]
[AVR] Fix incorrect decoding of RJMP and RCALL

This patch fixes the inaccurate decoding of the offset operand of
the RCALL & RJMP instructions.

Reviewed By: aykevl, MaskRay

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

22 months ago[SPIR-V] Map IR function pointers to registers in ModuleAnalysis
Michal Paszkowski [Sat, 7 Jan 2023 14:25:53 +0000 (15:25 +0100)]
[SPIR-V] Map IR function pointers to registers in ModuleAnalysis

SPIRVModuleAnalysis collects module and external function registers
(usually result of OpFunction) for use when emitting OpFunctionCall.
This patch makes the mapping between the functions and registers using
pointers (instead of name strings) to ensure anonymous functions and
calls can be resolved properly.

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

22 months ago[ARM][AArch64] Add tests for And/Or into CSel fold. NFC
David Green [Sat, 7 Jan 2023 14:08:29 +0000 (14:08 +0000)]
[ARM][AArch64] Add tests for And/Or into CSel fold. NFC

22 months ago[libc++] remove weird empty line
Backl1ght [Sat, 7 Jan 2023 09:19:16 +0000 (17:19 +0800)]
[libc++] remove weird empty line

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

22 months ago[LoongArch] Reorder code and inline variable in lowerGlobalTLSAddress for clarity...
wanglei [Sat, 7 Jan 2023 07:22:47 +0000 (15:22 +0800)]
[LoongArch] Reorder code and inline variable in lowerGlobalTLSAddress for clarity. NFC

22 months ago[BPF] preserve btf_decl_tag for parameters of extern functions
Eduard Zingerman [Sat, 7 Jan 2023 06:45:09 +0000 (22:45 -0800)]
[BPF] preserve btf_decl_tag for parameters of extern functions

Generate DILocalVariable entries for parameters of extern functions,
the "annotations" field of DILocalVariable is used to link
"btf_decl_tag" annotation with the parameter.

Do this only for BPF backend as there are no other users for this
information. Final DWARF is valid as "Appendix A" is very much lax in
what is allowed as attributes for "DW_TAG_formal_parameter":

    DWARF does not in general require that a given debugging information
    entry contain a particular attribute or set of attributes. Instead,
    a DWARF producer is free to generate any, all, or none of the
    attributes ... other attributes ... may also appear in a given
    debugging information entry.

DWARF Debugging Information Format Version 5,
Appendix A: Attributes by Tag Value (Informative)
Page 251, Line 3.

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

22 months ago[BPF] Triple::isBPF() utility method
Eduard Zingerman [Sat, 7 Jan 2023 06:35:25 +0000 (22:35 -0800)]
[BPF] Triple::isBPF() utility method

Adds a utility method llvm::Triple::isBPF() aggregating Triple::bpfel
and Triple::bpfeb architectures. Similar to other predicates in this class.

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

22 months ago[LoongArch] Move illegal ImmArg tests to llvm/test/Verifier
gonglingqin [Sat, 7 Jan 2023 02:38:41 +0000 (10:38 +0800)]
[LoongArch] Move illegal ImmArg tests to llvm/test/Verifier

This patch also fixes incorrect function declarations in test cases
and remove -disable-verify from the test case.

Fix https://github.com/llvm/llvm-project/issues/59839

22 months ago[libc++][test][NFC] revert indentation damage
Casey Carter [Fri, 6 Jan 2023 21:29:43 +0000 (13:29 -0800)]
[libc++][test][NFC] revert indentation damage

... from d65e66abb3bd4535e1900c0c7901c0f6254acf34.

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

22 months ago[Clang] Fix warning on unused varaible
Joseph Huber [Sat, 7 Jan 2023 03:14:05 +0000 (21:14 -0600)]
[Clang] Fix warning on unused varaible

Summary:
Don't check the flag this way, it leads to unused variables. Fix.

22 months ago[AVR] Fix some ambiguous cases in AsmParser
Ben Shi [Fri, 30 Dec 2022 12:07:16 +0000 (20:07 +0800)]
[AVR] Fix some ambiguous cases in AsmParser

Some specific operands in specific instructions should be treated
as variables/symbols/labels, other than registers.

This patch fixes those ambiguous cases, such as "lds r25, r24",
which means loading the value inside symbol 'r24' into register 'r25'.

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

Reviewed by: aykevl

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

22 months agoAMDGPU: Use getTypeAllocSize
Matt Arsenault [Fri, 6 Jan 2023 23:34:04 +0000 (18:34 -0500)]
AMDGPU: Use getTypeAllocSize

22 months agoAMDGPU: Use more accurate IR type for block handle
Matt Arsenault [Fri, 23 Dec 2022 20:52:41 +0000 (15:52 -0500)]
AMDGPU: Use more accurate IR type for block handle

The device library uses this as a struct with a pointer sized integer
and 2 ints.

22 months agoAMDGPU: Add more opencl printf tests
Matt Arsenault [Fri, 6 Jan 2023 22:34:02 +0000 (17:34 -0500)]
AMDGPU: Add more opencl printf tests

22 months agoAMDGPU: Invert handling of enqueued block detection
Matt Arsenault [Fri, 23 Dec 2022 21:18:43 +0000 (16:18 -0500)]
AMDGPU: Invert handling of enqueued block detection

Invert the sense of the attribute and let the attributor figure this
out like everything else. If needed we can have the not-OpenCL
languages set amdgpu-no-default-queue and amdgpu-no-completion-action
up front so they never have to pay the cost.

There are also so many of these now, the offset use API should
probably consider all of them at once. Maybe they should merge into
one attribute with used fields. Having separate functions for each
field in AMDGPUBaseInfo is also not the greatest API (might as well
fix this when the patch to get the object version from the module
lands).

22 months agoAMDGPU: Fix enqueue block lowering for opaque pointers
Matt Arsenault [Fri, 23 Dec 2022 20:39:55 +0000 (15:39 -0500)]
AMDGPU: Fix enqueue block lowering for opaque pointers

This was looking for a specific constant cast of the function, when
the type doesn't matter. Doesn't bother trying to handle typed
pointers, it will just assert.

Things probably don't work completely correctly if the block kernel
address is captured somewhere else, but that wouldn't work before
either. The uses should really be loads out of the handle, and the
handle initializer should contain the kernel address.

22 months agoAMDGPU: Convert enqueue-kernel.ll to opaque pointers
Matt Arsenault [Fri, 23 Dec 2022 22:14:06 +0000 (17:14 -0500)]
AMDGPU: Convert enqueue-kernel.ll to opaque pointers

This demonstrates the pass is broken with them, the follow up change
will fix it.

22 months ago[Clang] Fix mispelled option passed to the linker wrapper
Joseph Huber [Sat, 7 Jan 2023 02:02:23 +0000 (20:02 -0600)]
[Clang] Fix mispelled option passed to the linker wrapper

Summary:
This option was spelled wrong and caused errors if used in combination
with the linking job. Fix it.

22 months ago[OpenMP] Introduce '-f[no-]openmp-target-jit' flag to control JIT for offloading
Joseph Huber [Fri, 6 Jan 2023 21:22:12 +0000 (15:22 -0600)]
[OpenMP] Introduce '-f[no-]openmp-target-jit' flag to control JIT for offloading

JIT support for OpenMP offloading was introduced in D139287. This patch
adds a simple flag that enables this mode. It simply requires enabling
`-foffload-lto` mode and `--embed-bitcode` in the linker wrapper. This
option implies LTO if it is not enabled.

Reviewed By: jdoerfert

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

22 months ago[SLP][NFC]Fix compile build by declaring ArrayRef, NFC.
Alexey Bataev [Sat, 7 Jan 2023 01:01:48 +0000 (17:01 -0800)]
[SLP][NFC]Fix compile build by declaring ArrayRef, NFC.

Fix compiler build reported in https://lab.llvm.org/buildbot#builders/243/builds/218

22 months ago[SLP][NFC]Remove unused variables, NFC.
Alexey Bataev [Sat, 7 Jan 2023 00:55:54 +0000 (16:55 -0800)]
[SLP][NFC]Remove unused variables, NFC.

22 months ago[SLP]Fix incorrect reordering of clustered scalars.
Alexey Bataev [Fri, 6 Jan 2023 19:07:22 +0000 (11:07 -0800)]
[SLP]Fix incorrect reordering of clustered scalars.

The new mask represents the order, not the mask itself. At first, need
to treat as the order, convert to mask and only after that reorder
gathered scalars to build correct clustered order.

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

22 months ago[libc] Add a separate install target for the libc static archives.
Siva Chandra Reddy [Fri, 6 Jan 2023 08:21:49 +0000 (08:21 +0000)]
[libc] Add a separate install target for the libc static archives.

Also, skip installing startup objects for baremetal targets for now.

Reviewed By: michaelrj

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

22 months ago[mlir][spirv] Add folder for LogicalNotEqual
Thomas Raoux [Fri, 6 Jan 2023 23:03:12 +0000 (23:03 +0000)]
[mlir][spirv] Add folder for LogicalNotEqual

Add a folder for LogicalNotEqual when rhs is false. This pattern shows
up after lowering to SPIRV.

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

22 months ago[DebugInfo] Add support for variadic DBG_INSTR_REFs in LiveDebugValues
Stephen Tozer [Tue, 3 Jan 2023 13:53:25 +0000 (13:53 +0000)]
[DebugInfo] Add support for variadic DBG_INSTR_REFs in LiveDebugValues

Following support from the previous patches in this stack being added for
variadic DBG_INSTR_REFs to exist, this patch modifies LiveDebugValues to
handle those instructions. Support already exists for DBG_VALUE_LISTs, which
covers most of the work needed to handle these instructions; this patch only
modifies the transferDebugInstrRef function to correctly track them.

Reviewed By: jmorse

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

22 months ago[MLIR][TOSA] Switch Tosa to DenseArrayAttr
Alexander Shaposhnikov [Fri, 6 Jan 2023 22:57:14 +0000 (22:57 +0000)]
[MLIR][TOSA] Switch Tosa to DenseArrayAttr

This diff completes switching Tosa to DenseArrayAttr.

Test plan: ninja check-mlir check-all

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

22 months ago[Fix][-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callabl...
ziqingluo-90 [Fri, 6 Jan 2023 22:29:19 +0000 (14:29 -0800)]
[Fix][-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callable declarations

The original patch does include a `new` statement without a matching
`delete`, causing Sanitizer warnings in
https://lab.llvm.org/buildbot/#/builders/5/builds/30522/steps/13/logs/stdio.

This commit is a fix to it.

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

22 months agoAMDGPU: Try to fix 32-bit build bot
Matt Arsenault [Fri, 6 Jan 2023 22:33:56 +0000 (17:33 -0500)]
AMDGPU: Try to fix 32-bit build bot

22 months ago[ubsan][test] Fix typo in D139230
Roy Sundahl [Mon, 19 Dec 2022 18:31:22 +0000 (10:31 -0800)]
[ubsan][test] Fix typo in D139230

Fix "runtime runtime error" -> "runtime error"

Reviewed By: MaskRay

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

22 months agoAMDGPU: Use BinaryByteStream in printf expansion
Matt Arsenault [Fri, 6 Jan 2023 17:51:10 +0000 (12:51 -0500)]
AMDGPU: Use BinaryByteStream in printf expansion

Attempt to fix test failures on big endian bots. This pass definitely
needs more test coverage.

22 months agoAMDGPU: Add additional printf string tests
Matt Arsenault [Fri, 6 Jan 2023 18:37:31 +0000 (13:37 -0500)]
AMDGPU: Add additional printf string tests

Test various inputs passed to %s.

22 months ago[mlir][tensor] Add producer fusion for tensor.unpack op.
Hanhan Wang [Fri, 6 Jan 2023 18:49:08 +0000 (10:49 -0800)]
[mlir][tensor] Add producer fusion for tensor.unpack op.

Reviewed By: mravishankar

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

22 months ago[Support] On Windows 11 and Windows Server 2022, fix an affinity mask issue on large...
Alexandre Ganea [Thu, 5 Jan 2023 20:27:30 +0000 (15:27 -0500)]
[Support] On Windows 11 and Windows Server 2022, fix an affinity mask issue on large core count machines

Before Windows 11 and Windows Server 2022, only one 'processor group' is assigned by default to a starting process, then the program is responsible for dispatching its own threads on more 'processor groups'. That is what 8404aeb56a73ab24f9b295111de3b37a37f0b841 was doing, allowing LLVM tools to automatically use all hardware threads in the machine.

After Windows 11 and Windows Server 2022, the OS takes care of that. This has an adverse effect reported in #56618 which is that using `GetProcessAffinityMask()` API in some edge cases seems buggy now. That API is used to detect if an affinity mask was set, and adjust accordingly the available threads for a ThreadPool.

With this patch, on one hand, we let the OS dispatch threads on all 'processor groups', but only for Windows 11 & Windows Server 2022 and after. We retain the old behavior for older OS versions. On the other hand, a workaround was added to mitigate the `GetProcessAffinityMask()` issue described above (see Threading.inc, L226).

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

22 months ago[mlir][py] Fix python modules build with clang-cl due to requiring exceptions
Markus Böck [Fri, 6 Jan 2023 21:48:02 +0000 (22:48 +0100)]
[mlir][py] Fix python modules build with clang-cl due to requiring exceptions

The generator expression previously used to enable exceptions would not work since the compiler id of clang-cl is Clang, even if used via clang-cl.

The patch fixes that by replacing the generator expression with simple logic, setting the right compiler flags for all MSVC like compilers (including clang-cl) and all GCC like compilers.

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

22 months ago[BOLT][DWARF] Change rangelists to use DW_RLE_offset_pair
Alexander Yermolovich [Fri, 6 Jan 2023 21:45:43 +0000 (13:45 -0800)]
[BOLT][DWARF] Change rangelists to use DW_RLE_offset_pair

Before we always used DW_RLE_startx_length. This is not very efficient and leads
to bigger .debug_addr section. Changed it to use
DW_RLE_base_addressx/DW_RLE_offset_pair.

clang-16 build in debug mode
llvm-bolt ran on it with --update-debug-sections
| section | before | after | diff | % decrease |
| .debug_rnglists | 32732292 | 31986051 | -746241 | 2.3% |
| .debug_addr | 14415808 | 14184128 |  -231680 | 1.6% |

Reviewed By: maksfb

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

22 months agoRevert "[Fix][-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips...
ziqingluo-90 [Fri, 6 Jan 2023 21:37:13 +0000 (13:37 -0800)]
Revert "[Fix][-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callable declarations"

This reverts commit 6d140b952805bd9277fba666520ce46c19f2c637.

This commit may causes `test/SemaCXX/warn-unsafe-buffer-usage.cpp` failure.

22 months ago[Fix][-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callabl...
ziqingluo-90 [Fri, 6 Jan 2023 20:30:11 +0000 (12:30 -0800)]
[Fix][-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callable declarations

The original patch does include a `new` statement without a matching
`delete`, causing Sanitizer warnings in
https://lab.llvm.org/buildbot/#/builders/5/builds/30522/steps/13/logs/stdio.

This commit is a fix to it.

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

22 months ago[mlir][Arith] Remove expansions of integer min and max ops
Krzysztof Drewniak [Mon, 2 Jan 2023 21:24:39 +0000 (21:24 +0000)]
[mlir][Arith] Remove expansions of integer min and max ops

As of several months ago, both ArithToLLVM and ArithToSPIRV have
native support for integer min and max operations. Since these are all
the targets available in MLIR core, the need to "expand" arith.minui,
arith.minsi, arith,maxsi, and arith.manxui to more primitive
operations is to longer present.

Therefore, the expanding of integer min and max operations in Arith,
while correct, is likely to lead to performance loss by way of
misoptimization further down the line, and is no longer needed for
anyone's correctness.

This change may break downstream tests, but will not affect the
semantics of MLIR programs.

arith.minf and arith.maxf have a lot of underlying complexity due to
the many different possible NaN and signed zero semantics available on
various platforms, and so removing their expansion is left to a future
commit.

Reviewed By: ThomasRaoux, Mogball

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

22 months ago[-Wunsafe-buffer-usage] Changing the use of None with std::nullopt to address a warning.
MalavikaSamak [Fri, 6 Jan 2023 20:18:40 +0000 (12:18 -0800)]
[-Wunsafe-buffer-usage] Changing the use of None with std::nullopt to address a warning.

22 months ago[mlir] Add header file for ssize_t
Ashay Rane [Fri, 6 Jan 2023 20:29:04 +0000 (21:29 +0100)]
[mlir] Add header file for ssize_t

ssize_t is part of POSIX and not standard C/C++, so using ssize_t
without the necessary header files causes the build to fail on Windows
with the following error: 'ssize_t': undeclared identifier.

This patch includes llvm/Support/DataTypes.h to resolve the problem.

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

22 months ago[-Wunsafe-buffer-usage] Safe-buffers re-architecture to introduce Fixable gadgets
MalavikaSamak [Fri, 6 Jan 2023 19:33:49 +0000 (11:33 -0800)]
[-Wunsafe-buffer-usage] Safe-buffers re-architecture to introduce Fixable gadgets

Re-architecture of safe-buffers gadgets to re-classify them as warning and fixable
gadgets. The warning gadgets identify unsafe operations on buffer variables and
emit suitable warnings. While the fixable gadgets consider all operations on
variables identified by the warning gadgets and emit necessary fixits.

Differential Revision: https://reviews.llvm.org/D140062?id=486625

22 months ago[libc] add noexcept to external function headers
Michael Jones [Wed, 4 Jan 2023 18:37:51 +0000 (10:37 -0800)]
[libc] add noexcept to external function headers

To improve code generation for C++ code that directly includes our
headers, the external function definitions will now be marked noexcept.
This may not be necessary for the internal definitions since we build
with the -fno-exceptions flag.

Reviewed By: sivachandra

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

22 months agoFix PDL verifiers to be resilient to invalid IR
Mehdi Amini [Fri, 6 Jan 2023 19:34:28 +0000 (19:34 +0000)]
Fix PDL verifiers to be resilient to invalid IR

This would cause a crash when calling `dump()` on an operation that
didn't have a parent yet.

22 months ago[libc++][test] Add missing include
Casey Carter [Fri, 6 Jan 2023 19:35:26 +0000 (11:35 -0800)]
[libc++][test] Add missing include

`std::out_of_range` is in `<stdexcept>`

22 months ago[DebugInfo] Allow non-stack_value variadic expressions and use in DBG_INSTR_REF
Stephen Tozer [Tue, 3 Jan 2023 10:11:22 +0000 (10:11 +0000)]
[DebugInfo] Allow non-stack_value variadic expressions and use in DBG_INSTR_REF

Prior to this patch, variadic DIExpressions (i.e. ones that contain
DW_OP_LLVM_arg) could only be created by salvaging debug values to create
stack value expressions, resulting in a DBG_VALUE_LIST being created. As of
the previous patch in this patch stack, DBG_INSTR_REF's syntax has been
changed to match DBG_VALUE_LIST in preparation for supporting variadic
expressions. This patch adds some minor changes needed to allow variadic
expressions that aren't stack values to exist, and allows variadic expressions
that are trivially reduceable to non-variadic expressions to be handled
similarly to non-variadic expressions.

Reviewed by: jmorse

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

22 months ago[mlir] Support TBAA metadata in LLVMIR dialect.
Slava Zakharin [Thu, 29 Dec 2022 23:14:41 +0000 (15:14 -0800)]
[mlir] Support TBAA metadata in LLVMIR dialect.

This change introduces new LLVMIR dialect operations to represent
TBAA root, type descriptor and access tag metadata nodes.

For the purpose of importing TBAA metadata from LLVM IR it only
supports the current version of TBAA format described in
https://llvm.org/docs/LangRef.html#tbaa-metadata (i.e. size-aware
representation introduced in D41501 is not supported).

TBAA attribute support is only added for LLVM::LoadOp and LLVM::StoreOp.
Support for intrinsics operations (e.g. LLVM::MemcpyOp) may be added later.

The TBAA attribute is represented as an array of access tags, though,
LLVM IR supports only single access tag per memory accessing instruction.
I implemented it as an array anticipating similar support in LLVM IR
to combine TBAA graphs with different roots for Flang - one of the options
described in https://docs.google.com/document/d/16kKZVmI585wth01VSaJAqZMZpoX68rcdBmgfj0kNAt0/edit#heading=h.jzzheaz9vqac

It should be easy to restrict MLIR operation to a single access tag,
if we end up using a different approach for Flang.

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

22 months ago[AMDGPU] Combine redundant Asm64 and AsmVOP3DPPBase. NFC
Joe Nash [Thu, 5 Jan 2023 21:48:46 +0000 (16:48 -0500)]
[AMDGPU] Combine redundant Asm64 and AsmVOP3DPPBase. NFC

Reduce duplication in the codebase by combining these fields in
VOPProfile.

Reviewed By: rampitec

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

22 months agoCleanup unwind table emission code a bit.
James Y Knight [Fri, 6 Jan 2023 18:26:03 +0000 (13:26 -0500)]
Cleanup unwind table emission code a bit.

This change removes the `tidyLandingPads` function, which previously
had a few responsibilities:

1. Dealing with the deletion of an invoke, after MachineFunction lowering.
2. Dealing with the deletion of a landing pad BB, after MachineFunction lowering.
3. Cleaning up the type-id list generated by `MachineFunction::addLandingPad`.

Case 3 has been fixed in the generator, and the others are now handled
during table emission.

This change also removes `MachineFunction`'s `addCatchTypeInfo`,
`addFilterTypeInfo`, and `addCleanup` helper fns, as they had a single
caller, and being outlined didn't make it simpler.

Finally, as calling `tidyLandingPads` was effectively the only thing
`DwarfCFIExceptionBase` did, that class has been eliminated.

22 months agoRemove special cases for invoke of non-throwing inline-asm.
James Y Knight [Fri, 6 Jan 2023 15:11:44 +0000 (10:11 -0500)]
Remove special cases for invoke of non-throwing inline-asm.

Non-throwing inline asm infers the nounwind attribute in
instcombine. Thus, it can be handled in the same manner as
non-throwing target functions are generally. Further special casing is
unnecessary complexity.

22 months ago[mlir][tosa] Add tosa.conv3d lowering to Linalg
Rob Suderman [Fri, 6 Jan 2023 18:13:32 +0000 (10:13 -0800)]
[mlir][tosa] Add tosa.conv3d lowering to Linalg

Conv3D has an existing linalg operation for floating point. Adding a quantized
variant and corresponding lowering from TOSA. Numerical correctness was validated
using the TOSA conformance tests.

Reviewed By: jpienaar

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

22 months agoWhen loading mach-o corefile, new fallback for finding images
Jason Molenda [Fri, 6 Jan 2023 18:45:07 +0000 (10:45 -0800)]
When loading mach-o corefile, new fallback for finding images

When lldb is reading a user process corefile, it starts by finding
dyld, then finding the dyld_all_image_infos structure in dyld by
symbol name, then getting the list of loaded binaries.  If it fails
to find the structure by name, it can't load binaries.  There is
an additional fallback that this patch adds, which is to look for
this object by the section name it is stored in, if the symbol name
lookup fails.

Differential Revision: https://reviews.llvm.org/D140066
rdar://103369931

22 months agoRe-land "[-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips...
ziqingluo-90 [Fri, 6 Jan 2023 18:33:21 +0000 (10:33 -0800)]
Re-land "[-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callable declarations"

This reverts commit 22df4549a3718dcd8b387ba8246978349e4be50c.

After a quick investigation, realizing that the Sanitizer test
failures caused by this patch is not likely to block other
contributors. I re-land this patch before taking a closer look at
those tests so that it won't block the [-Wunsafe-buffer-usage]
development.

22 months agoFix: Title underline too short in D129372
Stephen Tozer [Fri, 6 Jan 2023 18:21:11 +0000 (18:21 +0000)]
Fix: Title underline too short in D129372

This patch fixes an error in commit e10e9363 in which the
added documentation contained an incorrectly-styled underline
for the title "Debug Instruction Reference Operands".

22 months ago[DebugInfo][NFC] Add new MachineOperand type and change DBG_INSTR_REF syntax
Stephen Tozer [Thu, 15 Sep 2022 10:26:57 +0000 (11:26 +0100)]
[DebugInfo][NFC] Add new MachineOperand type and change DBG_INSTR_REF syntax

This patch makes two notable changes to the MIR debug info representation,
which result in different MIR output but identical final DWARF output (NFC
w.r.t. the full compilation). The two changes are:

  * The introduction of a new MachineOperand type, MO_DbgInstrRef, which
    consists of two unsigned numbers that are used to index an instruction
    and an output operand within that instruction, having a meaning
    identical to first two operands of the current DBG_INSTR_REF
    instruction. This operand is only used in DBG_INSTR_REF (see below).
  * A change in syntax for the DBG_INSTR_REF instruction, shuffling the
    operands to make it resemble DBG_VALUE_LIST instead of DBG_VALUE,
    and replacing the first two operands with a single MO_DbgInstrRef-type
    operand.

This patch is the first of a set that will allow DBG_INSTR_REF
instructions to refer to multiple machine locations in the same manner
as DBG_VALUE_LIST.

Reviewed By: jmorse

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

22 months ago[libc++][test] Suppress MSVC warnings in std::expected tests
Casey Carter [Fri, 6 Jan 2023 03:28:21 +0000 (19:28 -0800)]
[libc++][test] Suppress MSVC warnings in std::expected tests

* initializing `short`s with `short`s instead of `int`s to avoid narrowing warnings
* Explicitly discard the result of `value` calls to avoid `[[nodiscard]]` warnings

Drive-by: `testException` from `value` test is duplicated in `value_or` test; remove the duplicate.
Differential Review: https://reviews.llvm.org/D141108

22 months ago[PPC] Add support for tune-cpu attribute
Kai Nacke [Fri, 18 Nov 2022 19:12:01 +0000 (19:12 +0000)]
[PPC] Add support for tune-cpu attribute

clang (like gcc) has the -mtune= command line option. This option
adds the "tune-cpu" attribute to a function. The intended functionality
is that the scheduling model of that cpu is used. E.g. -mtune=pwr9 -march=pwr8
generates only instructions supported on pwr8 but uses the scheduling model
of pwr9 for it.
This PR adds the infrastructure to support this in LLVM.
clang support was added in https://reviews.llvm.org/D130526.

Reviewed By: amyk, qiucf

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

22 months agoRecommit "[RISCV] Enable the LocalStackSlotAllocation pass support"
LiDongjin [Fri, 6 Jan 2023 17:54:19 +0000 (09:54 -0800)]
Recommit "[RISCV] Enable the LocalStackSlotAllocation pass support"

This includes a fix for the tramp3d failure from the llvm-testsuite
that caused the last revert. Hopefully the others failures were the
same issue.

Original commit message:
For RISC-V, load/store(exclude vector load/store) instructions only has a 12 bit immediate operand. If the offset is out-of-range, it must make use of a temp register to make up this offset. If between these offsets, they have a small(IsInt<12>) relative offset, LocalStackSlotAllocation pass can find a value as frame base register's value, and replace the origin offset with this register's value plus the relative offset.

Co-authored-by: luxufan <luxufan@iscas.ac.cn>
Co-authored-by: Craig Topper <craig.topper@sifive.com>
Differential Revision: https://reviews.llvm.org/D98101

22 months agoRe-gernerate a test in preparation for D141060
Alex Richardson [Fri, 6 Jan 2023 14:59:24 +0000 (14:59 +0000)]
Re-gernerate a test in preparation for D141060

22 months ago[mlir] improve error handling in Linalg op splitting
Alex Zinenko [Fri, 6 Jan 2023 16:09:28 +0000 (17:09 +0100)]
[mlir] improve error handling in Linalg op splitting

In several cases, the splitting may be known to be a noop, i.e., produce
no second part. Thread this information through the transform utilities
to the transform dialect, and differentiate it from the error state.

Reviewed By: nicolasvasilache

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

22 months ago[mlir][nvvm] Add lowering of gpu.printf to nvvm
Thomas Raoux [Thu, 5 Jan 2023 21:20:45 +0000 (21:20 +0000)]
[mlir][nvvm] Add lowering of gpu.printf to nvvm

When converting to nvvm lowering gpu.printf to vprintf allows us to
support printing when running on cuda.

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

22 months ago[SLP]Fix cost of the broadcast buildvector/gather.
Alexey Bataev [Wed, 21 Dec 2022 21:38:38 +0000 (13:38 -0800)]
[SLP]Fix cost of the broadcast buildvector/gather.

Need to include the cost of the initial insertelement to the cost of the
broadcasts. Also, need to adjust the cost of the gather/buildvector if
the element is inserted into poison/undef vector.

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

22 months ago[RISCV] Improve 4x and 8x (s/u)int_to_fp.
Craig Topper [Fri, 6 Jan 2023 16:39:14 +0000 (08:39 -0800)]
[RISCV] Improve 4x and 8x (s/u)int_to_fp.

Previously we emitted a 4x or 8x vzext followed by a vfcvt.
We can instead use a 2x or 4x vzext followed by a vfwcvt.

22 months agoRevert "[Dominator] Add findNearestCommonDominator() for Instructions (NFC)"
Nikita Popov [Fri, 6 Jan 2023 16:33:53 +0000 (17:33 +0100)]
Revert "[Dominator] Add findNearestCommonDominator() for Instructions (NFC)"

This reverts commit 7f0de9573f758f5f9108795850337a5acbd17eef.

This is missing handling for !isReachableFromEntry() blocks, which
may be relevant for some callers. Revert for now.

22 months ago[RISCV] Add more XVentanaCondOps patterns.
Craig Topper [Fri, 6 Jan 2023 16:29:23 +0000 (08:29 -0800)]
[RISCV] Add more XVentanaCondOps patterns.

Add patterns with seteq/setne conditions.

We don't have instructions for seteq/setne except for comparing
with zero and need to emit an ADDI or XOR before a seqz/snez to
compare other values.

The select ISD node takes a 0/1 value for the condition, but the
VT_MASKC(N) instructions check all XLen bits for zero or non-zero.
We can use this to avoid the seqz/snez in many cases.

This is pretty ridiculous number of patterns. I wonder if we could
use some ComplexPatterns to merge them, but I'd like to do that as
a follow up and focus on correctness of the result in this patch.

Reviewed By: reames

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

22 months ago[GVN] Name instructions in test (NFC)
Nikita Popov [Fri, 6 Jan 2023 16:28:18 +0000 (17:28 +0100)]
[GVN] Name instructions in test (NFC)

22 months ago[EntryExitInstrumenter] Convert test to opaque pointers (NFC)
Nikita Popov [Fri, 6 Jan 2023 16:25:09 +0000 (17:25 +0100)]
[EntryExitInstrumenter] Convert test to opaque pointers (NFC)

22 months ago[RISCV] Add support for the vscale_range attribute.
Craig Topper [Fri, 6 Jan 2023 16:20:37 +0000 (08:20 -0800)]
[RISCV] Add support for the vscale_range attribute.

This is based on @frasercrmck's D107290. At least some of the clang
portion of D107290 has already been committed.

This uses vscale_range for min/max vector width unless the command
line overrides are used.

As a follow up, I plan to add a max or exact VLEN option to clang
to control the vscale_range. This will eliminate many of the reasons
for users to use the overrides through the -mllvm interface.

Reviewed By: reames

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

22 months ago[mlir][vector] Relax restriction on reduction distribution
Thomas Raoux [Fri, 6 Jan 2023 16:09:21 +0000 (16:09 +0000)]
[mlir][vector] Relax restriction on reduction distribution

Relax unnecessary restriction when distribution a vector.reduce op.
All the float and integer types can be supported by user's lambda.

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

22 months agoflang: break the build on 32bit systems
Sylvestre Ledru [Fri, 6 Jan 2023 16:12:03 +0000 (17:12 +0100)]
flang: break the build on 32bit systems

Reviewed By: PeteSteinfeld

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

22 months agoDoc: improve the flang readme page
Sylvestre Ledru [Fri, 6 Jan 2023 16:09:21 +0000 (17:09 +0100)]
Doc: improve the flang readme page

Reviewed By: PeteSteinfeld

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

22 months ago[Dominator] Add findNearestCommonDominator() for Instructions (NFC)
Nikita Popov [Fri, 6 Jan 2023 15:56:34 +0000 (16:56 +0100)]
[Dominator] Add findNearestCommonDominator() for Instructions (NFC)

This is a recurring pattern: We want to find the nearest common
dominator (instruction) for two instructions, but currently only
provide an API for the nearest common dominator of two basic blocks.

Add an overload that accepts and return instructions.

22 months ago[gn build] Port 16c1c9fdcc48
LLVM GN Syncbot [Fri, 6 Jan 2023 15:46:03 +0000 (15:46 +0000)]
[gn build] Port 16c1c9fdcc48

22 months ago[SelectionDAG] Implicitly truncate known bits in SPLAT_VECTOR
Luke Lau [Thu, 5 Jan 2023 18:27:12 +0000 (18:27 +0000)]
[SelectionDAG] Implicitly truncate known bits in SPLAT_VECTOR

Now that D139525 fixes the Hexagon infinite loop, the stopgap can be
removed to provide more information about known bits in SPLAT_VECTOR
whose operands are smaller than the bit width (which is most of the
time)

Reviewed By: reames

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

22 months ago[WebAssembly][NFC] Add test case for PR59626
Luke Lau [Fri, 6 Jan 2023 11:30:09 +0000 (11:30 +0000)]
[WebAssembly][NFC] Add test case for PR59626

For D141079

Reviewed By: reames

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

22 months agoRevert D140263 "[NFC] Vastly simplifies TypeSize"
Guillaume Chatelet [Fri, 6 Jan 2023 15:31:46 +0000 (15:31 +0000)]
Revert D140263 "[NFC] Vastly simplifies TypeSize"

This broke some build bots : https://lab.llvm.org/buildbot/#/builders/16/builds/41419/steps/5/logs/stdio

This reverts commit 4670d5ece57d9b030597da679072f78bb3f4d419.

22 months ago[LoopFlattening] Check for extra uses on Mul
David Green [Fri, 6 Jan 2023 15:32:38 +0000 (15:32 +0000)]
[LoopFlattening] Check for extra uses on Mul

Similar to D138404, we were not guarding against extra uses of the Mul.
In most cases other checks would catch the issue due to unsupported
instructions in the outer loop, but certain non-canonical loop forms
could still get through.

Fixes #59339

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

22 months ago[LoopFlatten][NFC] Run instnamer on pr59339.ll
David Green [Fri, 6 Jan 2023 14:18:27 +0000 (14:18 +0000)]
[LoopFlatten][NFC] Run instnamer on pr59339.ll

22 months ago[AArch64][SME]: Make 'Expand' the default action for all Ops.
Hassnaa Hamdi [Thu, 5 Jan 2023 16:10:50 +0000 (16:10 +0000)]
[AArch64][SME]: Make 'Expand' the default action for all Ops.

By default expand all operations, then change to Custom/Legal if needed.

Reviewed By: sdesmalen

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

22 months agoRevert D141134 "[NFC] Only expose getXXXSize functions in TypeSize"
Guillaume Chatelet [Fri, 6 Jan 2023 15:27:50 +0000 (15:27 +0000)]
Revert D141134 "[NFC] Only expose getXXXSize functions in TypeSize"

The patch should be discussed further.

This reverts commit dd56e1c92b0e6e6be249f2d2dd40894e0417223f.

22 months ago[NFC] Only expose getXXXSize functions in TypeSize
Guillaume Chatelet [Fri, 6 Jan 2023 14:47:21 +0000 (14:47 +0000)]
[NFC] Only expose getXXXSize functions in TypeSize

Currently 'TypeSize' exposes two functions that serve the same purpose:
 - getFixedSize / getFixedValue
 - getKnownMinSize / getKnownMinValue

source : https://github.com/llvm/llvm-project/blob/bf82070ea465969e9ae86a31dfcbf94c2a7b4c4c/llvm/include/llvm/Support/TypeSize.h#L337-L338

This patch offers to remove one of the two and stick to a single function in the code base.

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

22 months ago[StackLifetime] Fix sign compare warning (NFC)
Nikita Popov [Fri, 6 Jan 2023 15:10:47 +0000 (16:10 +0100)]
[StackLifetime] Fix sign compare warning (NFC)

22 months ago[MemCpyOpt] Extract processStoreOfLoad() method (NFC)
Nikita Popov [Fri, 6 Jan 2023 14:58:49 +0000 (15:58 +0100)]
[MemCpyOpt] Extract processStoreOfLoad() method (NFC)

22 months ago[Libomptarget] Add more moves to expected conversion
Joseph Huber [Fri, 6 Jan 2023 15:09:18 +0000 (09:09 -0600)]
[Libomptarget] Add more moves to expected conversion

Summary:
Fixes other instances of the same problem in the previous patch.

22 months ago[Libomptarget] Add move to expected conversion
Joseph Huber [Fri, 6 Jan 2023 14:56:31 +0000 (08:56 -0600)]
[Libomptarget] Add move to expected conversion

Summary:
These implicit conversions from move-only types to expected seem to only
work with newer compilers. This should hopefully fix it.

22 months ago[mlir] fix use-after-free on error path in transform dialect
Alex Zinenko [Fri, 6 Jan 2023 15:02:14 +0000 (16:02 +0100)]
[mlir] fix use-after-free on error path in transform dialect

22 months ago[clang-format] fix template closer followed by >
Backl1ght [Fri, 6 Jan 2023 13:05:15 +0000 (21:05 +0800)]
[clang-format] fix template closer followed by >

fix https://github.com/llvm/llvm-project/issues/59785

Reviewed By: HazardyKnusperkeks, MyDeveloperDay, owenpan

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

22 months ago[IR] Use isEntryBlock() API (NFC)
Nikita Popov [Fri, 6 Jan 2023 14:43:02 +0000 (15:43 +0100)]
[IR] Use isEntryBlock() API (NFC)

22 months ago[IR] Add AllocaInst::getAllocationSize() (NFC)
Nikita Popov [Fri, 6 Jan 2023 14:33:39 +0000 (15:33 +0100)]
[IR] Add AllocaInst::getAllocationSize() (NFC)

When fetching allocation sizes, we almost always want to have the
size in bytes, but we were only providing an InBits API. Also add
the corresponding byte-based conjugate to save some *8 and /8
juggling everywhere.

22 months ago[SDAG] try to avoid multiply for X*Y==0
Sanjay Patel [Fri, 6 Jan 2023 13:49:19 +0000 (08:49 -0500)]
[SDAG] try to avoid multiply for X*Y==0

Forking this off from D140850 -
https://alive2.llvm.org/ce/z/TgBeK_
https://alive2.llvm.org/ce/z/STVD7d

We could almost justify doing this in IR, but consideration for
"minsize" requires that we only try it in codegen -- the
transform is not reversible.

In all other cases, avoiding multiply should be a win because a
mul is more expensive than simple/parallelizable compares. AArch
even has a trick to keep instruction count even for some types.

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

22 months agoAMDGPU/GlobalISel: Add missing test for implicit_def regbankselect
Matt Arsenault [Fri, 30 Dec 2022 14:45:32 +0000 (09:45 -0500)]
AMDGPU/GlobalISel: Add missing test for implicit_def regbankselect

22 months agoAMDGPU/GlobalISel: Add wave32 checks to bool test
Matt Arsenault [Tue, 27 Dec 2022 23:26:54 +0000 (18:26 -0500)]
AMDGPU/GlobalISel: Add wave32 checks to bool test

22 months ago[C++20] Determine the dependency of unevaluated lambdas more accurately
Liming Liu [Fri, 6 Jan 2023 13:56:25 +0000 (05:56 -0800)]
[C++20] Determine the dependency of unevaluated lambdas more accurately

During template instantiation, the instantiator will enter constant
evaluated
context before instantiate a template argument originated from an
expression,
and this impedes the instantiator from creating lambdas with independent
types.

This patch solves the problem via widening the condition that the
instantiator
marks lambdas as never dependent, and fixes the issue #57960

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

22 months ago[AMDGPU] Add a feature for VALUTransUseHazard
Jay Foad [Fri, 6 Jan 2023 11:09:36 +0000 (11:09 +0000)]
[AMDGPU] Add a feature for VALUTransUseHazard

NFCI. This just allows us to experiment with enabling/disabling the
workaround on different subtargets.

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

22 months ago[llvm-exegesis][NFC] Update benchmark phase naming to match documentation
Guillaume Chatelet [Fri, 6 Jan 2023 13:24:44 +0000 (13:24 +0000)]
[llvm-exegesis][NFC] Update benchmark phase naming to match documentation

22 months ago[mlir][memref] Add runtime verification for memref::CastOp
Matthias Springer [Fri, 6 Jan 2023 13:24:30 +0000 (14:24 +0100)]
[mlir][memref] Add runtime verification for memref::CastOp

Verify unranked -> ranked casts and casts of dynamic sizes/offset/strides to static ones.

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

22 months ago[AArch64] add tests for x*y == 0; NFC
Sanjay Patel [Thu, 5 Jan 2023 20:35:24 +0000 (15:35 -0500)]
[AArch64] add tests for x*y == 0; NFC

22 months ago[x86] add tests for x*y == 0; NFC
Sanjay Patel [Thu, 5 Jan 2023 19:58:56 +0000 (14:58 -0500)]
[x86] add tests for x*y == 0; NFC