platform/upstream/llvm.git
19 months ago[NFC] Port all InstSimplify tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:24 +0000 (02:27 +0300)]
[NFC] Port all InstSimplify tests to `-passes=` syntax

19 months ago[NFC] Port all InstMerge tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:24 +0000 (02:27 +0300)]
[NFC] Port all InstMerge tests to `-passes=` syntax

19 months ago[NFC] Port all InstCombine tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:24 +0000 (02:27 +0300)]
[NFC] Port all InstCombine tests to `-passes=` syntax

19 months ago[NFC] Port all IndVarSimplify tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:23 +0000 (02:27 +0300)]
[NFC] Port all IndVarSimplify tests to `-passes=` syntax

19 months ago[NFC] Port all IRCE tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:22 +0000 (02:27 +0300)]
[NFC] Port all IRCE tests to `-passes=` syntax

19 months ago[NFC] Port all GuardWidening tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:22 +0000 (02:27 +0300)]
[NFC] Port all GuardWidening tests to `-passes=` syntax

19 months ago[NFC] Port all GlobalOpt tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:21 +0000 (02:27 +0300)]
[NFC] Port all GlobalOpt tests to `-passes=` syntax

19 months ago[NFC] Port all GlobalDCE tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:21 +0000 (02:27 +0300)]
[NFC] Port all GlobalDCE tests to `-passes=` syntax

19 months ago[NFC] Port all GVNSink tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:21 +0000 (02:27 +0300)]
[NFC] Port all GVNSink tests to `-passes=` syntax

19 months ago[NFC] Port all GVNHoist tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:21 +0000 (02:27 +0300)]
[NFC] Port all GVNHoist tests to `-passes=` syntax

19 months ago[NFC] Port all GVN tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:20 +0000 (02:27 +0300)]
[NFC] Port all GVN tests to `-passes=` syntax

19 months ago[NFC] Port all FunctionSpecialization tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:20 +0000 (02:27 +0300)]
[NFC] Port all FunctionSpecialization tests to `-passes=` syntax

19 months ago[NFC] Port all FunctionAttrs tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:20 +0000 (02:27 +0300)]
[NFC] Port all FunctionAttrs tests to `-passes=` syntax

19 months ago[NFC] Port all ForcedFunctionAttrs tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:19 +0000 (02:27 +0300)]
[NFC] Port all ForcedFunctionAttrs tests to `-passes=` syntax

19 months ago[NFC] Port all Float2Int tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:19 +0000 (02:27 +0300)]
[NFC] Port all Float2Int tests to `-passes=` syntax

19 months ago[NFC] Port all DivRemPairs tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:18 +0000 (02:27 +0300)]
[NFC] Port all DivRemPairs tests to `-passes=` syntax

19 months ago[NFC] Port all DeadStoreElimination tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:18 +0000 (02:27 +0300)]
[NFC] Port all DeadStoreElimination tests to `-passes=` syntax

19 months ago[NFC] Port all DeadArgElim tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:18 +0000 (02:27 +0300)]
[NFC] Port all DeadArgElim tests to `-passes=` syntax

19 months ago[NFC] Port all DFAJumpThreading tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:18 +0000 (02:27 +0300)]
[NFC] Port all DFAJumpThreading tests to `-passes=` syntax

19 months ago[NFC] Port all CrossDSOCFI tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:17 +0000 (02:27 +0300)]
[NFC] Port all CrossDSOCFI tests to `-passes=` syntax

19 months ago[NFC] Port all CorrelatedValuePropagation tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:17 +0000 (02:27 +0300)]
[NFC] Port all CorrelatedValuePropagation tests to `-passes=` syntax

19 months ago[NFC] Port all Coroutines tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:17 +0000 (02:27 +0300)]
[NFC] Port all Coroutines tests to `-passes=` syntax

19 months ago[NFC] Port all ConstraintElimination tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:17 +0000 (02:27 +0300)]
[NFC] Port all ConstraintElimination tests to `-passes=` syntax

19 months ago[NFC] Port all ConstantHoisting tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:16 +0000 (02:27 +0300)]
[NFC] Port all ConstantHoisting tests to `-passes=` syntax

19 months ago[NFC] Port all CodeExtractor tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:16 +0000 (02:27 +0300)]
[NFC] Port all CodeExtractor tests to `-passes=` syntax

19 months ago[NFC] Port all CanonicalizeFreezeInLoops tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:16 +0000 (02:27 +0300)]
[NFC] Port all CanonicalizeFreezeInLoops tests to `-passes=` syntax

