Philip Reames [Tue, 27 Jun 2023 20:02:54 +0000 (13:02 -0700)]
[RISCV] Fix a typo in a comment
Aiden Grossman [Tue, 27 Jun 2023 20:01:20 +0000 (20:01 +0000)]
[llvm-exegesis] Use correct pid_t definition in SubprocessMemory.h
Due to failures in MinGW builds I adjusted the preprocessor directives
to be more specific about when to include but kept the old definition in
files that were committed more recently on accident. This patch changes
those definitions to match the fixed ones.
Also fix a typo leftover from the original change in PerfHelper.h.
Philip Reames [Tue, 27 Jun 2023 19:27:46 +0000 (12:27 -0700)]
[RISCV] Simplify pseudo classes used by v(f)merge [nfc]
This is mostly hand inlining multiclass definitions, and simplifying for the fact that non-default template values were never actually used.
Piotr Zegar [Tue, 27 Jun 2023 19:25:52 +0000 (19:25 +0000)]
Revert "[clang-tidy] Fix modernize-use-std-print check when return value used"
This reverts commit
3e12b2e207cfa802937488a2c0b90d482eaf00a9.
Sam McCall [Mon, 26 Jun 2023 18:01:04 +0000 (20:01 +0200)]
Reland "[dataflow] avoid more accidental copies of Environment"
This reverts commit
fb13d027eae405a7be96fd7da0d72422e48a0719.
Andrzej Warzynski [Mon, 19 Jun 2023 12:01:11 +0000 (13:01 +0100)]
[mlir][VectorType] Allow arbitrary dimensions to be scalable
At the moment, only the trailing dimensions in the vector type can be
scalable, i.e. this is supported:
vector<2x[4]xf32>
and this is not allowed:
vector<[2]x4xf32>
This patch extends the vector type so that arbitrary dimensions can be
scalable. To this end, an array of bool values is added to every vector
type to denote whether the corresponding dimensions are scalable or not.
For example, for this vector:
vector<[2]x[3]x4xf32>
the following array would be created:
{true, true, false}.
Additionally, the current syntax:
vector<[2x3]x4xf32>
is replaced with:
vector<[2]x[3]x4xf32>
This is primarily to simplify parsing (this way, the parser can easily
process one dimension at a time rather than e.g. tracking whether
"scalable block" has been entered/left).
NOTE: The `isScalableDim` parameter of `VectorType` (introduced in this
patch) makes `numScalableDims` redundant. For the time being,
`numScalableDims` is preserved to facilitate the transition between the
two parameters. `numScalableDims` will be removed in one of the
subsequent patches.
This change is a part of a larger effort to enable scalable
vectorisation in Linalg. See this RFC for more context:
* https://discourse.llvm.org/t/rfc-scalable-vectorisation-in-linalg/
Differential Revision: https://reviews.llvm.org/D153372
Valentin Clement [Tue, 27 Jun 2023 18:09:59 +0000 (11:09 -0700)]
[flang][openacc] Update num_gangs parser
Update num_gangs definition in ACC.td and its lowering
to support up to 3 arguments.
Depends on D153796
Depends on D153801
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D153806
Valentin Clement [Tue, 27 Jun 2023 18:09:04 +0000 (11:09 -0700)]
[tblgen][directive] Fix clause parser generation for list value
The clause parser generation was not taking into account the
`isValueList` flag. This patch updates the emitter to generate
the correct code.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D153801
Anton Korobeynikov [Tue, 27 Jun 2023 18:08:39 +0000 (11:08 -0700)]
Temporary switch off labeler on closed issues
Valentin Clement [Tue, 27 Jun 2023 18:08:22 +0000 (11:08 -0700)]
[mlir][openacc] Switch numGangs to a variadic operand
In the latest spec, the `num_gangs` clause accepts up to three
arguments. Update the dialect to swicth `numGangs` operands from
optional single operand to a variadic operand. The verifier limits
the number of operands to three as specified in the spec.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D153796
Ian Anderson [Mon, 26 Jun 2023 21:07:50 +0000 (14:07 -0700)]
[libc++] __iterator/readable_traits.h isn't standalone
`__iterator/readable_traits.h` can't be used by itself, intantiating `iter_value_t` requires `__iterator/iterator_traits.h`. `readable_traits.h` can't include `iterator_traits.h` though because `iterator_traits.h` requires `readable_traits.h`.
Move `iter_value_t` to `__iterator/iterator_traits.h` so that both headers can work standalone.
Reviewed By: Mordante, #libc
Differential Revision: https://reviews.llvm.org/D153828
Alex Langford [Tue, 27 Jun 2023 00:27:00 +0000 (17:27 -0700)]
[lldb][NFCI] Apply LLDB_DEPRECATED to things that have deprecated comments
Now that we have a proper way to deprecate things in the SB API, we
should apply it where we have manually done so with comments.
Differential Revision: https://reviews.llvm.org/D153824
Alex Langford [Mon, 26 Jun 2023 21:12:22 +0000 (14:12 -0700)]
[lldb][NFCI] Remove use of ConstString from PluginManager
The underlying structures no longer use ConstString so we can remove it
wholesale from PluginManager now.
Differential Revision: https://reviews.llvm.org/D153818
Simon Pilgrim [Tue, 27 Jun 2023 17:23:06 +0000 (18:23 +0100)]
[X86] LowerABD - improve pre-SSE41 handling for v16i8/v4i32 nodes
The generic expansion still causes a problem for SSE targets without BLENDV/select node, but we can create a custom lowering until that can be addressed.
Vitaly Buka [Tue, 27 Jun 2023 17:32:51 +0000 (10:32 -0700)]
[test][sanitizer] Disable D153500 test on solaris
The test causes unexpectedly high RSS usage there.
Alex Langford [Wed, 21 Jun 2023 01:45:03 +0000 (18:45 -0700)]
[DebugInfo] Add error handling to DWARFDebugAbbrev::getAbbreviationDeclarationSet
This gives us more meaningful information when
`getAbbreviationDeclarationSet` fails. Right now only
`verifyAbbrevSection` actually uses the error that it returns, but the
other call sites could be rewritten to take advantage of the returned error.
Differential Revision: https://reviews.llvm.org/D153459
Mike Crowe [Tue, 27 Jun 2023 16:35:22 +0000 (16:35 +0000)]
[clang-tidy] Fix modernize-use-std-print check when return value used
The initial implementation of the modernize-use-std-print check was
capable of converting calls to printf (etc.) which used the return value
to calls to std::print which has no return value, thus breaking the
code.
Use code inspired by the implementation of bugprone-unused-return-value
check to ignore cases where the return value is used. Add appropriate
lit test cases and documentation.
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D153860
Simon Pilgrim [Tue, 27 Jun 2023 17:06:29 +0000 (18:06 +0100)]
[X86] Add getBitSelect helper function to create OR(AND(LHS,MASK),AND(RHS,~MASK)) bit select patterns. NFC.
Simon Pilgrim [Tue, 27 Jun 2023 13:57:58 +0000 (14:57 +0100)]
[X86] Fold ANDNP(x, -1) -> NOT(x) -> XOR(x, -1)
Prefer XOR to ANDNP as its commutative
LLVM GN Syncbot [Tue, 27 Jun 2023 17:08:11 +0000 (17:08 +0000)]
[gn build] Port
f4cf51c99c74
Yitzhak Mandelbaum [Mon, 5 Jun 2023 20:49:07 +0000 (20:49 +0000)]
[clang][CFG] Add support for partitioning CFG into intervals.
Adds support for the classic dataflow algorithm that partitions a flow graph
into distinct intervals. C.f. Dragon book, pp. 664-666.
A version of this algorithm exists in LLVM (see llvm/Analysis/Interval.h and
related files), but it is specific to LLVM, is a recursive (vs iterative)
algorithm, and uses many layers of abstraction that seem unnecessary for CFG
purposes.
This patch is part 1 of 2. The next patch will generalize the code to work on
intervals, to support computation of the limit flow graph.
Differential Revision: https://reviews.llvm.org/D152263
Jake Egan [Tue, 27 Jun 2023 17:00:46 +0000 (13:00 -0400)]
[llvm-exegesis][NFC] Fix unused function 'IsMovRegToReg' warning
/scratch/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/unittests/tools/llvm-exegesis/X86/TargetTest.cpp:88:17: error: unused function 'IsMovRegToReg' [-Werror,-Wunused-function]
Matcher<MCInst> IsMovRegToReg(unsigned Opcode, int64_t Reg1, int64_t Reg2) {
1 error generated.
Craig Topper [Tue, 27 Jun 2023 16:39:05 +0000 (09:39 -0700)]
[RISCV] Split double out of compress-float.ll. Add Zcf and Zcd RUN lines.
Make Zcf/Zcd depend on Zca.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D153826
Craig Topper [Tue, 27 Jun 2023 16:38:43 +0000 (09:38 -0700)]
[RISCV] Fix encoding for Zcb instruction c.sh.
Bit 6 should be 0.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D153793
Florian Hahn [Tue, 27 Jun 2023 16:43:51 +0000 (17:43 +0100)]
Add myself as Loop Vectorizer code owner.
For more details about the nomination, please see
https://discourse.llvm.org/t/rfc-proposing-changes-to-the-code-owner-for-the-llvm-vectorizers/70267/9
Mark de Wever [Tue, 27 Jun 2023 16:39:59 +0000 (18:39 +0200)]
[libc++][doc] Fixes header formatting.
This was broken in D145628; it caused the new header not to be displayed
as a header at all and show part of the markup as text.
Craig Topper [Tue, 27 Jun 2023 16:37:28 +0000 (09:37 -0700)]
[RISCV] Replace uses of TAIL_UNDISTURBED_MASK_UNDISTURBED with TU_MU. NFC
Amy Kwan [Tue, 27 Jun 2023 03:26:31 +0000 (22:26 -0500)]
[PowerPC][TLS] Add additional TLS X-Form loads/store instructions
This patch is a follow up to D43315, and adds the following new load/store
TLS specific instructions for integer and floating point scalar types:
```
LHAXTLS
LWAXTLS
LHAXTLS_32
LWAXTLS_32
LFSXTLS
LFDXTLS
STFSXTLS
STFDXTLS
```
These instructions can be used to optimized TLS sequences when D-Form
loads/stores follow an ADD_TLS instruction.
Duplicate versions of these instructions are also added within an isAsmParserOnly=1
block (similar to D47382) to allow llvm-mc to assemble these instructions.
Differential Revision: https://reviews.llvm.org/D153645
Arthur Eubanks [Mon, 26 Jun 2023 20:52:18 +0000 (13:52 -0700)]
Reland [InstCombine] Infer inbounds for more GEPs of dereferenceable pointers
Use Value::getPointerDereferenceableBytes() instead of hardcoding dereferenceable only for allocas. Allows us to infer inbounds GEPs for other Values like CallInsts and Arguments.
Fixed clang test broken in initial land.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D153815
Florian Hahn [Tue, 27 Jun 2023 16:27:48 +0000 (17:27 +0100)]
[ConstraintElim] Track and simplify conditions at use.
This patch updates ConstraintElimination to track uses of conditions in
the worklist. This allows simplifying conditions using the context that
holds directly at the condition, instead of where the condition is
defined.
This allows us to catch more cases in practice: there are multiple
code-size changes for CTMark while compile-time remains unchanged:
https://llvm-compile-time-tracker.com/compare.php?from=
4b020cca9363bebab4643f89cfa92ab2fcc7976c&to=
7a6e84b8f029713c137814cd46eec775d24a54a1&stat=instructions:u
This should help to simplify D151799.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D153660
Arthur Eubanks [Tue, 27 Jun 2023 16:26:26 +0000 (09:26 -0700)]
Revert "[InstCombine] Infer inbounds for more GEPs of dereferenceable pointers"
This reverts commit
cd43b19c0127d80f3543803359db0f03e363e893.
Breaks clang/test/CodeGenOpenCL/builtins-amdgcn.cl.
Alex Richardson [Tue, 27 Jun 2023 16:13:39 +0000 (09:13 -0700)]
[builtins] Fix __floattitf and __floatuntitf on x86
These conversion functions were using LDBL_MANT_DIG (which is the 80-bit
extended float on x86) instead of the appropriate macro for the 128-bit
floating point type expected by the *tf* softfloat library calls.
This was discovered while testing D98261 (which allows building the *tf*
functions on x86).
This also changes the constants used in the two tests to use 128-bit
floating-point literals instead of long double ones to ensure that the
comparison succeeds on platforms with smaller long double (e.g. x86_64)
Reviewed By: scanon
Differential Revision: https://reviews.llvm.org/D131787
Stephen Tozer [Tue, 27 Jun 2023 16:15:29 +0000 (17:15 +0100)]
Revert "[DebugInfo][InstrRef] Instrument x86 CMOV conversion to preserve variable values"
This reverts commit
2325e0112ae7ef47244277da81920ba90ffadd89.
Reverted due to buildbot failure: llvm-clang-x86_64-expensive-checks-debian
Arthur Eubanks [Mon, 26 Jun 2023 20:52:18 +0000 (13:52 -0700)]
[InstCombine] Infer inbounds for more GEPs of dereferenceable pointers
Use Value::getPointerDereferenceableBytes() instead of hardcoding dereferenceable only for allocas. Allows us to infer inbounds GEPs for other Values like CallInsts and Arguments.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D153815
Arthur Eubanks [Mon, 26 Jun 2023 20:45:18 +0000 (13:45 -0700)]
[test] Precommit test for D153815
Philip Reames [Tue, 27 Jun 2023 16:05:03 +0000 (09:05 -0700)]
[RISCV] Remove legacy TA/TU pseudo distinction for VID
This is a follow on to D152740. The focus of this patch is on actually removing the old TA (unsuffixed) version. I realized we already had plumbing for combined TA/TU pseudos - used by some of the ternary instructions. As such, we can go ahead and fully remove the old TA, and rename the _TU variant to be unsuffixed. (The rename must happen in this patch for the table structure to work out as expected.)
The scheduling difference comes from an omission in D152740. If we selected a _MASK variant - either from manual ISEL or instrincs - we were going through doPeepholeMaskedRVV and still getting the TA variant. The use of the IsCombined flag in the MaskedPseudo table causes us to use the TU (now unsuffixed) variant instead.
Differential Revision: https://reviews.llvm.org/D153155
LLVM GN Syncbot [Tue, 27 Jun 2023 15:43:09 +0000 (15:43 +0000)]
[gn build] Port
58056ae29963
Simon Tatham [Tue, 20 Jun 2023 12:44:38 +0000 (13:44 +0100)]
Reland: [ELFAttributeParser] Skip unknown vendor subsections.
An .ARM.attributes section is divided into subsections, each labelled
with a vendor name. There is one standardised vendor name, which must
be used for all attributes that affect compatibility. Subsections
labelled with other vendor names can be used for optimisation
purposes, but it has to be safe for an object file consumer to ignore
them if it doesn't recognise the vendor name.
LLD currently terminates parsing of the whole attributes section as
soon as it encounters a subsection with a vendor name it doesn't
recognise (which is anything other than the standard one). This can
prevent it from detecting compatibility issues, if a standard
subsection followed the vendor-specific one.
This patch modifies the attribute parser so that unrecognised vendor
subsections are silently skipped, and the subsections beyond them are
still processed.
(Relanded with no change from the original commit
8f208edd44d0832. I
reverted it in
949bb7e4de62cd0 due to widespread buildbot breakage,
failing to notice that
975f71faa72aaaa had already fixed the failing
unit test. Also, the *revert* caused at least one buildbot to fail,
because I switched the affected lld test to making %t a directory, and
then the reverted version tried to treat it as a file without cleaning
the output directory first.)
Differential Revision: https://reviews.llvm.org/D153335
Takuya Shimizu [Tue, 27 Jun 2023 15:19:46 +0000 (00:19 +0900)]
[clang][ExprConstant] Fix display of syntactically-invalid note for member function calls
This patch makes the display of member function calls more true to the user-written code by making use of the syntactical structure of the function calls.
This patch also changes the display of conventional value-based printing from arrow operator to dot operator.
This avoids the syntactical invalidness in notes previously caused by the display of & operator
(lack of parentheses and reference of rvalue)
Fixes https://github.com/llvm/llvm-project/issues/57081
Reviewed By: cjdb
Differential Revision: https://reviews.llvm.org/D151720
Igor Kirillov [Tue, 27 Jun 2023 12:33:49 +0000 (12:33 +0000)]
Fix the ComplexDeinterleaving bug when handling mixed reductions.
Add a missing check that ensures that ComplexDeinterleaving for reduction
is only analyzed for Real and Imaginary Instructions of the same type.
Differential Revision: https://reviews.llvm.org/D153862
Youngsuk Kim [Tue, 27 Jun 2023 14:17:29 +0000 (10:17 -0400)]
[clang] Replace uses of CGBuilderTy::CreateElementBitCast (NFC)
Partial progress towards replacing `CreateElementBitCast`, as it no
longer does what its name suggests. Either replace its uses with
`Address::withElementType()`, or remove them if no longer needed.
Reviewed By: barannikov88, nikic
Differential Revision: https://reviews.llvm.org/D153314
Jeremy Morse [Tue, 27 Jun 2023 13:17:19 +0000 (14:17 +0100)]
[DebugInfo][InstrRef] Instrument x86 CMOV conversion to preserve variable values
X86's CMOV conversion transforms CMOV instructions into control flow between
blocks, meaning the value is computed by a PHI rather than a "real" machine
instruction. In instruction-referencing mode, we need to transfer the
instruction label between the old CMOV and the new PHI instruction to mark
where the variable value is computed.
There's an extra complication in that memory operands can be unfolded from the
CMOV and sunk into the new blocks -- the test checks both scenarios where the
instruction number has to hop between instructions.
This omission exposed by Dexter testing.
Reviewed By: Orlando
Differential Revision: https://reviews.llvm.org/D145565
Elliot Goodrich [Sun, 25 Jun 2023 17:04:47 +0000 (18:04 +0100)]
[llvm] Move AttributeMask to a separate header
Move `AttributeMask` out of `llvm/IR/Attributes.h` to a new file
`llvm/IR/AttributeMask.h`. After doing this we can remove the
`#include <bitset>` and `#include <set>` directives from `Attributes.h`.
Since there are many headers including `Attributes.h`, but not needing
the definition of `AttributeMask`, this causes unnecessary bloating of
the translation units and slows down compilation.
This commit adds in the include directive for `llvm/IR/AttributeMask.h`
to the handful of source files that need to see the definition.
This reduces the total number of preprocessing tokens across the LLVM
source files in lib from (roughly) 1,917,509,187 to 1,902,982,273 - a
reduction of ~0.76%. This should result in a small improvement in
compilation time.
Differential Revision: https://reviews.llvm.org/D153728
Joseph Huber [Tue, 20 Jun 2023 17:03:48 +0000 (12:03 -0500)]
[OpenMP] Always apply target declarations to canonical definitions
This patch changes the handling of OpenMP to add the device attributes
to the canonical definitions when we encounter a non-canonical
definition. Previously, the following code would not work because it
would find the non-canonical definition first which would then not be
used anywhere else.
```
int x;
extern int x;
```
This patch now adds the attribute to both of them. This allows us to
perform the following operation if, for example, there were an
implementation of `stderr` on the device.
```
#include <stdio.h>
// List of libc symbols supported on the device.
extern FILE *stderr;
```
Unfortunately I cannot think of an equivalent solution to HIP / CUDA
device declarations as those are done with simple attributes. Attributes
themselves cannot be used to affect a definition once its canonical
definition has already been seen. Some help on that front would be
appreciated.
Fixes https://github.com/llvm/llvm-project/issues/63355
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D153369
David Spickett [Tue, 27 Jun 2023 14:04:41 +0000 (14:04 +0000)]
Revert "[LLDB] Fix the use of "platform process launch" with no extra arguments"
This reverts commit
cc0fc358540517a3d205243c27bd543afeae2b02 due to a failure
reported on MacOS.
Ties Stuij [Tue, 27 Jun 2023 13:28:53 +0000 (14:28 +0100)]
[ARM] in ExpandTMOV32BitImm, CPSR register ops should be `Define`d
The CPSR registers ops of the instructions constructed in ExpandTMOV32BitImm
were marked as kill, instead of define. Best to use the pre-existing
t1CondCodeOp fn to construct CPSRs.
Reviewed By: simonwallis2
Differential Revision: https://reviews.llvm.org/D153763
Louis Dionne [Mon, 26 Jun 2023 19:08:26 +0000 (15:08 -0400)]
[libc++][NFC] Add missing includes to perfect_forward.h
Differential Revision: https://reviews.llvm.org/D153807
Simon Pilgrim [Tue, 27 Jun 2023 13:22:50 +0000 (14:22 +0100)]
[X86] SimplifyDemandedBitsForTargetNode - add X86ISD::ANDNP handling
Add X86ISD::ANDNP handling to targetShrinkDemandedConstant as well, which allows us to replace a lot of truncated masks with (rematerializable) allones values
Simon Tatham [Tue, 27 Jun 2023 13:21:16 +0000 (14:21 +0100)]
Revert "[ELFAttributeParser] Skip unknown vendor subsections."
This reverts commit
8f208edd44d0832ac2580e0ec4238be4ecfd5737.
I completely missed the compiled unit test for ELFAttributeParser,
which also needs updating. I'll reland this change once I make further
fixes.
Nikita Popov [Tue, 27 Jun 2023 12:53:40 +0000 (14:53 +0200)]
[InstSimplify] Make sure offsets have same size in computePointerICmp()
The way this is currently implemented the accumulated offsets can
end up having a different size, which causes unnecessary
complication for further extension of the code.
Don't strip pointer casts at the start and rely on
stripAndAccumulate to do any necessary stripping. It gracefully
handles different index sizes and will always retain the width of
the original pointer index type.
This is not NFC, but unlikely to make any practical difference.
Haojian Wu [Tue, 27 Jun 2023 13:15:02 +0000 (15:15 +0200)]
Revert "[llvm-profdata] Refactoring Sample Profile Reader to increase FDO build speed using MD5 as key to Sample Profile map"
This reverts commit
12e9c7aaa66b7624b5d7666ce2794d912bf9e4b7.
The commit has broken the buildbot, see comment https://reviews.llvm.org/D147740#4451540
Louis Dionne [Mon, 5 Jun 2023 19:53:42 +0000 (12:53 -0700)]
[libc++] Expand the contents of LIBCXX_ENABLE_FILESYSTEM
Since LIBCXX_ENABLE_FILESYSTEM now truly represents whether the
platform supports a filesystem (as opposed to whether the <filesystem>
library is provided), we can provide a few additional classes from
the <filesystem> library even when the platform does not have support
for a filesystem. For example, this allows performing path manipulations
using std::filesystem::path even on platforms where there is no actual
filesystem.
rdar://
107061236
Differential Revision: https://reviews.llvm.org/D152382
Matthias Springer [Tue, 27 Jun 2023 12:29:34 +0000 (14:29 +0200)]
[mlir][linalg] Padding transformation: Write back result to original destination
Copy back the padded result to the original destination of the computation. This is important for bufferization, to ensure that the result of the computation does not suddenly materialize in a different buffer due to padding.
A `bufferization.copy_tensor` is inserted for every (unpadded) result. Such ops bufferize to memcpys, but they fold away, should the padding fold away.
Differential Revision: https://reviews.llvm.org/D153554
Matthias Springer [Tue, 27 Jun 2023 12:29:18 +0000 (14:29 +0200)]
[mlir][bufferization] Add bufferization.copy_tensor op
This operation is a "copy" operation on tensors. It is guaranteed to bufferize to a memcpy. This is different from "tensor.insert_slice", which may fold away.
Note: There is a symmetry between certain tensor, bufferization and memref ops:
* `tensor.empty`, `bufferization.alloc_tensor`, `memref.alloc`
* (none), `bufferization.dealloc_tensor`, `memref.dealloc`
* `tensor.insert_slice`, `bufferization.copy_tensor`, `memref.copy`
Tensor ops can generally canonicalize/fold away, while bufferization dialect ops can be used when a certain side effect is expected to materialize; so they do not fold away.
Differential Revision: https://reviews.llvm.org/D153552
Matthias Springer [Tue, 27 Jun 2023 12:29:04 +0000 (14:29 +0200)]
[mlir][linalg] BufferizeToAllocationOp: Return handle to buffer
Add an additional result handle to the op. This new handle is mapped to the newly allocated buffer.
Differential Revision: https://reviews.llvm.org/D153514
Matthias Springer [Tue, 27 Jun 2023 12:28:50 +0000 (14:28 +0200)]
[mlir][linalg][NFC] Cleanup padding transform
* Use LinalgPaddingOptions instead of passing many parameters.
* Split function into two parts.
Differential Revision: https://reviews.llvm.org/D153853
Matthias Springer [Tue, 27 Jun 2023 12:28:38 +0000 (14:28 +0200)]
[mlir][linalg][NFC] Move padding transformation to separate file
Also remove `LinalgPaddingPattern`, which has no uses. (There is a transform dialect op that is used for testing instead.)
Differential Revision: https://reviews.llvm.org/D153512
Felipe de Azevedo Piovezan [Mon, 26 Jun 2023 20:10:30 +0000 (16:10 -0400)]
[DebugInfo][AsmPrinter] Don't emit accelerator entries with empty names
The DWARF 5 specification says that:
> All other debugging information entries without a DW_AT_name attribute are
> excluded.
Clang started generating these variables for string literals, see D123534.
Differential Revision: https://reviews.llvm.org/D153809
Haojian Wu [Tue, 27 Jun 2023 12:38:59 +0000 (14:38 +0200)]
[ELFAttributeParser] Update the ELFAttributeParserTest for 8f208ed
The 8f208ed has removed the "unrecognized vendor-name" error, updated
the unittest accordingly.
Alex Bradbury [Tue, 27 Jun 2023 12:35:41 +0000 (13:35 +0100)]
[RISCV][NFC] Adjust RISCVMoveMerge.cpp header to match standard style
* 80 columns
* Fix name of file (RISCVMoveMerger.cpp vs RISCVMoveMerge.cpp)
* `//===--` prefix rather than center-aligned text.
Alex Bradbury [Tue, 27 Jun 2023 12:28:28 +0000 (13:28 +0100)]
[RISCV] Relax rules for ordering s/z/x prefixed extensions in ISA naming strings
This was discussed somewhat in D148315. As it stands, we require in
RISCVISAInfo::parseArchString (used for e.g. -march parsing in Clang)
that extensions are given in the order of z, then s, then x prefixed
extensions (after the standard single-letter extensions). However, we
recently (in D148315) moved to that order from z/x/s as the canonical
ordering was changed in the spec. In addition, recent GCC seems to
require z* extensions before s*.
My recollection of the history here is that we thought keeping -march as
close to the rules for ISA naming strings as possible would simplify
things, as there's an existing spec to point to. My feeling is that now
we've had incompatible changes, and an incompatibility with GCC there's
no real benefit to sticking to this restriction, and it risks making it
much more painful than it needs to be to copy a -march= string between
GCC and Clang.
This patch removes all ordering restrictions so you can freely mix x/s/z
extensions.
To be very explicit, this doesn't change our behaviour when emitting a
canonically ordered extension string (e.g. in build attributes). We of
course sort according to the canonical order (as we understand it) in
that case.
Differential Revision: https://reviews.llvm.org/D149246
Nicolas Vasilache [Tue, 27 Jun 2023 12:29:16 +0000 (12:29 +0000)]
[mlir][Linalg]Add support for inferring batch dimensions
pvanhout [Tue, 27 Jun 2023 08:34:06 +0000 (10:34 +0200)]
[AMDGPU] Add more Common Feature Sets
A small refactor to add more `_Common` feature sets for GFX8+.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D153843
Simon Tatham [Tue, 20 Jun 2023 12:44:38 +0000 (13:44 +0100)]
[ELFAttributeParser] Skip unknown vendor subsections.
An .ARM.attributes section is divided into subsections, each labelled
with a vendor name. There is one standardised vendor name, which must
be used for all attributes that affect compatibility. Subsections
labelled with other vendor names can be used for optimisation
purposes, but it has to be safe for an object file consumer to ignore
them if it doesn't recognise the vendor name.
LLD currently terminates parsing of the whole attributes section as
soon as it encounters a subsection with a vendor name it doesn't
recognise (which is anything other than the standard one). This can
prevent it from detecting compatibility issues, if a standard
subsection followed the vendor-specific one.
This patch modifies the attribute parser so that unrecognised vendor
subsections are silently skipped, and the subsections beyond them are
still processed.
Differential Revision: https://reviews.llvm.org/D153335
Timm Bäder [Tue, 27 Jun 2023 09:42:38 +0000 (11:42 +0200)]
[clang] Add myself as code owner for the new constant interpreter
As discussed in the RFC at
https://discourse.llvm.org/t/rfc-proposing-a-code-owner-for-the-experimental-constexpr-interpreter/71514
Jean Perier [Tue, 27 Jun 2023 11:30:15 +0000 (13:30 +0200)]
[flang][hlfir] Add codegen for vector subscripted LHS
This patch adds support for vector subscripted assignment left-hand
side. It does not yet add support for the cases where the LHS must be
saved because its evaluation could be impacted by the assignment.
The implementation adds an hlfir::ElementalOpInterface to share the
elemental inlining utility and some other tools between
hlfir::ElementalOp and hlfir::ElelemntalAddrOp.
It adds generateYieldedLHS() to allow retrieving the LHS value
in lowering, whether or not it is vector subscripted. If it is vector
subscripted, this utility creates a loop nest iterating over the
elements and returns the address of an element.
Differential Revision: https://reviews.llvm.org/D153759
Florian Hahn [Tue, 27 Jun 2023 11:22:10 +0000 (12:22 +0100)]
[ConstraintElim] Add additional induction phi tests.
Extra tests with different GEP step sizes for D152730.
Timm Bäder [Tue, 27 Jun 2023 11:06:01 +0000 (13:06 +0200)]
Revert "[clang][CFG][NFC] A few smaller cleanups"
This reverts commit
173df3dd5f9a812b07f9866965f4e92a982a3fca.
Looks like this wasn't as innocent as it seemed:
https://lab.llvm.org/buildbot#builders/38/builds/12982
Simon Pilgrim [Tue, 27 Jun 2023 10:46:02 +0000 (11:46 +0100)]
Fix "this this" duplicate typo in comment. NFC.
Simon Pilgrim [Tue, 27 Jun 2023 10:39:31 +0000 (11:39 +0100)]
Fix "for for" duplicate typo in comment. NFC.
Simon Pilgrim [Tue, 27 Jun 2023 10:37:05 +0000 (11:37 +0100)]
Fix "the the" duplicate typo in comment. NFC.
Timm Bäder [Wed, 21 Jun 2023 09:15:55 +0000 (11:15 +0200)]
[clang][CFG][NFC] A few smaller cleanups
Use dyn_cast_if_present instead of _or_null, use decomposition decls,
and a few other minor things.
Timm Bäder [Sun, 18 Jun 2023 07:07:31 +0000 (09:07 +0200)]
[clang][Interp][NFC] Compare std::optional variables directly
We can do that and we already checked that they aren't nullopt before.
Guillaume Chatelet [Mon, 26 Jun 2023 13:58:30 +0000 (13:58 +0000)]
[Align] Add isAligned taking an APInt
This showed up in https://reviews.llvm.org/D153308
Reviewed By: courbet, nikic
Differential Revision: https://reviews.llvm.org/D153356
David Spickett [Thu, 22 Jun 2023 14:24:40 +0000 (14:24 +0000)]
[lldb] Use SmallVector for handling register data
Previously lldb was using arrays of size kMaxRegisterByteSize to handle
registers. This was set to 256 because the largest possible register
we support is Arm's scalable vectors (SVE) which can be up to 256 bytes long.
This means for most operations aside from SVE, we're wasting 192 bytes
of it. Which is ok given that we don't have to pay the cost of a heap
alocation and 256 bytes isn't all that much overall.
With the introduction of the Arm Scalable Matrix extension there is a new
array storage register, ZA. This register is essentially a square made up of
SVE vectors. Therefore ZA could be up to 64kb in size.
https://developer.arm.com/documentation/ddi0616/latest/
"The Effective Streaming SVE vector length, SVL, is a power of two in the range 128 to 2048 bits inclusive."
"The ZA storage is architectural register state consisting of a two-dimensional ZA array of [SVLB × SVLB] bytes."
99% of operations will never touch ZA and making every stack frame 64kb+ just
for that slim chance is a bad idea.
Instead I'm switching register handling to use SmallVector with a stack allocation
size of kTypicalRegisterByteSize. kMaxRegisterByteSize will be used in places
where we can't predict the size of register we're reading (in the GDB remote client).
The result is that the 99% of small register operations can use the stack
as before and the actual ZA operations will move to the heap as needed.
I tested this by first working out -wframe-larger-than values for all the
libraries using the arrays previously. With this change I was able to increase
kMaxRegisterByteSize to 256*256 without hitting those limits. With the
exception of the GDB server which needs to use a max size buffer.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D153626
Christian Ulmann [Tue, 27 Jun 2023 08:34:39 +0000 (08:34 +0000)]
[mlir][LLVM] Improve error handling in switch parsing
This commit changes the 'llvm.switch' parsing to not silently fail when
it encounters superfluous commas in the case list.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D153841
Martin Braenne [Tue, 27 Jun 2023 04:41:17 +0000 (04:41 +0000)]
[clang][dataflow] Use namespace qualifiers when defining functions.
See
https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions
Thank you to MaskRay for pointing this out on
https://reviews.llvm.org/D153006
Reviewed By: xazax.hun
Differential Revision: https://reviews.llvm.org/D153833
serge-sans-paille [Tue, 30 May 2023 21:15:11 +0000 (23:15 +0200)]
[Clang][Sema] Do not try to analyze dependent alignment during -Wcast-align
Fix #63007
Differential Revision: https://reviews.llvm.org/D151753
Diana Picus [Tue, 20 Jun 2023 07:23:50 +0000 (09:23 +0200)]
[AMDGPU][DAGISel] Be more flexible about what calls are allowed
Remove DAGISel checks on calling conventions. GlobalISel doesn't have
these checks either and we prefer it that way (see D152794).
Add a simple test like the one introduced in D117479 for GlobalISel.
Differential Revision: https://reviews.llvm.org/D153535
Haojian Wu [Tue, 27 Jun 2023 07:37:12 +0000 (09:37 +0200)]
[clangd] Fix the flaky FindTarget unittest after 1b66840
after 1b66840, FindTarget will report multiple refs with the same
location, make the sort order of the refs deterministic in
FindTargetTests.
David Spickett [Fri, 23 Jun 2023 14:31:14 +0000 (14:31 +0000)]
[LLDB] Fix the use of "platform process launch" with no extra arguments
This fixes #62068.
After
8d1de7b34af46a089eb5433c700419ad9b2923ee the following issue appeared:
```
$ ./bin/lldb /tmp/test.o
(lldb) target create "/tmp/test.o"
Current executable set to '/tmp/test.o' (aarch64).
(lldb) platform process launch -s
error: Cannot launch '': Nothing to launch
```
Previously would call target->GetRunArguments when there were no extra
arguments, so we could find out what target.run-args might be.
Once that change started relying on the first arg being the exe,
the fact that that call clears the existing argument list caused the bug.
Instead, have it set a local arg list and append that to the existing
one. Which in this case will just contain the exe name.
Since there's no existing tests for this command I've added a new file
that covers enough to check this issue.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D153636
Nikita Popov [Mon, 19 Jun 2023 12:21:40 +0000 (14:21 +0200)]
[BasicAA] Fix nsw handling for negated scales (PR63266)
We currently preserve the nsw flag when negating scales, which is
incorrect for INT_MIN.
However, just dropping the NSW flag in this case makes BasicAA
behavior unreliable and asymmetric, because we may or may not
drop the NSW flag depending on which side gets subtracted.
Instead, leave the Scale alone and add an additional IsNegated flag,
which indicates that the whole VarIndex should be interpreted as a
subtraction. This allows us to retain the NSW flag.
When accumulating the offset range, we need to use subtraction
instead of adding for IsNegated indices. Everything else works on
the absolute value of the scale, so the negation does not matter
there.
Fixes https://github.com/llvm/llvm-project/issues/63266.
Differential Revision: https://reviews.llvm.org/D153270
Cullen Rhodes [Tue, 27 Jun 2023 07:29:11 +0000 (07:29 +0000)]
[mlir][ArmSME] Fix crash on func decls in 'arm_za' legality checks
Reviewed By: dcaballe, Dinistro
Differential Revision: https://reviews.llvm.org/D153750
Aiden Grossman [Tue, 27 Jun 2023 07:36:25 +0000 (07:36 +0000)]
[llvm-exegesis] Fix requires flags on memory annotation tests
Job Noorman [Tue, 27 Jun 2023 07:18:39 +0000 (09:18 +0200)]
[JITLink] Use SubtargetFeatures to store features in LinkGraph
D149522 introduced target features to LinkGraph. However, to avoid a
public dependency on MC, the features were stored in a std::vector
instead of using SubtargetFeatures directly.
Since SubtargetFeatures was moved from MC to TargetParser (D150549), we
can now use it directly to store the features. This patch implements
that and removes the (private) dependency on MC.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D153749
Tobias Gysi [Tue, 27 Jun 2023 06:56:01 +0000 (06:56 +0000)]
[mlir][llvm] Add comdat attribute to functions
This revision adds comdat support to functions. Additionally,
it ensures only comdats that have uses are imported/exported and
only non-empty global comdat operations are created.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D153739
Aiden Grossman [Tue, 27 Jun 2023 07:01:20 +0000 (07:01 +0000)]
[llvm-exegesis] Fix warning and hoist statement of arch-specific section
My last patch broke most of the builders that aren't currently running
at least Kernel 5.6 as there was a variable used later on inside a
region that required that kernel version. Also fixes a minor warning
left over from a bad merge.
Aiden Grossman [Fri, 26 May 2023 09:13:34 +0000 (09:13 +0000)]
[llvm-exegesis] Add support for using memory annotations
This patch adds in support for using memory annotations in the
subprocess execution mode.
Mehdi Amini [Mon, 26 Jun 2023 20:51:02 +0000 (22:51 +0200)]
Revert "[mlir][Transform] Add support for mma.sync m16n8k16 f16 rewrite." and "[mlir][Transform] Introduce nvgpu transform extensions"
This reverts commit
40deed40ae77ba22f7c72693903752ab6bfeb4e7.
and commit
1660f2174d59bc2fd04131dab9ab0b43178bf665.
The buildbot is broken, the two tests aren't passing.
Aiden Grossman [Tue, 27 Jun 2023 06:09:01 +0000 (06:09 +0000)]
[llvm-exegesis] Remove extraneous print debug statement
This was leftover when I was working on the lit config while recomitting
a patch and never should've made it in tree.
Aiden Grossman [Tue, 27 Jun 2023 06:05:27 +0000 (06:05 +0000)]
Revert "[NFC] Refactor MBB hotness/coldness into templated PSI functions."
This reverts commit
c3e33720403c010e140c17313eeefd9a0f25887a.
This has broken quite a few buildbots.
Jim Lin [Tue, 27 Jun 2023 02:29:45 +0000 (10:29 +0800)]
[LibCallsShrinkWrap][NFC] Reuse createCond and createOrCond
Add two new functions `createCond` and `createOrCond` that accept extra
arguments Arg and Arg/Arg2 respectively.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D153253
Craig Topper [Tue, 27 Jun 2023 06:02:14 +0000 (23:02 -0700)]
[RISCV] Add bypass for ReadJalr in SiFive7 scheduler model.
Aiden Grossman [Fri, 26 May 2023 09:06:13 +0000 (09:06 +0000)]
[llvm-exegesis] Add memory annotation parsing
This patch adds memory annotation parsing to llvm-exegesis. The memory
annotations cannot be used currently, but this allows for using parsed
memory annotations within a FunctionExecutorImpl to set up a specified
execution environment.
Fangrui Song [Tue, 27 Jun 2023 05:20:02 +0000 (22:20 -0700)]
[test] Improve symbol visibility test
Aiden Grossman [Tue, 27 Jun 2023 04:59:09 +0000 (04:59 +0000)]
[llvm-exegesis] Fix test failure caused by assymetric values
I fixed compilation on 32-bit ARM earlier in the -Werror case using
preprocessor directives but forgot to update the unit tests that also
depend upon that value. This patch updates the unit tests as well as a
quick fix for the builders that were broken by the earlier patch.
Han Shen [Sat, 24 Jun 2023 17:19:26 +0000 (10:19 -0700)]
[NFC] Refactor MBB hotness/coldness into templated PSI functions.
In D152399, we calculate BPI->BFI in MachineFunctionSplit pass just to
use PSI->isFunctionHotInCallGraph, which is expensive. Instead, we can
implement this directly with MBFI.
Reviewer mentioned in the comment, that machine_size_opts already has
isFunctionColdInCallGraph, isFunctionHotInCallGraphNthPercentile, etc
implemented. These can be refactored and reused across MFS and machine
size opts.
This CL does this - it refactors out those internal static functions
into PSI as templated functions, so they can be accessed easily.
Differential Revision: https://reviews.llvm.org/D152758
Advenam Tacet [Thu, 1 Jun 2023 05:13:24 +0000 (05:13 +0000)]
[2a/3][ASan][libcxx] std::deque annotations
This revision is a part of a series of patches extending AddressSanitizer C++ container overflow detection capabilities by adding annotations, similar to those existing in `std::vector`, to `std::string` and `std::deque` collections. These changes allow ASan to detect cases when the instrumented program accesses memory which is internally allocated by the collection but is still not in-use (accesses before or after the stored elements for `std::deque`, or between the size and capacity bounds for `std::string`).
The motivation for the research and those changes was a bug, found by Trail of Bits, in a real code where an out-of-bounds read could happen as two strings were compared via a std::equals function that took `iter1_begin`, `iter1_end`, `iter2_begin` iterators (with a custom comparison function). When object `iter1` was longer than `iter2`, read out-of-bounds on `iter2` could happen. Container sanitization would detect it.
This revision introduces annotations for `std::deque`. Each chunk of the container can now be annotated using the `__sanitizer_annotate_double_ended_contiguous_container` function, which was added in the rG1c5ad6d2c01294a0decde43a88e9c27d7437d157. Any attempt to access poisoned memory will trigger an ASan error. Although false negatives are rare, they are possible due to limitations in the ASan API, where a few (usually up to 7) bytes before the container may remain unpoisoned. There are no false positives in the same way as with `std::vector` annotations.
This patch only supports objects (deques) that use the standard allocator. However, it can be easily extended to support all allocators, as suggested in the D146815 revision.
Furthermore, the patch includes the addition of the `is_double_ended_contiguous_container_asan_correct` function to `libcxx/test/support/asan_testing.h`. This function can be used to verify whether a `std::deque` object has been correctly annotated.
Finally, the patch extends the unit tests to verify ASan annotations (added LIBCPP_ASSERTs).
If a program is compiled without ASan, all helper functions will be no-ops. In binaries with ASan, there is a negligible performance impact since the code from the change is only executed when the deque container changes in size and it’s proportional to the change. It is important to note that regardless of whether or not these changes are in use, every access to the container's memory is instrumented.
If you have any questions, please email:
- advenam.tacet@trailofbits.com
- disconnect3d@trailofbits.com
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D132092
Advenam Tacet [Tue, 27 Jun 2023 01:30:03 +0000 (03:30 +0200)]
[ASan] Remove sanity checks during annotation of contiguous container
This revision removes sanity checks in
`__sanitizer_annotate_contiguous_container`.
(Changed them to `DCHECK_EQ`.)
Those checks may be problematic, if someone manually unpoisoned memory block.
Manual unpoisoning may be used if part of the program is not
instrumented.
Those checks are helpful while confirming correctness of ASan annotations
implementation.
Originally suggested here: https://reviews.llvm.org/D136765#4174546
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D145482
Slava Zakharin [Mon, 26 Jun 2023 20:20:04 +0000 (13:20 -0700)]
[flang][hlfir] Special handling for temporary LHS in AssignOp.
When `AssignOp` is used with LHS that is a compiler generated temporary
special care must be taken to initialize the temporary and avoid
finalizations of its components. This change-set adds optional
`temporary_lhs` attribute for `AssignOp` to convey this information
to HLFIR-to-FIR conversion pass. Currently, this results in
calling `AssignTemporary` runtime for doing the assignment.
Reviewed By: jeanPerier, tblah
Differential Revision: https://reviews.llvm.org/D152482