Matt Morehouse [Thu, 9 Dec 2021 20:19:40 +0000 (12:19 -0800)]
[libFuzzer] Remove entropic-scale-per-exec-time.test.
The test has been flaky for years, and I think we should remove it to
eliminate noise on the buildbot.
Neither me nor dokyungs have been able to fully deflake the test, and it
tests a non-default Entropic flag.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D115453
Vitaly Buka [Thu, 9 Dec 2021 19:21:16 +0000 (11:21 -0800)]
[lsan] Move out suppression of invalid PCs from StopTheWorld
This removes the last use of StackDepot from StopTheWorld.
Depends on D115284.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D115319
Vitaly Buka [Wed, 8 Dec 2021 08:44:51 +0000 (00:44 -0800)]
[NFC][sanitizer] Relax InternalLowerBound interface
val can be of any type accepted by Compare.
Aart Bik [Wed, 8 Dec 2021 18:13:14 +0000 (10:13 -0800)]
[mlir][sparse] reenable asan for sampled mm integration test
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D115364
Jessica Paquette [Wed, 8 Dec 2021 20:00:47 +0000 (12:00 -0800)]
[AArch64][GlobalISel] Legalize scalar G_FMAXIMUM + G_FMINIMUM
Necessary for implementing some combines on floating point selects.
Differential Revision: https://reviews.llvm.org/D115372
Vitaly Buka [Wed, 8 Dec 2021 05:40:20 +0000 (21:40 -0800)]
[lsan] Reduce StopTheWorld access to StackDepot
StackDepot locks some stuff. As is there is small probability to
deadlock if we stop thread which locked the Depot.
We need either Lock/Unlock StackDepot for StopTheWorld, or don't
interact with StackDepot from there.
This patch does not run LeakReport under StopTheWorld. LeakReport
contains most of StackDepot access.
As a bonus this patch will help to resolve kMaxLeaksConsidered FIXME.
Depends on D114498.
Reviewed By: morehouse, kstoimenov
Differential Revision: https://reviews.llvm.org/D115284
Martin Storsjö [Thu, 9 Dec 2021 09:09:39 +0000 (11:09 +0200)]
[benchmark] Reapply fix for -Wcovered-switch-default warning
This reapplies a fix from
948ce4e6edec6ad3cdf1911fc3e8e9569140d4ff,
whichn't originally submitted upstream. I has now been merged upstream
though, in https://github.com/google/benchmark/pull/1302.
When benchmarks were unified in
5dda2efde574d3a200d04c371f561a77ee9f4aff, it lost this change,
but it also lost another local modification, where benchmark's
CMakeLists.txt was modified to comment out adding -Werror.
(This change was part of the original import in
0addd170ab0880941fa4089c2717f3f3a0e4e25a.)
As the benchmark library is built automatically by default, when
building all of LLVM (contrary to the copy in libcxx, which wasn't
built by default), building it with -Werror by default is very brittle.
This fixes building LLVM with MinGW. (It wasn't broken in MSVC
mode, as the benchmark library doesn't add -Werror or anything
equivalent in MSVC mode, and it's unclear if this warning is
enabled in that mode at all.)
Differential Revision: https://reviews.llvm.org/D115434
Martin Storsjö [Sat, 23 Oct 2021 22:11:20 +0000 (01:11 +0300)]
Reapply #2 of [runtimes] Fix building initial libunwind+libcxxabi+libcxx with compiler implied -lunwind
This does mostly the same as D112126, but for the runtimes cmake files.
Most of that is straightforward, but the interdependency between
libcxx and libunwind is tricky:
Libunwind is built at the same time as libcxx, but libunwind is not
installed yet. LIBCXXABI_USE_LLVM_UNWINDER makes libcxx link directly
against the just-built libunwind, but the compiler implicit -lunwind
isn't found. This patch avoids that by adding --unwindlib=none if
supported, if we are going to link explicitly against a newly built
unwinder anyway.
Since the previous attempt, this no longer uses
llvm_enable_language_nolink (and thus doesn't set
CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY during the compiler
sanity checks). Setting CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY
during compiler sanity checks makes cmake not learn about some
aspects of the compiler, which can make further find_library or
find_package fail. This caused OpenMP to not detect libelf and libffi,
disabling some OpenMP target plugins.
Instead, require the caller to set CMAKE_{C,CXX}_COMPILER_WORKS=YES
when building in a configuration with an incomplete toolchain.
Differential Revision: https://reviews.llvm.org/D113253
Vitaly Buka [Wed, 8 Dec 2021 05:37:02 +0000 (21:37 -0800)]
[NFC][lsan] Change LeakSuppressionContext interface
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D115318
Alexey Bataev [Tue, 7 Dec 2021 18:16:14 +0000 (10:16 -0800)]
[SLP]Fix comparator for cmp instruction vectorization.
The comparator for the sort functions should provide strict weak
ordering relation between parameters. Current solution causes compiler
crash with some standard c++ library implementations, because it does
not meet this criteria. Tried to fix it + it improves the iverall
vectorization result.
Differential Revision: https://reviews.llvm.org/D115268
Philip Reames [Thu, 9 Dec 2021 18:52:35 +0000 (10:52 -0800)]
[reductions] Delete another piece of dead flag handling [NFC]
The code claimed to handle nsw/nuw, but those aren't passed via builder state and the explicit IR construction just above never sets them.
The only case this bit of code is actually relevant for is FMF flags. However, dropPoisonGeneratingFlags currently doesn't know about FMF at all, so this was a noop. It's also unneeded, as the caller explicitly configures the flags on the builder before this call, and the flags on the individual ops should be controled by the intrinsic flags anyways. If any of the flags aren't safe to propagate, the caller needs to make that change.
Ellis Hoag [Thu, 9 Dec 2021 18:41:13 +0000 (10:41 -0800)]
[dsymutil][NFC] Fix typo in help message
Just a simple typo fix that allows me to test landing a commit now that
I have commit access.
Reviewed By: xgupta
Differential Revision: https://reviews.llvm.org/D115414
Philip Reames [Thu, 9 Dec 2021 18:42:18 +0000 (10:42 -0800)]
[recurrence] Delete dead flag/fmf handling [NFC]
The recurrence lowering code has handling which claims to be about flag intersection, but all the callers pass empty arrays to the arguments. The sole exception is a caller of a method which has the argument, but no implementation.
I don't know what the intent was here, but it certaintly doesn't actually do anything today.
Vitaly Buka [Wed, 8 Dec 2021 20:28:12 +0000 (12:28 -0800)]
[asan] Run background thread for asan only on THUMB
As in D114934, or lsan crashes on the same bot.
Vitaly Buka [Tue, 23 Nov 2021 05:24:10 +0000 (21:24 -0800)]
[sanitizer] Run Stack compression in background thread
Depends on D114495.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D114498
Philip Reames [Thu, 9 Dec 2021 17:54:45 +0000 (09:54 -0800)]
[instcombine] Do demanded elts last when visiting extractelement
This reorders existing transforms to put demanded elements last. The reasoning here is that when we have an example which can be scalarized or handled via demanded bits, we should prefer scalarization as that doesn't require dropping flags on arithmetic instructions.
This doesn't show major changes in the tests today, but once I add support for fast math flags to dropPoisonGeneratingFlags this becomes glaringly obvious.
Differential Revision: https://reviews.llvm.org/D115394
Benjamin Kramer [Thu, 9 Dec 2021 17:56:13 +0000 (18:56 +0100)]
Thread safety analysis: Remove unused variable. NFC.
Petr Hosek [Thu, 9 Dec 2021 17:55:49 +0000 (09:55 -0800)]
Revert "[sanitizer] Run Stack compression in background thread"
This reverts commit
e5c2a46c5e8fc038b9f6c898df9628f9524dc10e as this
change introduced a linker error when building sanitizer runtimes:
ld.lld: error: undefined symbol: __sanitizer::internal_start_thread(void* (*)(void*), void*)
>>> referenced by sanitizer_stackdepot.cpp:133 (compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp:133)
>>> compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonSymbolizer.x86_64.dir/sanitizer_stackdepot.cpp.obj:(__sanitizer::(anonymous namespace)::CompressThread::NewWorkNotify())
Philip Reames [Thu, 9 Dec 2021 17:40:03 +0000 (09:40 -0800)]
Compute estimated trip counts for multiple exit loops
This change allows us to estimate trip count from profile metadata for all multiple exit loops. We still do the estimate only from the latch, but that's fine as it causes us to over estimate the trip count at worst.
Reviewing the uses of the API, all but one are cases where we restrict a loop transformation (unroll, and vectorize respectively) when we know the trip count is short enough. So, as a result, the change makes these passes strictly less aggressive. The test change illustrates a case where we'd previously have runtime unrolled a loop which ran fewer iterations than the unroll factor. This is definitely unprofitable.
The one case where an upper bound on estimate trip count could drive a more aggressive transform is peeling, and I duplicated the logic being removed from the generic estimation there to keep it the same. The resulting heuristic makes no sense and should probably be immediately removed, but we can do that in a separate change.
This was noticed when analyzing regressions on D113939.
I plan to come back and incorporate estimated trip counts from other exits, but that's a minor improvement which can follow separately.
Differential Revision: https://reviews.llvm.org/D115362
Stanislav Mekhanoshin [Wed, 17 Nov 2021 20:33:31 +0000 (12:33 -0800)]
[InstCombine] (~a & b & c) | ~(a | b | c) -> ~(a | (b ^ c))
Transform
```
(~a & b & c) | ~(a | b | c) -> ~(a | (b ^ c))
```
And swapped case:
```
(~a | b | c) & ~(a & b & c) -> ~a | (b ^ c)
```
```
----------------------------------------
define i4 @src(i4 %a, i4 %b, i4 %c) {
%0:
%or1 = or i4 %b, %a
%or2 = or i4 %or1, %c
%not1 = xor i4 %or2, 15
%not2 = xor i4 %a, 15
%and1 = and i4 %b, %not2
%and2 = and i4 %and1, %c
%or3 = or i4 %and2, %not1
ret i4 %or3
}
=>
define i4 @tgt(i4 %a, i4 %b, i4 %c) {
%0:
%1 = xor i4 %c, %b
%2 = or i4 %1, %a
%or3 = xor i4 %2, 15
ret i4 %or3
}
Transformation seems to be correct!
```
```
----------------------------------------
define i4 @src(i4 %a, i4 %b, i4 %c) {
%0:
%and1 = and i4 %b, %a
%and2 = and i4 %and1, %c
%not1 = xor i4 %and2, 15
%not2 = xor i4 %a, 15
%or1 = or i4 %not2, %b
%or2 = or i4 %or1, %c
%and3 = and i4 %or2, %not1
ret i4 %and3
}
=>
define i4 @tgt(i4 %a, i4 %b, i4 %c) {
%0:
%xor = xor i4 %b, %c
%not = xor i4 %a, 15
%or = or i4 %xor, %not
ret i4 %or
}
Transformation seems to be correct!
```
Differential Revision: https://reviews.llvm.org/D112966
CJ Johnson [Thu, 9 Dec 2021 17:28:07 +0000 (17:28 +0000)]
Prevent abseil-cleanup-ctad check from stomping on surrounding context
This change applies two fixes to the abseil-cleanup-ctad check. It uses hasSingleDecl() to ensure only declStmt()s with one varDecl() are matched (leaving compount declStmt()s unchanged). It also addresses a bug in the handling of comments that surround the absl::MakeCleanup() calls by switching to the callArgs() combinator from Clang Transformer.
Reviewed By: ymandel
Differential Revision: https://reviews.llvm.org/D115452
Kazu Hirata [Thu, 9 Dec 2021 17:37:29 +0000 (09:37 -0800)]
[llvm] Use range-based for loops (NFC)
MaheshRavishankar [Thu, 9 Dec 2021 17:18:00 +0000 (09:18 -0800)]
[mlir][Vector] Avoid infinite loop in InnerOuterDimReductionConversion.
This patterns tries to convert an inner (outer) dim reduction to an
outer (inner) dim reduction. Doing this on a 1D or 0D vector results
in an infinite loop since the converted op is same as the original
operation. Just returning failure when source rank <= 1 fixes the
issue.
Differential Revision: https://reviews.llvm.org/D115426
Valentin Clement [Thu, 9 Dec 2021 17:28:36 +0000 (18:28 +0100)]
[fir] Keep runtime function name in comment
Some of the function name in the comment didn't match
their actual name in the runtime. This patch fixes that.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D115076
Jonas Devlieghere [Thu, 9 Dec 2021 17:18:10 +0000 (09:18 -0800)]
Revert "tsan: new runtime (v3)"
This reverts commit
5a33e412815b8847610425a2a3b86d2c7c313b71 becuase it
breaks LLDB.
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/39208/
Craig Topper [Thu, 9 Dec 2021 16:53:46 +0000 (08:53 -0800)]
[RISCV] Use MULHU for more division by constant cases.
D113805 improved handling of i32 divu/remu on RV64. The basic idea
from that can be extended to (mul (and X, C2), C1) where C2 is any
mask constant.
We can replace the and with an SLLI by shifting by the number of
leading zeros in C2 if we also shift C1 left by XLen - lzcnt(C1)
bits. This will give the full product XLen additional trailing zeros,
putting the result in the output of MULHU. If we can't use ANDI,
ZEXT.H, or ZEXT.W, this will avoid materializing C2 in a register.
The downside is it make take 1 additional instruction to create C1.
But since that's not on the critical path, it can hopefully be
interleaved with other operations.
The previous tablegen pattern is replaced by custom isel code.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D115310
Jon Chesterfield [Thu, 9 Dec 2021 16:47:41 +0000 (16:47 +0000)]
[amdgpu][nfc] Drop dead PtrSet, fix a comment
Haojian Wu [Thu, 9 Dec 2021 11:10:58 +0000 (12:10 +0100)]
[lldb] Remove unused lldb.cpp
lldb.cpp is unused after https://github.com/llvm/llvm-project/commit/
ccf1469a4cdb03cb2bc7868f76164e85d90ebee1
Differential Revision: https://reviews.llvm.org/D115438
Arthur Eubanks [Wed, 8 Dec 2021 19:49:12 +0000 (11:49 -0800)]
[NFC] Replace some deprecated getAlignment() calls with getAlign()
Reviewed By: gchatelet
Differential Revision: https://reviews.llvm.org/D115370
Craig Topper [Thu, 9 Dec 2021 16:04:43 +0000 (08:04 -0800)]
[RISCV] Reduce duplicate FP test cases.
-Remove feq, fle, flt tests from *-arith.ll in favor of *-fcmp.ll which tests all predicates.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D113703
Bixia Zheng [Tue, 7 Dec 2021 23:15:42 +0000 (15:15 -0800)]
Avoid unnecessary output buffer allocation and initialization.
The sparse tensor code generator allocates memory for the output tensor. As
such, we only need to allocate a MemRefDescriptor to receive the output tensor
and do not need to allocate and initialize the storage for the tensor.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D115292
Shraiysh Vaishay [Thu, 9 Dec 2021 14:28:25 +0000 (19:58 +0530)]
[NFC][mlir][OpenMP] Added documentation for omp.atomic ops
This patch adds the documentation for the operations `omp.atomic.read`,
`omp.atomic.write` and `omp.atomic.update`.
Reviewed By: peixin
Differential Revision: https://reviews.llvm.org/D115445
David Sherwood [Mon, 6 Dec 2021 11:02:29 +0000 (11:02 +0000)]
[AArch64][Analysis] Add on overhead costs for SVE gathers and scatters
This patch adds on an overhead cost for gathers and scatters, which
is a rough estimate based on performance investigations I have
performed on SVE hardware for various micro-benchmarks.
Differential Revision: https://reviews.llvm.org/D115143
Krzysztof Drewniak [Wed, 8 Dec 2021 23:28:06 +0000 (23:28 +0000)]
[MLIR][GPU] Define gpu.printf op and its lowerings
- Define a gpu.printf op, which can be lowered to any GPU printf() support (which is present in CUDA, HIP, and OpenCL). This op only supports constant format strings and scalar arguments
- Define the lowering of gpu.pirntf to a call to printf() (which is what is required for AMD GPUs when using OpenCL) as well as to the hostcall interface present in the AMD Open Compute device library, which is the interface present when kernels are running under HIP.
- Add a "runtime" enum that allows specifying which of the possible runtimes a ROCDL kernel will be executed under or that the runtime is unknown. This enum controls how gpu.printf is lowered
This change does not enable lowering for Nvidia GPUs, but such a lowering should be possible in principle.
And:
[MLIR][AMDGPU] Always set amdgpu-implicitarg-num-bytes=56 on kernels
This is something that Clang always sets on both OpenCL and HIP kernels, and failing to include it causes mysterious crashes with printf() support.
In addition, revert the max-flat-work-group-size to (1, 256) to avoid triggering bugs in the AMDGPU backend.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D110448
David Sherwood [Wed, 1 Dec 2021 14:55:10 +0000 (14:55 +0000)]
[LoopVectorize][AArch64] Add vectoriser cost model tests for gathers/scatters
I've added some tests that were previously missing for the gather-scatter costs
being calculated by the vectorizer for AArch64:
Transforms/LoopVectorize/AArch64/sve-gather-scatter-cost.ll
The costs are sometimes different to the ones in
Analysis/CostModel/AArch64/sve-gather.ll
because the vectorizer also adds on the address computation cost.
Brian Cain [Thu, 9 Dec 2021 15:30:27 +0000 (07:30 -0800)]
Revert "[xray] add support for hexagon"
This reverts commit
543a9ad7c460bb8d641b1b7c67bbc032c9bfdb45.
Eugene Zhulenev [Thu, 9 Dec 2021 11:21:22 +0000 (03:21 -0800)]
[mlir] AsyncParallelFor: align block size to be a multiple of inner loops iterations
Depends On D115263
By aligning block size to inner loop iterations parallel_compute_fn LLVM can later unroll and vectorize some of the inner loops with small number of trip counts. Up to 2x speedup in multiple benchmarks.
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D115436
Eugene Zhulenev [Wed, 8 Dec 2021 02:45:31 +0000 (18:45 -0800)]
[mlir] AsyncParallelFor: sink constants into the parallel compute function
With complex recursive structure of async dispatch function LLVM can't always propagate constants to the parallel_compute_fn and it often prevents optimizations like loop unrolling and vectorization. We help LLVM by pushing known constants into the parallel_compute_fn explicitly.
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D115263
Amy Kwan [Thu, 9 Dec 2021 01:54:57 +0000 (19:54 -0600)]
[test-release.sh] Respect the given width in LIT runs by adding `-j` in LLVM_LIT_ARGS.
This patch adds allows the LIT runs within test-release.sh to obey the width that
is passed into the script. This is accomplished by adding the width in the LLVM_LIT_ARGS
CMake configuration.
Differential Revision: https://reviews.llvm.org/D115350
Nikita Popov [Thu, 9 Dec 2021 13:18:32 +0000 (14:18 +0100)]
[InlineAdvisor] Remove outdated comment (NFC)
This just returns None nowadays, so this comment doesn't apply
anymore.
Nikita Popov [Wed, 8 Dec 2021 13:03:46 +0000 (14:03 +0100)]
[Inliner] Add debug message for history skip (NFC)
Jake Egan [Thu, 9 Dec 2021 14:03:16 +0000 (09:03 -0500)]
[AIX] Disable failing tests because of missing DWARF sections
The following tests are failing due to missing DWARF sections: `DwarfAccelNamesSection` and `DwarfAddrSection`. This patch sets these tests as `XFAIL` until the sections can be implemented for AIX.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D114681
Brian Cain [Thu, 9 Dec 2021 01:57:20 +0000 (17:57 -0800)]
[xray] add support for hexagon
Adds x-ray support for hexagon to llvm codegen, clang driver,
compiler-rt libs.
Differential Revision: https://reviews.llvm.org/D113638
Ties Stuij [Thu, 9 Dec 2021 11:51:31 +0000 (11:51 +0000)]
[ARM][clang] Option b-key must not affect __ARM_FEATURE_PAC_DEFAULT
When using -mbranch-protection=pac-ret+b-key, macro __ARM_FEATURE_PAC_DEFAULT
should still have the value corresponding to a-key, because b-key is only valid
for AArch64.
This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension
The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:
https://developer.arm.com/documentation/ddi0553/latest
The following people contributed to this patch:
- Victor Campos
Reviewed By: danielkiss
Differential Revision: https://reviews.llvm.org/D115140
Matthias Springer [Thu, 9 Dec 2021 10:50:47 +0000 (19:50 +0900)]
[mlir][linalg][bufferize] LinalgOps can bufferize inplace with input args
LinalgOp results usually bufferize inplace with output args. With this change, they may buffer inplace with input args if the value of the output arg is not used in the computation.
Differential Revision: https://reviews.llvm.org/D115022
lh123 [Thu, 9 Dec 2021 12:12:48 +0000 (20:12 +0800)]
[clang][clangd] Desugar array type.
Desugar array type.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D115107
Dmitry Makogon [Thu, 9 Dec 2021 11:41:48 +0000 (18:41 +0700)]
[MetaRenamer] Add command line options to disable renaming name with specified prefixes
This patch adds 4 options for specifying functions, aliases, globals and
structs name prefixes hat don't need to be renamed by MetaRenamer pass.
This is useful if one has some downstream logic that depends directly
on an entity name. MetaRenamer can break this logic, but with the patch
you can tell it not to rename certain names.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D115323
Lasse Folger [Thu, 9 Dec 2021 11:09:56 +0000 (12:09 +0100)]
[lldb][NFC] clang-format some files as preparation for https://reviews.llvm.org/D114627
Reviewed By: werat
Differential Revision: https://reviews.llvm.org/D115110
Groverkss [Thu, 9 Dec 2021 10:41:00 +0000 (16:11 +0530)]
[MLIR] Move Presburger Math from FlatAffineConstraints to Presburger/IntegerPolyhedron
This patch factors out math functionality that is a subset of Presburger arithmetic and moves it from FlatAffineConstraints to Presburger/IntegerPolyhedron. This patch only moves some parts of the functionality planned to be moved, with subsequent patches moving more functionality. There are three main reasons for this:
1. This split makes the Presburger Library easier and more flexible to use
across MLIR, by not depending on IR.
2. This split allows the Presburger library to be developed independently from
Affine Analysis, with Affine Analysis using this library.
3. With more functionality being upstreamed to the Presburger Library, the
mlir/Analysis directory will be cluttered with Presburger library components
since they depend on math functionality from FlatAffineConstraints. Moving this
functionality to the Presburger directory allows keeping the new functionality
in the Presburger directory.
This patch is part of an ongoing effort to make the Presburger Library easier to use. The motivation for this effort is the feedback received at the LLVM conference from Mehdi and others.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D114674
Martin Storsjö [Thu, 9 Dec 2021 10:54:37 +0000 (12:54 +0200)]
Revert "Reapply [runtimes] Fix building initial libunwind+libcxxabi+libcxx with compiler implied -lunwind"
This reverts commit
317dc31e53b83c1d2a468d7a541925f0cc7d9dce.
After that change, OpenMP doesn't find dependencies in the host
system (it fails do find e.g. /usr/lib/x86_64-linux-gnu/libelf.so
which it found before), which causes some OpenMP target offloading
plugins to not be found. This doesn't break the build, but just
causes the AMDGPU OpenMP target plugin to be omitted. See
https://reviews.llvm.org/D113253#3181934 for the report of this
issue.
Florian Hahn [Thu, 9 Dec 2021 10:51:29 +0000 (10:51 +0000)]
[LV] Mark various functions as const (NFC).
Make sure various accessors do not modify any state, in preparation for
D115111.
Ties Stuij [Thu, 9 Dec 2021 09:40:46 +0000 (09:40 +0000)]
[ARM][clang] Define feature test macro for the PACBTI-M extension
If the extension string "+pacbti" was given in -march=... or -mcpu=... options the compiler shall define the following preprocessor macros:
__ARM_FEATURE_PAUTH with value 1.
__ARM_FEATURE_BTI with value 1.
This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension
The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:
https://developer.arm.com/documentation/ddi0553/latest
The following people contributed to this patch:
- Momchil Velikov
- Ties Stuij
Reviewed By: miyuki
Differential Revision: https://reviews.llvm.org/D112431
mydeveloperday [Thu, 9 Dec 2021 10:34:55 +0000 (10:34 +0000)]
[clang-format] PR48916 PointerAlignment not working when using C++20 init-statement in for loop
https://bugs.llvm.org/show_bug.cgi?id=48916
Left and Right Alignment inside a loop is misaligned.
Reviewed By: HazardyKnusperkeks, curdeius
Differential Revision: https://reviews.llvm.org/D115050
Jan Svoboda [Thu, 9 Dec 2021 09:47:54 +0000 (10:47 +0100)]
[clang][deps] Use MemoryBuffer in minimizing FS
This patch avoids unnecessarily copying contents of `mmap`-ed files into `CachedFileSystemEntry` by storing `MemoryBuffer` instead. The change leads to ~50% reduction of peak memory footprint when scanning LLVM+Clang via `clang-scan-deps`.
Depends on D115331.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D115043
Jan Svoboda [Wed, 8 Dec 2021 12:24:45 +0000 (13:24 +0100)]
[llvm] Add null-termination capability to SmallVectorMemoryBuffer
Most of `MemoryBuffer` interfaces expose a `RequiresNullTerminator` parameter that's being used to:
* determine how to open a file (`mmap` vs `open`),
* assert newly initialized buffer indeed has an implicit null terminator.
This patch adds the paramater to the `SmallVectorMemoryBuffer` constructors, meaning:
* null terminator can now be added to `SmallVector`s that didn't have one before,
* `SmallVectors` that had a null terminator before keep it even after the move.
In line with existing code, the new parameter is defaulted to `true`. This patch makes sure all calls to the `SmallVectorMemoryBuffer` constructor set it to `false` to preserve the current semantics.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D115331
Jan Svoboda [Thu, 9 Dec 2021 09:45:10 +0000 (10:45 +0100)]
[llvm][lldb] Remove unused SmallVectorMemoryBuffer.h includes
Michel Weber [Thu, 9 Dec 2021 10:16:31 +0000 (15:46 +0530)]
[MLIR] Introduce coalesce for PresburgerSet
This patch provides functionality for simplifying `PresburgerSet`s by checking if any `FlatAffineConstraints` in the set is contained in another, and removing such redundant FACs.
This is part of a series of patches to provide functionality for [integer set coalescing](http://impact.gforge.inria.fr/impact2015/papers/impact2015-verdoolaege.pdf) in MLIR.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D110617
Shraiysh Vaishay [Thu, 9 Dec 2021 05:35:55 +0000 (11:05 +0530)]
[MLIR][OpenMP] Added omp.atomic.update
This patch supports the atomic construct (update) following section 2.17.7 of OpenMP 5.0 standard. Also added tests and verifier for the same.
Reviewed By: kiranchandramohan, peixin
Differential Revision: https://reviews.llvm.org/D112982
Martin Storsjö [Fri, 5 Nov 2021 09:28:21 +0000 (11:28 +0200)]
[clang] Fix a misadjusted path style comparison in a unittest
This was changed incorrectly by accident in
99023627010bbfefb71e25a2b4d056de1cbd354e.
Differential Revision: https://reviews.llvm.org/D113254
Jan Svoboda [Thu, 9 Dec 2021 09:42:47 +0000 (10:42 +0100)]
[clang][deps] Use lock_guard instead of unique_lock
This patch changes uses of `std::unique_lock` to `std::lock_guard`.
The `std::unique_lock` template provides some advanced capabilities (deferred locking, time-constrained locking attempts, etc.) we don't use in the caching filesystem. Plain `std::lock_guard` will do here.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D115332
Dmitry Makogon [Thu, 9 Dec 2021 09:22:39 +0000 (16:22 +0700)]
[Test] [GVN] Add test showing equivalent PHIs generation by GVN
Mikael Holmen [Thu, 9 Dec 2021 09:20:27 +0000 (10:20 +0100)]
[ARM] Fix gcc warning about mix of enumeral and non-enumeral types
gcc warned with
../lib/Target/ARM/ARMFrameLowering.cpp:797:31: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
797 | Reg == ARM::R12 ? ARM::RA_AUTH_CODE : Reg, true);
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Mikael Holmen [Thu, 9 Dec 2021 09:18:29 +0000 (10:18 +0100)]
[PowerPC] Fix gcc warning about unused variable [NFC]
gcc warned about
../lib/Target/PowerPC/PPCTargetTransformInfo.cpp:1401:13: warning: unused variable 'VecTy' [-Wunused-variable]
1401 | if (auto *VecTy = dyn_cast<FixedVectorType>(DataType)) {
| ^~~~~
Dmitry Vyukov [Thu, 2 Dec 2021 07:36:44 +0000 (08:36 +0100)]
tsan: new runtime (v3)
This change switches tsan to the new runtime which features:
- 2x smaller shadow memory (2x of app memory)
- faster fully vectorized race detection
- small fixed-size vector clocks (512b)
- fast vectorized vector clock operations
- unlimited number of alive threads/goroutimes
Depends on D112602.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D112603
Fraser Cormack [Wed, 8 Dec 2021 17:54:30 +0000 (17:54 +0000)]
[NewPM] Port FlattenCFGPass to NPM
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D115361
Nicolas Vasilache [Thu, 9 Dec 2021 07:40:19 +0000 (07:40 +0000)]
[mlir][memref] Fix subview offset verification.
Offset-specific verification seems to have been lost in one of the recent refactorings.
Also add proper tests that would have caught this omission.
This addresses the immediate issues discussed in:
https://llvm.discourse.group/t/memref-subview-affine-map-and-symbols/4851
Differential Revision: https://reviews.llvm.org/D115427
Arthur Eubanks [Wed, 8 Dec 2021 21:03:43 +0000 (13:03 -0800)]
[NFC][Verifier] Remove checks for atomic loads/stores that alignment is non-zero
The alignment is never 0 since getAlign() returns 1 << bits.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D115388
Chuanqi Xu [Thu, 9 Dec 2021 06:55:18 +0000 (14:55 +0800)]
[C++20] [Coroutines] Mark coroutine done if unhandled_exception throws
According to [dcl.fct.def.coroutine]/p14:
> If the evaluation of the expression promise.unhandled_exception()
> exits via an exception, the coroutine is considered suspended at the
> final suspend point.
But this is not implemented in clang before. This patch would implement
this feature by marking the coroutine as done at the place of
coro.end(frame, /*InUnwindPath=*/true ).
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D115219
Kito Cheng [Thu, 7 Oct 2021 12:38:37 +0000 (20:38 +0800)]
[RISCV] Fix vm operand constraint to fit GCC's behavior
- `vm` constraint is used for masking operand, which always v0.
- Update testcase, only masking operand should use `vm`, vector mask operations
should just use `vr` for any vector register.
- Revise the description of `vm` constraint.
- This patch also fix issue on RISCVRegisterInfo.td and RISCVISelLowering.cpp.
RISCVRegisterInfo.td:
- The first VT in the list must be the largest total size since the
SelectionDAGBuilder uses the first register in the list as the canonical
type for the register.
RISCVISelLowering.cpp:
- Fix RISCVTargetLowering::splitValueIntoRegisterParts and
RISCVTargetLowering::joinRegisterPartsIntoValue for handling vectors
with different total size, that will happened on fractional LMUL since
fractional LMUL is always occupy one vector register.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D112599
Chuanqi Xu [Thu, 9 Dec 2021 06:37:05 +0000 (14:37 +0800)]
[Coroutines] Remove unused coroutine builtin/intrinsics llvm.coro.param (NFC-ish)
I found that the coroutine intrinsic llvm.coro.param in documentation
(https://llvm.org/docs/Coroutines.html#id101) didn't get used actually
since there isn't lowering codes in LLVM. I also checked the
implementation of libstdc++ and libc++. Both of them didn't use
llvm.coro.param. So I am pretty sure that the llvm.coro.param intrinsic
is unused. I think it would be better t to remove it to avoid possible
misleading understandings.
Note: according to [class.copy.elision]/p1.3, this optimization is
allowed by the C++ language specification. Let's make it someday.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D115222
MaheshRavishankar [Thu, 9 Dec 2021 06:10:12 +0000 (22:10 -0800)]
[mlir][Linalg] Bufferize the region of LinalgOps as well.
The region of `linalg.generic` might contain `tensor` operations. For
example, current lowering of `gather` uses a `tensor.extract` in the
body of the `LinalgOp`. Bufferize the ops within a `LinalgOp` region
as well to catch such cases.
Differential Revision: https://reviews.llvm.org/D115322
Dmitry Vyukov [Thu, 9 Dec 2021 06:18:20 +0000 (07:18 +0100)]
tsan: fork runtime
Fork the current version of tsan runtime before commiting
rewrite of the runtime (D112603). The old runtime can be
enabled with TSAN_USE_OLD_RUNTIME option.
This is a temporal measure for emergencies and is required
for Chromium rollout (for context see http://crbug.com/1275581).
The old runtime is supposed to be deleted soon.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D115223
Chuanqi Xu [Thu, 9 Dec 2021 05:52:28 +0000 (13:52 +0800)]
[C++20 Modules] Don't create global module fragment for extern linkage declaration in GMF already
Previously we would create global module fragment for extern linkage
declaration which is alreday in global module fragment. However, it is
clearly redundant to do so. This patch would check if the extern linkage
declaration are already in GMF before we create a GMF for it.
Mircea Trofin [Thu, 9 Dec 2021 05:12:54 +0000 (21:12 -0800)]
[NFC] Rename MachineFunction::cloneMachineInstrBundle (coding style)
Mircea Trofin [Thu, 9 Dec 2021 04:35:33 +0000 (20:35 -0800)]
[NFC] Rename MachineFunction::deleteMachineInstr (coding style)
Kazu Hirata [Thu, 9 Dec 2021 04:35:39 +0000 (20:35 -0800)]
[llvm] Use range-based for loops (NFC)
LLVM GN Syncbot [Thu, 9 Dec 2021 04:11:22 +0000 (04:11 +0000)]
[gn build] Port
059e03476cbb
Mircea Trofin [Tue, 7 Dec 2021 23:07:39 +0000 (15:07 -0800)]
[NFC][mlgo] Generalize model runner interface
This prepares it for the regalloc work. Part of it is making model
evaluation accross 'development' and 'release' scenarios more reusable.
This patch:
- extends support to tensors of any shape (not just scalars, like we had
in the inliner -Oz case). While the tensor shape can be anything, we
assume row-major layout and expose the tensor as a buffer.
- exposes the NoInferenceModelRunner, which we use in the 'development'
mode to keep the evaluation code path consistent and simplify logging,
as we'll want to reuse it in the regalloc case.
Differential Revision: https://reviews.llvm.org/D115306
Zi Xuan Wu [Thu, 9 Dec 2021 03:35:34 +0000 (11:35 +0800)]
[CSKY] Complete codegen of basic arithmetic and load/store operations
Complete basic arithmetic operations such as add/sub/mul/div, and it also includes converions
and some specific operations such as bswap.Add load/store patterns to generate different addressing mode instructions.
Also enable some infra such as copy physical register and eliminate frame index.
Joe Loser [Thu, 9 Dec 2021 01:01:39 +0000 (20:01 -0500)]
[libc++][NFC] Remove test/support/tracked_value.h
No tests are using `libcxx/test/support/tracked_value.h`. So, remove it.
Differential Revision: https://reviews.llvm.org/D115411
Mircea Trofin [Thu, 9 Dec 2021 01:36:37 +0000 (17:36 -0800)]
[NFC] Rename MachineFunction::DeleteMachineBasicBlock
Renamed to conform to coding style
Noah Shutty [Thu, 9 Dec 2021 00:51:33 +0000 (00:51 +0000)]
[Support] [Debuginfod] Use libcurl imported library.
A [[ https://lists.llvm.org/pipermail/llvm-dev/2021-December/154203.html | report on llvm-dev ]] indicated that `curl.h` could be found during build configuration but not during compilation. This diff uses the libcurl imported library created by findcurl, so that includes and libs are automatically managed correctly by cmake.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D115189
Chen Zheng [Sat, 9 Oct 2021 09:06:53 +0000 (09:06 +0000)]
[PowerPC] copy byval parameter to caller's stack when needed
Now we won't copy the byval parameter (bigger than 8 bytes) to
caller's parameter save area. Instead, we will only copy the
byval parameter when it can not be passed entirely in registers
which means we have to use parameter save area according to the
64 bit SVR4 ABI.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D111485
Nico Weber [Thu, 9 Dec 2021 00:45:17 +0000 (19:45 -0500)]
[gn build] (manually) port
ccf1469a4cdb (lldbVersion)
Andrew Browne [Thu, 9 Dec 2021 00:41:36 +0000 (16:41 -0800)]
Revert "[asan] Run background thread for asan only on THUMB"
This reverts commit
5c27740238007d22f2d0cd0ebe2aaffa90a9c92b.
Reverting due to Windows build issue:
sanitizer_stackdepot.cpp.obj : error LNK2005: "void __cdecl __sanitizer::StackDepotStopBackgroundThread(void)" (?StackDepotStopBackgroundThread@__sanitizer@@YAXXZ) already defined in sanitizer_common_libcdep.cpp.obj
LINK : fatal error LNK1181: cannot open input file 'projects\compiler-rt\lib\asan\CMakeFiles\RTAsan_dynamic.x86_64.dir\asan_rtl_x86_64.S.obj'
Duncan P. N. Exon Smith [Thu, 9 Dec 2021 00:18:00 +0000 (16:18 -0800)]
Support: Avoid using SmallVector::set_size() in zlib
Stop using `SmallVector::set_size()` in zlib. Replace pairs of
`reserve()` / `set_size()` with `resize_for_overwrite()` and
`truncate()`.
Differential Revision: https://reviews.llvm.org/D115391
Duncan P. N. Exon Smith [Wed, 8 Dec 2021 01:22:44 +0000 (17:22 -0800)]
Support: Avoid using SmallVector::set_size() in sys::path
Stop using `SmallVector::set_size()` in sys::path APIs. In both cases,
use `truncate()` instead.
Differential Revision: https://reviews.llvm.org/D115391
Nico Weber [Thu, 9 Dec 2021 00:20:52 +0000 (19:20 -0500)]
[gn build] (manually) port
f75cce0be861
Siva Chandra Reddy [Wed, 8 Dec 2021 07:02:48 +0000 (07:02 +0000)]
[libc] Add a .clang-tidy file for the toplevel libc directory.
Generation of the .yaml has been removed to prevent lint from
running with every ninja invocation. The new .clang-tidy file is copied
to the libc build directory so that generated files also get checked.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D115405
Kirill Stoimenov [Thu, 9 Dec 2021 00:16:14 +0000 (00:16 +0000)]
Revert "[ASan] Shared optimized callbacks implementation."
This reverts commit
f71c553a30cc52c0b4a6abbaa82ce97c30c13979.
Reviewed By: kstoimenov
Differential Revision: https://reviews.llvm.org/D115407
Duncan P. N. Exon Smith [Wed, 8 Dec 2021 21:41:31 +0000 (13:41 -0800)]
ADT: Make StringRef::size() and StringRef::empty() constexpr
This unblocks using `StringLiteral::size()` for a SmallVector size in
another patch.
Differential Revision: https://reviews.llvm.org/D115395
Nico Weber [Thu, 9 Dec 2021 00:10:53 +0000 (19:10 -0500)]
[gn build] (manually) port
f71c553a30cc
Kirill Stoimenov [Wed, 17 Nov 2021 22:39:48 +0000 (22:39 +0000)]
[ASan] Shared optimized callbacks implementation.
This change moves optimized callbacks from each .o file to compiler-rt. Instead of using code generation it uses direct assembly implementation. Please note that the 'or' version is not implemented and it will produce unresolved external if somehow 'or' version is requested.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D114558
Matt Arsenault [Wed, 8 Dec 2021 17:46:27 +0000 (12:46 -0500)]
AMDGPU: Mark scc defs dead in SGPR to VMEM path for no free SGPRs
This introduces verifier errors into this broken situation which we do
not handle correctly, which is better than being silently
miscompiled. For the emergency stack slot, the scavenger likes to move
the restore instruction as late as possible, which ends up separating
the SCC def from the conditional branch.
Matt Arsenault [Wed, 8 Dec 2021 17:44:40 +0000 (12:44 -0500)]
AMDGPU: Simplify test for SGPR spilling bug
Remove the control flow from the test from
25eb7fa01d7ebbe67648ea03841cda55b4239ab2. It's not necessary to
reproduce the original assert with the patch reverted. The control
flow happens to expose a different issue that calls for a separate
test in a future change.
Matt Arsenault [Tue, 7 Dec 2021 23:24:29 +0000 (18:24 -0500)]
AMDGPU: Mark SCC def as dead when expanding frame indexes
This improves liveness queries in a future change.
Craig Topper [Wed, 8 Dec 2021 23:13:40 +0000 (15:13 -0800)]
[RISCV] Improve tracking of EndLoc in the assembly parser.
The SMLoc::getFromPointer(S.getPointer() - 1) pattern used in
several place didn't make sense since that puts the End before the
Start location.
This patch corrects this to properly calculate the end location as
we parse. Unsure how much this matters, a lot of these are for custom
operand parsing. If the custom parsing succeeds, the instruction
matching probably won't fail, so the end loc won't be used to build
a range for a diagnostic.
I've also fixed the creation functions for the CSR and VType operands
to assign the EndLoc of the RISCVOperand class using the StartLoc
instead of an empty SMLoc. I don't think these will ever be accessed,
but it makes the code look less like we forgot to assign it. This is
consistent with some operands on the ARM target.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D115192
Med Ismail Bennani [Wed, 8 Dec 2021 01:49:44 +0000 (17:49 -0800)]
[lldb/Target] Slide source display for artificial locations at function start
It can happen that a line entry reports that some source code is located
at line 0. In DWARF, line 0 is a special location which indicates that
code has no 1-1 mapping with source.
When stopping in one of those artificial locations, lldb doesn't know which
line to display and shows the beginning of the file instead.
This patch mitigates this behaviour by checking if the current symbol context
of the line entry has a matching function, in which case, it slides the
source listing to the start of that function.
This patch also shows the user a warning explaining why lldb couldn't
show sources at that location.
rdar://
83118425
Differential Revision: https://reviews.llvm.org/D115313
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Duncan P. N. Exon Smith [Wed, 8 Dec 2021 01:22:37 +0000 (17:22 -0800)]
OpenMP: Avoid using SmallVector::set_size()
Update `OpenMPIRBuilder::collapseLoops()` to call `resize()` instead of
`set_size()`. The latter asserts on capacity limits and cannot grow,
which seems likely to be unintentional here (if it is, I think a local
assertion would be good for clarity).
Also update `CodeGenFunction::EmitOMPCollapsedCanonicalLoopNest()` to
use `pop_back_n()` instead of `set_size()`.
Differential Revision: https://reviews.llvm.org/D115378
Jonas Devlieghere [Wed, 8 Dec 2021 20:23:57 +0000 (12:23 -0800)]
[lldb] Make lldbVersion a full fledged library
Because of its dependency on clang (and potentially other compilers
downstream, such as swift) lldb_private::GetVersion already lives in its
own library called lldbBase. Despite that, its implementation was spread
across unrelated files. This patch improves things by introducing a
Version library with its own directory, header and implementation file.
The benefits of this patch include:
- We can get rid of the ugly quoting macros.
- Other parts of LLDB can read the version number from
lldb/Version/Version.inc.
- The implementation can be swapped out for tools like lldb-server than
don't need to depend on clang at all.
Differential revision: https://reviews.llvm.org/D115211