19 months ago[NFC] Port all CallSiteSplitting tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:15 +0000 (02:27 +0300)]
[NFC] Port all CallSiteSplitting tests to `-passes=` syntax

19 months ago[NFC] Port all BlockExtractor tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:15 +0000 (02:27 +0300)]
[NFC] Port all BlockExtractor tests to `-passes=` syntax

19 months ago[NFC] Port all Attributor tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:14 +0000 (02:27 +0300)]
[NFC] Port all Attributor tests to `-passes=` syntax

19 months ago[NFC] Port all ArgumentPromotion tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:14 +0000 (02:27 +0300)]
[NFC] Port all ArgumentPromotion tests to `-passes=` syntax

19 months ago[NFC] Port all ADCE tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 23:27:13 +0000 (02:27 +0300)]
[NFC] Port all ADCE tests to `-passes=` syntax

19 months ago[libc] Fix undefined behavior in UInt<>::shift_right.
Tue Ly [Wed, 7 Dec 2022 19:24:46 +0000 (14:24 -0500)]
[libc] Fix undefined behavior in UInt<>::shift_right.

Fix undefined behavior of left-shifting uint64_t by 64 in
`UInt<>::shift_right` implementation.

Reviewed By: michaelrj, sivachandra

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

19 months agoAdd support for a backdoor driver option that enables emitting header
Akira Hatanaka [Wed, 16 Nov 2022 22:20:23 +0000 (14:20 -0800)]
Add support for a backdoor driver option that enables emitting header
usage information in JSON to a file

Each line in the file is a JSON object that has the name of the main
source file followed by the list of system header files included
directly or indirectly from that file.

For example:

{"source":"/tmp/foo.c",
 "includes":["/usr/include/stdio.h", "/usr/include/stdlib.h"]}

To reduce the amount of data written to the file, only the system
headers that are directly included from a non-system header file are
recorded.

In order to emit the header information in JSON, it is necessary to set
the following environment variables:

CC_PRINT_HEADERS_FORMAT=json CC_PRINT_HEADERS_FILTERING=only-direct-system

The following combination is equivalent to setting CC_PRINT_HEADERS=1:

CC_PRINT_HEADERS_FORMAT=textual CC_PRINT_HEADERS_FILTERING=none

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

19 months ago[Bitcode(Reader|Writer)] Convert Optional to std::optional
Krzysztof Parzyszek [Wed, 7 Dec 2022 18:04:25 +0000 (10:04 -0800)]
[Bitcode(Reader|Writer)] Convert Optional to std::optional

19 months ago[mlir][sparse] Add dependence on bufferization.
bixia1 [Wed, 7 Dec 2022 20:54:50 +0000 (12:54 -0800)]
[mlir][sparse] Add dependence on bufferization.

Reviewed By: aartbik

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

19 months ago[mlir][Transforms] Simplify region before simplifying operation in CSE.
Mahesh Ravishankar [Wed, 7 Dec 2022 01:00:37 +0000 (01:00 +0000)]
[mlir][Transforms] Simplify region before simplifying operation in CSE.

This covers more options for CSE. It also ensures that two operations
that have same operands but different regions to begin with, but same
regions after `simplifyRegions`, don't get both added to the list of
`knownValues`.

Fixes #59135

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

19 months ago[compiler-rt][hwasan] Let CheckAddressSized eventually call HandleTagMismatch on...
Leonard Chan [Wed, 7 Dec 2022 23:09:53 +0000 (23:09 +0000)]
[compiler-rt][hwasan] Let CheckAddressSized eventually call HandleTagMismatch on Fuchsia

Any hwasan tag checking done through runtime calls like __hwasan_mem* or
__hwasan_load/store* currently raise a sigtrap on a tag mismatch. Hwasan
dumps as much information it knows on the tag mismatch by placing
important values in specific registers before the brk and encoding the
access information in the optional argument supplied to the brk. If the
platform hwasan runs on uses signal handlers, then users can see the
typical pretty hwasan error report, but Fuchsia doesn't use signal
handlers, so it's left up to the platform exception handler to print all
this encoded information.

This patch attempts to enter the regular error reporting path via
HandleTagMismatch if a new macro CAN_GET_REGISTERS is set. For now this
is only defined for Fuchsia + aarch64, but can be expanded for other
platforms.

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

