Commit Graph

411906 Commits

Author SHA1 Message Date
Caroline Concatto ad43217a04 [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
2022-01-21 14:19:51 +00:00
serge-sans-paille e9211e0393 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
2022-01-21 15:17:39 +01:00
Kai Nacke d5ae039ed7 [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
2022-01-21 09:10:37 -05:00
serge-sans-paille 7e3bcae506 Add apple-specific missing header in Support/GraphWriter.cpp 2022-01-21 14:59:30 +01:00
Jan Svoboda 622354a522 [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
2022-01-21 14:50:53 +01:00
serge-sans-paille 2a9e33db4f Add ms-specific missing header in Support/InitLLVM.cpp 2022-01-21 14:28:47 +01:00
serge-sans-paille 51c53a0791 Add apple-specific missing include 2022-01-21 14:18:29 +01:00
Archibald Elliott 38ac4093d9 [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
2022-01-21 13:15:04 +00:00
serge-sans-paille 2b8e4c6e5f Add missing header in Support/ConvertUTF.h 2022-01-21 14:01:51 +01:00
serge-sans-paille 75e164f61d [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
2022-01-21 13:54:49 +01:00
Simon Pilgrim 0abaf64580 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
2022-01-21 12:35:36 +00:00
Simon Pilgrim 3ef88b3184 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
2022-01-21 12:34:19 +00:00
Simon Pilgrim 8ee135dcf8 [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
2022-01-21 12:24:58 +00:00
Valentin Clement 68db0e25df
[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>
2022-01-21 13:15:28 +01:00
Jan Svoboda 8cc2a13727 [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
2022-01-21 13:04:25 +01:00
Jan Svoboda 5daeada330 [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
2022-01-21 13:04:25 +01:00
Jan Svoboda ced077e1ba [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
2022-01-21 13:04:25 +01:00
Simon Pilgrim 4727d29d90 [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
2022-01-21 11:59:08 +00:00
Kadir Cetinkaya 825a3cd6b6
[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
2022-01-21 12:40:49 +01:00
Fraser Cormack 4d268dc94a [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
2022-01-21 11:30:37 +00:00
Siddharth Bhat 357f2d9ccf [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
2022-01-21 17:08:53 +05:30
OCHyams b6a41fddcf [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
2022-01-21 11:37:49 +00:00
Kadir Cetinkaya 597eae998a
[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
2022-01-21 12:37:20 +01:00
Nikita Popov bfbdb5e43e [Coroutines] Avoid some pointer element type accesses
These are just verifying that pointer types are correct, which is
no longer relevant under opaque pointers.
2022-01-21 12:36:19 +01:00
Simon Pilgrim 0ca426d6ac [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
2022-01-21 11:25:05 +00:00
Nikita Popov 9c5b856dac [CoroSplit] Avoid pointer element type accesses
Use isOpaqueOrPointeeTypeMatches() for the assertions instead.
2022-01-21 12:22:09 +01:00
serge-sans-paille f53d359816 Fix 1f9e18b656
Part 2
2022-01-21 12:12:29 +01:00
Sebastian Neubauer ae2f9c8be8 [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
2022-01-21 12:09:08 +01:00
Sebastian Neubauer 603d18033c [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
2022-01-21 12:09:07 +01:00
Sebastian Neubauer 0530fdbbbb [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
2022-01-21 12:09:06 +01:00
Sebastian Neubauer b351ac3873 [AMDGPU][NFC] Regenerate InstCombine test 2022-01-21 12:09:06 +01:00
Sameer Rahmani 329feeb938 [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
2022-01-21 22:05:17 +11:00
serge-sans-paille 065044c443 Fix 1f9e18b656
Don't assume iterator on std::array<char, ...> are char*, use .data() instead
2022-01-21 11:57:32 +01:00
Nikita Popov e7762653d3 [Attributor] Avoid some pointer element type accesses 2022-01-21 11:20:10 +01:00
serge-sans-paille 1f9e18b656 [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
2022-01-21 10:48:09 +01:00
Florian Hahn 55689904d2
[VPlan] Move ::isCanonical outside ifdef.
This fixes a build failure with assertions disabled.
2022-01-21 09:44:31 +00:00
Florian Hahn c0cf209076
[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
2022-01-21 09:35:06 +00:00
serge-sans-paille a2f6921ef2 [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
2022-01-21 10:18:32 +01:00
Markus Böck d03c5bc8d4 [mlir] Fully qualify return types in OpAsmInterface.td and FunctionInterfaces.td 2022-01-21 10:04:02 +01:00
Valentin Clement (バレンタイン クレメン) 69825f3693
[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
2022-01-21 09:56:54 +01:00
Tres Popp 99b5a8049b Match bazel config with cmake after f29256a64 2022-01-21 09:50:05 +01:00
Nikita Popov b4900296e4 [ConstantFold] Allow all float types in reinterpret load folding
Rather than hardcoding just half, float and double, allow all
floating point types.
2022-01-21 09:26:51 +01:00
Nikita Popov 3f9d1f516e [InstSimplify] Add tests for reinterpret load of floats (NFC)
Add tests for currently unsupported float types.
2022-01-21 09:26:50 +01:00
Simon Moll 7950010e49 [VE][NFC] Factor out helper functions
Factor out some helper functions to cleanup VEISelLowering.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D117683
2022-01-21 09:15:59 +01:00
Nikita Popov 6a19cb837c [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.
2022-01-21 09:13:37 +01:00
Nikita Popov 05cd9a0596 [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.
2022-01-21 09:06:35 +01:00
MaheshRavishankar a99e06aa86 [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
2022-01-20 23:43:50 -08:00
eopXD e6de53b4de [RISCV] Bump rvv-related extensions from 0.10 to 1.0
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D112987
2022-01-20 23:22:20 -08:00
Siva Chandra Reddy 7f0f4cab18 [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.
2022-01-21 07:04:32 +00:00
Igor Kudrin 86b08ed6bb [DebugInfo][NFC] Do not call 'isRootFile' for DWARF Version < 5
A quicker comparison should be done first.

Differential Revision: https://reviews.llvm.org/D117786
2022-01-21 13:52:10 +07:00