Nikita Popov [Thu, 17 Feb 2022 09:03:58 +0000 (10:03 +0100)]
[SCEV] Fully invalidate SCEVUnknown on RAUW
When a SCEVUnknown gets RAUWd, we currently drop it from the folding
set, but don't forget memoized values. I believe we should be
treating RAUW the same way as deletion here and invalidate all
caches and dependent expressions.
I don't have any specific cases where this causes issues right now,
but it does address the FIXME in https://reviews.llvm.org/D119488.
Differential Revision: https://reviews.llvm.org/D120033
Timm Bäder [Thu, 3 Mar 2022 11:13:48 +0000 (12:13 +0100)]
[clang][parser] Stop dragging an EndLoc around when parsing attributes
It's almost always entirely unused and if it is used, the end of the
attribute range can be used instead.
Differential Revision: https://reviews.llvm.org/D120888
Christian Sigg [Sun, 6 Mar 2022 19:55:59 +0000 (20:55 +0100)]
[MLIR] Change call sites from deprecated `parseSourceFile()` to `parseSourceFile<ModuleOp>()`.
Mark `parseSourceFile()` deprecated. The functions will be removed two weeks after landing this change.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D121075
Johannes Doerfert [Sun, 6 Mar 2022 23:37:47 +0000 (17:37 -0600)]
[Attributor] Determine potentially loaded values through memory
We already look through memory to determine where a value that is stored
might pop up again (potential copies). This patch introduces the other
direction with similar logic. If a value is loaded, we can follow all
the accesses to the pointer (or better object) and try to determine what
value might have been stored.
Johannes Doerfert [Mon, 7 Mar 2022 01:16:35 +0000 (19:16 -0600)]
[Attributor] Handle undef and null in AAAlignFloating
Both `undef` and `nullptr` are maximally aligned. This is especially
important as we often see `undef` until a proper value has been
identified during simplification.
Johannes Doerfert [Tue, 1 Mar 2022 21:22:53 +0000 (15:22 -0600)]
[Attributor] Use CFG reasoning also for read accesses
With D106397 we used CFG reasoning to filter out writes that will not
interfere with a given load instruction. With this patch we use the
same logic (modulo the reversal in reachability check order) for store
instructions. As an example, we can now proof stores to shared memory
are dead if all the loads of the shared memory are not reachable from
them.
Johannes Doerfert [Fri, 25 Feb 2022 22:44:24 +0000 (16:44 -0600)]
[Attributor] Improve isValidAtPosition (mostly for old PM)
To minimize the test difference between old and new PM we perform some
local dominance check if no dominator tree is available.
Qiu Chaofan [Mon, 7 Mar 2022 05:00:06 +0000 (13:00 +0800)]
[PowerPC] Add generic fnmsub intrinsic
Currently in Clang, we have two types of builtins for fnmsub operation:
one for float/double vector, they'll be transformed into IR operations;
one for float/double scalar, they'll generate corresponding intrinsics.
But for the vector version of builtin, the 3 op chain may be recognized
as expensive by some passes (like early cse). We need some way to keep
the fnmsub form until code generation.
This patch introduces ppc.fnmsub.* intrinsic to unify four fnmsub
intrinsics.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D116015
Johannes Doerfert [Fri, 25 Feb 2022 00:52:21 +0000 (18:52 -0600)]
[Attributor][NFCI] Introduce fine-grained anonymous namespaces
Johannes Doerfert [Fri, 25 Feb 2022 00:45:52 +0000 (18:45 -0600)]
[Attributor][OpenMPOpt][FIX] Register simplification callbacks
Heap-2-stack and heap-2-shared can replace an allocation call with
something else. To avoid us deriving information from the allocator
implementation we register a simplification callback now that will
force us to stop at the call site. We probably should create the
replacement memory eagerly and return that instead though.
Johannes Doerfert [Thu, 24 Feb 2022 23:29:31 +0000 (17:29 -0600)]
[Attributor][FIX] Use maximal access for dereferenceability deduction
While we can use range information when we derive dereferenceability we
must make sure to pick he right end of the range. Before we always went
with the minimal offset, which is not correct if we want to combine
the base dereferenceability with some offset. In that case it's the
maximum that gives the correct result.
Johannes Doerfert [Thu, 24 Feb 2022 23:27:11 +0000 (17:27 -0600)]
[Attributor][FIX] Initialize stack variable
Johannes Doerfert [Mon, 7 Mar 2022 03:27:41 +0000 (21:27 -0600)]
Revert "[OpenMP][NFCI] Use RAII lock guards in libomptarget where possible"
This reverts commit
ff50e81b500800708db927cbccca2ab52ec11884 as it broke
the buildbots, see https://reviews.llvm.org/D121060#3362737.
Zakk Chen [Sun, 6 Mar 2022 23:05:13 +0000 (15:05 -0800)]
[RISCV] Fix incorrect optimization for masked vmsgeu.vi with 0 immediate.
vmsgeu.vi with 0 is always true, but in the masked with mask undisturbed
policy, we still need to keep inactive elelemt which come from maskedoff.
We could return mask directly if it's mask agnostic policy in the future.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D121080
Johannes Doerfert [Wed, 2 Mar 2022 19:34:24 +0000 (13:34 -0600)]
[OpenMP][NFCI] Use RAII lock guards in libomptarget where possible
Differential Revision: https://reviews.llvm.org/D121060
Johannes Doerfert [Mon, 7 Feb 2022 23:04:39 +0000 (17:04 -0600)]
[Attributor][NFCI] No repeated manifest of AAValueSimplifyReturned (CGSCC)
Johannes Doerfert [Mon, 7 Feb 2022 22:13:02 +0000 (16:13 -0600)]
[Attributor][NFC] Expose helper with more generic interface
This simply makes the function argument of the
`Attributor::checkForAllInstructions` helper explicit so one can iterate
over instructions in other functions.
Johannes Doerfert [Mon, 7 Feb 2022 21:24:59 +0000 (15:24 -0600)]
[Attributor][NFC] Improve debug messages
William S. Moses [Sat, 5 Mar 2022 23:04:19 +0000 (18:04 -0500)]
[OpenMPIRBuilder] Allocate temporary at the correct block in a nested parallel
The OpenMPIRBuilder has a bug. Specifically, suppose you have two nested openmp parallel regions (writing with MLIR for ease)
```
omp.parallel {
%a = ...
omp.parallel {
use(%a)
}
}
```
As OpenMP only permits pointer-like inputs, the builder will wrap all of the inputs into a stack allocation, and then pass this
allocation to the inner parallel. For example, we would want to get something like the following:
```
omp.parallel {
%a = ...
%tmp = alloc
store %tmp[] = %a
kmpc_fork(outlined, %tmp)
}
```
However, in practice, this is not what currently occurs in the context of nested parallel regions. Specifically to the OpenMPIRBuilder,
the entirety of the function (at the LLVM level) is currently inlined with blocks marking the corresponding start and end of each
region.
```
entry:
...
parallel1:
%a = ...
...
parallel2:
use(%a)
...
endparallel2:
...
endparallel1:
...
```
When the allocation is inserted, it presently inserted into the parent of the entire function (e.g. entry) rather than the parent
allocation scope to the function being outlined. If we were outlining parallel2, the corresponding alloca location would be parallel1.
This causes a variety of bugs, including https://github.com/llvm/llvm-project/issues/54165 as one example.
This PR allows the stack allocation to be created at the correct allocation block, and thus remedies such issues.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D121061
Michael Kruse [Sun, 6 Mar 2022 22:22:09 +0000 (16:22 -0600)]
[mlir][support] Fix msvc build.
Add typename keyword to help the C++ parser to disambiguate dependent
qualified name after D120852/1c941d. Fixes the msvc build.
mydeveloperday [Sun, 6 Mar 2022 20:02:11 +0000 (20:02 +0000)]
[clang-format] NFC update LLVM overall clang-formatted status
A 1% increase in the number of clang-formatted files.
An additional 530 files have been added to LLVM, and an additional
450 files are now clang-format clean. Raising the overall % to 53%
There are now 8857 files clean out of 16432 (ignoring lit tests)
David Green [Sun, 6 Mar 2022 18:35:34 +0000 (18:35 +0000)]
[DAG] Don't convert undef to 0 when creating buildvector
When inserting undef into buildvectors created from shuffles of
buildvectors, we convert elements to the largest needed type. This had
the effect of converting undef into 0, which isn't needed as the
buildvector implicitly truncates and trunc(zext(undef)) == undef.
Differential Revision: https://reviews.llvm.org/D121002
Benjamin Kramer [Sun, 6 Mar 2022 18:22:31 +0000 (19:22 +0100)]
[Hexagon] Move single-use global tables into their only user and turn them into StringSwitch
Delete the unused globals. NFCI.
Simon Pilgrim [Sun, 6 Mar 2022 17:23:51 +0000 (17:23 +0000)]
[X86] Update AVX512-BW mask intrinsic tests to avoid adds
As noticed in D119654, by adding the masked intrinsics results together we can end up with the selects being canonicalized away from the intrinsic - this isn't what we want to test here so replace with a insertvalue chain into a aggregate instead to retain all the results.
Simon Pilgrim [Sun, 6 Mar 2022 17:05:44 +0000 (17:05 +0000)]
[X86] Update AVX512 rotate intrinsic tests to avoid adds
As noticed in D119654, by adding the masked intrinsics results together we can end up with the selects being canonicalized away from the intrinsic - this isn't what we want to test here so replace with a insertvalue chain into a aggregate instead to retain all the results.
Simon Pilgrim [Sun, 6 Mar 2022 16:58:29 +0000 (16:58 +0000)]
[X86] Update AVX512-VNNI mask intrinsic tests to avoid adds
As noticed in D119654, by adding the masked intrinsics results together we can end up with the selects being canonicalized away from the intrinsic - this isn't what we want to test here so replace with a insertvalue chain into a aggregate instead to retain all the results.
Benjamin Kramer [Sun, 6 Mar 2022 12:24:42 +0000 (13:24 +0100)]
Drop some more global std::maps. NFCI.
Florian Hahn [Sun, 6 Mar 2022 11:14:41 +0000 (11:14 +0000)]
[LoopSink] Do not try to sink phi nodes.
Skip phi nodes in the preheader. They may not be considered loop
invariant by the assertion below.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D121010
Groverkss [Sun, 6 Mar 2022 11:12:20 +0000 (16:42 +0530)]
[MLIR][Presburger][NFC] Fix PresburgerLocalSpace::print() output
This change puts a colon before before the printing number of locals in
PresburgerLocalSpace::print().
Jun Zhang [Sun, 6 Mar 2022 05:01:49 +0000 (13:01 +0800)]
[Clang] Use = default(NFC)
Craig Topper [Sun, 6 Mar 2022 05:26:28 +0000 (21:26 -0800)]
[RISCV] Add SimplifyDemandedBits support for FSR/FSL/FSRW/FSLW.
James Beddek [Sun, 6 Mar 2022 04:20:28 +0000 (20:20 -0800)]
[OpenMP][CMake] Ensure linking against libm for Linux
Do the same as is done for NetBSD. Some compiler-rt/lib/builtins files call
libm functions (e.g. fmaxl, fabs). Linking libomp with --rtlib=compiler-rt
references these functions.
Downstream report: https://bugs.gentoo.org/816831
Fixes: https://github.com/llvm/llvm-project/issues/51457
Shilei Tian [Sun, 6 Mar 2022 03:37:46 +0000 (22:37 -0500)]
[OpenMP][CMake] Clean up the CMake variable `LIBOMPTARGET_LLVM_INCLUDE_DIRS`
`LIBOMPTARGET_LLVM_INCLUDE_DIRS` is currently checked and included for
multiple times redundantly. This patch is simply a clean up.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D121055
Kai Luo [Sun, 6 Mar 2022 00:55:22 +0000 (00:55 +0000)]
[libcxx][atomic] Remove workaround for PR31864
I believe the origin issue in PR31864 has been addressed by https://reviews.llvm.org/D59566.
As discussed in https://github.com/llvm/llvm-project/issues/53840, `ATOMIC_LLONG_LOCK_FREE == 2` sometimes is not consistent with `std::atomic<long long>::is_always_lock_free`, since the macro takes `long long`'s ABI alignment into account. https://reviews.llvm.org/D28213 proposed we should not rely on ABI alignment of types, thus we have consistent `ATOMIC_LLONG_LOCK_FREE` and `std::atomic<long long>::is_always_lock_free` on x86's old cpu. Currently, I plan to move on to remove the workaround which should have been addressed and don't want to break current tests.
Reviewed By: #libc, ldionne, Quuxplusone
Differential Revision: https://reviews.llvm.org/D119931
Benjamin Kramer [Sat, 5 Mar 2022 21:24:20 +0000 (22:24 +0100)]
[YAML] Simplify code a bit. NFC.
owenca [Sat, 5 Mar 2022 07:45:50 +0000 (23:45 -0800)]
[clang-format] Handle goto labels for RemoveBracesLLVM
Differential Revision: https://reviews.llvm.org/D121042
Florian Hahn [Sat, 5 Mar 2022 19:46:27 +0000 (19:46 +0000)]
[IVDescriptor] Remove SinkCandidate from SinkAfter before re-sinking.
This ensures the right order in the sink-after map is maintained. If we
re-sink an instruction, it must be sunk after all earlier instructions
have been sunk.
Fixes https://github.com/llvm/llvm-project/issues/54223
Benjamin Kramer [Sat, 5 Mar 2022 19:32:37 +0000 (20:32 +0100)]
Make ParsedAttrInfo and subclasses use constexpr construction
This removes a 30 kB global initializer. NFCI.
AndreyChurbanov [Sat, 5 Mar 2022 18:46:39 +0000 (21:46 +0300)]
[OpenMP] libomp: omp_in_explicit_task() implemented.
Differential Revision: https://reviews.llvm.org/D120671
David Green [Sat, 5 Mar 2022 18:35:43 +0000 (18:35 +0000)]
[AArch64] Some tests to show reconstructing truncates. NFC
Benjamin Kramer [Sat, 5 Mar 2022 18:31:44 +0000 (19:31 +0100)]
Drop iostream include, which is forbidden in LLVM
Nikolas Klauser [Sat, 5 Mar 2022 18:17:07 +0000 (19:17 +0100)]
[libc++] Granularize <utility> includes
Reviewed By: ldionne, #libc
Spies: EricWF, libcxx-commits, arphaman
Differential Revision: https://reviews.llvm.org/D120466
Benjamin Kramer [Sat, 5 Mar 2022 18:16:01 +0000 (19:16 +0100)]
[OpenCL] Turn global vector into static array. NFCI.
mydeveloperday [Sat, 5 Mar 2022 18:07:16 +0000 (18:07 +0000)]
[clang-format] QualifierOrder does not reorder template arguments
https://github.com/llvm/llvm-project/issues/53981
Reorder the qualifiers inside the template argument. This should handle the simple cases of
```
<const T>
<T const>
```
But only by relaxing that single letter capital variables are not possible macros
Fixes: #53981
Reviewed By: HazardyKnusperkeks, curdeius
Differential Revision: https://reviews.llvm.org/D120710
Nikolas Klauser [Thu, 3 Mar 2022 19:49:21 +0000 (20:49 +0100)]
[libc++] Don't warn that coroutines aren't supported when including <experimental/coroutine>
This change makes the behavior of `<experimental/coroutine>` consistent with other headers that only work conditionally.
Reviewed By: ldionne, #libc
Spies: Mordante, ChuanqiXu, libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D119964
Karl Meakin [Sat, 5 Mar 2022 17:51:58 +0000 (17:51 +0000)]
[AArch64] fix i128-math.ll
Karl Meakin [Fri, 4 Mar 2022 18:31:50 +0000 (18:31 +0000)]
[AArch64] Add test for i128 overflow/saturation ops (NFC)
This test exposes opportunities for future optimization work
Differential Revision: https://reviews.llvm.org/D121013
Benjamin Kramer [Sat, 5 Mar 2022 16:59:05 +0000 (17:59 +0100)]
[clang-format] Turn global COperatorsFollowingVar vector into a switch
LLVM optimizes this into a bit test. NFCI.
Sanjay Patel [Fri, 4 Mar 2022 17:59:27 +0000 (12:59 -0500)]
[SDAG] fold bitwise logic with shifted operands
This extends
acb96ffd149d to 'and' and 'xor' opcodes.
Copying from that message:
LOGIC (LOGIC (SH X0, Y), Z), (SH X1, Y) --> LOGIC (SH (LOGIC X0, X1), Y), Z
https://alive2.llvm.org/ce/z/QmR9rR
This is a reassociation + factoring fold. The common shift operation is moved
after a bitwise logic op on 2 input operands.
We get simpler cases of these patterns in IR, but I suspect we would miss all
of these exact tests in IR too. We also handle the simpler form of this plus
several other folds in DAGCombiner::hoistLogicOpWithSameOpcodeHands().
Sanjay Patel [Fri, 4 Mar 2022 17:32:40 +0000 (12:32 -0500)]
[AArch64][x86] add tests for bitwise logic + shifts; NFC
Copy tests from
ecf606cb4329ae and replace 'or' with 'xor' / 'and'.
This provides coverage for an enhancement of D120516 /
acb96ffd149d
kamenokonokotan [Sat, 5 Mar 2022 15:34:28 +0000 (16:34 +0100)]
[WebAssembly] Update WebAssemblyAsmTypeCheck for table.get
This patch is aimed to resolve [[ https://github.com/llvm/llvm-project/issues/53789 | GitHub Issue #53789 ]].
Reviewed By: sbc100
Differential Revision: https://reviews.llvm.org/D120229
Zakk Chen [Fri, 4 Mar 2022 03:44:46 +0000 (19:44 -0800)]
[RISCV] Fix incorrect codegen introduced by D119688.
We should not emit a tail agnostic vlse for a tail undisturbed vmv.s.x
In D119688:
- if (IsScalarMove && !Node->getOperand(0).isUndef())
+ bool HasPassthruOperand = Node->getOpcode() != ISD::SPLAT_VECTOR;
+ if (HasPassthruOperand && !IsScalarMove &&
!Node->getOperand(0).isUndef())
break;
The IsScalarMove check in the if statement had been changed.
Differential Revision: https://reviews.llvm.org/D120963
Zakk Chen [Fri, 4 Mar 2022 03:43:17 +0000 (19:43 -0800)]
[RISCV][NFC] Precommit test cases for D120963.
Corentin Jabot [Sat, 5 Mar 2022 08:43:38 +0000 (09:43 +0100)]
[NFC][Clang] Fix a couple of typos
Craig Topper [Sat, 5 Mar 2022 06:33:16 +0000 (22:33 -0800)]
[RISCV] Add CMOV isel pattern for (select (setgt X, -1), Y, Z)
setgt X, -1 is the canonical form of setge X, 0. We can swap the
select operands and use setlt X, X0 when selecting CMOV. This
avoid materializing the -1 in a register.
Shoaib Meenai [Sat, 5 Mar 2022 00:30:46 +0000 (16:30 -0800)]
[cmake] Pass /winsysroot explicitly
We were relying on HandleLLVMOptions adding this flag, but that's not
included in compiler-rt. Add the flag explicitly ourselves to ensure
it's present; the duplication of the flag in the parts of the build
which do include HandleLLVMOptions doesn't cause any issues.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D121033
Petr Hosek [Sat, 5 Mar 2022 06:20:42 +0000 (22:20 -0800)]
[llvm-cov] New parameters to set coverage coverage_watermark
Add a pairs of parameters to set coverage watermark for llvm-cov, and
user can change the percentage thresholds marked with different colors
in the report.
Patch By: tanjinhua
Differential Revision: https://reviews.llvm.org/D116876
Shao-Ce SUN [Thu, 3 Mar 2022 14:12:02 +0000 (22:12 +0800)]
[RISCV] Support k-ext clang intrinsics
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D112774
Arthur Eubanks [Sat, 5 Mar 2022 04:36:37 +0000 (20:36 -0800)]
Revert "[polly] Fix regression test after D110620."
This reverts commit
2aa624a94fa00ac5e9d34dbf549b016a8afd4d37.
D110620 was reverted.
Arthur O'Dwyer [Fri, 4 Mar 2022 23:29:39 +0000 (18:29 -0500)]
[libc++] Add _LIBCPP_HIDE_FROM_ABI to __quoted_proxy ctors.
ldionne says this looks right to him, too.
Reviewed as part of D120135.
Arthur O'Dwyer [Fri, 4 Mar 2022 23:15:20 +0000 (18:15 -0500)]
[libc++] [NFC] Formatting preliminary to D120135 (std::quoted)
This just gets some of the non-functional formatting out of the way
before the meat of D120135.
Arthur O'Dwyer [Fri, 4 Mar 2022 23:02:37 +0000 (18:02 -0500)]
[libc++] ADL-proof calls to __quoted and noskipws.
Reviewed as part of D120135.
Arthur Eubanks [Fri, 4 Mar 2022 00:30:30 +0000 (16:30 -0800)]
Revert "[SCEV] Infer ranges for SCC consisting of cycled Phis"
This reverts commit
fc539b0004d4fe8072aca00e38599a2300a955ce.
Causes miscompiles, see D110620.
Fangrui Song [Sat, 5 Mar 2022 03:00:10 +0000 (19:00 -0800)]
Reland D119909 [ELF] Parallelize initializeLocalSymbols
ObjFile::parse combines symbol initialization and resolution. Many tasks
unrelated to symbol resolution can be postponed and parallelized. This patch
extracts local symbol initialization and parallelizes it.
Technically the new function initializeLocalSymbols can be merged into
ObjFile::postParse, but functions like getSrcMsg may access the
uninitialized (all nullptr) local part of InputFile::symbols.
Linking chrome: 1.02x as fast with glibc malloc, 1.04x as fast with mimalloc
Depends on
f456c3ae3f4182b23673929e8fe0aa18bcec4289 and D119908
Reviewed By: ikudrin
Differential Revision: https://reviews.llvm.org/D119909
Fangrui Song [Sat, 5 Mar 2022 02:56:37 +0000 (18:56 -0800)]
[ELF] Move addWrappedSymbols before postParseObjectFile
addWrappedSymbols may trigger archive extraction: split stack implementation
uses --wrap=pthread_create, which extracts libgcc.a(generic-morestack-thread.o).
This fixes the regression caused by
09602d3b47ec83abb2c26efa5a199c13b72c7abf by
making the invariant satisfied: no more non-compileBitcodeFiles object file is
produced at postParseObjectFile.
Thomas Lively [Sat, 5 Mar 2022 02:40:10 +0000 (18:40 -0800)]
[WebAssembly] Update Preprocessor/init.c test after
3be9e0ba972c
Craig Topper [Sat, 5 Mar 2022 01:44:29 +0000 (17:44 -0800)]
[RISCV] Move vslide1up/down intrinsics into lowerVectorIntrinsicSplats. NFC
Rename to lowerVectorIntrinsicScalars.
This allows us to share the code that checks if the scalar needs
to be type legalized.
Vladimir Vereschaka [Sat, 5 Mar 2022 00:36:57 +0000 (16:36 -0800)]
[CMake] Replace `TARGET_TRIPLE` with `TOOLCHAIN_TARGET_TRIPLE` for Win-to-Arm cross toolchain cache file. NFC.
Avoid using TARGET_TRIPLE argument for the cross toolchain cmake cache file and replace it
with TOOLCHAIN_TARGET_TRIPLE.
Reference: https://reviews.llvm.org/D119918
Differential Revision: https://reviews.llvm.org/D121029
Craig Topper [Fri, 4 Mar 2022 19:57:39 +0000 (11:57 -0800)]
[RISCV] Merge more rv32/rv64 vector intrinsic tests that contain the same content.
Use sed to convert iXLen to i32/i64 before running the test.
Med Ismail Bennani [Sat, 5 Mar 2022 00:22:53 +0000 (16:22 -0800)]
[lldb/Test] Fix test_launch_scripted_process_stack_frames failure
This should fix the test_launch_scripted_process_stack_frames GreenDragon
test failure : https://green.lab.llvm.org/green/job/lldb-cmake/41901
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Thomas Lively [Sat, 5 Mar 2022 00:07:16 +0000 (16:07 -0800)]
[WebAssembly] Check bulk-memory when adjusting lang opts
We previously had logic to disable pthreads, set the ThreadModel to Single, and
disable thread-safe statics when the atomics target features is disabled, since
that means that the resulting program will not be used in a threaded context.
Similarly check for the presence of the bulk-memory feature, since that is also
necessary to produce multithreaded programs.
Differential Revision: https://reviews.llvm.org/D121014
Zequan Wu [Thu, 3 Mar 2022 19:59:57 +0000 (11:59 -0800)]
[clang-format] fix namepsace format when the name is macro expansion
Originally filed at crbug.com/1184570.
When the name of a namespace is a macro that takes arguments,
- It fixed the indentation.
- It fixed the namepsace end comments.
Differential Revision: https://reviews.llvm.org/D120931
Andrew Browne [Fri, 4 Mar 2022 23:45:55 +0000 (15:45 -0800)]
[Docs] List __has_feature(dataflow_sanitizer) in LanguageExtensions docs.
Kevin Athey [Fri, 4 Mar 2022 22:08:36 +0000 (14:08 -0800)]
[MSAN] extend ioctl interceptor to support BLKSSZGET
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D120693
River Riddle [Thu, 3 Mar 2022 01:54:32 +0000 (17:54 -0800)]
[mlir][Pass] Add support for an InterfacePass and pass filtering based on OperationName
This commit adds a new hook Pass `bool canScheduleOn(RegisteredOperationName)` that
indicates if the given pass can be scheduled on operations of the given type. This makes it
easier to define constraints on generic passes without a) adding conditional checks to
the beginning of the `runOnOperation`, or b) defining a new pass type that forwards
from `runOnOperation` (after checking the invariants) to a new hook. This new hook is
used to implement an `InterfacePass` pass class, that represents a generic pass that
runs on operations of the given interface type.
The PassManager will also verify that passes added to a pass manager can actually be
scheduled on that pass manager, meaning that we will properly error when an Interface
is scheduled on an operation that doesn't actually implement that interface.
Differential Revision: https://reviews.llvm.org/D120791
Jorge Gorbe Moya [Fri, 4 Mar 2022 22:02:20 +0000 (14:02 -0800)]
Revert "[ELF] Parallelize initializeLocalSymbols"
This reverts commit
09602d3b47ec83abb2c26efa5a199c13b72c7abf.
Med Ismail Bennani [Fri, 4 Mar 2022 22:21:56 +0000 (14:21 -0800)]
[lldb/Test] Disable test_scripted_process_and_scripted_thread on Windows
This disables TestScriptedProcess.test_scripted_process_and_scripted_thread
on Windows since the inferior binary a linked to a dylib that doesn't
build on Windows.
This should fix https://lab.llvm.org/buildbot/#/builders/83/builds/16100
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Martin Storsjö [Fri, 21 Jan 2022 23:21:31 +0000 (23:21 +0000)]
[libcxx] Fix the ctype `is` (pointer version) function for Windows
Previously, this test snippet would report incorrect information:
F::mask m;
std::wstring in(L"\u00DA"); // LATIN CAPITAL LETTER U WITH ACUTE
f.is(in.data(), in.data() + 1, &m);
// m & F::lower would be set
The single-character version of the `is` function wasn't
affected by this issue though.
Define `_LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA` for Windows,
as the `alpha` / `_ALPHA` constant is a mask consisting of
multiple bits set, which avoids setting `alpha` whenver any
of the bits is set, in the `do_is` implementation.
On Windows, with the "C" locale, wchars are classified according
to their Unicode interpretation, just as in the en_US.UTF-8 locale on
all platforms.
Due to the differing classification of some characters, the
`scan_is` and `scan_not` tests are quite annoying to fix, thus just
ifdef out some of the tests for the "C" locale there - the code gets
tested with the more standard en_US.UTF-8 locale anyway.
Differential Revision: https://reviews.llvm.org/D120796
Arthur O'Dwyer [Thu, 24 Feb 2022 01:08:28 +0000 (20:08 -0500)]
[libc++] [LWG3656] Update the return type of std::bit_width.
Fixes LWG3656, "Inconsistent bit operations returning a count".
https://cplusplus.github.io/LWG/issue3656
The fix has been approved for C++23 and left to vendors' discretion
in C++20 (but it sounds like everyone's on the same page that
of course it should be DR'ed back to C++20 too).
Differential Revision: https://reviews.llvm.org/D120444
Aart Bik [Fri, 4 Mar 2022 21:26:56 +0000 (13:26 -0800)]
[mlir][sparse] fix mlir-window build breakage
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D121022
Tanya Lattner [Fri, 4 Mar 2022 22:27:07 +0000 (14:27 -0800)]
Update references to the mailing list to reference Discourse. Also update references to LLVM Bugzilla as we have moved to GitHub issues.
Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D120833
Mogball [Fri, 4 Mar 2022 22:25:18 +0000 (22:25 +0000)]
[mlir] RegionBranchOpInterface should be verifyWithRegions
Roman Lebedev [Fri, 4 Mar 2022 22:08:11 +0000 (01:08 +0300)]
Revert "Reland [SROA] Maintain shadow/backing alloca when some slices are noncapturnig read-only calls to allow alloca partitioning/promotion"
There seems to be one more uncaught problem, SROA may now end up trying
to re-re-repromote the just-promoted shadow alloca, and do that endlessly.
This reverts commit
adc0984d81f570ecc38ea23e7f556b95c7831e4c.
Mogball [Fri, 4 Mar 2022 21:59:14 +0000 (21:59 +0000)]
[mlir][ods] Save the Enum info in EnumAttr
Mogball [Fri, 4 Mar 2022 21:58:17 +0000 (21:58 +0000)]
[mlir] NFC fix missing dependency on Async
Saleem Abdulrasool [Fri, 4 Mar 2022 21:50:54 +0000 (21:50 +0000)]
ObjectFile: add a case for `EM_RISCV`
This adds the jump slot mapping for RISCV. This enables lldb to attach to a
remote debug server. Although this doesn't enable debugging RISCV targets, it
is sufficient to attach, which is a slight improvement.
Tested with DebugServer2:
~~~
(lldb) gdb-remote localhost:1234
(lldb) Process 71438 stopped
* thread #1, name = 'reduced', stop reason = signal SIGTRAP
frame #0: 0x0000003ff7fe1b20
error: Process 71438 is currently being debugged, kill the process before connecting.
(lldb) register read
general:
x0 = 0x0000003ff7fe1b20
x1 = 0x0000002ae00d3a50
x2 = 0x0000003ffffff3e0
x3 = 0x0000002ae01566e0
x4 = 0x0000003fe567c7b0
x5 = 0x0000000000001000
x6 = 0x0000002ae00604ec
x7 = 0x00000000000003ff
x8 = 0x0000003fffc22db0
x9 = 0x0000000000000000
x10 = 0x0000000000000000
x11 = 0x0000002ae603b1c0
x12 = 0x0000002ae6039350
x13 = 0x0000000000000000
x14 = 0x0000002ae6039350
x15 = 0x0000002ae6039350
x16 = 0x73642f74756f3d5f
x17 = 0x00000000000000dd
x18 = 0x0000002ae6038f08
x19 = 0x0000002ae603b1c0
x20 = 0x0000002b0f3d3f40
x21 = 0x0000003ff0b212d0
x22 = 0x0000002b0f3a2740
x23 = 0x0000002b0f3de3a0
x24 = 0x0000002b0f3d3f40
x25 = 0x0000002ad6929850
x26 = 0x0000000000000000
x27 = 0x0000002ad69297c0
x28 = 0x0000003fe578b364
x29 = 0x000000000000002f
x30 = 0x0000000000000000
x31 = 0x0000002ae602401a
pc = 0x0000003ff7fe1b20
ft0 = 0
ft1 = 0
ft2 = 0
ft3 = 0
ft4 = 0
ft5 = 0
ft6 = 0
ft7 = 0
fs0 = 0
fs1 = 0
fa0 = 0
fa1 = 0
fa2 = 0
fa3 = 0
fa4 = 0
fa5 = 0
fa6 = 0
fa7 = 9.
10304232197721e-313
fs2 = 0
fs3 = 1.
35805727667792e-312
fs4 = 1.
35589259164679e-312
fs5 = 1.
35805727659887e-312
fs6 = 9.
10304232355822e-313
fs7 = 0
fs8 = 9.
10304233027751e-313
fs9 = 0
fs10 = 9.
10304232948701e-313
fs11 = 1.
35588724164707e-312
ft8 = 0
ft9 = 9.
1372158616833e-313
ft10 = 9.
13720376537528e-313
ft11 = 1.
356808717416e-312
3 registers were unavailable.
(lldb) disassemble
error: Failed to disassemble memory at 0x3ff7fe1b2
~~~
Stella Laurenzo [Fri, 4 Mar 2022 20:08:04 +0000 (12:08 -0800)]
Reapply "[cmake] Prefix gtest and gtest_main with "llvm_"."
This reverts commit
7cdda6b8ce49ae3c90c068cff4dc355bba5d77f2.
Differential Revision: https://reviews.llvm.org/D121020
Med Ismail Bennani [Fri, 4 Mar 2022 21:36:36 +0000 (13:36 -0800)]
revert "[lldb/Host] Fix crash in FileSystem::IsLocal"
This reverts commit
2dc6e906b09deb092c15a726c06d0ecbeec1eb18 following
changes introduced in
59eb70527741594fe3c92d0a1b6704ed45111437.
Med Ismail Bennani [Fri, 4 Mar 2022 19:22:32 +0000 (11:22 -0800)]
[lldb/Plugins] Add ability to load modules to Scripted Processes
This patch introduces a new way to load modules programatically with
Scripted Processes. To do so, the scripted process blueprint holds a
list of dictionary describing the modules to load, which their path or
uuid, load address and eventually a slide offset.
LLDB will fetch that list after launching the ScriptedProcess, and
iterate over each entry to create the module that will be loaded in the
Scripted Process' target.
The patch also refactors the StackCoreScriptedProcess test to stop
inside the `libbaz` module and make sure it's loaded correctly and that
we can fetch some variables from it.
rdar://
74520238
Differential Revision: https://reviews.llvm.org/D120969
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Tue, 1 Mar 2022 01:37:28 +0000 (17:37 -0800)]
[lldb/Plugin] Use static ScriptedInterface::ErrorWithMessage function (NFC)
This patch replaces the calls to ErrorWithMessage using the GetInterface
message by a call to the static method directly.
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Sat, 26 Feb 2022 04:50:05 +0000 (20:50 -0800)]
[lldb/test] Re-enable TestEvents.py on Darwin and fix crashes
This patch re-enables TestEvents.py on Darwin and fixes some crashes
that were happening due to an undefined method.
I ran it 100 times locally with the following command and it passed
every the time:
```
for i in {1..100}; do print $i/100; ./bin/lldb-dotest -p TestEvents.py 2>&1 | rg PASSED; if [ "$?" -eq "1" ]; then break; fi; done
```
Let's see if it still fails non-deterministically on the bots and
eventually also re-enable it on linux.
rdar://
37037235
Differential Revision: https://reviews.llvm.org/D120607
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Yaxun (Sam) Liu [Fri, 4 Mar 2022 21:27:53 +0000 (16:27 -0500)]
Fix test failure in openmp-offload.c
Update active offload kind of actions for OpenMP programs.
The change is expected as of
e5eb365069cce7bb642421d53a1d3964f8d5bdb7.
Richard Howell [Fri, 4 Mar 2022 21:24:37 +0000 (13:24 -0800)]
[llvm] add -r functionality to llvm-bitcode-strip
This diff adds functionality to the llvm-bitcode-strip tool for
stripping of LLVM bitcode sections.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D120669
Augie Fackler [Fri, 11 Feb 2022 20:07:48 +0000 (15:07 -0500)]
OpenMP: add allocsize(0) attribute to __kmpc_alloc_shared
This is the second step in obviating two columns about allocation
functions in MemoryBuiltins.cpp.
Differential Revision: https://reviews.llvm.org/D119583
Roman Lebedev [Thu, 24 Feb 2022 12:24:36 +0000 (15:24 +0300)]
Reland [SROA] Maintain shadow/backing alloca when some slices are noncapturnig read-only calls to allow alloca partitioning/promotion
This is inspired by the original variant of D109749 by Graham Hunter,
but is a more general version.
Roughly, instead of promoting the alloca, we call it
a shadow/backing alloca, go through all it's slices,
clone(!) instructions that operated on it,
but make them operate on the cloned alloca,
and promote cloned alloca instead.
This keeps the shadow/backing alloca, and all the original instructions
around, which results in said shadow/backing alloca being
a perfect mirror/representation of the promoted alloca's content,
so calls that take the alloca as arguments (non-capturingly!)
can be supported.
For now, we require that the calls also don't modify the alloca's content,
but that is only to simplify the initial implementation,
and that will be supported in a follow-up.
Overall, this leads to *smaller* codesize:
https://llvm-compile-time-tracker.com/compare.php?from=
a8b4f5bbab62091835205f3d648902432a4a5b58&to=
aeae054055b125b011c1122f82c86457e159436f&stat=size-total
and is roughly neutral compile-time wise:
https://llvm-compile-time-tracker.com/compare.php?from=
a8b4f5bbab62091835205f3d648902432a4a5b58&to=
aeae054055b125b011c1122f82c86457e159436f&stat=instructions
This relands commit
703240c71fd640af7490069e8149d32d78d14da1,
that was reverted by commit
7405581f7ca3ba54be8a04c394a96fe6d980f073,
because the assertion `isa<LoadInst>(OrigInstr)` didn't hold in practice,
as the newly added test `@select_of_ptrs` shows:
If the pointers into alloca are used by select's/PHI's, then even if
we manage to fracture the alloca, some sub-alloca's will likely remain.
And if there are any non-capturing calls, then we will also decide to
keep the original backing alloca around, and we suddenly ~doubled
the alloca size, and the amount of memory traffic.
I'm not sure if this is a problem or we could live with it,
but let's leave that for later...
Reviewed By: djtodoro
Differential Revision: https://reviews.llvm.org/D113520
Roman Lebedev [Fri, 4 Mar 2022 20:46:27 +0000 (23:46 +0300)]
[NFC][SROA] Add test w/ select and non-capturing call
Zequan Wu [Fri, 4 Mar 2022 03:22:30 +0000 (19:22 -0800)]
[LLDB] Flush stream at the end of PrintCommandOutput
On Windows, lldb doesn't print any error message until exit. This fixes it.
Differential Revision: https://reviews.llvm.org/D120961
Augie Fackler [Wed, 26 Jan 2022 04:50:22 +0000 (23:50 -0500)]
getAllocAlignment: respect allocalign attribute if present
As with allocsize(), we prefer the table data to attributes.
Differential Revision: https://reviews.llvm.org/D118263
Augie Fackler [Fri, 21 Jan 2022 17:07:53 +0000 (12:07 -0500)]
BuildLibCalls: add allocalign attributes for memalign and aligned_alloc
This gets us close to being able to remove a column from the table in
MemoryBuiltins.cpp.
Differential Revision: https://reviews.llvm.org/D117923
Augie Fackler [Fri, 21 Jan 2022 16:22:09 +0000 (11:22 -0500)]
Attributes: add a new allocalign attribute
This will let us start moving away from hard-coded attributes in
MemoryBuiltins.cpp and put the knowledge about various attribute
functions in the compilers that emit those calls where it probably
belongs.
Differential Revision: https://reviews.llvm.org/D117921