19 months ago[AMDGPU] Annotate the intrinsics to be default and nocallback
Johannes Doerfert [Tue, 4 Oct 2022 12:45:21 +0000 (05:45 -0700)]
[AMDGPU] Annotate the intrinsics to be default and nocallback

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

19 months ago[mlir][arith] Fix comment typo. NFC.
Jakub Kuderski [Wed, 7 Dec 2022 22:21:41 +0000 (17:21 -0500)]
[mlir][arith] Fix comment typo. NFC.

19 months ago[mlir][arith] Rename addui_carry to addui_extended
Jakub Kuderski [Wed, 7 Dec 2022 22:15:55 +0000 (17:15 -0500)]
[mlir][arith] Rename addui_carry to addui_extended

The goal is to make the naming of the future `_extended` ops more
consistent. With unsigned addition, the carry value/flag and overflow
bit are the same, but this is not true when it comes to signed addition.

Also rename the second result from `carry` to `overflow`.

Reviewed By: antiagainst

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

19 months ago[amdgpu] Reimplement LDS lowering
Jon Chesterfield [Wed, 7 Dec 2022 22:02:53 +0000 (22:02 +0000)]
[amdgpu] Reimplement LDS lowering

Renames the current lowering scheme to "module" and introduces two new
ones, "kernel" and "table", plus a "hybrid" that chooses between those three
on a per-variable basis.

Unit tests are set up to pass with the default lowering of "module" or "hybrid"
with this patch defaulting to "module", which will be a less dramatic codegen
change relative to the current. This reflects the sparsity of test coverage for
the table lowering method. Hybrid is better than module in every respect and
will be default in a subsequent patch.

Reviewed By: arsenm

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

19 months ago[mlir] Make patterns for folding tensor.empty optional.
Alexander Belyaev [Wed, 7 Dec 2022 17:30:36 +0000 (18:30 +0100)]
[mlir] Make patterns for folding tensor.empty optional.

At the moment, they are a part of EmptyOp::getCanonicalizationPatterns. When
extract_slice(tensor.empty) is rewritten as a new tensor.empty, it could
happen that we end up with two tensor.empty ops, since the original
tensor.empty can have two users. After bufferization such cases result in two
allocations.

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

19 months ago[llvm-exegesis][x86] Add test coverage for Issue #38507
Simon Pilgrim [Wed, 7 Dec 2022 21:52:06 +0000 (21:52 +0000)]
[llvm-exegesis][x86] Add test coverage for Issue #38507

Ensure that the PBLENDVBrr0 destination register is never xmm0

19 months agoEnable kmpc_atomic functions for arm64
Bran Hagger [Wed, 7 Dec 2022 10:00:15 +0000 (12:00 +0200)]
Enable kmpc_atomic functions for arm64

Define the same kmpc_atomic functions for arm and arm64 that are defined for x86 and x64.

Reviewed By: mstorsjo

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

19 months agoGenerate DXIL Shader hash
Chris Bieneman [Mon, 5 Dec 2022 20:21:41 +0000 (14:21 -0600)]
Generate DXIL Shader hash

DXIL shader bitcode is hashed and the hash is placed into the final
output object file in its own data part.

This change modifies the DXContainerGlobals pass to compute the shader
hash (just an MD5 of the bitcode) and put the shader hash data into a
global for the HASH part.

This also sets the hash flag as appropriate for if the hashed shader
contained debug information. There is additional handling required to
get debug information in shaders working correctly with our tooling,
but that will be addressed in subsequent patches.

Reviewed By: python3kgae

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

19 months agoRevert "[llvm][dwwarf] Change CU/TU index to 64-bit"
Alexander Yermolovich [Wed, 7 Dec 2022 21:14:23 +0000 (13:14 -0800)]
Revert "[llvm][dwwarf] Change CU/TU index to 64-bit"

This reverts commit 5ebd28f3e56c00a739fda46c72c9e0f6528add87.

19 months agoRevert "[DWARFLibrary] Add support to re-construct cu-index"
Alexander Yermolovich [Wed, 7 Dec 2022 21:14:11 +0000 (13:14 -0800)]
Revert "[DWARFLibrary] Add support to re-construct cu-index"

This reverts commit a5bd76a6e3119af9dd9c1d8af89e2b89f5267deb.

19 months ago[BOLT][DWARF] Don't create extra .debug_str_offsets contributions
Alexander Yermolovich [Wed, 7 Dec 2022 20:22:58 +0000 (12:22 -0800)]
[BOLT][DWARF] Don't create extra .debug_str_offsets contributions

