Aiden Grossman [Mon, 3 Jul 2023 20:16:56 +0000 (13:16 -0700)]
[llvm-exegesis] Disable tests requiring the subprocess executor
This patch temporarily disables tests that require the subprocess
executor as they are currently flaky on systems that are able to run
them such as clang-cmake-x86_64-avx512-linux. Once I have a fix for the
flakiness they will be reenabled.
Peter Klausler [Thu, 29 Jun 2023 21:02:18 +0000 (14:02 -0700)]
[flang] Check constant POS/LEN arguments IBITS even when not both constant
Apply compile-time checks to the values supplied for the POS and LEN
arguments of the IBITS intrinsic function even when only one of them
is a known constant.
Differential Revision: https://reviews.llvm.org/D154376
Peter Klausler [Wed, 28 Jun 2023 23:38:08 +0000 (16:38 -0700)]
[flang] Fix overflow detection for folding SUM/PRODUCT
The overflow detection code in the templates that fold SUM and PRODUCT
was checking for overflow before performing the reduction, not after.
Fix and add tests.
Differential Revision: https://reviews.llvm.org/D154374
Johannes Doerfert [Mon, 3 Jul 2023 19:47:31 +0000 (12:47 -0700)]
[Polly][FIX] Adjust enum after D153305
Johannes Doerfert [Mon, 3 Jul 2023 06:48:02 +0000 (23:48 -0700)]
[Attributor] Use the right argument number (call site vs callee)
Peter Klausler [Wed, 28 Jun 2023 21:55:09 +0000 (14:55 -0700)]
[flang] More actual argument warnings
Emit warnings when CHARACTER lengths or array sizes of actual
and dummy arguments mismatch in risky ways.
Differential Revision: https://reviews.llvm.org/D154370
Louis Dionne [Wed, 28 Jun 2023 14:45:39 +0000 (10:45 -0400)]
[libc++] Remove support for .fail.cpp tests
We want to move away from those tests and towards explicit .verify.cpp
tests, since those have a simpler model.
Differential Revision: https://reviews.llvm.org/D153982
Christopher Bate [Fri, 30 Jun 2023 22:04:08 +0000 (16:04 -0600)]
[mlir][Conversion/GPUCommon] Fix bug in conversion of `math` ops
The common GPU operation transformation that lowers `math` operations
to function calls in the `gpu-to-nvvm` and `gpu-to-rocdl` passes handles
`vector` types by applying the function to each scalar and returning a
new vector. However, there was a typo that results in incorrectly
accumulating the result vector, and the rewrite returns an `llvm.mlir.undef`
result instead of the correct vector. A patch is added and tests are
strengthened.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D154269
Zhixun Tan [Mon, 3 Jul 2023 19:20:18 +0000 (12:20 -0700)]
[mlir][dataflow] Unify dependency management in AnalysisState.
In the MLIR dataflow analysis framework, when an `AnalysisState` is updated, it's dependents are enqueued to be visited.
Currently, there are two ways dependents are managed:
* `AnalysisState::dependents` stores a list of dependents. `DataFlowSolver::propagateIfChanged()` reads this list and enqueues them to the worklist.
* `AnalysisState::onUpdate()` allows custom logic to enqueue more to the worklist. This is called by `DataFlowSolver::propagateIfChanged()`.
This cleanup diff consolidates the two into `AnalysisState::onUpdate()`. This way, `DataFlowSolver` does not need to know the detail about `AnalysisState::dependents`, and the logic of dependency management is entirely handled by `AnalysisState`.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D154170
Peter Klausler [Mon, 3 Jul 2023 16:53:20 +0000 (09:53 -0700)]
[flang] Prevent lowering crash by properly updating symbol pointer
Kind of an edge case. When a MODULE FUNCTION or SUBROUTINE
interface is defined by a MODULE PROCEDURE in the same program
unit, ensure that the symbol table pointer in the parse tree is
updated to point to the SubprogramDetails symbol for the
interface, and not left pointing to what should soon become
a dead SubprogramNameDetails symbol.
Differential Revision: https://reviews.llvm.org/D154380
Johannes Doerfert [Fri, 30 Jun 2023 22:12:24 +0000 (15:12 -0700)]
[Attributor][NFCI] Move attribute collection and manifest to Attributor
Before, we checked and manifested attributes right in the IR. This was
bad as we modified the IR before the manifest stage. Now we can
add/remove/inspect attributes w/o going to the IR (except for the
initial query).
Johannes Doerfert [Mon, 3 Jul 2023 18:30:36 +0000 (11:30 -0700)]
[Attributor][NFCI] Manifest assumption attributes explicitly
We had some custom manifest for assumption attributes but we use the
generic manifest logic. If we later decide to curb duplication (of
attributes on the call site and callee), we can do that at a single
location and for all attributes.
The test changes basically add known `llvm.assume` callee information to
the call sites.
Johannes Doerfert [Fri, 30 Jun 2023 22:56:08 +0000 (15:56 -0700)]
[Attributor][NFCI] Merge MemoryEffects explicitly
We had some custom handling for existing MemoryEffects but we now move
it to the place we check other existing attributes before we manifest
new ones. If we later decide to curb duplication (of attributes on the
call site and callee), we can do that at a single location and for all
attributes.
The test changes basically add known `memory` callee information to the
call sites.
Med Ismail Bennani [Mon, 3 Jul 2023 18:48:11 +0000 (11:48 -0700)]
[lldb] Fix data race when interacting with python scripts
This patch should fix some data races when a python script (i.e. a
Scripted Process) has a nested call to another python script (i.e. a
OperatingSystem Plugin), which can cause concurrent writes to the python
lock count.
This patch also fixes a data race happening when resetting the operating
system unique pointer.
To address these issues, both accesses is guarded by a mutex.
rdar://
109413039
Differential Revision: https://reviews.llvm.org/D154271
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Alex Langford [Tue, 27 Jun 2023 20:48:27 +0000 (13:48 -0700)]
[lldb][NFCI] Target::StopHook::GetDescription should take a Stream ref instead of pointer
We always assume that this is valid anyway, might as well take a
reference.
Differential Revision: https://reviews.llvm.org/D153917
Peter Klausler [Thu, 29 Jun 2023 22:19:23 +0000 (15:19 -0700)]
[flang][runtime] Allow OPEN(n,ENCODING=) to change the encoding
OPEN statements can be used to change some, but not all, attributes
of units that have already been opened. The I/O runtime library
wasn't allowing ENCODING= to be changed. Every other Fortran compiler
permits this usage, and it's safe and useful, so allow it.
(Otherwise there's no good way to ensure that the preconnected
unit 6 is in UTF-8 mode.)
Differential Revision: https://reviews.llvm.org/D154379
Peter Klausler [Thu, 29 Jun 2023 20:03:14 +0000 (13:03 -0700)]
[flang][NFC] Document semantics of an ambiguous/non-portable use case
We intentionally process NAMELIST groups in a scope after having
resolved all of the names in that scope. This means that a name
whose first appearance in a scope is in the NAMELIST group resolves
to a local object, if any, rather than to any host associated object.
The standard is unclear on this point, and there is no clear
precedent in other compilers.
This patch doesn't implement this choice -- that was done long ago --
but just documents the behavior in Extensions.md.
Differential Revision: https://reviews.llvm.org/D154375
Peter Klausler [Wed, 28 Jun 2023 23:08:54 +0000 (16:08 -0700)]
[flang] Warn about overflow after folding HYPOT
The code that folds the intrinsic function HYPOT was neglecting to
warn the programmer about overflow when it occurs.
Differential Revision: https://reviews.llvm.org/D154371
Alex Langford [Tue, 27 Jun 2023 22:51:27 +0000 (15:51 -0700)]
[lldb] Introduce a macro to mark methods as unsupported with no replacement
We already have LLDB_DEPRECATED which is used to mark methods as
deprecated with a message and an alternative to use instead. This is
expresses an intent of "We recognize this functionality is useful but
there are some pitfalls with the interface we have exposed."
In other cases, there are no "alternative" methods to use and the code should be
refactored to avoid using a method entirely. For example,
`SBValue::Cast` should be avoided in favor of using the expression
evaluator to perform a cast. There isn't a mechanical solution, the
recommendation is to instead refactor your code.
This commit renames the existing `LLDB_DEPRECATED` to
`LLDB_DEPRECATED_FIXME`, and adds a `LLDB_DEPRECATED` macro to cover the
second scenario.
Differential Revision: https://reviews.llvm.org/D153928
Alex Langford [Tue, 27 Jun 2023 01:13:38 +0000 (18:13 -0700)]
[lldb][NFCI] Remove use of ConstString from ProcessElfCore
I'm not convinced that it makes sense for the paths to be ConstStrings. We're
going to be putting them into FileSpecs (which are backed by
ConstStrings, for now) but otherwise there's no need to store them as
ConstStrings upfront.
Differential Revision: https://reviews.llvm.org/D153827
Florian Hahn [Mon, 3 Jul 2023 17:57:30 +0000 (18:57 +0100)]
[LSR] Add test for another normalization miscompile.
Based on @peixin test case shared in D153004.
Peter Klausler [Thu, 22 Jun 2023 18:28:47 +0000 (11:28 -0700)]
[flang][NFC] Add F2023X documentation
Add a document that summarizes Fortran 202X's upcoming
features and their urgency for implementation.
Differential Revision: https://reviews.llvm.org/D153916
Johannes Doerfert [Mon, 3 Jul 2023 06:49:18 +0000 (23:49 -0700)]
[Attributor] Ensure we call the specialized isImpliedByIR
Before we ended up not calling the specialized AAType::isImpliedByIR but
the generic IRAttribute::isImpliedByIR in the IRAttribute::initialize
function.
Johannes Doerfert [Fri, 30 Jun 2023 17:49:06 +0000 (10:49 -0700)]
[Attributor][NFC] Check for the Explorer first to avoid traversing uses
Johannes Doerfert [Fri, 30 Jun 2023 22:54:58 +0000 (15:54 -0700)]
[Attributor][NFC] Exit manifestAttrs early if there are no attributes
Johannes Doerfert [Thu, 15 Jun 2023 04:44:24 +0000 (21:44 -0700)]
[MemoryEffects][NFCI] Make the MemoryEffects class reusable
In a follow up we will reuse the logic in MemoryEffectsBase to merge
AAMemoryLocation and AAMemoryBehavior without duplicating all the bit
fiddling code already available in MemoryEffectsBase.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D153305
Alex Langford [Tue, 27 Jun 2023 00:57:48 +0000 (17:57 -0700)]
[lldb][NFCI] Change return type of GetProcessPluginName
Instead of just returning a raw `const char *`, I think llvm::StringRef
would make more sense. Most of the time that we use the return value of
`GetProcessPluginName` we're passing it to `CreateProcess` which takes a
StringRef anyway.
Differential Revision: https://reviews.llvm.org/D153825
Slava Zakharin [Mon, 3 Jul 2023 15:41:28 +0000 (08:41 -0700)]
[flang][hlfir] Evaluate actual args before impure elemental calls.
Actual argument expressions must be evaluated before the invocation
of the sequence of per-element calls of an impure elemental subprogram.
Otherwise, the side effects of the calls may affect the input for
the consequent elements.
The proposed changes are described by Jean in D154174.
Reviewed By: tblah
Differential Revision: https://reviews.llvm.org/D154263
Kiran Chandramohan [Mon, 3 Jul 2023 16:48:12 +0000 (16:48 +0000)]
[Flang] Mark as maybe_unused to fix warning in PPCIntrinsicCall.cpp
Florian Hahn [Mon, 3 Jul 2023 16:49:35 +0000 (17:49 +0100)]
[LV] Prepare tests for D154261.
Update trip count of test in
pr56319-vector-exit-cond-optimization-epilogue-vectorization.ll to
make sure epilogue vectorization will still trigger after D154261,
checking for the original issue.
Move the original test to limit-vf-by-tripcount.ll for testing new
functionality of D154261.
Dmitriy Smirnov [Mon, 3 Jul 2023 16:31:20 +0000 (16:31 +0000)]
[Flang][OpenMP] Lower allocatable or pointer in private clause
This patch lowers allocatables and pointers named in "private" OpenMP clause.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D148570
Jorge Pinto Sousa [Mon, 3 Jul 2023 16:39:31 +0000 (16:39 +0000)]
[clang-tidy] Accessing checks not done for aliases of `std::array`
Index accessing checks are not performed for aliases
of `std::array`, as only `std::array` itself seems to be checked.
This patch aims to extend it for aliases such as:
`using MyArray = std::array<int, 10>;`
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D154297
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