Mike Crowe [Mon, 3 Jul 2023 16:29:28 +0000 (16:29 +0000)]
[clang-tidy] Fix width/precision argument order in modernize-use-std-print
Victor Zverovich pointed out[1] that printf takes the field width and
precision arguments before the value to be printed whereas std::print
takes the value first (unless positional arguments are used.) Many of
the test cases in use-std-print.cpp were incorrect.
Teach the check to rotate the arguments when required to correct
this. Correct the test cases and add more.
[1] https://github.com/fmtlib/fmt/pull/3515#issuecomment-
1615259893
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D154283
Alex Langford [Mon, 26 Jun 2023 20:17:49 +0000 (13:17 -0700)]
[lldb][NFCI] TypeSystemClang::CreateStructForIdentifier should take a StringRef
This doesn't really use fast comparison or string uniqueness. In fact,
all of the current callers pass an empty string for type_name. The only
reason I don't remove it is because it looks like it is used downstream
for swift.
Differential Revision: https://reviews.llvm.org/D153810
Alex Langford [Tue, 27 Jun 2023 18:37:22 +0000 (11:37 -0700)]
[lldb][NFCI] Remove unneeded use of ConstString in ASTResultSynthesizer
2/3 of the ConstStrings in this class were just to be able to log
something. Putting something in the StringPool just to log it doesn't
make a lot of sense, so let's remove them.
The remaining use is for `RegisterPersistentDecl` which is fine for now.
Differential Revision: https://reviews.llvm.org/D153905
Peter Klausler [Fri, 30 Jun 2023 00:32:00 +0000 (17:32 -0700)]
[flang] Add optional portability warning for upcoming Fortran 202X/3 breaking change
The soon-to-be-published next revision of the ISO Fortran language standard
contains a couple of breaking changes to previous specifications that may cause
existing programs to silently change their behavior.
For the change that introduces automatic reallocation of deferred length
allocatable character scalar variables when they appear as the targets
of internal WRITE statements, as IOMSG=/ERRMSG= variables, as outputs
of INQUIRE specifiers, or as INTENT(OUT) arguments to intrinsic
procedures, this patch adds an optional portability warning.
Differential Revision: https://reviews.llvm.org/D154242
Matthias Springer [Mon, 3 Jul 2023 15:57:02 +0000 (17:57 +0200)]
[mlir][Interfaces] Add `promoteIfSingleIteration` to `LoopLikeOpInterface`
There are existing implementations for `scf.for`, `scf.forall` and `affine.for`. This revision adds an interface method to the `LoopLikeOpInterface`.
* `scf.forall` now implements the `LoopLikeOpInterface`.
* The implementations of `scf.for` and `scf.forall` become interface method implementations. `affine.for` remains as is for the moment. (The implementation of `promoteIfSingleIteration` depepends on helper functions from `MLIRAffineAnalysis`, which cannot be used from `MLIRAffineDialect`, where the interface is currently implemented.)
* More efficient implementations of `promoteIfSingleIteration`. In particular, the `scf.forall` operation now inlines operations instead of cloning them. This also preserves handles when used from the transform dialect.
Differential Revision: https://reviews.llvm.org/D154343
Christudasan Devadasan [Mon, 3 Jul 2023 15:59:34 +0000 (21:29 +0530)]
[CodeGen] MRI call back in TargetMachine
It is needed for target specific initializatons.
Reviewed By: qcolombet
Differential Revision: https://reviews.llvm.org/D143758
Yashwant Singh [Mon, 3 Jul 2023 15:23:05 +0000 (20:53 +0530)]
[Mips] Remove isMoveReg=1 from wrdsp and rddsp instructions
This is a prep patch for D150388. Treating rddsp and wrdsp as copy
instructions was causing test failures as we tried using isCopyInstr()
hook to query target-specific copy instructions for LiveRangeSplitting.
As suggested, removing 'isMoveReg = 1' from wrdsp and rddsp so they
aren't considered simple copy-like instructions for the moment.
Reviewed By: sdardis
Differential Revision: https://reviews.llvm.org/D151181
Christian Ulmann [Mon, 3 Jul 2023 15:14:12 +0000 (15:14 +0000)]
[mlir][LLVM] Export LLVMFuncOp's GC for declarations
This commit ensures that the garbage collector attribute of LLVMFuncOps
is exported, even when they are declarations.
Kadir Cetinkaya [Mon, 3 Jul 2023 11:29:15 +0000 (13:29 +0200)]
[clang][tooling] Fix early termination when there are nested expansions
This also does some cleanups, I am happy to undo them (or send as
separate patches):
- Change the early exit to stop only once we hit an expansion inside the
main file, to make sure we keep following the nested expansions.
- Add more tests to cover all the cases mentioned in the implementation
- Drop the adjustments for prev/next tokens. We do the final checks
based on the expansion locations anyway, so any intermediate mapping
was a no-op.
Differential Revision: https://reviews.llvm.org/D154335
David Truby [Mon, 3 Jul 2023 14:50:40 +0000 (15:50 +0100)]
[flang] Install omp_lib.h to install directory alongside modules
This patch simply adds a cmake install line for omp_lib.h that was
previously missing, to put it alongisde omp_lib.mod so it can be found
by the driver.
Paul Walker [Mon, 3 Jul 2023 13:28:35 +0000 (14:28 +0100)]
[SVE] Extend incp/decp testing to cover 32-bit use cases.
Joel E. Denny [Mon, 3 Jul 2023 14:23:38 +0000 (10:23 -0400)]
[OpenMP] libomptarget: Don't map alignment padding to host
In the case of partially mapped structs, libomptarget sometimes adds
padding to device allocations to ensure they are aligned properly.
However, without this patch, it considers that padding to be mapped to
the host, which can cause presence checks (e.g.,
`omp_target_is_present` or a `present` modifier) to misbehave for
unmapped parts of the struct. This patch keeps the padding but treats
it as unmapped. See the new test case for examples.
Reviewed By: grokos, jdoerfert
Differential Revision: https://reviews.llvm.org/D149685
Mariya Podchishchaeva [Mon, 3 Jul 2023 14:05:25 +0000 (10:05 -0400)]
[clang] Add `__has_extension ()` for C++11 features
Add `__has_extension (cxx_defaulted_functions)` and
`__has_extension (cxx_default_function_template_args)` since they are
accepted in C++98 mode as extensions.
Fixes https://github.com/llvm/llvm-project/issues/61758
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D154334
Balazs Benics [Mon, 3 Jul 2023 14:13:02 +0000 (16:13 +0200)]
[NFC] Fix typo explicitly_convertable -> explicitly_convertible
Differential Revision: https://reviews.llvm.org/D152891
David Spickett [Mon, 3 Jul 2023 13:50:35 +0000 (13:50 +0000)]
Revert "[ARM] Adjust strd/ldrd codegen alignment requirements"
This reverts commit
92a9c30c61da7f973d55cd84fade424159b9cac9.
This has caused a test failure in the 2nd stage of Linaro's
Arm 32 bit buildbots.
LLVM::simplified-template-names.s
7: error: Simplified template DW_AT_name could not be reconstituted:
check:10'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8: original: f3<unsigned char, (unsigned char)'\x00'>
check:10'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9: reconstituted: f3<unsigned char, (unsigned char)'\x7f'>
check:10'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I suspect a load/store is slightly off.
Louis Dionne [Wed, 21 Jun 2023 21:55:40 +0000 (17:55 -0400)]
[lit] Remove dead code not referenced, documented or tested anywhere
If someone encounters issues due to this patch (e.g. they are using
that test format out-of-tree), please reach out on the review and
we'll figure out a way forward.
Differential Revision: https://reviews.llvm.org/D153534
Louis Dionne [Fri, 16 Jun 2023 15:04:06 +0000 (11:04 -0400)]
[libc++] Move all the remaining .fail.cpp tests to .verify.cpp
I made sure they all had some expected-error output in them. Many of
these tests would be better implemented as a positive test using SFINAE,
but this is beyond the scope of this patch.
Differential Revision: https://reviews.llvm.org/D153980
Louis Dionne [Tue, 27 Jun 2023 14:58:19 +0000 (10:58 -0400)]
[libc++] Add missing includes
Those were found while trying to enable configurations like no-threads
and no-localization with Clang modules enabled.
Differential Revision: https://reviews.llvm.org/D153977
Matthias Springer [Mon, 3 Jul 2023 13:24:35 +0000 (15:24 +0200)]
[mlir][transform] Add `transform.apply_licm` op
This op applies loop-invariant code motion to the targeted loop-like op.
Differential Revision: https://reviews.llvm.org/D154327
Florian Hahn [Mon, 3 Jul 2023 13:16:46 +0000 (14:16 +0100)]
[LV] Check for vector instruction in main vector loop.
Update the test to check for the vectorization call in the main vector
loop, not the dead epilogue vector loop as it does currently.
Simon Pilgrim [Mon, 3 Jul 2023 13:04:12 +0000 (14:04 +0100)]
[Headers][X86] Ensure all AVX broadcast scalar load intrinsics are unaligned
Similar to the existing _mm_load1_pd/_mm_loaddup_pd and broadcast vector loads, these intrinsic should ensure the loads are unaligned and not assume type alignment
Fixes #62325
Felipe de Azevedo Piovezan [Fri, 30 Jun 2023 21:26:37 +0000 (17:26 -0400)]
[lldb][NFC] Simplify GetLocation_DW_OP_addr function
A very old commit (
9422dd64f870dd33) changed the signature of this function in a
number of ways. This patch aims to improve it:
1. Reword the documentation, which still mentions old parameters that no longer
exist, and to elaborate upon the behavior of this function.
2. Remove the unnecessary parameter `op_addr_idx`. This parameter is odd in a
couple of ways: we never use it with a value that is non-zero, and the matching
`Update_DW_OP_addr` function doesn't use a similar parameter. We also document
that this new behavior. If we ever decide to handle multiple "DW_OP_addr", we
can introduce the complexity again.
Differential Revision: https://reviews.llvm.org/D154265
Felipe de Azevedo Piovezan [Tue, 27 Jun 2023 18:12:10 +0000 (14:12 -0400)]
[lldb] Skip apple accelerator table test in DWARF 5 mode
D68678 added a test that ensures an Apple accelerator lookup is done
efficiently. Since these tables are not used for DWARF 5, we should decorate the
test appropriately.
Differential Revision: https://reviews.llvm.org/D154268
Ankur [Mon, 3 Jul 2023 11:53:07 +0000 (17:23 +0530)]
[clang][ExtractAPI] Add --emit-symbol-graph option
Add new --emit-symbol-graph=<DIR> option which generates ExtractAPI symbol
graph information of .c/.m files on regular compilation job and put them in
the provided "DIR" directory.
Reviewed By: dang
Differential Revision: https://reviews.llvm.org/D152356
Leandro Lupori [Thu, 29 Jun 2023 14:46:58 +0000 (14:46 +0000)]
[flang] Fix codegen of subcomponents' indexing
Identify multidimensional array indices in subcomponents and
convert them from column-major to row-major ordering.
This fixes codegen for fircg.ext_array_coor, fircg.ext_embox and,
possibly, fircg.ext_rebox.
Fixes https://github.com/llvm/llvm-project/issues/62038
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D154214
Sergei Barannikov [Mon, 3 Jul 2023 11:45:22 +0000 (14:45 +0300)]
[RISCV] Use parseDirective returning ternary status (NFC)
The new method was introduced in D154101.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D154276
Adrian Kuegel [Mon, 3 Jul 2023 11:16:28 +0000 (13:16 +0200)]
[mlir][Bazel] Add missing dependencies after
564713c47175d9f61fe8e18e750fb7f7b486d533
Sedenion [Mon, 3 Jul 2023 10:53:28 +0000 (11:53 +0100)]
[clang-format] Fixed bad performance with enabled qualifier fixer.
This fixes github issue #57117: If the "QualifierAlignment"
option of clang-format is set to anything else but "Leave", the
"QualifierAlignmentFixer" pass gets enabled. This pass scales
quadratically with the number of preprocessor branches, i.e.
with the number of elements in TokenAnalyzer::UnwrappedLines.
The reason is that QualifierAlignmentFixer::process() generates
the UnwrappedLines, but then QualifierAlignmentFixer::analyze()
calls LeftRightQualifierAlignmentFixer::process() several times
(once for each qualifier) which again each time generates the
UnwrappedLines.
This commit gets rid of this double loop by registering the
individual LeftRightQualifierAlignmentFixer passes directly in
the top most container of passes (local variable "Passes" in
reformat()).
With this change, the original example in the github issue #57117
now takes only around 3s instead of >300s to format.
Since QualifierAlignmentFixer::analyze() got deleted, we also
no longer have the code with the NonNoOpFixes. This causes
replacements that end up not changing anything to appear in the
list of final replacements. There is a unit test to check that
this does not happen: QualifierFixerTest.NoOpQualifierReplacements.
However, it got broken at some point in time. So this commit
fixes the test. To keep the behavior that no no-op replacements
should appear from the qualifier fixer, the corresponding code
from QualifierAlignmentFixer::analyze() was moved to the top
reformat() function. Thus, is now done for **every** replacement
of every formatting pass. If no-op replacements are a problem
for the qualifier fixer, then it seems to be a good idea to
filter them out always.
See
https://github.com/llvm/llvm-project/issues/57117#issuecomment-
1546716934
for some more details.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D153228
Quentin Colombet [Mon, 3 Jul 2023 10:41:35 +0000 (12:41 +0200)]
[mlir][Linalg] Remove useless include
This include was not needed in the end and creates a creating circular
dependencies (linalg <-> linalg/util).
Just remove it.
NFC
Igor Kirillov [Wed, 21 Jun 2023 17:36:19 +0000 (17:36 +0000)]
[CodeGen] Refactor ComplexDeinterleaving to run identification on Values instead of Instructions
This change will make it easier to add identification of complex constants
in future patches.
Differential Revision: https://reviews.llvm.org/D153446
Aleksandr Popov [Sun, 2 Jul 2023 06:32:57 +0000 (08:32 +0200)]
[AArch64] Add PredictableSelectIsExpensive feature to all the cpus that have FeatureEnableSelectOptimize
In the revision https://reviews.llvm.org/D138990 was enabled select
optimize pass for AArch64.
We were doing some benchmarking on the Neoverse V1 and were
experimenting with select optimize heuristics. We found out that there
are some additional profitable transformations to predictable branches
(with prediction rate > 75% according to Agner Fog's rule of thumb) can
be done by base heuristic from SelectOptimize pass or by
optimizeSelectInst form CodeGenPrepare pass. But they are blocked on the
Neoverse V1, since PredictableSelectIsExpensive feature is not set for
that subtarget.
Note that to achieve this results we also changed predictable branch
threshold from 99% to 75%
Looks like it makes sense to add this feature to all targets where was
enabled select optimize pass in the https://reviews.llvm.org/D138990.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D143162
Cullen Rhodes [Wed, 14 Jun 2023 08:26:44 +0000 (08:26 +0000)]
[mlir][ArmSME] Add basic lowering of vector.transfer_write to zero
This patch adds support for lowering a 'vector.transfer_write' of zeroes
and type 'vector<[16x16]xi8>' to the SME 'zero {za}' instruction [1],
which zeroes the entire accumulator, and then writing it out to memory
with the 'str' instruction [2].
This contributes to supporting a path from 'linalg.fill' to SME.
[1] https://developer.arm.com/documentation/ddi0602/2022-06/SME-Instructions/ZERO--Zero-a-list-of-64-bit-element-ZA-tiles-
[2] https://developer.arm.com/documentation/ddi0602/2022-06/SME-Instructions/STR--Store-vector-from-ZA-array-
Reviewed By: awarzynski, dcaballe, WanderAway
Differential Revision: https://reviews.llvm.org/D152508
Xiaodong Liu [Mon, 3 Jul 2023 09:50:56 +0000 (17:50 +0800)]
[ISel] Improve notes for 'ComplexPattern' class
Add notes for 'Ty' parameter and correct the 'addr' example.
Xiaodong Liu [Mon, 3 Jul 2023 09:49:13 +0000 (17:49 +0800)]
[AMDGPU] Fix typo for "amdgpu-spill-sgpr-to-vgpr" option description
Mariya Podchishchaeva [Mon, 3 Jul 2023 09:34:12 +0000 (05:34 -0400)]
[clang] Fix new-expression with elaborated-type-specifier
Expressions like
```
struct A {};
...
new struct A {};
struct A* b = (1 == 1) ? new struct A : new struct A;
```
were parsed as redefinitions of `struct A` and failed, however as clarified by
`CWG2141` new-expression cannot define a type, so both these examples
should be considered as references to the previously declared `struct A`.
The patch adds a "new" kind context for parsing declaration specifiers in
addition to already existing declarator context in order to track that
the parser is inside of a new expression.
Fixes https://github.com/llvm/llvm-project/issues/34341
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D153857
aleks-tmb [Sun, 2 Jul 2023 06:23:44 +0000 (08:23 +0200)]
[IRCE][Tests] Add tests with range checks in the form of 'iv + offset vs limit'
Added tests on 3 types of range checks which are not supported by IRCE now:
* N - IV >= limit
* IV - N <= limit
* IV + N <= limit
Reviewed By: skatkov
Differential Revision: https://reviews.llvm.org/D154062
Théo Degioanni [Mon, 3 Jul 2023 08:48:16 +0000 (10:48 +0200)]
[mlir][llvm] Type consistency transformations
This revision introduces new rewrites to improve the type consistency of
a program expressed in the LLVM dialect.
Type consistency means that a given opaque pointer is consistently used
assuming the same pointee type, in a best effort basis. The introduced
rewrites modify the program to improve type consistency while preserving
the same semantics. This is useful for two main reasons:
- Transformation passes in the LLVM dialect like SROA or Mem2Reg can
analyse code better if type information and structure is used in a
consistent manner. Opaque pointers make this difficult to enforce, but
type consistency improvements increase the amount of occurences where
reasonable analysis can pick up on transformable patterns.
- While LLVM IR is not particularly picky about inconsistent type uses,
it may be of interest to lift LLVM IR into higher level dialects.
Having more instances of consistent type information would help
lifting into dialects that do care about consistent types.
In order to detect cases of inconsistent uses, operations returning an
LLVMPointer can implement the GetResultPtrElementType interface, which
allows getting a hint of which type the provided pointer should see its
pointee as, if such hint is available. The provided rewrites will then
use this hint to attempt to modify operations using the pointers so they
use the hinted type when dealing with the pointer.
Two transformations have been implemented in this revision:
- When a load/store uses a struct ptr directly to write to the first
element of the struct, introduce a GEP to the first element so the
type structure is preserved.
- When a GEP statically indexes in a pointer with a base type
inconsistent with the hint, try to find indices using the hint as a
base type that would result in the same offset, and replace the GEP
with this indexing.
More transformations are possible and I hope this is only a beginning
for this simplification effort.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D153973
David Green [Mon, 3 Jul 2023 09:05:40 +0000 (10:05 +0100)]
[Reassociate] Keep flags for more unchanged operations
Reassociation destroys nsw/nuw flags from BinOps that are changed. But if the
expression at the end of a tree that was altered, but didn't change itself,
the flags do not need to be removed. For example, if %a, %b and %c are
reassociated in
%x = add nsw i32 %a, %c
%y = add nsw i32 %x, %b
%z = add nsw i32 %y, %d
The value of %y and so add %y %d remains the same, and %z needn't drop the nsw
flags.
https://alive2.llvm.org/ce/z/_juAiV
Differential Revision: https://reviews.llvm.org/D154289
Quentin Colombet [Fri, 30 Jun 2023 14:59:41 +0000 (16:59 +0200)]
[mlir][Linalg] Implement the tiling interface for softmax
Original implementation from Harsh Menon <harsh@nod-labs.com>.
Differential Revision: https://reviews.llvm.org/D153421
Wang, Xin10 [Mon, 3 Jul 2023 08:43:27 +0000 (04:43 -0400)]
[X86]Precommit test cases for D154193
Add mir test cases for D154193, which tend to remove test16rr in possible and32ri+test16rr, similar to what we did for and32*+test64rr.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D154322
Ella Ma [Thu, 8 Jun 2023 12:22:58 +0000 (20:22 +0800)]
[analyzer][CStringChecker] Adjust the invalidation operation on the super region of the destination buffer during string copy
Fixing GitHub issue: https://github.com/llvm/llvm-project/issues/55019
Following the previous fix https://reviews.llvm.org/D12571 on issue https://github.com/llvm/llvm-project/issues/23328
The two issues report false memory leaks after calling string-copy APIs with a buffer field in an object as the destination.
The buffer invalidation incorrectly drops the assignment to a heap memory block when no overflow problems happen.
And the pointer of the dropped assignment is declared in the same object of the destination buffer.
The previous fix only considers the `memcpy` functions whose copy length is available from arguments.
In this issue, the copy length is inferable from the buffer declaration and string literals being copied.
Therefore, I have adjusted the previous fix to reuse the copy length computed before.
Besides, for APIs that never overflow (strsep) or we never know whether they can overflow (std::copy),
new invalidation operations have been introduced to inform CStringChecker::InvalidateBuffer whether or not to
invalidate the super region that encompasses the destination buffer.
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D152435
zhanglimin [Mon, 3 Jul 2023 08:05:00 +0000 (16:05 +0800)]
[dfsan] Support Linux loongarch64
Make minor changes to enable DFSAN and its tests on
loongarch64. And port Linux loongarch64 memory mappings
from msan.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D140690
Haojian Wu [Mon, 3 Jul 2023 07:34:19 +0000 (09:34 +0200)]
[Tooling][Rewriter] Remove the redundant AtomicallyMovedFile Implementation.
Replace it with llvm::writeToOutput.
Reviewed By: avl
Differential Revision: https://reviews.llvm.org/D153741
Balazs Benics [Mon, 3 Jul 2023 07:29:37 +0000 (09:29 +0200)]
[ADT] Add deduction guide for iterator_range
This commit also enhances the container overload constructor so that it
now considers the `begin` and `end` free functions, and performs ADL
lookups to find the best match.
To make this possible, I had to split-off the ADL helper functions from
the STLExtras header so that the iterator_range still remains pretty
cheap to include.
Differential Revision: https://reviews.llvm.org/D152891
tripleCC [Mon, 3 Jul 2023 07:28:41 +0000 (09:28 +0200)]
[analyzer] Fix false negative when using a nullable parameter directly without binding to a variable
If a parameter has a nullability annotation, the nullability information
of the parameter should be set as a NullabilityState trait at the
beginning of the function.
Patch By tripleCC!
Differential Revision: https://reviews.llvm.org/D153017
Matthias Springer [Mon, 3 Jul 2023 07:15:22 +0000 (09:15 +0200)]
[mlir][linalg] LinalgOp-anchored empty tensor elimination
This revision adds a pre-bufferization transform that can reduce the number of allocation. It is similar to `bufferization.eliminate_empty_tensors`, but specific to LinalgOp.
The transform looks for `tensor.empty` ops where the SSA use-def chain ends in an "ins" operand of a `LinalgOp`. If the same `LinalgOp` has an unused "outs" operand (and some other conditions are met), this "outs" operand can be used instead of the `tensor.empty` and the "ins" operand can be turned into an "outs" operand.
Differential Revision: https://reviews.llvm.org/D153952
Matthias Springer [Mon, 3 Jul 2023 07:09:09 +0000 (09:09 +0200)]
[mlir][vector] Clean up some dimension size checks
* Add `memref::getMixedSize` (same as in the tensor dialect).
* Simplify in-bounds check in `VectorTransferSplitRewritePatterns.cpp` and fix off-by-one error in the static in-bounds check.
* Use "memref::DimOp" instead of `createOrFoldDimOp` when possible.
Differential Revision: https://reviews.llvm.org/D154218
Matthias Springer [Mon, 3 Jul 2023 06:59:19 +0000 (08:59 +0200)]
[mlir][linalg] Remove redundant dimension size helper functions
Differential Revision: https://reviews.llvm.org/D154211
Ben Shi [Fri, 23 Jun 2023 04:23:30 +0000 (12:23 +0800)]
[CSKY] Optimize conditional branch with BLZ32/BLSZ32/BHZ32/BHSZ32
Add more `Pat`s to generate BLZ32/BLSZ32/BHZ32/BHSZ32.
Reviewed By: zixuan-wu
Differential Revision: https://reviews.llvm.org/D153607
Ben Shi [Thu, 22 Jun 2023 10:39:08 +0000 (18:39 +0800)]
[CSKY] Optimize IR pattern icmp-select with DECT32/DECF32
Reviewed By: zixuan-wu
Differential Revision: https://reviews.llvm.org/D153518
Matthias Springer [Mon, 3 Jul 2023 06:49:59 +0000 (08:49 +0200)]
[mlir][transform] Add `transform.apply_cse` op
This op applies CSE to the targeted op. This is similar to `transform.apply_registered_pass "cse"`, but it retains handles in the body of the targeted op.
Differential Revision: https://reviews.llvm.org/D154099
Matthias Springer [Mon, 3 Jul 2023 06:42:14 +0000 (08:42 +0200)]
[mlir][Transforms][NFC] CSE: Add C++ entry point
* All IR modifications are done with a rewriter.
* The new C++ entry point takes a `RewriterBase &`, which may have a listener attached to it.
This revision is useful because it allows users to run CSE and track IR modifications via a listener that can be attached to the rewriter.
This is a reupload. The original CL was reverted (
9979417d4db4) due to a memory leak. The memory leak is unrelated to this change and fixed with D154185.
Differential Revision: https://reviews.llvm.org/D145226
Matthias Springer [Mon, 3 Jul 2023 06:35:20 +0000 (08:35 +0200)]
[mlir][IR] Fix memory leak in DominanceInfo
Differential Revision: https://reviews.llvm.org/D154185
Jie Fu [Mon, 3 Jul 2023 06:14:48 +0000 (14:14 +0800)]
[flang] Fix -Wstring-conversion in PPCIntrinsicCall.cpp (NFC)
/Users/jiefu/llvm-project/flang/lib/Optimizer/Builder/PPCIntrinsicCall.cpp:617:14: error: implicit conversion turns string literal into bool: 'const char[39]' to 'bool' [-Werror,-Wstring-conversion]
assert("Invalid vector operation for generator");
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kelvin Li [Mon, 26 Jun 2023 15:45:35 +0000 (11:45 -0400)]
[flang] Add PowerPC vec_cmpge, vec_cmpgt, vec_cmple, vec_cmplt and vec_any_ge intrinsic
Differential Revision: https://reviews.llvm.org/D154167
Chuanqi Xu [Mon, 3 Jul 2023 02:39:07 +0000 (10:39 +0800)]
[Coroutines] Prevent infinite loop in simplifyTerminatorLeadingToRet
Close https://github.com/llvm/llvm-project/issues/63639
This comes from the oversight the refactoring that we missed a `return
false;` in the loop.
Freddy Ye [Mon, 3 Jul 2023 00:12:25 +0000 (08:12 +0800)]
[X86] Add missing features for ivybridge, sandybridge and knl in X86TargetParser.def.
This is also a pre-commit change for D151696
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D154209
Alfred Persson Forsberg [Mon, 3 Jul 2023 00:07:59 +0000 (01:07 +0100)]
[libc] Correct usage of __unix__ and __linux__
Reviewed By: michaelrj, thesamesam
Differential Revision: https://reviews.llvm.org/D153729
Eugene Zhulenev [Sun, 2 Jul 2023 23:11:28 +0000 (16:11 -0700)]
[mlir] Use reinterpret cast to construct TypedValue from a pointer
Value is not convertible to TypedValue<T>, use explicit constructor from a pointer
Differential Revision: https://reviews.llvm.org/D154313
Eugene Zhulenev [Sun, 2 Jul 2023 22:47:30 +0000 (15:47 -0700)]
[mlir] Specialize DenseMapInfo and PointerLikeTypeTraits for mlir::TypedValue
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D154310
Maurice Heumann [Sun, 2 Jul 2023 19:18:50 +0000 (12:18 -0700)]
[ARM] Adjust strd/ldrd codegen alignment requirements
In change https://reviews.llvm.org/D152790, it was discovered that the
alignment requirement calculation for LDRD/STRD codegen was suboptimal
and the calculation for volatile loads and stores was adjusted.
This change here adopts the calculation for the remaining non-volatile
occurances.
Differential Revision: https://reviews.llvm.org/D153800
Eli Friedman [Fri, 30 Jun 2023 22:31:47 +0000 (15:31 -0700)]
[clang][CodeGen] Fix global variables initialized with an inheriting constructor.
For inheriting constructors which have to be emitted inline, we use
CodeGenFunction::EmitInlinedInheritingCXXConstructorCall to emit the
required code. This code uses EmitParmDecl to emit the "this" argument
of the call. EmitParmDecl then helpfully calls llvm::Value::setName to
name the parameter... which renames the global variable to "this".
To fix the issue, skip the setName call on globals.
The renaming still has slightly weird results in other cases (it renames
all local variables initialized with an inlined inheriting constructor
to "this"), but the result isn't actually wrong in those cases, so I'm
just going to leave it for now.
Fixes https://github.com/llvm/llvm-project/issues/63618
Differential Revision: https://reviews.llvm.org/D154270
Florian Hahn [Sun, 2 Jul 2023 21:17:16 +0000 (22:17 +0100)]
[LV] Add test case for #63602.
Aaron Ballman [Sun, 2 Jul 2023 18:40:21 +0000 (14:40 -0400)]
[C11] Correct global atomic pointer initialization from an integer constant
This is a follow-up to
2e275e24355cb224981f9beb2b026a3169fc7232 and
1395cde24b3641e284bb1daae7d56c189a2635e3 which corrects a missed case:
initializing an _Atomic(T *) from a null pointer constant in the form
of the integer literal 0.
Fixes https://github.com/llvm/llvm-project/issues/63550
Differential Revision: https://reviews.llvm.org/D154284
Sergei Barannikov [Sun, 2 Jul 2023 15:38:53 +0000 (18:38 +0300)]
Revert "[MC] Allow conversion between ParseStatus and MatchOperandResultTy"
This reverts commit
15ef9b26adeb8c9dd98228fc26757966d8355986.
Going to put it for review with larger set of differences.
Yaxun (Sam) Liu [Fri, 30 Jun 2023 12:36:26 +0000 (08:36 -0400)]
[AMDGPU] Rename predefined macro __AMDGCN_WAVEFRONT_SIZE
rename it to __AMDGCN_WAVEFRONT_SIZE__ for consistency.
__AMDGCN_WAVEFRONT_SIZE will be deprecated in the future.
Reviewed by: Matt Arsenault, Johannes Doerfert
Differential Revision: https://reviews.llvm.org/D154207
Amirreza Ashouri [Sun, 2 Jul 2023 14:54:20 +0000 (16:54 +0200)]
Fix typo "__is_parititioned_impl" to "__is_partitioned_impl"
A typo has been fixed
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D154296
Youngsuk Kim [Sun, 2 Jul 2023 14:40:00 +0000 (10:40 -0400)]
[clang] Remove CGBuilderTy::CreateElementBitCast
`CGBuilderTy::CreateElementBitCast()` no longer does what its name suggests.
Remove remaining in-tree uses by one of the following methods.
* drop the call entirely
* fold it to an `Address` construction
* replace it with `Address::withElementType()`
This is a NFC cleanup effort.
Reviewed By: barannikov88, nikic, jrtc27
Differential Revision: https://reviews.llvm.org/D154285
David Green [Sun, 2 Jul 2023 14:02:52 +0000 (15:02 +0100)]
[DAG][AArch64] Handle vector types when expanding sdiv/udiv into mulh
The aarch64 backend will benefit from expanding 64vector sdiv/udiv into mulh
using shift(mul(ext, ext)), as the larger type size is legal and the mul(ext,
ext) can efficiently use smull/umull instructions. This extends the existing
code in GetMULHS to handle vector types for it.
Differential Revision: https://reviews.llvm.org/D154049
Simon Pilgrim [Sun, 2 Jul 2023 11:43:44 +0000 (12:43 +0100)]
[GlobalIsel][X86] Add initial scalar G_MUL/G_SMULH/G_UMULH instruction selection handling
Reuse the existing div/rem selection code to also handle mul/imul to support G_MUL/G_SMULH/G_UMULH, as they have a similar pattern using rDX/rAX for mulh/mul results, plus the AH/AL support for i8 multiplies.
David Green [Sun, 2 Jul 2023 11:44:15 +0000 (12:44 +0100)]
[AArch64] Expand typesizes of tests for constant srem/urem. NFC
See D154049.
Rainer Orth [Sun, 2 Jul 2023 11:27:04 +0000 (13:27 +0200)]
[sanitizer_common][test] Fix huge_malloc.c UNSUPPORTED syntax
`lit` doesn't accept arbitrary substrings of the target triple any longer,
so
d5a779b5a39b655ed9fafedaacbb017c46f5dbfe
<https://reviews.llvm.org/rGd5a779b5a39b655ed9fafedaacbb017c46f5dbfe> has
no effect.
Instead, this patch uses the `target=` syntax as all other tests in
`compiler-rt`.
Tested on `amd64-pc-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D154298
David Green [Sun, 2 Jul 2023 10:17:59 +0000 (11:17 +0100)]
[AArch64] Ensure BICi and ORRi have same input and output types. NFC
Timm Bäder [Fri, 30 Jun 2023 09:50:22 +0000 (11:50 +0200)]
[llvm][NFC] Stop plenking in an assertion message
Remove whitespace before an exclamation mark.
Timm Bäder [Sat, 1 Jul 2023 14:54:10 +0000 (16:54 +0200)]
[clang][Sema][NFC] Make worklist in CheckForIntOverflow const
Timm Bäder [Fri, 30 Jun 2023 19:09:16 +0000 (21:09 +0200)]
[clang][Interp][NFC] Fix a test to actually test something
This was always meant to test the values of c2, not c.
Haohai Wen [Sun, 2 Jul 2023 01:28:30 +0000 (09:28 +0800)]
[Driver][MSVC] Move lld specific flags before inputs
Check linker earlier so that lld specific flags can be append before
inputs. Just like position of other flags. The intention is to make
expanded cmd more consistent and elegent so that user can easily
look for inputs when using -###.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D154176
Yuanfang Chen [Sun, 2 Jul 2023 00:19:38 +0000 (17:19 -0700)]
[clang] P1816R0 and P2082R1 should work for cxx20 and after only
For commit
632dd6a4ca0036009f
Igor Kudrin [Sat, 1 Jul 2023 21:45:59 +0000 (14:45 -0700)]
[AArch64] Emit fewer CFI instructions for synchronous unwind tables
The instruction-precise, or asynchronous, unwind tables usually take up
much more space than the synchronous ones. If a user is concerned about
the load size of the program and does not need the features provided
with the asynchronous tables, the compiler should be able to generate
the more compact variant.
This patch changes the generation of CFI instructions for these cases so
that they all come in one chunk in the prolog; it emits only one
`.cfi_def_cfa*` instruction followed by `.cfi_offset` ones after all
stack adjustments and register spills, and avoids generating CFI
instructions in the epilog(s) as well as any other exceeding CFI
instructions like `.cfi_remember_state` and `.cfi_restore_state`.
Effectively, it reverses the effects of D111411 and D114545 on functions
with the `uwtable(sync)` attribute. As a side effect, it also restores
the behavior on functions that have neither `uwtable` nor `nounwind`
attributes.
Differential Revision: https://reviews.llvm.org/D153098
Sergei Barannikov [Sat, 1 Jul 2023 21:43:16 +0000 (00:43 +0300)]
[MC] Allow conversion between ParseStatus and MatchOperandResultTy
This allows a smooth transition to ParseStatus.
David Green [Sat, 1 Jul 2023 20:59:54 +0000 (21:59 +0100)]
[AArch64] Treat the icmp in icmp(and(..), 0) as free
As in https://godbolt.org/z/4dafd9Geq, the icmp from an And may use an Ands to
set flags, meaning the icmp is free.
This could also be done for add/sub, but those patterns often happen in the
induction variable of a loop, making them quite performance sensitive.
Differential Revision: https://reviews.llvm.org/D153611
Thurston Dang [Sat, 1 Jul 2023 20:27:11 +0000 (20:27 +0000)]
Revert "[msan] Intercept dladdr1, and refactor dladdr"
Reverting my commit because of buildbot breakage.
This reverts commit
d0b0dbeae17756f7ba99e0867cfb867fcb375066.
Thurston Dang [Fri, 30 Jun 2023 23:08:20 +0000 (23:08 +0000)]
[msan] Intercept dladdr1, and refactor dladdr
This patch adds an msan interceptor for dladdr1 (with support
for RTLD_DL_LINKMAP and RTLD_DL_SYMENT) and an accompanying
test. It also adds a helper file, msan_dl.cpp, that contains
UnpoisonDllAddrInfo (refactored out of the dladdr interceptor)
and UnpoisonDllAddr1ExtraInfo.
Differential Revision: https://reviews.llvm.org/D154272
Evandro Menezes [Sat, 1 Jul 2023 18:26:14 +0000 (13:26 -0500)]
[AArch64] Remove duplicate code (NFC)
Remove multiple versions of the predicate that checks if the
instruction operand is shifted by up to 4.
Petr Hosek [Thu, 29 Jun 2023 06:48:10 +0000 (06:48 +0000)]
[libc] Missing FEnvImpl.h dependency on math.h
FEnvImpl.h includes math.h and so needs an explicit dependency.
Differential Revision: https://reviews.llvm.org/D154044
Sergei Barannikov [Sat, 1 Jul 2023 02:11:31 +0000 (05:11 +0300)]
[RISCV] Add a test with unknown argument of .attribute directive
Evandro Menezes [Thu, 22 Jun 2023 23:40:53 +0000 (18:40 -0500)]
[AArch64] Add scheduling model for Neoverse N1
Add the scheduling model for Neoverse N1.
Differential revision: https://reviews.llvm.org/D152417
Piotr Zegar [Sat, 1 Jul 2023 16:20:36 +0000 (16:20 +0000)]
[clang-tidy] Correct sizeof/alignas handling in misc-redundant-expression
Fixed issue with the comparison of UnaryExprOrTypeTraitExpr
objects in which only the argument type was checked, without
considering the kind of expression. This led to false positives when
using sizeof(x) and alignof(x) expressions, as only the
comparison x = x was performed without checking if sizeof
was equal to alignof.
Fixes: https://github.com/llvm/llvm-project/issues/63096
Reviewed By: Izaron
Differential Revision: https://reviews.llvm.org/D152713
Piotr Fusik [Sat, 1 Jul 2023 11:33:48 +0000 (13:33 +0200)]
[libc++] Implement stringbuf members of P0408R7 (Efficient Access to basic_stringbuf's Buffer)
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D153709
Mark de Wever [Sat, 1 Jul 2023 10:37:02 +0000 (12:37 +0200)]
[libc++][doc] Updates spaceship status.
Work on the missing chrono parts has started, but their operators will
be added in different patches. So split the remaining chrono part to one
entry per line and mark them in progress.
Mark de Wever [Fri, 30 Jun 2023 15:33:47 +0000 (17:33 +0200)]
[libc++] Enables constexpr string tests.
These tests were disabled during constant evaluation in D90569. At that
time constexpr string was not implemented. It now is.
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D154227
Mike Crowe [Sat, 1 Jul 2023 08:40:20 +0000 (08:40 +0000)]
[clang-tidy] Improve documentation for modernize-use-std-print check
Remove incorrect use of double colons so that the code blocks are
rendered correctly to HTML.
Wrap the name of another check in single backticks. Wrap the name of a
macro in double backticks.
Explain that with the default settings the check is only enabled with
C++23 or later standards.
Correct std::string_data() to std::string::data().
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D154151
Haojian Wu [Sat, 1 Jul 2023 06:33:45 +0000 (08:33 +0200)]
[LTO] Fix a missing comment
Address a missing code-review comment: https://reviews.llvm.org/D154191#inline-1490951
Haojian Wu [Sat, 1 Jul 2023 06:27:26 +0000 (08:27 +0200)]
Haojian Wu [Fri, 30 Jun 2023 08:38:59 +0000 (10:38 +0200)]
[LTO] Replace llvm::writeFileAtomically with llvm::writeToOutput API.
Vincent Lee [Thu, 29 Jun 2023 22:05:56 +0000 (15:05 -0700)]
[FuncSpec] Avoid crashing when SwitchInst doesn't see ConstantInt
D150464 updated the cost model for function specialization. Unfortunately, this
also crashes when trying to build stage2 LLD with thinLTO and assertions. It looks
like the issue is caused by a mishandling of the Constant in a SwitchInst since the
Constant cannot always be assumed to safely casted to a ConstantInt. In the case
of the crash, Constant was a ConstantExpr which triggered the assertion.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D154159
Evandro Menezes [Sat, 1 Jul 2023 02:37:12 +0000 (21:37 -0500)]
[AArch64] Remove duplicate code (NFC)
Sergei Barannikov [Thu, 29 Jun 2023 14:22:41 +0000 (17:22 +0300)]
[MC] Add three-state parseDirective as a replacement for ParseDirective
Conventionally, parsing methods return false on success and true on
error. However, directive parsing methods need a third state: the
directive is not target specific. AsmParser::parseStatement detected
this case by using a fragile heuristic: if the target parser did not
consume any tokens, the directive is assumed to be not target-specific.
Some targets fail to follow the convention: they return success after
emitting an error or do not consume the entire line and return failure
on successful parsing. This was partially worked around by checking for
pending errors in parseStatement.
This patch tries to improve the situation by introducing parseDirective
method that returns ParseStatus -- three-state class. The new method
should eventually replace the old one returning bool.
ParseStatus is intentionally implicitly constructible from bool to allow
uses like `return Error(Loc, "message")`. It also has a potential to
replace OperandMatchResulTy as it is more convenient to use due to the
implicit construction from bool and more type safe.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D154101
Jason Molenda [Sat, 1 Jul 2023 01:26:06 +0000 (18:26 -0700)]
Change the dyld notification function that lldb puts a breakpoint in
On Darwin systems, the dynamic linker dyld has an empty function
it calls when binaries are added/removed from the process. lldb puts
a breakpoint on this dyld function to catch the notifications. The
function arguments are used by lldb to tell what is happening.
The linker has a natural representation when the addresses of
binaries being added/removed are in the pointer size of the process.
There is then a second function where the addresses of the binaries
are in a uint64_t array, which the debugger has been using before -
dyld allocates memory for the array, copies the values in to it,
and calls it for lldb's benefit.
This changes to using the native notifier function, with pointer-sized
addresses.
Differential Revision: https://reviews.llvm.org/D139453
Haohai Wen [Sat, 1 Jul 2023 00:58:56 +0000 (08:58 +0800)]
[lld/COFF] Add /dwodir to enable DWARF fission with LTO
This patch added /dwodir to lld/COFF which is equivalent to lld/ELF
option -plugin-opt=dwo_dir=. This option tells LTO backend to create
dwo directory and files and all dwo files will be in it. Otherwise all
dwarf sections will be embeded into image even if -gsplit-dwarf is
specified when using LTO.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D154070