With ThinLTO mutliple CUs can share the same .debug_str_offsets contribution. We
were creating a new one for each CU. This lead to a binary size increase.

Reviewed By: maksfb

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

19 months ago[DWARFLibrary] Add support to re-construct cu-index
Alexander Yermolovich [Wed, 7 Dec 2022 00:07:59 +0000 (16:07 -0800)]
[DWARFLibrary] Add support to re-construct cu-index

Summary:

According to DWARF5 specification and gnu specification for DWARF4 the offset
entry in the CU/TU Index is 32 bits. This presents a problem when
.debug_info.dwo in DWP file grows beyond 4GB. The CU Index becomes partially
corrupted.

This diff adds manual parsing of .debug_info.dwo/.debug_abbrev.dwo to
reconstruct CU index in general, and TU index for DWARF5. This is a work around
until DWARF6 spec is finalized.

Next patch will change internal CU/TU struct to 64 bit, and change uses as
necessary. The plan is to land all the patches in one go after all are approved.

This patch originates from the discussion in: https://discourse.llvm.org/t/dwarf-dwp-4gb-limit/63902

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

19 months ago[llvm][dwwarf] Change CU/TU index to 64-bit
Alexander Yermolovich [Tue, 6 Dec 2022 00:37:26 +0000 (16:37 -0800)]
[llvm][dwwarf] Change CU/TU index to 64-bit

Summary:

Changed contribution data structure to 64 bit. I added the 32bit and 64bit
accessors to make it explicit where we use 32bit and where we use 64bit. Also to
make sure sure we catch all the cases where this data structure is used.

19 months agoRevert "[RISCV] Return InstSeq from generateInstSeqImpl instead of using an output...
Craig Topper [Wed, 7 Dec 2022 20:57:04 +0000 (12:57 -0800)]
Revert "[RISCV] Return InstSeq from generateInstSeqImpl instead of using an output parameter. NFC"

This reverts commit d24915207c631b7cf637081f333b41bc5159c700.

Thinking about this more this probably chewed up 100+ bytes of stack
for each recursive call. So this probably needs more thought. The
code simplification wasn't that much.

19 months agoNVPTX: Cleanup check for denormal mode
Matt Arsenault [Tue, 6 Dec 2022 23:51:16 +0000 (18:51 -0500)]
NVPTX: Cleanup check for denormal mode

Go through the common query and be explicit about the supported flush
type.

19 months agoAMDGPU: Rename test functions and add some cases for consistency
Matt Arsenault [Wed, 7 Dec 2022 00:45:17 +0000 (19:45 -0500)]
AMDGPU: Rename test functions and add some cases for consistency

Test all the permutations.

19 months agoRevert "[libunwind] Use .irp directives. NFC"
David Tenty [Wed, 7 Dec 2022 20:40:22 +0000 (15:40 -0500)]
Revert "[libunwind] Use .irp directives. NFC"

This reverts commit 8482e95f75d02227fbf51527680c0b5424bacb69, which breaks on AIX
due to unsupported psudeo-ops in the assembly.

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

19 months agoGISel/Combiner: maintain created instructions in a SetVector
Nicolai Hähnle [Thu, 1 Dec 2022 11:24:01 +0000 (12:24 +0100)]
GISel/Combiner: maintain created instructions in a SetVector

This is not a correctness fix because the set is only used for debug
output. However, it helps avoid noise when looking at diffs between
compiler runs.

The set is only maintained with debug output enabled, so the added cost
should be acceptable.

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

19 months ago[SPARC] Lower SELECT_CC to MOVr on 64-bit target whenever possible
Koakuma [Wed, 7 Dec 2022 20:31:31 +0000 (15:31 -0500)]
[SPARC] Lower SELECT_CC to MOVr on 64-bit target whenever possible

On 64-bit target, when doing i64 SELECT_CC where one of the comparison operands
is a constant zero, try to fold the compare and MOVcc into a MOVr instruction.

For all integers, EQ and NE comparison are available, additionally for signed
integers, GT, GE, LT, and LE is also available.

Reviewed By: arsenm

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

19 months ago[NFC][Object] Include header `BitcodeReader.h` instead of using forward declaration...
Shilei Tian [Wed, 7 Dec 2022 20:28:20 +0000 (15:28 -0500)]
[NFC][Object] Include header `BitcodeReader.h` instead of using forward declaration for BitcodeModule

`BitcodeModule` is used as element of a vector in `IRSymtabFile`, while in the
header there is only a forward declaration. It will work if the header `BitcodeReader.h`
is included before including `IRObjectFile.h`. However, it is not always the case,
causing compilation error. This patch simply includes the header and remove the
forward declaration.

