Argyrios Kyrtzidis [Wed, 8 Feb 2023 23:34:44 +0000 (15:34 -0800)]
[CMake] Use `LLVM_ENABLE_ASSERTIONS` to enable assertions in `libc++`
Follow-up to https://reviews.llvm.org/
D142279 for also enabling `libc++` assertions.
This is particularly useful to recover the assertion checks we had with `llvm::Optional`, before moving to `std::optional`.
Differential Revision: https://reviews.llvm.org/
D143612
Augusto Noronha [Sat, 11 Feb 2023 01:32:48 +0000 (17:32 -0800)]
[lldb] Fix passing None as an env variable in TestMultipleDebuggers
Augusto Noronha [Fri, 10 Feb 2023 19:21:14 +0000 (11:21 -0800)]
Adapt TestCustomShell and TestMultipleDebuggers to run under ASAN
In situations where only LLDB is ASANified, a false positive occurs
unless ASAN_OPTIONS=detect_container_overflow=0 is set in the
environment.
Differential Revision: https://reviews.llvm.org/
D143772
Jonas Devlieghere [Fri, 10 Feb 2023 19:55:02 +0000 (11:55 -0800)]
[lldb] Add an SB API to get progress events as SBStructuredData
This is a preparatory patch to add an SB API to get the progress data as
SBStructuredData. The advantage of using SBStructuredData is that the
dictionary can grow over time with more fields.
This approach is identical to the way this is implemented for diagnostic
events.
Differential revision: https://reviews.llvm.org/
D143687
Peiming Liu [Thu, 9 Feb 2023 20:31:51 +0000 (20:31 +0000)]
[mlir][sparse] implement lowering rules for sparse_tensor::unpack
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/
D143672
Peiming Liu [Thu, 9 Feb 2023 19:08:36 +0000 (19:08 +0000)]
[mlir][sparse] introduce sparse_tensor::unpack operation
An inverse operation of sparse_tenosr::pack
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/
D143669
Louis Dionne [Sat, 11 Feb 2023 00:46:55 +0000 (16:46 -0800)]
[libc++] Remove unused std::function test
We don't support std::function in C++03 anymore, and the test had
started failing due to compilation errors instead of the ABI bug it
was supposed to demonstrate.
Fangrui Song [Sat, 11 Feb 2023 00:48:34 +0000 (16:48 -0800)]
[dfsan] Fix some build-libc-list.py lint issues
Aart Bik [Thu, 9 Feb 2023 21:55:18 +0000 (13:55 -0800)]
[mlir][sparse] fixed pack op documentation and purity
Example did not have correct shapes. Also the operation
has no side effects (since it slaps a clean SSA tensor
around the data).
Reviewed By: Peiming, wrengr
Differential Revision: https://reviews.llvm.org/
D143679
Marco Elver [Fri, 10 Feb 2023 23:31:52 +0000 (00:31 +0100)]
[SanitizerBinaryMetadata] Fix ignorelist test with -Assert
%clang and %clang_cc1 have different behaviour, and with -Assert %clang
seems to not match +Assert behaviour. Fix it by switching to %clang_cc1
for the test.
Fixes: 421215b919d0 ("[SanitizerBinaryMetadata] Support ignore list")
Slava Zakharin [Fri, 10 Feb 2023 16:56:30 +0000 (08:56 -0800)]
[flang] Do not print backtrace for most TODOs.
There are two ways to interrupt flang when a TODO is hit: abort or
exit with non-zero exit code. Abort implies printing the backtrace
and "PLEASE submit a bug report" message. We used to use abort
only in debug compiler build. Since the TODOs are already known
problems it may be counterproductive to ask debug compiler users
to submit bug reports. In addition, the TODO messages are pretty
self-explanatory, so the backtrace printing seems to be redundant.
This change makes all TODOs non-aborting. I added TODO_.*TRACE macros
for TODOs that may benefit from the backtrace and the "bug report"
message in the debug compiler. These macros are currently unused.
Differential Revision: https://reviews.llvm.org/
D143761
Michael Buch [Fri, 10 Feb 2023 23:02:57 +0000 (23:02 +0000)]
Revert "[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if missing"
This reverts commit
b296ddd91cb8e7676b3c38ca7f6d7bdbd84eb4af.
Michael Buch [Fri, 10 Feb 2023 23:02:50 +0000 (23:02 +0000)]
Revert "[lldb][Test] TestExternalCtorDtorLookup.py: skip on Windows and dwo"
This reverts commit
f889d6f9d05b2b1bd188ddf40b3d38a3488c212e.
Louis Dionne [Fri, 10 Feb 2023 23:00:52 +0000 (15:00 -0800)]
[libc++] Simplify non_default_alloc
Also, since it is only used in two tests that are C++11/C++14 tests only,
I don't think it is worth keeping around in test_allocator.h.
Alex Brachet [Fri, 10 Feb 2023 22:39:29 +0000 (22:39 +0000)]
[Driver] Stop stack use after free
In reality this would have always been fine because main's
stack frame will always be live when another thread is
executing the cc1_reproducer_main. But ASan and HWASan
were upset
Fangrui Song [Fri, 10 Feb 2023 22:41:21 +0000 (14:41 -0800)]
[bazel] Fix {clang,llvm}/unittests
Lang Hames [Fri, 20 Jan 2023 04:45:05 +0000 (20:45 -0800)]
[libunwind] On Darwin, add a callback-based lookup scheme for JIT'd unwind info.
This commit adds support for a new callback-based lookup scheme for unwind
info that was inspired by the `_dyld_find_unwind_info_sections` SPI that
libunwind uses to find unwind-info in non-JIT'd frames. From
llvm-project/libunwind/src/AddressSpace.hpp:
```
struct dyld_unwind_sections {
const struct mach_header* mh;
const void* dwarf_section;
uintptr_t dwarf_section_length;
const void* compact_unwind_section;
uintptr_t compact_unwind_section_length;
};
extern bool _dyld_find_unwind_sections(void *, dyld_unwind_sections *);
```
During unwinding libunwind calls `_dyld_find_unwind_sections` to both find
unwind section addresses and identify the subarchitecture for frames (via the
MachO-header pointed to by the mh field).
This commit introduces two new libunwind SPI functions:
```
struct unw_dynamic_unwind_sections {
unw_word_t dso_base;
unw_word_t dwarf_section;
size_t dwarf_section_length;
unw_word_t compact_unwind_section;
size_t compact_unwind_section_length;
};
typedef int (*unw_find_dynamic_unwind_sections)(
unw_word_t addr, struct unw_dynamic_unwind_sections *info);
// Returns UNW_ESUCCESS if successfully registered, UNW_EINVAL for duplicate
// registrations, and UNW_ENOMEM to indicate too many registrations.
extern int __unw_add_find_dynamic_unwind_sections(
unw_find_dynamic_unwind_sections find_dynamic_unwind_sections);
// Returns UNW_ESUCCESS if successfully deregistered, UNW_EINVAL to indicate
// no such registration.
extern int __unw_remove_find_dynamic_unwind_sections(
unw_find_dynamic_unwind_sections find_dynamic_unwind_sections);
```
These can be used to register and deregister callbacks that have a similar
signature to `_dyld_find_unwind_sections`. During unwinding if
`_dyld_find_unwind_sections` returns false (indicating that no frame info
was found by dyld) then registered callbacks are run in registration order until
either the unwind info is found or the end of the list is reached.
With this commit, and by implementing the find-unwind-info callback in the ORC
runtime in LLVM, we (1) enable support for registering JIT'd compact-unwind info
with libunwind*, (2) provide a way to identify the subarchitecture for each frame
(by returning a pointer to a JIT'd MachO header), and (3) delegate tracking of
unwind info to the callback, which may be able to implement more efficient
address-based lookup than libunwind.
* JITLink does not process or register compact unwind info yet, so this patch
does not fully enable compact unwind info in ORC, it simply provides some
necessary plumbing. JITLink support for compact unwind should land some time
in the LLVM 17 development cycle.
Reviewed By: pete
Differential Revision: https://reviews.llvm.org/
D142176
Martin Storsjö [Thu, 9 Feb 2023 22:40:48 +0000 (00:40 +0200)]
[openmp] Fix building z_Linux_asm.S for armv5t
Don't use the ldrd instruction; that one requires armv5te. Instead
do two separate loads (or only one if OMPT_SUPPORT isn't defined).
This should fix https://github.com/llvm/llvm-project/issues/60370.
Differential Revision: https://reviews.llvm.org/
D143683
Frederik Gossen [Fri, 10 Feb 2023 20:24:06 +0000 (15:24 -0500)]
[MLIR] Reintroduce shared attribute names in the LLVM dialect
Differential Revision: https://reviews.llvm.org/
D143774
Craig Topper [Fri, 10 Feb 2023 20:43:25 +0000 (12:43 -0800)]
[InstCombine] Add tests for
D143766. NFC
Jay Foad [Fri, 10 Feb 2023 15:43:44 +0000 (15:43 +0000)]
[AMDGPU] Add GFX11 HW_REG_PERF_SNAPSHOT_*
These are similar to hardware registers already added for GFX940,
but with different numbers and slightly different names.
Differential Revision: https://reviews.llvm.org/
D143740
AmosLewis [Fri, 10 Feb 2023 20:12:50 +0000 (12:12 -0800)]
[mlir][tosa] Add TOSA f64 type support for cast op
Add TOSA f64 type support for cast op
Reviewed By: eric-k256
Differential Revision: https://reviews.llvm.org/
D142599
Markus Böck [Fri, 10 Feb 2023 19:40:38 +0000 (20:40 +0100)]
[mlir] Port Conversion Passes to LLVM to use TableGen generated constructors and options
See https://github.com/llvm/llvm-project/issues/57475 for more context.
Using auto-generated constructors and options has significant advantages:
* It forces a uniform style and expectation for consuming a pass
* It allows to very easily add, remove or change options to a pass by simply making the changes in TableGen
* Its less code
This patch in particular ports all the conversion passes which lower to LLVM to use the auto generated constructors and options. For the most part, care was taken so that auto generated constructor functions have the same name as they previously did. Only following slight breaking changes (which I consider as worth the churn) have been made:
* `mlir::cf::createConvertControlFlowToLLVMPass` has been moved to the `mlir` namespace. This is consistent with basically all conversion passes
* `createGpuToLLVMConversionPass` now takes a proper options struct array for its pass options. The pass options are now also autogenerated.
* `LowerVectorToLLVMOptions` has been replaced by the autogenerated `ConvertVectorToLLVMPassOptions` which is automatically kept up to date by TableGen
* I had to move one function in the GPU to LLVM lowering as it is used as default value for an option.
* All passes that previously returned `unique_ptr<OperationPass<...>>` now simply return `unique_ptr<Pass>`
Differential Revision: https://reviews.llvm.org/
D143773
Alex Brachet [Fri, 10 Feb 2023 19:41:43 +0000 (19:41 +0000)]
[llvm-driver] Reinvoke clang as described by llvm driver extra args
Differential Revision: https://reviews.llvm.org/
D137800
Alex Brachet [Fri, 10 Feb 2023 19:40:56 +0000 (19:40 +0000)]
[llvm-driver] Pass extra arguments to tools
Differential Revision: https://reviews.llvm.org/
D137799
Rahman Lavaee [Mon, 6 Feb 2023 21:39:28 +0000 (13:39 -0800)]
[Propeller] Change SHT_LLVM_BB_ADDR_MAP version to 2.
D100808 implemented the new version, but kept version 1 as the
emitted version. This patch changes the version to 2 and updates the
codegen tests.
Differential Revision: https://reviews.llvm.org/
D139799
Konstantin Varlamov [Fri, 10 Feb 2023 19:31:26 +0000 (11:31 -0800)]
[libc++] In tests, use `abort` to terminate upon an error.
Differential Revision: https://reviews.llvm.org/
D143245
Changpeng Fang [Fri, 10 Feb 2023 19:16:38 +0000 (11:16 -0800)]
AMDGPU: Use module flag to get code object version at IR level folow-up
Summary:
This is part of the leftover work for https://reviews.llvm.org/
D143138.
In this work, we pass code object version as an argument to initialize target ID
and use it for targetID dump.
Reviewers: arsenm
Differential Revision
https://reviews.llvm.org/
D143293
Dani Ferreira Franco Moura [Tue, 31 Jan 2023 11:53:40 +0000 (11:53 +0000)]
A slightly more concise AST dump :)
If the modifiedType and the minimally desugared type of an AttributedType are the same, then we do not need to show both in an AST dump.
Here, we change VisitAttributedType to only visit the modifiedType when it is different from the equivalentType (the minimally desugared type), because the latter is already visited by default.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/
D142637
ManuelJBrito [Fri, 10 Feb 2023 19:04:14 +0000 (19:04 +0000)]
[InstCombine] precommit tests for
D143593
Jim Kitchen [Fri, 10 Feb 2023 19:08:49 +0000 (13:08 -0600)]
[mlir][sparse] Sparse reduction in lex order no longer produces dense output
Previously, when performing a reduction on a sparse tensor, the result
would be different depending on iteration order. For expanded access pattern,
an empty row would contribute no entry in the output. For lex ordering, the
identity would end up in the output.
This code changes that behavior and keeps track of whether any entries were
actually reduced in lex ordering, making the output consistent between the
two iteration styles.
Differential Revision: https://reviews.llvm.org/
D142050
Tue Ly [Fri, 10 Feb 2023 05:10:22 +0000 (00:10 -0500)]
[libc][math] Update exceptional cases for logf, log10f, log2f, log1pf.
Properly set floating point exceptions and add more exceptional
values for non-FMA x86-64 targets.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/
D143699
Fangrui Song [Fri, 10 Feb 2023 18:55:44 +0000 (10:55 -0800)]
[dfsan] Fix build-libc-list.py for Python 3 after
D143701
BigPeet [Fri, 10 Feb 2023 18:36:41 +0000 (18:36 +0000)]
Fix handling of -> calls for modernize-use-emplace
Fixes #55869
Reviewed By: njames93, nicovank
Differential Revision: https://reviews.llvm.org/
D142939
Michael Buch [Fri, 10 Feb 2023 18:38:09 +0000 (18:38 +0000)]
[lldb][Test] TestExternalCtorDtorLookup.py: skip on Windows and dwo
Also make expected mangling more flexible since it's different
between Linux and Darwin
Differential Revision: https://reviews.llvm.org/
D143652
Arthur Eubanks [Fri, 10 Feb 2023 01:22:56 +0000 (17:22 -0800)]
[Passes] Remove some legacy passes
Namely CrossDSOCFI and GlobalSplit.
These are part of the optimization pipeline, of which the legacy pass manager version is deprecated.
Michael Jones [Thu, 9 Feb 2023 00:38:35 +0000 (16:38 -0800)]
[libc] add standalone strtoint/float fuzzers
Fuzzing the string to integer and float functions without relying on the
system libc allows for tests to be run in a wider variety of places.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/
D143616
Tom Weaver [Fri, 10 Feb 2023 18:29:41 +0000 (18:29 +0000)]
[ClangScanDeps] Add UNSUPPORTED: system-windows to test P1689.cppm
The revert of
https://reviews.llvm.org/rG65f9719913eca9c7c72d1abf4eddab767abaebf6
removes a system-windows guard but does not remove the test causing windows
system failures. This patch adds back a guard to prevent further failures.
Yitzhak Mandelbaum [Fri, 10 Feb 2023 16:53:11 +0000 (16:53 +0000)]
[clang-tidy] Clarify documention of `bugprone-unchecked-optional-access`.
Removes a reference to google-internal document and expands the relevant material in place.
Fixes: #60633.
Differential Revision: https://reviews.llvm.org/
D143750
OCHyams [Fri, 10 Feb 2023 17:43:29 +0000 (17:43 +0000)]
[Assignment Tracking] Fix migrateDebuginfo in SROA
Without this patch, migrateDebugInfo doesn't understand how to handle existing
fragments that are smaller than the to-be-split store. This can occur
if. e.g. a vector store (1 dbg.assign) is split (many dbg.assigns - 1 fragment
for each scalar) and later those stores are re-vectorized (many dbg.assigns),
and then SROA runs on that.
The approach taken in this patch is to drop intrinsics with fragments outside
of the slice.
For example, starting with:
store <2 x float> %v, ptr %dest !DIAssignID !1
call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 0, 32), !1, ...)
call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 32, 32), !1, ...)
When visiting the slice of bits 0 to 31 we get:
store float %v.extract.0, ptr %dest !DIAssignID !2
call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 0, 32), !2, ...)
The other dbg.assign associated with the currently-split store is dropped for
this split part. And visiting bits 32 to 63 we get the following:
store float %v.extract.1, ptr %adjusted.dest !DIAssignID !3
call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 32, 32), !3, ...)
I've added two tests that cover this case.
Implementing this meant re-writing the fragment-calculation part of
migrateDebugInfo to work with the absolute offset of the new slice in terms of
the base alloca (instead of the offset of the slice into the new alloca), the
fragment (if any) of the variable associated with the base alloca, and the
fragment associated with the split store. Because we need the offset into the
base alloca for the variables being split, some careful wiring is required for
memory intrinsics due to the fact that memory intrinsics can be split when
either the source or dest allocas are split. In the case where the source
alloca drives the splitting, we need to be careful to pass migrateDebugInfo the
information in relation to the dest alloca.
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/
D143146
David Green [Fri, 10 Feb 2023 18:09:11 +0000 (18:09 +0000)]
[AArch64] Reassociate sub(x, add(m1, m2)) to sub(sub(x, m1), m2)
The mid end will reassociate sub(sub(x, m1), m2) to sub(x, add(m1, m2)). This
reassociates it back to allow the creation of more mls instructions.
Differential Revision: https://reviews.llvm.org/
D143143
Craig Topper [Fri, 10 Feb 2023 18:02:51 +0000 (10:02 -0800)]
[X86] Attempt to fix ubsan failure.
operator~ promote the single bit input to int. The ~ will cause the upper
31 bits to become 1s making it a negative value. This is undefined for
shift.
Mask it back down to a single bit.
The extra 1s were being shifted to bit 8 and above and the they aren't
used by the emitByte call so this shouldn't be a functional change.
Benjamin Kramer [Fri, 10 Feb 2023 18:02:01 +0000 (19:02 +0100)]
Johannes Doerfert [Tue, 7 Feb 2023 15:17:02 +0000 (07:17 -0800)]
[Attributor][NFCI] Use a set to track dependences
Johannes Doerfert [Fri, 3 Feb 2023 10:35:06 +0000 (02:35 -0800)]
[Attributor][NFCI] Avoid AAIntraFnReachability updates if possible
Even if liveness changed, we only care about certain dead edges in
AAIntraFnReachability. If those are still dead, we can avoid an update.
Johannes Doerfert [Fri, 3 Feb 2023 09:42:30 +0000 (01:42 -0800)]
[Attributor][NFCI] Use queries without exclusion set whenever possible
If a query uses an exclusion set but we haven't used it to determine the
result, we can cache the query without exclusion set too. When we lookup
a cached result we can check for the non-exclusion set version first.
Johannes Doerfert [Wed, 8 Feb 2023 15:02:24 +0000 (07:02 -0800)]
[Attributor][FIX] Ensure we use the right set comparison
Johannes Doerfert [Tue, 7 Feb 2023 14:17:08 +0000 (06:17 -0800)]
[Attributor][NFC] Avoid unnecessary string operations
This caused multiple string operations which we don't need if we do not
create a profile.
Johannes Doerfert [Fri, 3 Feb 2023 09:42:10 +0000 (01:42 -0800)]
[Attributor][NFCI] Create a AAIsDead for the function eagerly
Johannes Doerfert [Fri, 3 Feb 2023 09:40:36 +0000 (01:40 -0800)]
[Attributor][NFCI] Avoid a temporary vector and exit early
This change simply avoids the temporary vector and processes the elments
right away.
Louis Dionne [Thu, 9 Feb 2023 18:52:20 +0000 (10:52 -0800)]
[libc++][NFC] Reorganize hash.h
- Add missing _LIBCPP_HIDE_FROM_ABI
- Implement inline functions in the class to simplify the code
- Add missing `const` to `operator()`
- Move _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK to the usual location for function attributes
Differential Revision: https://reviews.llvm.org/
D143668
Michael Buch [Tue, 7 Feb 2023 13:53:30 +0000 (13:53 +0000)]
[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if missing
**Summary**
This patch addresses the case where we have a `DW_AT_external`
subprogram for a constructor (and/or destructor) that doesn't carry
a `DW_AT_linkage_name` attribute. The corresponding DIE(s) that
represent the definition will have a linkage name, but if the name
contains constructs that LLDBs fallback mechanism for guessing mangled
names to resolve external symbols doesn't support (e.g., abi-tags)
then we end up failing to resolve the function call.
We address this by trying to find the linkage name before we create
the constructor/destructor decl, which will get attached using
an `AsmLabelAttr` to make symbol resolution easier.
**Testing**
* Added API test
Differential Revision: https://reviews.llvm.org/
D143652
Michael Buch [Fri, 10 Feb 2023 12:43:42 +0000 (12:43 +0000)]
Reland "[llvm][dsymutil] Add DW_TAG_imported_declaration to accelerator table"
This relands the commit previously reverted in
`
8570bee53a8ce0c5d04bc11f288e19a457474c4c` due to failures on linux.
The problem was that the test executable was built with absolute
OSO prefix paths. This re-commit adds a modified version of the
executable that strips the absolute OSO prefix paths and makes
sure the test appends the OSO prefix appropriately (via the appropriate
dsymutil flags).
Differential Revision: https://reviews.llvm.org/
D143458
Florian Hahn [Fri, 10 Feb 2023 17:12:21 +0000 (17:12 +0000)]
[ConstraintElim] Update getLastConstraint to return to last row. (NFC)
The current code incorrectly returned the first instead of the last row.
This fixes the debug output.
Slava Zakharin [Thu, 9 Feb 2023 22:38:24 +0000 (14:38 -0800)]
[flang] Fixed selective TargetRewrite.
Some conversions were still happening under no-complex/character-conversion
options. This change fixes that and adds a LIT test.
Differential Revision: https://reviews.llvm.org/
D143685
Markus Böck [Wed, 8 Feb 2023 14:37:17 +0000 (15:37 +0100)]
[mlir][OpenMP] Add support for using Opaque Pointers in the OpenMP Dialect
The current OpenMP implementation assumes the use of typed pointers (or rather typed pointer like types). Given the support for typed pointers in LLVM is now pending removal, the OpenMP Dialect should be able to support opaque pointers as well, given that any users of it must lower OpenMP through the LLVM Dialect.
This patch fixes the above and adds support for using LLVM opaque pointers with the OpenMP dialect. This is implemented by making all related code not make use of the element type of pointer arguments. The few (one) op requiring a pointer element type now use an explicit `TypeAttr` for representing the element type.
More concretely, the list of changes are:
* `omp.atomic.read` now has an extra `TypeAttr` (also in syntax) which is the element type of the values read and stored from the operands
* `omp.reduction` now has an type argument in the syntax for both the accmulator and operand since the operand type can no longer be inferred from the accumulator
* `OpenMPToLLVMIRTranslation.cpp` was rewritten to never query element types of pointers
* Adjusted the verifier to be able to handle pointers without element types
Differential Revision: https://reviews.llvm.org/
D143582
Markus Böck [Fri, 10 Feb 2023 11:35:49 +0000 (12:35 +0100)]
[mlir][Async] Add option to LLVM lowering to use opaque pointers
Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179
This patch adds the pass option 'use-opaque-pointers' to allow the dialect conversion from async to LLVM to create LLVM opaque pointers instead of typed pointers.
The gist of the changes boil down to having to propagate the choice of whether opaque or typed pointers should be used, to various helper functions that then either create typed pointers or opaque pointers.
This sadly creates a bit of a code duplication in comparison to other patches in this series, which I think is mostly unavoidable however, since a lot of the patterns in this lowering require the use of the AsyncTypeConverter, instead of the LLVMTypeConverter.
Besides that, the tests have been converter to opaque pointers with one file with typed pointer support having been created as regression tests.
Differential Revision: https://reviews.llvm.org/
D143661
Daniel Grumberg [Thu, 19 Jan 2023 11:25:17 +0000 (11:25 +0000)]
[clang] [extract-api] Don't crash for category in libclang APIs
Remove failure conditions for categories in libclang and return empty
content instead.
Differential Revision: https://reviews.llvm.org/
D142101
Florian Hahn [Fri, 10 Feb 2023 16:26:38 +0000 (16:26 +0000)]
[ConstraintElim] Improve debug test to show removed constraints (NFC).
The current checks show incorrect debug output.
Tom Eccles [Tue, 10 Jan 2023 16:08:58 +0000 (16:08 +0000)]
[mlir] Add function for checking if a block is inside a loop
This function returns whether a block is nested inside of a loop. There
can be three kinds of loop:
1) The block is nested inside of a LoopLikeOpInterface
2) The block is nested inside another block which is in a loop
3) There is a cycle in the control flow graph
This will be useful for Flang's stack arrays pass, which moves array
allocations from the heap to the stack. Special handling is needed when
allocations occur inside of loops to ensure additional stack space is
not allocated on each loop iteration.
Differential Revision: https://reviews.llvm.org/
D141401
Sanjay Patel [Fri, 10 Feb 2023 15:53:22 +0000 (10:53 -0500)]
[VectorCombine] fix insertion point of shuffles
As shown in issue #60649, the new shuffles were
being inserted before a phi, and that is invalid.
It seems like most test coverage for this fold
(foldSelectShuffle) lives in the AArch64 dir,
but this doesn't repro there for a base target.
John Brawn [Fri, 10 Feb 2023 14:51:54 +0000 (14:51 +0000)]
[extract_symbols.py] Adjust how the output of nm is interpreted
When looking for defined symbols, look for symbols that aren't of a
type that we don't want, instead of having specific list of symbol
types that we do want. This fixes a problem where (when using GNU
nm at least) there were some symbol types that we want to export but
which weren't in the list.
Yitzhak Mandelbaum [Fri, 10 Feb 2023 15:02:44 +0000 (15:02 +0000)]
[clang][dataflow] Convert nonnull pointer parameter to a reference.
The parameter in question belongs to a function that is only called once. This patch updates the API to use a reference and changes the caller accordingly.
Differential Revision: https://reviews.llvm.org/
D143735
Mircea Trofin [Fri, 10 Feb 2023 15:46:47 +0000 (07:46 -0800)]
Revert "[mlgo] Fix test after
D143624"
This reverts commit
dc4c3cfd78c01bef427fca0431fe66a6c6de7c35.
Reverting because
D143624 has been reverted.
Guillaume Chatelet [Fri, 10 Feb 2023 15:15:10 +0000 (15:15 +0000)]
[libc] Move likely/unlikely to the optimization header
Sanjay Patel [Fri, 10 Feb 2023 14:59:33 +0000 (09:59 -0500)]
[InstCombine] propagate FMF in exp2->ldexp fold
Sanjay Patel [Fri, 10 Feb 2023 14:54:22 +0000 (09:54 -0500)]
[InstCombine] copy tail markings in exp2->ldexp fold
Sanjay Patel [Fri, 10 Feb 2023 14:51:27 +0000 (09:51 -0500)]
[InstCombine] add 'tail' to exp2 call in test; NFC
Tail markings are not propagated if the transform succeeds.
David Green [Fri, 10 Feb 2023 15:01:49 +0000 (15:01 +0000)]
Revert "Inlining: Run the legacy AlwaysInliner before the regular inliner."
This seems to cause large regressions in existing code, as much as 75% slower
(4x the time taken). Small always inline functions seem to be used a lot in the
cmsis-dsp library.
I would add a phase ordering test to show the problems, but one already exists!
The llvm/test/Transforms/PhaseOrdering/ARM/arm_mult_q15.ll was just changed by
removing alwaysinline to hide the problems that existed.
This reverts commit
cae033dcf227aeecf58fca5af6fc7fde1fd2fb4f.
This reverts commit
8e33c41e72ad42e4c27f8cbc3ad2e02b169637a1.
Juan Manuel MARTINEZ CAAMAÑO [Fri, 10 Feb 2023 14:05:05 +0000 (15:05 +0100)]
[AMDGPU][MC] Generate relative relocations for allocatable (more particularly, eh_frame) sections
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/
D142453
Benjamin Maxwell [Tue, 7 Feb 2023 10:36:34 +0000 (10:36 +0000)]
[DebugInfo] Handle missed DW_FORM_addrx3 and DW_FORM_strx3 cases
This fixes a few places where the addrx3 and strx3 forms were missed.
Previously this meant if one of these forms appeared somewhere various
errors could occur. This now also adds an extra test case for the addrx3
form (which previously failed).
Differential Revision: https://reviews.llvm.org/
D143488
Denis Fatkulin [Fri, 10 Feb 2023 14:19:11 +0000 (17:19 +0300)]
[clangd] Move function body to out-of-line: unnamed class method incorrect moving
The refactoring !!Move function body to out-of-line!! produces incorrect code for methods of unnamed classes.
For this simple example
// foo.h
struct Foo {
struct {
void f^oo() {}
} Bar;
};
the refactoring generates code:
// foo.cpp
void Foo::(unnamed struct at D:\test\foo.h:2:3)foo() {}
Outplace definition for methods of unnamed classes is meaningless. The patch disables it.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/
D143638
Tobias Gysi [Fri, 10 Feb 2023 14:22:54 +0000 (15:22 +0100)]
[mlir][llvm] Store memory op metadata using op attributes.
The revision introduces operation attributes to store tbaa metadata on
load and store operations rather than relying using dialect attributes.
At the same time, the change also ensures the provided getters and
setters instead are used instead of a string based lookup. The latter
is done for the tbaa, access groups, and alias scope attributes.
The goal of this change is to ensure the metadata attributes are only
placed on operations that have the corresponding operation attributes.
This is imported since only these operations later on translate these
attributes to LLVM IR. Dialect attributes placed on other operations
are lost during the translation.
Reviewed By: vzakhari, Dinistro
Differential Revision: https://reviews.llvm.org/
D143654
Joseph Huber [Fri, 10 Feb 2023 14:22:05 +0000 (08:22 -0600)]
[amdgpu-arch] Fix build of amdgpu-arch with CLANG_LINK_CLANG_DYLIB
The function clang_target_link_libraries must only be used with real
Clang libraries; with CLANG_LINK_CLANG_DYLIB, it will instead link in
clang-cpp. We must use the standard CMake target_link_libraries for
the HSA library.
v1nh1shungry [Wed, 18 Jan 2023 14:15:28 +0000 (22:15 +0800)]
[clangd] fix wrong CalleeArgInfo in the hover
```
void foobar(int);
int main() {
foobar(1 + 2);
^
}
```
Currently the CalleeArgInfo will be "Passed by reference", which should
be "Passed by value".
Fixes https://github.com/clangd/clangd/issues/1467
Differential Revision: https://reviews.llvm.org/
D142014
LLVM GN Syncbot [Fri, 10 Feb 2023 14:07:17 +0000 (14:07 +0000)]
[gn build] Port
6470706bc0ed
Simon Pilgrim [Fri, 10 Feb 2023 13:14:38 +0000 (13:14 +0000)]
[X86] combineConcatVectorOps - concatenate AVX512 vselect nodes. NFC.
This also requires us to constant fold vXi1 concat_vector nodes
Guillaume Chatelet [Fri, 10 Feb 2023 13:49:03 +0000 (13:49 +0000)]
[libc] Fix exp2f and prevent misuse of likely/unlikely
Let's make sure that we only accept boolean expressions when using likely/unlikely.
Differential Revision: https://reviews.llvm.org/
D143732
Nico Weber [Fri, 10 Feb 2023 13:58:51 +0000 (08:58 -0500)]
OCHyams [Fri, 10 Feb 2023 12:33:16 +0000 (12:33 +0000)]
[Assignment Tracking] Fix fragment index error in getDerefOffsetInBytes
Without this patch `getDerefOffsetInBytes` incorrectly always returns
`std::nullopt` for expressions with fragments due to an off-by-one error with
fragment element indices.
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/
D143567
Christian Ulmann [Fri, 10 Feb 2023 13:33:41 +0000 (14:33 +0100)]
[mlir][llvm] Adapt loop metadata to match llvm
This commit adds support for the "llvm.loop.isvectorized" metadata and
ensures that the unroll followups match llvm's naming.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/
D143730
Tobias Hieta [Fri, 10 Feb 2023 13:42:48 +0000 (14:42 +0100)]
[NFC][compiler-rt] Shorten comment
Tobias Hieta [Fri, 27 Jan 2023 15:46:19 +0000 (16:46 +0100)]
[Workflow] Add Release Repo sync script
Adds a bash script that syncs llvm/llvm-project and llvm/llvm-project-release-prs.
This should run on pushes to any of the repositories release branches.
I will follow this up with a change to the github actions to run this
script.
This breaks out the sync script from: https://reviews.llvm.org/
D133476
so we can keep them separate.
Reviewed By: kwk
Differential Revision: https://reviews.llvm.org/
D142726
Tobias Hieta [Wed, 8 Feb 2023 08:26:49 +0000 (09:26 +0100)]
[CMake][compiler-rt] Support clang-cl in CompilerRTMockLLVMCMakeConfig
clang-cl doesn't support -dumpmachine directly, so we need to
preface it with /clang: in order to get this probing function
to work.
This is needed in order to run cmake directly on the runtimes
directory.
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/
D143557
Job Noorman [Fri, 10 Feb 2023 11:50:26 +0000 (19:50 +0800)]
[RISCV] Add tests for .attribute stack_align
As suggested by @asb [here](https://reviews.llvm.org/
D143570#
4112877), we need tests for `.attribute stack_align`. This patch simply verifies a stack alignment of 16 is emitted for any combination of currently supported base ISA and extensions.
Reviewed By: asb, kito-cheng
Differential Revision: https://reviews.llvm.org/
D143639
Sanjay Patel [Fri, 10 Feb 2023 13:01:04 +0000 (08:01 -0500)]
[InstCombine] avoid crashing in pow->ldexp
Similar to
62a0a1b9eea7788c1f9dbae -
We have pow math intrinsics in IR, but no ldexp intrinsics
to handle vector types.
A patch for that was proposed in D14327, but it was not completed.
Issue #60605
Frederic Cambus [Fri, 10 Feb 2023 12:50:04 +0000 (13:50 +0100)]
[clang] Update Clang version from 16 to 17 in scan-build.1.
Similar to
D110763.
Sanjay Patel [Fri, 10 Feb 2023 12:03:56 +0000 (07:03 -0500)]
[InstCombine] avoid crashing in exp2->ldexp
We have exp2 math intrinsics in IR, but no ldexp intrinsics
to handle vector types.
A patch for that was proposed in D14327, but it was not completed.
Issue #60605
Sanjay Patel [Fri, 10 Feb 2023 11:55:59 +0000 (06:55 -0500)]
[InstCombine] add test for exp2->ldexp; NFC
Sanjay Patel [Fri, 10 Feb 2023 11:51:57 +0000 (06:51 -0500)]
[InstCombine] auto-generate check lines in test file; NFC
Tim Northover [Fri, 10 Feb 2023 11:40:20 +0000 (11:40 +0000)]
ARM: skip debug instructions when matching jump-table patterns.
When working out whether we can see a compressible jump-table pattern during
ConstantIslands, we were stopping when we saw a debug instruction. Instead it's
better to keep iterating backwards to the first real instruction.
https://reviews.llvm.org/
D142019
Ingo Müller [Fri, 10 Feb 2023 11:31:35 +0000 (11:31 +0000)]
[mlir][bufferization] Restrict function boundary buffer. to func.call.
The current bufferization on function boundaries works on `func.func`
and any call op implementing `CallOpInterface`. Then, an error is thrown
if there is a `CallOpInterface` op that is not `func.call`. This is
unnecessary and breaks the pass whenever such an op occurs (such as
`llvm.call`). This PR simply restricts the handling of call ops to
`func.call`.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/
D143724
Guillaume Chatelet [Fri, 10 Feb 2023 11:40:14 +0000 (11:40 +0000)]
[bazel] Fix build and make all target respect layering_check
Tested with `bazelisk-linux-amd64 query //... + @llvm-project//... | xargs bazelisk-linux-amd64 test --config=ci --features=layering_check`
LiaoChunyu [Fri, 10 Feb 2023 11:34:37 +0000 (19:34 +0800)]
[RISCV] Add precommit tests for
D143646
Ivan Kosarev [Fri, 10 Feb 2023 11:07:17 +0000 (11:07 +0000)]
[AMDGPU][AsmParser] Fix matching immediate literals.
Prevents potential matching of literal offsets to non-literal operands.
Reviewed By: dp
Differential Revision: https://reviews.llvm.org/
D142194
Yingchi Long [Fri, 10 Feb 2023 11:26:14 +0000 (19:26 +0800)]
[InstCombine][NFC] regenerate tests for simple_phi_condition.ll
Max Kazantsev [Fri, 10 Feb 2023 10:55:01 +0000 (17:55 +0700)]
[Test] Add complementary tests for OR analogous for those for AND
Max Kazantsev [Fri, 10 Feb 2023 10:41:03 +0000 (17:41 +0700)]
[Test] Add test showing an opportunity to transform checks and hoist invariants
Marco Elver [Fri, 10 Feb 2023 10:22:17 +0000 (11:22 +0100)]
[SanitizerBinaryMetadata] Fix ignorelist test under Windows
Windows paths confuse the regular expression. Just use the test source
name directly.
Fixes: 421215b919d0 ("[SanitizerBinaryMetadata] Support ignore list")
Dominik Adamski [Tue, 17 Jan 2023 09:51:48 +0000 (03:51 -0600)]
Move SIMD alignment calculation to LLVM Frontend
Currently default simd alignment is defined by Clang specific TargetInfo class.
This class cannot be reused for LLVM Flang. That's why default simd alignment
calculation has been moved to OMPIRBuilder which is common for Flang and Clang.
Previous attempt: https://reviews.llvm.org/
D138496 was wrong because
the default alignment depended on the number of built LLVM targets.
If we wanted to calculate the default alignment for PPC and we hadn't specified
PPC LLVM target to build, then we would get 0 as the alignment because
OMPIRBuilder couldn't create PPCTargetMachine object and it returned 0 as
the default value.
If PPC LLVM target had been built earlier, then OMPIRBuilder could have created
PPCTargetMachine object and it would have returned 128.
Differential Revision: https://reviews.llvm.org/
D141910
Reviewed By: jdoerfert