466374 Commits

Author SHA1 Message Date
Alex Langford
b709149b76 [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
2023-07-03 11:39:38 -07:00
Peter Klausler
c9b31dae56
[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
2023-07-03 11:28:28 -07:00
Peter Klausler
2163e662c6
[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
2023-07-03 11:22:14 -07:00
Peter Klausler
b2b43794b9
[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
2023-07-03 11:21:32 -07:00
Alex Langford
ebec53e2d7 [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
2023-07-03 11:17:48 -07:00
Alex Langford
e3921b8bff [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
2023-07-03 11:13:50 -07:00
Florian Hahn
02591d26b9
[LSR] Add test for another normalization miscompile.
Based on @peixin test case shared in D153004.
2023-07-03 18:57:31 +01:00
Peter Klausler
eb5ffa58f5
[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
2023-07-03 10:18:34 -07:00
Johannes Doerfert
8babebe8d5 [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.
2023-07-03 10:07:07 -07:00
Johannes Doerfert
41086f38ec [Attributor][NFC] Check for the Explorer first to avoid traversing uses 2023-07-03 10:07:03 -07:00
Johannes Doerfert
24fc579f57 [Attributor][NFC] Exit manifestAttrs early if there are no attributes 2023-07-03 10:07:03 -07:00
Johannes Doerfert
a90ac20c52 [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
2023-07-03 10:07:03 -07:00
Alex Langford
1b102886c0 [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
2023-07-03 10:03:49 -07:00
Slava Zakharin
b5fa9af4ae [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
2023-07-03 10:01:26 -07:00
Kiran Chandramohan
06c3607a6e [Flang] Mark as maybe_unused to fix warning in PPCIntrinsicCall.cpp 2023-07-03 16:51:39 +00:00
Florian Hahn
e561edaaa5
[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.
2023-07-03 17:49:36 +01:00
Dmitriy Smirnov
bc4586da6e [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
2023-07-03 16:46:02 +00:00
Jorge Pinto Sousa
ce2d44b0ab [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
2023-07-03 16:43:08 +00:00
Mike Crowe
2806cf4b54 [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
2023-07-03 16:39:04 +00:00
Alex Langford
a2ff2921e8 [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
2023-07-03 09:35:24 -07:00
Alex Langford
673f91055a [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
2023-07-03 09:31:10 -07:00
Peter Klausler
7871deb821
[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
2023-07-03 09:07:00 -07:00
Matthias Springer
de9caf2f32 [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
2023-07-03 18:03:35 +02:00
Christudasan Devadasan
aa82b562b7 [CodeGen] MRI call back in TargetMachine
It is needed for target specific initializatons.

Reviewed By: qcolombet

Differential Revision: https://reviews.llvm.org/D143758
2023-07-03 21:29:37 +05:30
Yashwant Singh
0f58cfeb9f [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
2023-07-03 21:19:09 +05:30
Christian Ulmann
a3e48ad9b8 [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.
2023-07-03 15:16:02 +00:00
Kadir Cetinkaya
9841daf270
[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
2023-07-03 16:58:04 +02:00
David Truby
a51fba6b0f [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.
2023-07-03 15:55:06 +01:00
Paul Walker
c9eec3b085 [SVE] Extend incp/decp testing to cover 32-bit use cases. 2023-07-03 15:36:56 +01:00
Joel E. Denny
6e127c6f29 [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
2023-07-03 10:23:38 -04:00
Mariya Podchishchaeva
2d4f289082 [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
2023-07-03 10:15:40 -04:00
Balazs Benics
23ed601ae1 [NFC] Fix typo explicitly_convertable -> explicitly_convertible
Differential Revision: https://reviews.llvm.org/D152891
2023-07-03 16:13:13 +02:00
David Spickett
ab3bb86d44 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.
2023-07-03 14:05:49 +00:00
Louis Dionne
29f4c39871 [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
2023-07-03 09:44:05 -04:00
Louis Dionne
b82dcb624e [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
2023-07-03 09:41:03 -04:00
Louis Dionne
60a6a0d17a [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
2023-07-03 09:40:09 -04:00
Matthias Springer
fa1a23a720 [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
2023-07-03 15:28:53 +02:00
Florian Hahn
c14b0a7c55
[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.
2023-07-03 14:16:47 +01:00
Simon Pilgrim
d9634205d9 [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
2023-07-03 14:04:50 +01:00
Felipe de Azevedo Piovezan
f292ca1362 [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
2023-07-03 08:36:57 -04:00
Felipe de Azevedo Piovezan
379b59d1b0 [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
2023-07-03 08:35:55 -04:00
Ankur
8e9145e431 [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
2023-07-03 17:32:30 +05:30
Leandro Lupori
783222efde [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
2023-07-03 08:59:53 -03:00
Sergei Barannikov
32e5d6173f [RISCV] Use parseDirective returning ternary status (NFC)
The new method was introduced in D154101.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D154276
2023-07-03 14:48:11 +03:00
Adrian Kuegel
630b8d36c0 [mlir][Bazel] Add missing dependencies after 564713c47175d9f61fe8e18e750fb7f7b486d533 2023-07-03 13:16:28 +02:00
Sedenion
899c867794 [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
2023-07-03 11:54:33 +01:00
Quentin Colombet
cf244b55c3 [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
2023-07-03 12:47:22 +02:00
Igor Kirillov
b4f9c3a933 [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
2023-07-03 10:35:14 +00:00
Aleksandr Popov
22f2173837 [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
2023-07-02 09:23:43 +02:00
Cullen Rhodes
564713c471 [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
2023-07-03 10:18:43 +00:00