Reviewed By: tejohnson

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

19 months agoRevert "[SPARC] Mark the %g0 register as constant & use it to materialize zeros"
Brad Smith [Wed, 7 Dec 2022 20:22:28 +0000 (15:22 -0500)]
Revert "[SPARC] Mark the %g0 register as constant & use it to materialize zeros"

2 of the Sparc tests are now failing.

This reverts commit 2c41310fc146a1f609147c65ac5f30e5a57e84a8.

19 months ago[RISCV] Without Zfh, promote f16 inputs before creating RISCVISD::FCVT_W(U)_RV64...
Craig Topper [Wed, 7 Dec 2022 20:25:30 +0000 (12:25 -0800)]
[RISCV] Without Zfh, promote f16 inputs before creating RISCVISD::FCVT_W(U)_RV64 nodes.

This allows us to remove a couple more Zfhmin isel patterns.

19 months ago[NFC] Port all SimpleLoopUnswitch tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 19:53:08 +0000 (22:53 +0300)]
[NFC] Port all SimpleLoopUnswitch tests to `-passes=` syntax

19 months ago[NFC] Port all (but one) HotColdSplit tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 19:42:54 +0000 (22:42 +0300)]
[NFC] Port all (but one) HotColdSplit tests to `-passes=` syntax

19 months ago[NFC] Port all CodeExtractor tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 19:37:54 +0000 (22:37 +0300)]
[NFC] Port all CodeExtractor tests to `-passes=` syntax

19 months ago[NFC] Port all LoopIdiom tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 19:31:04 +0000 (22:31 +0300)]
[NFC] Port all LoopIdiom tests to `-passes=` syntax

19 months ago[gn build] Reformat all build files
Nico Weber [Wed, 7 Dec 2022 20:14:36 +0000 (15:14 -0500)]
[gn build] Reformat all build files

Ran:

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

19 months ago[mlir] Add hoisting of transfer ops in affine loops
Javier Setoain [Mon, 7 Nov 2022 21:27:36 +0000 (21:27 +0000)]
[mlir] Add hoisting of transfer ops in affine loops

The only way to do this with the current hoisting strategy is by
lowering Affine to Scf first, but that prevents further passes on
Affine.

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

19 months ago[mlir][sparse] Improve concatenate operation conversion for the case with annotated...
bixia1 [Wed, 7 Dec 2022 16:57:40 +0000 (08:57 -0800)]
[mlir][sparse] Improve concatenate operation conversion for the case with annotated all dense result.

Reviewed By: aartbik

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

19 months ago[clang] Tweak test to tolerate clang being called "clang" instead of "clang-15"
Nico Weber [Wed, 7 Dec 2022 20:03:16 +0000 (15:03 -0500)]
[clang] Tweak test to tolerate clang being called "clang" instead of "clang-15"

See also af95441ba7f3ca6.

19 months ago[RISCV] Promote f16 fp_to_int_sat with Zfhmin during lowering instead of isel.
Craig Topper [Wed, 7 Dec 2022 19:58:30 +0000 (11:58 -0800)]
[RISCV] Promote f16 fp_to_int_sat with Zfhmin during lowering instead of isel.

We already have a custom handler for FP_TO_(S/U)INT_SAT. It's easy
enought to inject an FP_EXTEND in there.

19 months ago[Driver][test] Fix test by creating empty archive instead of empty file
Jacob Lambert [Wed, 7 Dec 2022 19:50:11 +0000 (11:50 -0800)]
[Driver][test] Fix test by creating empty archive instead of empty file

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

19 months ago[SPARC] Simplify instruction decoder.
James Y Knight [Mon, 21 Nov 2022 01:41:42 +0000 (20:41 -0500)]
[SPARC] Simplify instruction decoder.

After https://reviews.llvm.org/D137653 named sub-operands can be used
in the auto-generated instruction decoders. This allows the
auto-generated decoders to work properly, so all the hand-coded
decoders in the sparc target can be removed.

In some instances, a manually-written decoder had not been implemented
for an instruction, and thus that instruction was not decoded
properly. These have been fixed (and tests added).

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

19 months ago[TableGen] More named sub-operands work.
James Y Knight [Tue, 8 Nov 2022 22:11:04 +0000 (17:11 -0500)]
[TableGen] More named sub-operands work.

