Craig Topper [Fri, 21 Jan 2022 20:31:41 +0000 (12:31 -0800)]
[RISCV] Strengthen a SDTypeProfile. Fix formatting.
Alex Brachet [Fri, 21 Jan 2022 21:00:39 +0000 (21:00 +0000)]
[Sema] Warn about printf %n on Android and Fuchsia
The `printf` specifier `%n` is not supported on Android's libc and will soon be removed from Fuchsia's
Reviewed By: enh
Differential Revision: https://reviews.llvm.org/D117611
Daniel Thornburgh [Fri, 21 Jan 2022 19:26:52 +0000 (19:26 +0000)]
[Support] Update missed tests with lazy caching behavior.
Fixes test failures created by https://reviews.llvm.org/D117589.
Reviewed By: zhuhan0
Differential Revision: https://reviews.llvm.org/D117915
Rob Suderman [Fri, 21 Jan 2022 20:22:50 +0000 (12:22 -0800)]
[mlir] Add polynomial approximation for atan and atan2
Implement a taylor series approximation for atan and add an atan2 lowering
that uses atan's appromation. This includes tests for edge cases and tests
for each quadrant.
Reviewed By: NatashaKnk
Differential Revision: https://reviews.llvm.org/D115682
Amir Ayupov [Sat, 30 Oct 2021 00:27:38 +0000 (17:27 -0700)]
[BOLT][NFC] Reduce includes with include-what-you-use
Summary: Removed redundant includes with IWYU
Test Plan: ninja bolt
Reviewers: maksfb
FBD32043568
Amir Ayupov [Thu, 20 Jan 2022 04:20:55 +0000 (20:20 -0800)]
[BOLT] Make ICP target selection (more) deterministic
Summary: Break ties by selecting targets with lower addresses.
Reviewers: maksfb
FBD33677001
Amir Ayupov [Fri, 9 Apr 2021 06:31:12 +0000 (23:31 -0700)]
[BOLT][NFC] Expand auto types pt.2
Summary: Expand autos where it may lead to differences in the BOLT binary.
Test Plan: NFC
Reviewers: maksfb
Reviewed By: maks
FBD27673231
David Green [Fri, 21 Jan 2022 20:01:06 +0000 (20:01 +0000)]
[AArch64] Add extra tests useful in testing hadd. NFC
wren romano [Thu, 20 Jan 2022 20:56:25 +0000 (12:56 -0800)]
[mlir][sparse] Adding assertions for overhead storage types
Fixes https://bugs.llvm.org/show_bug.cgi?id=52314 aka https://github.com/llvm/llvm-project/issues/51656
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D117597
Mark de Wever [Fri, 21 Jan 2022 17:00:33 +0000 (18:00 +0100)]
[libc++] Use addressof in unordered_map.
This addresses the usage of `operator&` in `<unordered_map>`.
(Note there are still more headers with the same issue.)
Reviewed By: #libc, Quuxplusone, ldionne
Differential Revision: https://reviews.llvm.org/D117393
Craig Topper [Fri, 21 Jan 2022 19:30:49 +0000 (11:30 -0800)]
[RISCV] Simplify interface to combineMUL_VLToVWMUL. NFC
Instead of passing the both the SDNode* and 2 of the operands
in two different orders, just pass the SDNode * and a bool to
indicate which operand order to test.
While there rename to combineMUL_VLToVWMUL_VL.
Valentin Clement [Fri, 21 Jan 2022 19:34:17 +0000 (20:34 +0100)]
Revert "[flang] Update tco tool pipline and add translation to LLVM IR"
This reverts commit
68db0e25df4b1edaa2c6080eb88453ab01ea01d3.
Alexander Belyaev [Fri, 21 Jan 2022 18:29:08 +0000 (19:29 +0100)]
[mlir] Move linalg::PadTensorOp to tensor::PadOp.
RFC: https://llvm.discourse.group/t/rfc-move-linalg-padtensorop-to-tensor-padop/5785
Differential Revision: https://reviews.llvm.org/D117892
Lei Zhang [Fri, 7 Jan 2022 22:19:41 +0000 (17:19 -0500)]
[mlir][spirv] Support size-1 vector inserts during conversion
Differential Revision: https://reviews.llvm.org/D115517
Craig Topper [Fri, 21 Jan 2022 18:49:50 +0000 (10:49 -0800)]
[RISCV] Use RVBUnary in more places to simplify some tablegen declarations. NFCI
Florian Mayer [Thu, 6 Jan 2022 00:27:23 +0000 (16:27 -0800)]
[NFC] Improve code reuse.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D116711
eopXD [Thu, 20 Jan 2022 18:16:00 +0000 (10:16 -0800)]
[Clang][RISCV] Restrict rvv builtins with zve macros
The `zve` extension specifies the maximum ELEN for both integer and floating
point mode - defined by macro `__riscv_v_elen` and `__riscv_v_elen_fp`.
This commit restricts the functions in riscv_vector.h by the zve defined
macro-s.
Change enum `RISCVExtension` to `RISCVPredefinedMacro` since now it
contains not only extensions. Also added type alignment to it.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D112986
John Paul Adrian Glaubitz [Fri, 21 Jan 2022 17:57:17 +0000 (09:57 -0800)]
[Sparc] Don't define __sparcv9 and __sparcv9__ when targeting V8+
Currently, clang defines the three macros __sparcv9, __sparcv9__
and __sparc_v9__ when targeting the V8+ baseline, i.e. using the
V9 instruction set on a 32-bit target.
Since neither gcc nor SolarisStudio define __sparcv9 and __sparcv9__
when targeting V8+, some existing code such as the glibc breaks when
defining either of these two macros on a 32-bit target as they are
used to detect a 64-bit target. Update the tests accordingly.
Fixes PR49562.
Reviewed By: jrtc27, MaskRay, hvdijk
Differential Revision: https://reviews.llvm.org/D98574
Petr Hosek [Fri, 21 Jan 2022 17:53:14 +0000 (09:53 -0800)]
Revert "[cmake] Duplicate `{llvm,compiler_rt}_check_linker_flag` for runtime libs and llvm"
This reverts commit
4af11272f57a4a6fed2932e9e0857b2c1a707c51.
Valentin Clement [Fri, 21 Jan 2022 17:30:34 +0000 (18:30 +0100)]
[flang] Remove target and require shell
Fix failure from
68db0e25df4b1edaa2c6080eb88453ab01ea01d3 on
arm buildbot.
David Tenty [Fri, 21 Jan 2022 17:20:28 +0000 (12:20 -0500)]
Revert "[compiler-rt][cmake] Use HandleOutOfTreeLLVM like libcxx and friends"
This reverts commit
8c9f62ea90c70d538766a81ef5980c9223b8566b, which is causing build failures on
the bots because it inadvertently changes the output directory of the compiler-rt libs when
built as a runtime.
Differential Revision: https://reviews.llvm.org/D117815
Marek Kurdej [Fri, 21 Jan 2022 17:17:55 +0000 (18:17 +0100)]
[clang-format] Fix comment in spaceRequiredBefore. NFC.
Mark de Wever [Fri, 21 Jan 2022 16:59:07 +0000 (17:59 +0100)]
Revert "[libc++] Use addressof in unordered_map."
This reverts commit
cab96169380296a496614f433507d86b743f0d02.
This breaks the CI.
Bixia Zheng [Fri, 14 Jan 2022 00:27:28 +0000 (16:27 -0800)]
Upstream MLIR PyTACO implementation.
Add TACO tests to test/Integration/Dialect/SparseTensor/taco. Add the MLIR
PyTACO implementation as tools under the directory.
Reviewed By: aartbik, mehdi_amini
Differential Revision: https://reviews.llvm.org/D117260
Mark de Wever [Sun, 7 Nov 2021 18:44:59 +0000 (19:44 +0100)]
[libc++] Use addressof in unordered_map.
This addresses the usage of `operator&` in `<unordered_map>`.
(Note there are still more headers with the same issue.)
Reviewed By: #libc, Quuxplusone, ldionne
Differential Revision: https://reviews.llvm.org/D117393
Jake Egan [Fri, 21 Jan 2022 16:18:48 +0000 (11:18 -0500)]
[ifs] Use a tmp file instead of "-"
Currently, Clang on AIX uses the system assembler to generate object files from assembly. The use of `-o -` results in a file named `-` instead of output to stdout. This patch uses a temporary object file instead.
Reviewed By: DiggerLin, hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D117587
serge-sans-paille [Fri, 21 Jan 2022 16:05:36 +0000 (17:05 +0100)]
Include missing "llvm/Support/Path.h" in "flang/lib/Frontend/CompilerInvocation.cpp"
Chris Bieneman [Wed, 19 Jan 2022 00:20:14 +0000 (18:20 -0600)]
[ADT] [NFC] Add StringRef::detectEOL
This change moves EOL detection out of the clang::InclusionRewriter into
llvm::StringRef so that it can be easily reused elsewhere. It also adds
additional explicit test cases to verify the correct and expected return
results.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D117626
Vy Nguyen [Fri, 21 Jan 2022 15:17:28 +0000 (10:17 -0500)]
[libcxx][doc][nfc] Fixed typo in doc
Nico Weber [Fri, 21 Jan 2022 15:04:41 +0000 (10:04 -0500)]
Try to unbreak build on Windows more after
e9211e03937
serge-sans-paille [Fri, 21 Jan 2022 15:04:19 +0000 (16:04 +0100)]
Add missing llvm/support/Regex.h include in polly/lib/Analysis/ScopDetection.cpp
Nico Weber [Fri, 21 Jan 2022 14:59:22 +0000 (09:59 -0500)]
Try to unbreak build on Windows after
e9211e03937
Benjamin Kramer [Fri, 21 Jan 2022 14:54:33 +0000 (15:54 +0100)]
[clang-tidy] Avoid binding nullptr to a reference
That's undefined behavior. Found by -fsanitize=null.
Kristof Beyls [Wed, 12 Jan 2022 13:40:14 +0000 (14:40 +0100)]
Add security group 2021 transparency report.
Differential Revision: https://reviews.llvm.org/D117872
Caroline Concatto [Mon, 13 Dec 2021 17:20:16 +0000 (17:20 +0000)]
[InstCombine] Fold for masked gather when loading the same value each time.
This patch checks in the masked gather when the first operand value is a
splat and the mask is all one, because the masked gather is reloading the
same value each time. This patch replaces this pattern of masked gather by
a scalar load of the value and splats it in a vector.
Differential Revision: https://reviews.llvm.org/D115726
serge-sans-paille [Thu, 20 Jan 2022 11:04:42 +0000 (12:04 +0100)]
Remove dependency from raw_ostream on <chrono>
The tryLockFor method from raw_fd_sotreamis the sole user of that
header, and it's not referenced in the mono repo. I still chose to keep
it (may be useful for downstream user) but added a transient type that's
forward declared to hold the duration parameter.
Notable changes:
- "llvm/Support/Duration.h" must be included in order to use tryLockFor.
- "llvm/Support/raw_ostream.h" no longer includes <chrono>
This sole change has an interesting impact on the number of processed
line, as measured by:
clang++ -E -Iinclude -I../llvm/include ../llvm/lib/Support/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l
before: 7917500
after: 7835142
Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup/5831
Kai Nacke [Thu, 20 Jan 2022 19:28:18 +0000 (14:28 -0500)]
[SystemZ] Properly register machine passes.
Registering the passes enables use of -stop-before=/-stop-after
options.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D117823
serge-sans-paille [Fri, 21 Jan 2022 13:59:11 +0000 (14:59 +0100)]
Add apple-specific missing header in Support/GraphWriter.cpp
Jan Svoboda [Wed, 12 Jan 2022 15:09:58 +0000 (16:09 +0100)]
[llvm][ADT] Implement `BitVector::{pop_,}back`
LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>` and suggests `llvm::BitVector` as a possible replacement.
Currently, some users of `std::vector<bool>` cannot switch to `llvm::BitVector` because it doesn't implement the `pop_back()` and `back()` functions.
To enable easy transition of `std::vector<bool>` users, this patch implements `llvm::BitVector::pop_back()` and `llvm::BitVector::back()`.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D117115
serge-sans-paille [Fri, 21 Jan 2022 13:28:47 +0000 (14:28 +0100)]
Add ms-specific missing header in Support/InitLLVM.cpp
serge-sans-paille [Fri, 21 Jan 2022 13:18:17 +0000 (14:18 +0100)]
Add apple-specific missing include
Archibald Elliott [Fri, 21 Jan 2022 13:14:58 +0000 (13:14 +0000)]
[NFCI][Support] Avoid ASSERT_/EXPECT_TRUE(A <op> B)
The error messages in tests are far better when a test fails if the test
is written using ASSERT_/EXPECT_<operator>(A, B) rather than
ASSERT_/EXPECT_TRUE(A <operator> B).
This commit updates all of llvm/unittests/Support to use these macros
where possible.
This change has not been possible in:
- llvm/unittests/Support/FSUniqueIDTest.cpp - due to not overloading
operators beyond ==, != and <.
- llvm/unittests/Support/BranchProbabilityTest.cpp - where the unchanged
tests are of the operator overloads themselves.
There are other possibilities of this conversion not being valid, which
have not applied in these tests, as they do not use NULL (they use
nullptr), and they do not use const char* (they use std::string or
StringRef).
Reviewed By: mubashar_
Differential Revision: https://reviews.llvm.org/D117319
serge-sans-paille [Fri, 21 Jan 2022 13:01:51 +0000 (14:01 +0100)]
Add missing header in Support/ConvertUTF.h
serge-sans-paille [Thu, 20 Jan 2022 11:55:14 +0000 (12:55 +0100)]
[llvm] Cleanup header dependencies in ADT and Support
The cleanup was manual, but assisted by "include-what-you-use". It consists in
1. Removing unused forward declaration. No impact expected.
2. Removing unused headers in .cpp files. No impact expected.
3. Removing unused headers in .h files. This removes implicit dependencies and
is generally considered a good thing, but this may break downstream builds.
I've updated llvm, clang, lld, lldb and mlir deps, and included a list of the
modification in the second part of the commit.
4. Replacing header inclusion by forward declaration. This has the same impact
as 3.
Notable changes:
- llvm/Support/TargetParser.h no longer includes llvm/Support/AArch64TargetParser.h nor llvm/Support/ARMTargetParser.h
- llvm/Support/TypeSize.h no longer includes llvm/Support/WithColor.h
- llvm/Support/YAMLTraits.h no longer includes llvm/Support/Regex.h
- llvm/ADT/SmallVector.h no longer includes llvm/Support/MemAlloc.h nor llvm/Support/ErrorHandling.h
You may need to add some of these headers in your compilation units, if needs be.
As an hint to the impact of the cleanup, running
clang++ -E -Iinclude -I../llvm/include ../llvm/lib/Support/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l
before: 8000919 lines
after: 7917500 lines
Reduced dependencies also helps incremental rebuilds and is more ccache
friendly, something not shown by the above metric :-)
Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup/5831
Simon Pilgrim [Fri, 21 Jan 2022 12:35:36 +0000 (12:35 +0000)]
Revert rG4727d29d908f9dd608dd97a58c0af1ad579fd3ca "[X86] Remove __builtin_ia32_pabs intrinsics and use generic __builtin_elementwise_abs"
Some build bots are referencing the `__builtin_ia32_pabs` intrinsics via alternative headers
Simon Pilgrim [Fri, 21 Jan 2022 12:34:19 +0000 (12:34 +0000)]
Revert rG8ee135dcf8ff060656ad481c3e980fe8763576f5 "[X86] Remove `__builtin_ia32_pmax/min` intrinsics and use generic `__builtin_elementwise_max/min`"
Some build bots are referencing the `__builtin_ia32_pmax/min` intrinsics via alternative headers
Simon Pilgrim [Fri, 21 Jan 2022 12:24:32 +0000 (12:24 +0000)]
[X86] Remove `__builtin_ia32_pmax/min` intrinsics and use generic `__builtin_elementwise_max/min`
D111985 added the generic `__builtin_elementwise_max` and `__builtin_elementwise_min` intrinsics with the same integer behaviour as the SSE/AVX instructions
This patch removes the `__builtin_ia32_pmax/min` intrinsics and just uses `__builtin_elementwise_max/min` - the existing tests see no changes:
```
__m256i test_mm256_max_epu32(__m256i a, __m256i b) {
// CHECK-LABEL: test_mm256_max_epu32
// CHECK: call <8 x i32> @llvm.umax.v8i32(<8 x i32> %{{.*}}, <8 x i32> %{{.*}})
return _mm256_max_epu32(a, b);
}
```
This requires us to add a `__v64qs` explicitly signed char vector type (we already have `__v16qs` and `__v32qs`).
Sibling patch to D117791
Differential Revision: https://reviews.llvm.org/D117798
Valentin Clement [Fri, 21 Jan 2022 12:14:39 +0000 (13:14 +0100)]
[flang] Update tco tool pipline and add translation to LLVM IR
tco is a tool to test the FIR to LLVM IR pipeline of the Flang compiler.
This patch update tco pipelines and adds the translation to LLVM IR.
A simple test is added to make sure the tool is working with a simple
FIR program.
More tests will be upstream in follow up patch from the fir-dev branch.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: schweitz, mehdi_amini
Differential Revision: https://reviews.llvm.org/D117781
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>
Jan Svoboda [Fri, 21 Jan 2022 10:18:22 +0000 (11:18 +0100)]
[clang][deps] Handle symlinks in minimizing FS
The minimizing and caching filesystem used by the dependency scanner can be configured to **not** minimize some files. That's necessary when scanning a TU with prebuilt inputs (i.e. PCH) that refer to the original (non-minimized) files. Minimizing such files in the dependency scanner would cause discrepancy between the current perceived state of the filesystem and the file sizes stored in the AST file. By not minimizing such files, we avoid creating the discrepancy.
The problem with the current approach is that files that should not be minimized are identified by their path. This breaks down when the prebuilt input (PCH) and the current TU refer to the same file via different paths (i.e. symlinks). This patch switches from paths to `llvm::sys::fs::UniqueID` when identifying ignored files. This is consistent with how the rest of Clang treats files.
Depends on D114966.
Reviewed By: dexonsmith, arphaman
Differential Revision: https://reviews.llvm.org/D114971
Jan Svoboda [Fri, 21 Jan 2022 09:55:34 +0000 (10:55 +0100)]
[clang][deps] Ensure filesystem cache consistency
The minimizing filesystem used by the dependency scanner isn't great when it comes to the consistency of its caches. There are two problems that can be exposed by a filesystem that changes during dependency scan:
1. In-memory cache entries for original and minimized files are distinct, populated at different times using separate stat/open syscalls. This means that when a file is read with minimization disabled, its contents might be inconsistent when the same file is read with minimization enabled at later point (and vice versa).
2. In-memory cache entries are indexed by filename. This is problematic for symlinks, where the contents of the symlink might be inconsistent with contents of the original file (for the same reason as in problem 1).
This patch ensures consistency by always stating/reading a file exactly once. The original contents are always cached and minimized contents are derived from that on demand. The cache entries are now indexed by their `UniqueID` ensuring consistency for symlinks too. Moreover, the stat/read syscalls are now issued outside of critical section.
Depends on D115935.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D114966
Jan Svoboda [Fri, 21 Jan 2022 09:54:27 +0000 (10:54 +0100)]
[clang][deps] NFC: Simplify handling of cached FS errors
The return types of some `CachedFileSystemEntry` member function are needlessly complex.
This patch attempts to simplify the code by unwrapping cached entries that represent errors early, and then asserting `!isError()`.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D115935
Simon Pilgrim [Fri, 21 Jan 2022 11:55:40 +0000 (11:55 +0000)]
[X86] Remove __builtin_ia32_pabs intrinsics and use generic __builtin_elementwise_abs
D111986 added the generic `__builtin_elementwise_abs()` intrinsic with the same integer absolute behaviour as the SSE/AVX instructions (abs(INT_MIN) == INT_MIN)
This patch removes the `__builtin_ia32_pabs*` intrinsics and just uses `__builtin_elementwise_abs` - the existing tests see no changes:
```
__m256i test_mm256_abs_epi8(__m256i a) {
// CHECK-LABEL: test_mm256_abs_epi8
// CHECK: [[ABS:%.*]] = call <32 x i8> @llvm.abs.v32i8(<32 x i8> %{{.*}}, i1 false)
return _mm256_abs_epi8(a);
}
```
This requires us to add a `__v64qs` explicitly signed char vector type (we already have `__v16qs` and `__v32qs`).
Differential Revision: https://reviews.llvm.org/D117791
Kadir Cetinkaya [Thu, 20 Jan 2022 13:11:15 +0000 (14:11 +0100)]
[clangd] Fail inlayHints requests on content changes
This should improve the overall UX by making the labels less jumpy.
Differential Revision: https://reviews.llvm.org/D117776
Fraser Cormack [Wed, 19 Jan 2022 17:49:33 +0000 (17:49 +0000)]
[RISCV] Enable CGP to sink splat operands of VP intrinsics
This patch brings better splat-matching to our VP support, by sinking
splat operands of VP intrinsics back into the same block as the VP
operation. The list of VP intrinsics we are interested in matches that
of the regular instructions.
Some optimization is still lacking. For instance, our VL nodes aren't
recognized as commutative, so splats must be on the RHS. Because of
this, we limit our sinking of splats to just the RHS operand for now.
Improvement in this regard can come in another patch.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117703
Siddharth Bhat [Fri, 21 Jan 2022 11:32:39 +0000 (17:02 +0530)]
[mlir][LangRef] Add top-level production to the MLIR grammar
The LangRef currently lacks a top-level production, leaving the productions attribute-alias-def and type-alias-defunused. Clarify the situation by declaring what is to be parsed by an MLIR parser at the toplevel.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D117668
OCHyams [Fri, 21 Jan 2022 10:54:53 +0000 (10:54 +0000)]
[DWARF][DebugInfo] Fix off-by-one error in size of DW_TAG_base_type types
Fix PR53163 by rounding the byte size of DW_TAG_base_type types up. Without
this fix we risk emitting types with a truncated size (including rounding
less-than-byte-sized types' sizes down to zero).
Reviewed By: probinson
Differential Revision: https://reviews.llvm.org/D117124
Kadir Cetinkaya [Thu, 20 Jan 2022 16:22:09 +0000 (17:22 +0100)]
[clangd][Background] Make index validation logs verbose
These errors are non-harmful and should be transient. They either
imply:
- compilation database returned stale results for TUs and it'll be fixed once
it's updated to match project state.
- a TUs dependencies has changed and some headers no longer exist. this should
be fixed with the next indexing cycle.
In either case the user will have some stale symbols in their index until clangd
restarts and the underlying issue is resolved. On the downside these logs are
confusing users when there's another issue.
Differential Revision: https://reviews.llvm.org/D117792
Nikita Popov [Fri, 21 Jan 2022 11:34:35 +0000 (12:34 +0100)]
[Coroutines] Avoid some pointer element type accesses
These are just verifying that pointer types are correct, which is
no longer relevant under opaque pointers.
Simon Pilgrim [Fri, 21 Jan 2022 11:22:36 +0000 (11:22 +0000)]
[llvm-mca] Improve barriers for strict region marking (PR52198)
As suggested on the bug, to help (but not completely....) stop folded instructions crossing the inline asm barriers used for llvm-mca analysis, we should recommend tagging with memory captures/attributes.
Differential Revision: https://reviews.llvm.org/D117788
Nikita Popov [Fri, 21 Jan 2022 11:20:23 +0000 (12:20 +0100)]
[CoroSplit] Avoid pointer element type accesses
Use isOpaqueOrPointeeTypeMatches() for the assertions instead.
serge-sans-paille [Fri, 21 Jan 2022 11:12:16 +0000 (12:12 +0100)]
Sebastian Neubauer [Tue, 21 Dec 2021 16:31:24 +0000 (17:31 +0100)]
[AMDGPU] Remove lz and nomip combine from codegen
These combines have been moved into the IR combiner in D116042.
Differential Revision: https://reviews.llvm.org/D116116
Sebastian Neubauer [Tue, 21 Dec 2021 16:27:14 +0000 (17:27 +0100)]
[AMDGPU][InstCombine] Remove zero LOD bias
If the bias is zero, we can remove it from the image instruction.
Also copy other image optimizations (l->lz, mip->nomip) to IR combines.
Differential Revision: https://reviews.llvm.org/D116042
Sebastian Neubauer [Mon, 20 Dec 2021 14:11:01 +0000 (15:11 +0100)]
[AMDGPU] Fix LOD bias in A16 combine
As the codegen fix in D111754, the LOD bias needs to be converted to 16
bits. Fix this in the combine.
Differential Revision: https://reviews.llvm.org/D116038
Sebastian Neubauer [Mon, 20 Dec 2021 13:25:16 +0000 (14:25 +0100)]
[AMDGPU][NFC] Regenerate InstCombine test
Sameer Rahmani [Fri, 21 Jan 2022 10:27:55 +0000 (21:27 +1100)]
[ORC][docs] Describe removing JITDylibs, using custom program representations.
Add documentation around:
* Removing JITDylib from the session
* Add support for custom program representation
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D116476
serge-sans-paille [Fri, 21 Jan 2022 10:56:32 +0000 (11:56 +0100)]
Fix
1f9e18b6565fd1bb69c4b649b9efd3467b3c7c7d
Don't assume iterator on std::array<char, ...> are char*, use .data() instead
Nikita Popov [Fri, 21 Jan 2022 10:19:54 +0000 (11:19 +0100)]
[Attributor] Avoid some pointer element type accesses
serge-sans-paille [Thu, 20 Jan 2022 10:21:47 +0000 (11:21 +0100)]
[llvm] Remove (some) LLVMDemangle header dependencies
- Avoid using <iterator> for std::end on a plain array (using <array> instead)
- Avoid using <algorithm> for std::min and std::equal (using alternate logic and std::strcmp instead)
As an hint to the impact of the cleanup, running
clang++ -E -Iinclude -I../llvm/include ../llvm/lib/Demangle/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l
before: 203965 lines
after: 169704 lines
Florian Hahn [Fri, 21 Jan 2022 09:44:31 +0000 (09:44 +0000)]
[VPlan] Move ::isCanonical outside ifdef.
This fixes a build failure with assertions disabled.
Florian Hahn [Fri, 21 Jan 2022 09:34:38 +0000 (09:34 +0000)]
[VPlan] Add VPWidenIntOrFpInductionRecipe::isCanonical, use it (NFCI).
This patch adds VPWidenIntOrFpInductionRecipe::isCanonical to check if
an induction recipe is canonical. The code is also updated to use it
instead of isCanonicalID.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D117551
serge-sans-paille [Thu, 20 Jan 2022 10:08:24 +0000 (11:08 +0100)]
[llvm] Remove unused headers in LLVMDemangle
As an hint to the impact of the cleanup, running
clang++ -E -Iinclude -I../llvm/include ../llvm/lib/Demangle/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l
before: 208053 lines
after: 203965 lines
Markus Böck [Fri, 21 Jan 2022 09:03:48 +0000 (10:03 +0100)]
[mlir] Fully qualify return types in OpAsmInterface.td and FunctionInterfaces.td
Valentin Clement (バレンタイン クレメン) [Fri, 21 Jan 2022 08:56:26 +0000 (09:56 +0100)]
[fir] Add array operations documentation
This patch adds documentation on FIR array operations
and their usage.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D115077
Tres Popp [Fri, 21 Jan 2022 08:49:55 +0000 (09:49 +0100)]
Match bazel config with cmake after
f29256a64
Nikita Popov [Fri, 21 Jan 2022 08:23:41 +0000 (09:23 +0100)]
[ConstantFold] Allow all float types in reinterpret load folding
Rather than hardcoding just half, float and double, allow all
floating point types.
Nikita Popov [Fri, 21 Jan 2022 08:20:54 +0000 (09:20 +0100)]
[InstSimplify] Add tests for reinterpret load of floats (NFC)
Add tests for currently unsupported float types.
Simon Moll [Fri, 21 Jan 2022 08:15:50 +0000 (09:15 +0100)]
[VE][NFC] Factor out helper functions
Factor out some helper functions to cleanup VEISelLowering.
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D117683
Nikita Popov [Thu, 20 Jan 2022 15:48:19 +0000 (16:48 +0100)]
[ConstantFold] Support pointers in reinterpret load folding
Peculiarly, the necessary code to handle pointers (including the
check for non-integral address spaces) is already in place,
because we were already allowing vectors of pointers here, just
not plain pointers.
Nikita Popov [Fri, 21 Jan 2022 08:06:35 +0000 (09:06 +0100)]
[ConstantFold] Simplify type check in reinterpret load folding (NFC)
Keep a list of allowed types, but then always construct the map
type the same way. We need an integer with the same width as the
original type.
MaheshRavishankar [Fri, 21 Jan 2022 06:27:06 +0000 (22:27 -0800)]
[mlir][Linalg] Avoid generating illegal operations during elementwise fusion.
In some cases, fusion can produce illegal operations if after fusion
the range of some of the loops cannot be computed from shapes of its
operands. Check for this case and abort the fusion if this happens.
Differential Revision: https://reviews.llvm.org/D117602
eopXD [Thu, 20 Jan 2022 10:24:10 +0000 (02:24 -0800)]
[RISCV] Bump rvv-related extensions from 0.10 to 1.0
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D112987
Siva Chandra Reddy [Fri, 21 Jan 2022 06:28:42 +0000 (06:28 +0000)]
[libc][NFC] Add 'struct_' prefix to type headers defining struct types.
This allows header generator to generate type inclusion boiler plate in
a straightforward manner.
Igor Kudrin [Fri, 21 Jan 2022 06:04:44 +0000 (13:04 +0700)]
[DebugInfo][NFC] Do not call 'isRootFile' for DWARF Version < 5
A quicker comparison should be done first.
Differential Revision: https://reviews.llvm.org/D117786
Igor Kudrin [Fri, 21 Jan 2022 06:04:32 +0000 (13:04 +0700)]
[DebugInfo] Fix handling '# line "file"' for DWARFv5
`CppHashInfo.Filename` is a `StringRef` that references a part of the
source file and it is not null-terminated at the end of the file name.
`AsmParser::parseAndMatchAndEmitTargetInstruction()` passes it to
`getStreamer().emitDwarfFileDirective()`, and it eventually comes to
`isRootFile()`. The comparison fails because `FileName.data()` is not
properly terminated.
In addition, the old code might cause a significant speed degradation
for long source files. The `operator!=()` for `std::string` and
`const char *` can be implemented in a way that it finds the length of
the second argument first, which slows the comparison for long data.
`parseAndMatchAndEmitTargetInstruction()` calls
`emitDwarfFileDirective()` every time if `CppHashInfo.Filename` is not
empty. As a result, the longer the source file is, the slower the
compilation wend, and for a very long file, it might take hours instead
of a couple of seconds normally.
Differential Revision: https://reviews.llvm.org/D117785
wangpc [Fri, 21 Jan 2022 05:54:09 +0000 (13:54 +0800)]
[RISCV] Set CostPerUse to 1 iff RVC is enabled
After D86836, we can define multiple cost values for
different cost models. So here we set CostPerUse to
1 iff RVC is enabled to avoid potential impact on RA.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117741
Zi Xuan Wu [Thu, 20 Jan 2022 09:44:53 +0000 (17:44 +0800)]
[CSKY] Add codegen support of GlobalTLSAddress lowering
There are static and dynamic TLS address lowering in DAG stage according to different TLS model.
It needs PseudoTLSLA32 pseudo to get address of TLS-related entry which resides in constant pool.
Sockke [Fri, 21 Jan 2022 06:23:52 +0000 (14:23 +0800)]
[clang-tidy] Fix wrong FixIt in performance-move-const-arg
There are incorrect Fixit and missing warnings:
case :
A trivially-copyable object wrapped by std::move is passed to the function with rvalue reference parameters. Removing std::move will cause compilation errors.
```
void showInt(int&&) {}
void testInt() {
int a = 10;
// expect: warning + nofix
showInt(std::move(a)); // showInt(a) <--- wrong fix
}
struct Tmp {};
void showTmp(Tmp&&) {}
void testTmp() {
Tmp t;
// expect: warning + nofix
showTmp(std::move(t)); // showTmp(t) <--- wrong fix
}
```
Reviewed By: aaron.ballman, Quuxplusone
Differential Revision: https://reviews.llvm.org/D107450
Mehdi Amini [Fri, 21 Jan 2022 05:45:48 +0000 (05:45 +0000)]
Remove obsolete `getAsmResultNames` from OpAsmDialectInterface
This is superseded by the same method on OpAsmOpInterface, which is
available on the Dialect through the Fallback mechanism,
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D117750
Rahul Kayaith [Fri, 21 Jan 2022 05:21:00 +0000 (05:21 +0000)]
[mlir][python] 8b/16b DenseIntElements access
This extends dense attribute element access to support 8b and 16b ints.
Also extends the corresponding parts of the C api.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D117731
Mehdi Amini [Fri, 21 Jan 2022 05:15:46 +0000 (05:15 +0000)]
Print the `// ----` separator between modules when using -split-input-file with mlir-opt
This allows to pipe sequences of `mlir-opt -split-input-file | mlir-opt -split-input-file`.
Depends On D117750
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D117756
Craig Topper [Fri, 21 Jan 2022 04:43:48 +0000 (20:43 -0800)]
[RISCV] Add isel patterns for grevi, shfli, and unshfli to brev8/zip/unzip instructions.
Zbkb supports some encodings of the general grevi, shfli, and
unshfli instructions legal, so we added separate instructions for
those encodings to improve the diagnostics for assembler and
disassembler. To be consistent we should always use these separate
instructions whenever those specific encodings of grevi/shfli/unshfli
occur. So this patch adds specific isel patterns to override the generic
isel patterns for these cases. Similar was done for rev8 and zext.h
for Zbb previously.
Wu Xinlong [Thu, 20 Jan 2022 08:35:55 +0000 (16:35 +0800)]
[RISCV][RFC] add inst support of zbkb
This commit add instructions supports of `zbkb` which defined in scalar cryptography extension version v1.0.0 (has been ratified already).
Most of the zbkb directives reuse parts of the zbp and zbb directives, so this patch just modified some of the inst aliases and predicates.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117640
Joao Moreira [Fri, 21 Jan 2022 01:31:21 +0000 (09:31 +0800)]
[X86] Enable ibt-seal optimization when LTO is used in Kernel
Intel's CET/IBT requires every indirect branch target to be an ENDBR instruction. Because of that, the compiler needs to correctly emit these instruction on function's prologues. Because this is a security feature, it is desirable that only actual indirect-branch-targeted functions are emitted with ENDBRs. While it is possible to identify address-taken functions through LTO, minimizing these ENDBR instructions remains a hard task for user-space binaries because exported functions may end being reachable through PLT entries, that will use an indirect branch for such. Because this cannot be determined during compilation-time, the compiler currently emits ENDBRs to every non-local-linkage function.
Despite the challenge presented for user-space, the kernel landscape is different as no PLTs are used. With the intent of providing the most fit ENDBR emission for the kernel, kernel developers proposed an optimization named "ibt-seal" which replaces the ENDBRs for NOPs directly in the binary. The discussion of this feature can be seen in [1].
This diff brings the enablement of the flag -mibt-seal, which in combination with LTO enforces a different policy for ENDBR placement in when the code-model is set to "kernel". In this scenario, the compiler will only emit ENDBRs to address taken functions, ignoring non-address taken functions that are don't have local linkage.
A comparison between an LTO-compiled kernel binaries without and with the -mibt-seal feature enabled shows that when -mibt-seal was used, the number of ENDBRs in the vmlinux.o binary patched by objtool decreased from 44383 to 33192, and that the number of superfluous ENDBR instructions nopped-out decreased from 11730 to 540.
The 540 missed superfluous ENDBRs need to be investigated further, but hypotheses are: assembly code not being taken care of by the compiler, kernel exported symbols mechanisms creating bogus address taken situations or even these being removed due to other binary optimizations like kernel's static_calls. For now, I assume that the large drop in the number of ENDBR instructions already justifies the feature being merged.
[1] - https://lkml.org/lkml/2021/11/22/591
Reviewed By: xiangzhangllvm
Differential Revision: https://reviews.llvm.org/D116070
John Ericson [Fri, 21 Jan 2022 02:48:10 +0000 (02:48 +0000)]
Revert "[llvm][cmake] Make `llvm_install_symlink` robust to absolute dirs."
https://lab.llvm.org/buildbot/#/builders/36/builds/16668 was the sort of
thing I saw before when this was part of D99484, and it makes some sense
now this would have something to do with it.
This reverts commit
58580e922a69d94859a2506c3053d8c066a1e38c.
Jonas Devlieghere [Fri, 21 Jan 2022 02:28:17 +0000 (18:28 -0800)]
[lldb] Update the modulemap
LLVM GN Syncbot [Fri, 21 Jan 2022 02:11:31 +0000 (02:11 +0000)]
[gn build] Port
1755f5b1d7b7
John Ericson [Thu, 20 Jan 2022 22:20:24 +0000 (22:20 +0000)]
[llvm][cmake] Make `llvm_install_symlink` robust to absolute dirs.
If `CMAKE_INSTALL_BINDIR` is a different absolute path per project, as
it is with NixOS when we install every package to its own prefix, the
old way fails when the absolute path gets prepended.
There are still some issues with dowstream packages using `LLVM_TOOLS_INSTALL_DIR` which also may be absolute and just for LLVM proper, but that will be addressed in a future commit.
Differential Revision: https://reviews.llvm.org/D101070
Joseph Huber [Thu, 20 Jan 2022 18:06:22 +0000 (13:06 -0500)]
[Libomptarget] Change visibility to hidden for device RTL
This patch changes the visibility for all construct in the new device
RTL to be hidden by default. This is done after the changes introduced
in D117806 changed the visibility from being hidden by default for all
device compilations. This asserts that the visibility for the device
runtime library will be hidden except for the internal environment
variable. This is done to aid optimization and linking of the device
library.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D117807
Joseph Huber [Thu, 20 Jan 2022 17:06:47 +0000 (12:06 -0500)]
[OpenMP] Change default visibility to protected for device declarations
This patch changes the special-case handling of visibility when
compiling for an OpenMP target offloading device. This was orignally
added as a precaution against the bug encountered in PR41826 when
symbols in the device were being preempted by shared library symbols.
This should instead be done by making the visibility protected by default.
With protected visibility we are asserting that the symbols on the device
will never be preempted or preempt another symbol pending a shared library
load.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D117806