Commit a538d1f13a13 first added support for named sub-operands in
CodeEmitterGen. We now add a few more features to that, enabling
further target cleanups.

1. Adds support for handling an EncoderMethod in a sub-operand in
CodeEmitterGen. Previously, the specified encoder of a sub-operand was
ignored, and only the default used.

2. Adds support for sub-operands in DecoderEmitter, along with support
for tied sub-operands.

The changes to the decoder required a few minor tweaks to a few
targets, where existing brokeness was exposed. In order to keep this
patch small, I left FIXMEs which will be addressed in upcoming
patches. (Except MIPS16, since its object file emission/decoding is
totally broken).

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

19 months ago[RISCV] Consolidate identical (fcopysign FPR32:, FPR16:) isel patterns. NFC
Craig Topper [Wed, 7 Dec 2022 19:26:58 +0000 (11:26 -0800)]
[RISCV] Consolidate identical (fcopysign FPR32:, FPR16:) isel patterns. NFC

19 months ago[mlir][tosa] Fix tosa.resize for i48 accumulator
Rob Suderman [Wed, 7 Dec 2022 19:11:51 +0000 (11:11 -0800)]
[mlir][tosa] Fix tosa.resize for i48 accumulator

Implementation assumed a i32 accumulator. Fixed the implementation to
work with an i32 accumulator.

Reviewed By: NatashaKnk

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

19 months agoFix @llvm.global_ctors docs (NFC)
Keith Smiley [Wed, 7 Dec 2022 19:23:42 +0000 (11:23 -0800)]
Fix @llvm.global_ctors docs (NFC)

19 months ago[NFC] Port all IndVarSimplify tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 19:10:05 +0000 (22:10 +0300)]
[NFC] Port all IndVarSimplify tests to `-passes=` syntax

19 months ago[NFC] Port all RewriteStatepointsForGC tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 19:01:38 +0000 (22:01 +0300)]
[NFC] Port all RewriteStatepointsForGC tests to `-passes=` syntax

19 months ago[NFC] Port all MergeFunc tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 18:59:26 +0000 (21:59 +0300)]
[NFC] Port all MergeFunc tests to `-passes=` syntax

19 months ago[NFC] Port all GVN tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 18:57:37 +0000 (21:57 +0300)]
[NFC] Port all GVN tests to `-passes=` syntax

19 months ago[NFC] Port all IROutliner tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 18:52:06 +0000 (21:52 +0300)]
[NFC] Port all IROutliner tests to `-passes=` syntax

19 months agoAArch64: emit `fcmp ord %a, zeroinitializer` as a single fcmeq.
Tim Northover [Thu, 10 Nov 2022 09:22:40 +0000 (09:22 +0000)]
AArch64: emit `fcmp ord %a, zeroinitializer` as a single fcmeq.

Most "ord" checks need two real-world compares to implement, but this is the
canonical form of a "!isnan" check, which is equivalent to comparing the input
for equality against itself.

19 months ago[NFC] Port all SLPVectorizer tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 18:35:57 +0000 (21:35 +0300)]
[NFC] Port all SLPVectorizer tests to `-passes=` syntax

19 months ago[mlir][linalg] Add extra parameter to tiling reduction to foreach_thread
Thomas Raoux [Tue, 6 Dec 2022 23:14:00 +0000 (23:14 +0000)]
[mlir][linalg] Add extra parameter to tiling reduction to foreach_thread

This adds a tile_size parameter, when it is used the tiles are
cyclically distributed onto the threads of the scf.foreach_thread op.

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

19 months ago[SPARC] Mark the %g0 register as constant & use it to materialize zeros
Koakuma [Wed, 7 Dec 2022 18:25:38 +0000 (13:25 -0500)]
[SPARC] Mark the %g0 register as constant & use it to materialize zeros

Materialize zeros by copying from %g0, which is now marked as constant.

This makes it possible for some common operations (like integer negation) to be
performed in fewer instructions.

This continues @arichardson's patch at D132561.

Reviewed By: arsenm

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

19 months ago[AMDGPU] Enable OMod on more VOP3 instructions
Joe Nash [Fri, 2 Dec 2022 20:36:39 +0000 (15:36 -0500)]
[AMDGPU] Enable OMod on more VOP3 instructions

OMod was disabled if OpSel was enabled, but that restriction is more
specific than necessary. Any VOP3 with float operands can use OMod.

On GFX11, FMAC_F16_e64 can use op_sel.
Previously, SIFoldOperands and convertToThreeAddress were accidentally correct when
they reinterpreted the zero OMod operand on V_FMAC_F16_e64 as the OpSel operand on
V_FMA_F16_gfx9_e64. Now we explicitly add op_sel if required.

Reviewed By: arsenm

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

19 months agoOverload all llvm.annotation intrinsics for globals argument
Alex Richardson [Sun, 20 Nov 2022 11:38:16 +0000 (11:38 +0000)]
Overload all llvm.annotation intrinsics for globals argument

The global constant arguments could be in a different address space
than the first argument, so we have to add another overloaded argument.
This patch was originally made for CHERI LLVM (where globals can be in
address space 200), but it also appears to be useful for in-tree targets
as can be seen from the test diffs.

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

19 months agoAdd a baseline test for llvm.annotation IR upgrade
Alex Richardson [Fri, 25 Nov 2022 16:00:04 +0000 (16:00 +0000)]
Add a baseline test for llvm.annotation IR upgrade

This will be overloaded in the next commit.

19 months ago[GlobalISel] Add a new G_INVOKE_REGION_START instruction to fix an EH bug.
Amara Emerson [Sun, 13 Nov 2022 09:43:04 +0000 (01:43 -0800)]
[GlobalISel] Add a new G_INVOKE_REGION_START instruction to fix an EH bug.

We currently have a bug where the legalizer, when dealing with phi operands,
may create instructions in the phi's incoming blocks at points which are effectively
dead due to a possible exception throw.

Say we have:

throwbb:
  EH_LABEL
  x0 = %callarg1
  BL @may_throw_call
  EH_LABEL
  B returnbb

bb:
  %v = phi i1 %true, throwbb, %false....

When legalizing we may need to widen the i1 %true value, and to do that we need
to create new extension instructions in the incoming block. Our insertion point
currently is the MBB::getFirstTerminator() which puts the IP before the unconditional
branch terminator in throwbb. These extensions may never be executed if the call
throws, and therefore we need to emit them before the call (but not too early, since
our new instruction may need values defined within throwbb as well).

throwbb:
  EH_LABEL
  x0 = %callarg1
  BL @may_throw_call
  EH_LABEL
  %true = G_CONSTANT i32 1 ; <<<-- ruh'roh, this never executes if may_throw_call() throws!
  B returnbb

bb:
  %v = phi i32 %true, throwbb, %false....

To fix this, I've added two new instructions. The main idea is that G_INVOKE_REGION_START
is a terminator, which tries to model the fact that in the IR, the original invoke inst
is actually a terminator as well. By using that as the new insertion point, we
make sure to place new instructions on always executing paths.

Unfortunately we still need to make the legalizer use a new insertion point API
that I've added, since the existing `getFirstTerminator()` method does a reverse
walk up the block, and any non-terminator instructions cause it to bail out. To
avoid impacting compile time for all `getFirstTerminator()` uses, I've added a new
method that does a forward walk instead.

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

19 months ago[RISCV][InsertVSETVLI] Generalize scalar move rule for when AVL is unchanged
Philip Reames [Wed, 7 Dec 2022 18:24:48 +0000 (10:24 -0800)]
[RISCV][InsertVSETVLI] Generalize scalar move rule for when AVL is unchanged

By definition, the AVL of the scalar move is equally zero to the prior AVL if they are the same value.  This generalizes the existing code to the case where the scalar move has a register AVL which is unknown, but unchanged from the preceeding instruction.

This doesn't cause any interesting diffs on its own, but another patch makes this case much more common.  Split off to reduce a future diff.

19 months agoRevert "[clang-doc] Add template support."
Brett Wilson [Wed, 7 Dec 2022 18:22:05 +0000 (10:22 -0800)]
Revert "[clang-doc] Add template support."

Causes a build failure in YAML specializations.

This reverts commit 0f6dbb5f164662c3e6a167a89e7a89f07c60e32b.

19 months ago[RISCV] Remove pseudos for whole register load, store, and move.
Craig Topper [Wed, 7 Dec 2022 18:03:51 +0000 (10:03 -0800)]
[RISCV] Remove pseudos for whole register load, store, and move.

The MC layer instructions have the correct register classes, and
the pseudos don't have any additional operands. So there doesn't
seem to be any reason for them to exist.

The pseudos were incorrectly going through code in RISCVMCInstLower
that converted LMUL>1 register classes to LMUL1 register class.
This makes the MCInst technically malformed, and prevented the
vl2r.v, vl4r.v, and vl8r.v InstAliases from matching. This accounts
for all of the .ll test diffs.

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

19 months agoFix an -Wunused-variable warning in release build, NFC
Haojian Wu [Wed, 7 Dec 2022 17:59:17 +0000 (18:59 +0100)]
Fix an -Wunused-variable warning in release build, NFC

19 months ago[llvm-exegesis][x86] Add option to prevent use of xmm8-xmm15 upper SSE registers
Simon Pilgrim [Wed, 7 Dec 2022 17:50:28 +0000 (17:50 +0000)]
[llvm-exegesis][x86] Add option to prevent use of xmm8-xmm15 upper SSE registers

Noticed while trying to use llvm-exegesis to get some accurate capture numbers on some old Atom/Silverment hardware as part of the work with D103695.

These targets' frontends are particularly poor and the use of the xmm8-xmm15 SSE registers results in longer instruction encodings which were affecting the latency/throughput estimates.

Thanks to @lebedev.ri for the --skip-measurements command line argument which made testing much easier!

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

19 months ago[NFC] Port all (but one) LICM tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 17:42:33 +0000 (20:42 +0300)]
[NFC] Port all (but one) LICM tests to `-passes=` syntax

19 months ago[libc++] Implement P0339R6 (polymorphic_allocator<> as a vocabulary type)
Nikolas Klauser [Thu, 1 Dec 2022 22:17:53 +0000 (23:17 +0100)]
[libc++] Implement P0339R6 (polymorphic_allocator<> as a vocabulary type)

Reviewed By: ldionne, #libc

Spies: LRFLEW, libcxx-commits, arichardson, krytarowski, jdoerfert

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

19 months ago[clang-doc] Add template support.
Brett Wilson [Mon, 7 Nov 2022 23:07:56 +0000 (15:07 -0800)]
[clang-doc] Add template support.

Reads template information from the AST and adds template parameters and
specialization information to the corresponding clang-doc structures.

Add a "QualName" to the Reference struct which includes the full
qualified type name. The Reference object represents a link in the
HTML/MD generators so is based on the unqualified name. But this does
not encode C-V qualifiers or template information that decorate the
name. The new QualName member encodes all of this information and also
makes it easier for the generators or downsteam YAML consumers to
generate the full name (before they had to process the "Path").

In test code that was changed, remove made-up paths to built-in types
like "int". In addition to slightnly cleaning up the code, these types
do not have paths in real execution, and generating incorrect references
to nonexistant data may complicate future changes in the generators.

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

19 months agoDisable flaky MLIR async.mlir test on ASan.
Mitch Phillips [Wed, 7 Dec 2022 17:46:22 +0000 (09:46 -0800)]
Disable flaky MLIR async.mlir test on ASan.

Test keeps flaking on the ASan buildbot:
https://github.com/llvm/llvm-project/issues/57231

19 months ago[RISCV] Replace uses of hasStdExtC with COrZca.
Craig Topper [Wed, 7 Dec 2022 17:33:40 +0000 (09:33 -0800)]
[RISCV] Replace uses of hasStdExtC with COrZca.

Except MakeCompressible which will need more work.

Reviewed By: reames

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

19 months ago[AMDGPU][GlobalISel] Fix legalizing image intrinsics for new types
Mirko Brkusanin [Wed, 7 Dec 2022 17:20:41 +0000 (18:20 +0100)]
[AMDGPU][GlobalISel] Fix legalizing image intrinsics for new types

We no longer need to increase vector size to 16 for intrinsics that use more
than 8 vgprs for addr. There is no image intrinsic that needs more than 12
so all currently existing cases will be covered. Using incorrect size was
causing an error in instruction selection because instructions were updated
to require new types (9x32, 10x32, 11x32, 12x32).

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

19 months ago[llvm-exegesis] Dry run mode
Roman Lebedev [Wed, 7 Dec 2022 17:14:13 +0000 (20:14 +0300)]
[llvm-exegesis] Dry run mode

Sometimes we only want to ensure that we can produce snippets (all the way
through `SnippetRepetitor`!), but don't care for the execution.
E.g. all of our tests are this way.

I've built LLVM without PFM and removed my CPU from `X86PfmCounters.td`,
and this produces the expected results in that configuration.

Reviewed By: courbet

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

19 months ago[NFC] Port all (but one) LoopUnroll tests to `-passes=` syntax
Roman Lebedev [Wed, 7 Dec 2022 16:43:17 +0000 (19:43 +0300)]
[NFC] Port all (but one) LoopUnroll tests to `-passes=` syntax