Peter Smith [Mon, 17 Apr 2023 17:37:05 +0000 (18:37 +0100)]
[LLD][ELF][AArch64] Add AArch64 short range thunk support
The AArch64 branch immediate instruction has a 128MiB range. This
makes it suitable for use a short range thunk in the same way as
short thunks are implemented in Arm and PPC. This patch adds
support for short range thunks to AArch64.
Adding short range thunk support should mean that OutputSections
can grow to nearly 256 MiB in size without needing long-range
indirect branches.
Differential Revision: https://reviews.llvm.org/D148701
Paul Walker [Thu, 20 Apr 2023 16:45:56 +0000 (16:45 +0000)]
[Clang][Sema] Fix invalid cast when validating SVE types within CheckVariableDeclarationType.
Fixes #62087
Differential Revision: https://reviews.llvm.org/D148919
Jay Foad [Fri, 21 Apr 2023 13:11:31 +0000 (14:11 +0100)]
[Vectorize] Fix vectorization, scalarization and folding of llvm.is.fpclass
llvm.is.fpclass is different from other vectorizable intrinsics in that
it is overloaded on an argument type, not on the return type.
Differential Revision: https://reviews.llvm.org/D148905
Jay Foad [Fri, 21 Apr 2023 14:43:02 +0000 (15:43 +0100)]
[Vectorize] Pre-commit tests for D148905
Differential Revision: https://reviews.llvm.org/D149050
Michael Buch [Mon, 24 Apr 2023 12:40:23 +0000 (08:40 -0400)]
[lldb][tests] TestPreferredName.py: add missing import
Siyuan Zhu [Mon, 24 Apr 2023 12:29:37 +0000 (14:29 +0200)]
[InstSimplify] sdiv a (1 srem b) --> a
Extend the existing fold for division by zero or one to use known
bits, so it catches additional patterns like division by
(1 srem b).
Fixes https://github.com/llvm/llvm-project/issues/62163.
Differential Revision: https://reviews.llvm.org/D149001
Aaron Ballman [Mon, 24 Apr 2023 12:35:43 +0000 (08:35 -0400)]
Fix file info comment; NFC
There is no TargetInfoImpl class any longer.
Michael Buch [Mon, 24 Apr 2023 12:29:48 +0000 (08:29 -0400)]
[lldb][tests] TestPreferredName.py: Fix for older compilers
This only works as of D145803, where we re-point the
`DW_AT_type` based on existence of `[[clang::preferred_name]]`
Siyuan Zhu [Mon, 24 Apr 2023 12:28:12 +0000 (14:28 +0200)]
[InstSimplify] Test case for D149001 (NFC)
Differential Revision: https://reviews.llvm.org/D149012
Aaron Ballman [Mon, 24 Apr 2023 12:25:28 +0000 (08:25 -0400)]
Minor cleanup of the Open Projects page
Sets the charset to UTF-8, fixes the page title, replaces mention of
cfe-dev with Discourse, points out Discord and IRC.
Nikita Popov [Mon, 24 Apr 2023 12:25:45 +0000 (14:25 +0200)]
[InstSimplify] Move more folds into simplifyDivRem() (NFCI)
The threading folds are the same for div/rem and the isDivZero()
fold only differes in the return value.
This should be NFC, but as this slightly shuffles around the
order of the folds it might not be exactly the same.
Jingu Kang [Mon, 24 Apr 2023 12:23:57 +0000 (13:23 +0100)]
[AArch64] Precommit test
This patch precommits tests for:
https://reviews.llvm.org/D148347
Alexandros Lamprineas [Tue, 28 Mar 2023 17:16:19 +0000 (18:16 +0100)]
[FuncSpec] Track the return values of specializations.
To track the return values of specializations, we need to invalidate all
the lattice values across the use-def chain which originates from the
callsites, recompute and propagate.
Differential Revision: https://reviews.llvm.org/D146158
Nikita Popov [Mon, 24 Apr 2023 10:56:09 +0000 (12:56 +0200)]
[InstSimplify] Drop redundant div fold (NFCI)
This is nowadays handled generically via isDivZero() and icmp
simplification, specifically the computeConstantRange() based
logic.
Mikhail Goncharov [Mon, 24 Apr 2023 11:58:09 +0000 (13:58 +0200)]
[bazel] test files for IRDL
8ac8c922fb3f15706f5cb1db2cc655d30b095766
Differential Revision: https://reviews.llvm.org/D149056
Hassnaa Hamdi [Thu, 20 Apr 2023 05:34:05 +0000 (05:34 +0000)]
[AArch64][DAGCombiner]: combine <2xi64> mul add/sub.
64-bit vector mul is not supported in NEON,
so we use the SVE's mul.
To improve the performance, we can go one step further,
and use SVE's add/sub, so that we can use SVE's mla/mls.
That works on these patterns:
add v1, (mul v2, v3)
sub v1, (mul v2, v3)
Reviewed By: david-arm, paulwalker-arm
Differential Revision: https://reviews.llvm.org/D148118
Nikita Popov [Mon, 24 Apr 2023 10:40:46 +0000 (12:40 +0200)]
[InstSimplify] Move fold into isDivZero() (NFCI)
This is a special case where we know the division result is zero.
For the unsigned case this is handled by generic icmp code, for
the signed case we do need to special case it.
Tom Weaver [Mon, 24 Apr 2023 10:14:10 +0000 (11:14 +0100)]
Revert "[Coverity] Fix explicit null dereferences"
This reverts commit
22b23a5213b57ce1834f5b50fbbf8a50297efc8a.
This commit caused the following two build bots to start failing:
https://lab.llvm.org/buildbot/#/builders/216/builds/20322
https://lab.llvm.org/buildbot/#/builders/123/builds/18511
Kito Cheng [Fri, 17 Jun 2022 09:32:51 +0000 (17:32 +0800)]
[RISCV] Add SiFive extension support
Add SiFive extension support
Depends on D147934
Differential Revision: https://reviews.llvm.org/D147935
Nelson Chu [Wed, 18 May 2022 09:26:16 +0000 (02:26 -0700)]
[RISCV] Support LLVM IR intrinsics for xsfvcp extension.
The sf.vc.x and sf.vc.i intrinsics don't have any vector types in the output
and inputs, but the intrinsic spec said that we still need to add vetvli for
them. Therefore, we need to encode the VTYPE to these IR names.
Differential Revision: https://reviews.llvm.org/D147934
David Spickett [Fri, 21 Apr 2023 09:53:50 +0000 (10:53 +0100)]
[llvm][docs] Update "Adding a Builder" docs
* Move step 8 to later, after worker credentials have
been added to the buildmaster.
* Added command for starting the worker, in addition
to creating the worker. The latter only sets up the
directories.
* Noted that in step 6, it is expected that you get a
refused connection.
* Stated that the connection should be tried once,
and the worker then stopped.
We could mention that repeated connections with invalid
credentials will result in an IP ban, but it's probably
detail people don't need here.
If it did happen, then you would not know until you tried
the later steps. At which point you are already in contact
with Galina, who is the person who would help you with that
issue in any case.
Reviewed By: gkistanova
Differential Revision: https://reviews.llvm.org/D148913
Momchil Velikov [Mon, 24 Apr 2023 08:50:28 +0000 (09:50 +0100)]
[CodeGenPrepare] Estimate liveness of loop invariants when checking for address folding profitability
When checking the profitability of folding an address computation
into a memory instruction, the compiler tries to determine the liveness
of the values, comprising the address, at the point of the memory instruction.
This patch improves on the live variable estimates by including
the loop invariants which are references in the loop body.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D143897
Stoorx [Fri, 21 Apr 2023 14:33:15 +0000 (17:33 +0300)]
[clang] Return `std::string_view` from `TargetInfo::getClobbers()`
Change the return type of `getClobbers` function from `const char*`
to `std::string_view`. Update the function usages in CodeGen module.
The reasoning of these changes is to remove unsafe `const char*`
strings and prevent unnecessary allocations for constructing the
`std::string` in usages of `getClobbers()` function.
Differential Revision: https://reviews.llvm.org/D148799
Stoorx [Fri, 21 Apr 2023 21:06:58 +0000 (00:06 +0300)]
[clang] Remove unnecessary virtual inheritance in `TargetInfo`
Since the `TargetInfo` has no diamond-like inheritance diagram,
the `virtual` keyword is not necessary.
Differential Revision: https://reviews.llvm.org/D148961
Stoorx [Tue, 18 Apr 2023 20:49:00 +0000 (23:49 +0300)]
[clang] Make access to submodules via `iterator_range`
In file `clang/lib/Basic/Module.cpp` the `Module` class had `submodule_begin()` and `submodule_end()` functions to retrieve corresponding iterators for private vector of Modules. This commit removes mentioned functions, and replaces all of theirs usages with `submodules()` function and range-based for-loops.
Differential Revision: https://reviews.llvm.org/D148954
Vlad Serebrennikov [Mon, 24 Apr 2023 08:52:31 +0000 (11:52 +0300)]
[clang] Mark CWG2009 as N/A
[[https://wg21.link/p1787 | P1787]]: CWG2331 is resolved by defining lookup from complete-class contexts and out-of-line member definitions. The rest of CWG2009 is resolved by making it ill-formed NDR for forward lookup outside a complete-class context to change the results (before overload resolution, to avoid differences in instantiation).
Wording: The result of the search is the declaration set of S(N, T). If it is an invalid set, the program is ill-formed. If it differs from the result of a search in T for N from immediately after the class-specifier of T, the program is ill-formed, no diagnostic required. ([class.member.lookup]/7)
Reviewed By: #clang-language-wg, shafik
Differential Revision: https://reviews.llvm.org/D148263
Joshua Cao [Mon, 24 Apr 2023 08:39:13 +0000 (01:39 -0700)]
Revert "[SCEV] Precise trip multiples"
This reverts commit
027a4c8b96c7f97df8e98b1dac069b956810ab94.
Sebastian Neubauer [Mon, 24 Apr 2023 08:34:59 +0000 (10:34 +0200)]
[llvm][ADT] Fix Any linker error with multiple compilers
Citing the comment in the source:
Define the type id and initialize with a non-zero value.
Initializing with a zero value means the variab can end up in either the
.data or the .bss section. This can lead to multiple definition linker
errors when some object files are compiled with a compiler that puts the
variable into .data but they are linked to object files from a different
compiler that put the variable into .bss. To prevent this issue from
happening, initialize the variable with a non-zero value, which forces
it to land in .data (because .bss is zero-initialized).
Fixes https://github.com/llvm/llvm-project/issues/62270
A regression of D139974.
Differential Revision: https://reviews.llvm.org/D148953
Alex Zinenko [Mon, 24 Apr 2023 07:33:51 +0000 (07:33 +0000)]
Drop MLIR Bazel dependency on LLVM Analysis
This is no longer necessary after
f5425c128a30 and significatly
decreases the build time and the binary footprint.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D149042
Nikita Popov [Fri, 21 Apr 2023 08:17:03 +0000 (10:17 +0200)]
[Pipelines] Don't run ForceFunctionAttrs post-link
This is effectively a debugging pass to adjust function attributes.
I don't think it makes sense to run it in the post-link pipeline.
Differential Revision: https://reviews.llvm.org/D148904
Mikhail Goncharov [Mon, 24 Apr 2023 07:35:06 +0000 (09:35 +0200)]
Joshua Cao [Tue, 11 Apr 2023 06:52:06 +0000 (23:52 -0700)]
[SCEV] Precise trip multiples
We currently have getMinTrailingZeros(), from which we can get a SCEV's
multiple by computing 1 << MinTrailingZeroes. However, this only gets us
multiples that are a power of 2. This patch introduces a way to get max
constant multiples that are not just a power of 2. The logic is similar
to that of getMinTrailingZeros. getMinTrailingZeros is replaced by
computing the max constant multiple, and counting the number of trailing
bits.
This is applied in two places:
1) Computing unsigned constant ranges. For example, if we have i8
{10,+,10}<nuw>, we know the max constant it can be is 250.
2) Computing trip multiples as shown in SCEV output. This is useful if
for example, we are unrolling a loop by a factor of 5, and we know
the trip multiple is 5, then we don't need a loop epilog.
If the code sees that a SCEV does not have <nuw>, it will fall back to
finding the max multiple that is a power of 2. Multiples that are a
power of 2 will still be a multiple even after the SCEV overflows.
Differential Revision: https://reviews.llvm.org/D141823
Joshua Cao [Fri, 14 Apr 2023 07:23:04 +0000 (00:23 -0700)]
[SCEV] Add trip multiple tests
Joshua Cao [Fri, 14 Apr 2023 07:01:44 +0000 (00:01 -0700)]
[SCEV] Add ranges tests
WANG Xuerui [Mon, 24 Apr 2023 07:18:46 +0000 (15:18 +0800)]
[Clang][Driver] Handle LoongArch multiarch tuples
This follows v1.00 of the [[ https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html | LoongArch Toolchain Conventions ]],
but notably with [[ https://github.com/loongson/LoongArch-Documentation/pull/80 | this patch ]]
applied (a proper version bump to v2.00 was not done, so it is
indistinguishable from the "original" but now incompatible v1.00
otherwise).
Only `loongarch64` is implemented in `Linux::getMultiarchTriple`
because support for LA32 and ILP32* ABIs are incomplete right now.
The Debian sysroot layout is based on Han Gao's recent porting effort,
specifically the ghcr.io/rabenda/beige:loong64-v23-preview-
20230330
container image.
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D142688
Jean Perier [Mon, 24 Apr 2023 07:04:57 +0000 (09:04 +0200)]
[flang] Turn on use-desc-for-alloc by default
Currently, local allocatables and contiguous/scalar pointers (and some
other conditions) are lowered to a set of independent variables in FIR
(one for the address, one for each bound and one for character length).
The intention was to help LLVM get rids of descriptors. But LLVM knows
how to do that anyway in those cases:
```
subroutine foo(x)
real, target :: x(100)
real, pointer, contiguous :: p(:)
p => x
call bar(p(50))
end subroutine
```
The output fir the option on or off is the same after llvm opt -O1,
there is no descriptor anymore, the indirection is removed.
```
define void @foo_(ptr %0) local_unnamed_addr {
%2 = getelementptr [100 x float], ptr %0, i64 0, i64 49
tail call void @bar_(ptr %2)
ret void
}
```
So the benefit of not using a descriptor in lowering is questionable,
and although it is abstracted as much as possible in the so called
MutableBoxValue class that represent allocatable/pointer in lowering
it is still causing bugs from time to time, and will also be a bit
problematic when emitting debug info for the pointer/allocatable.
In HLFIR lowering, the simplification to always use a descriptor in
lowering was already made. This patch allows decorrelating the impact
from this change from the bigger impact HLFIR will have so that it
is easier to get feedback if this causes performance issues.
The lowering tests relying on the previous behavior are only updated
to set back this option to true. The reason is that I think we should
preserve coverage of the code dealing with the "non descriptor" approach
in lowering until we actually get rid of it. The other reason is that
the test will have to be or are already covered by equivalent HLFIR
tests, which use descriptors.
Differential Revision: https://reviews.llvm.org/D148910
Craig Topper [Mon, 24 Apr 2023 06:28:23 +0000 (23:28 -0700)]
[TableGen] Make getRegisterValueType stricter about HwModes.
I don't think this code would work correctly if the register class
used used HwModes. Add asserts to make sure it's not used with HwModes.
Also fix a long outdated comment on the function.
zhanglimin [Mon, 24 Apr 2023 06:27:37 +0000 (14:27 +0800)]
[lsan][test] Obtaining page size using sysconf(_SC_PAGESIZE)
The effectiveness of the mprotect function depends on whether
the first argument is aligned to a page boundary. If mprotect
doesn't work, the kernel will not generate a SIGSEGV signal for
the process when the calling process tries to access memory in
a manner that violates the protection. If so, this test fails.
The problem for this test is that it uses a fixed 4 kB page size
and is aligned. This fails when the page size is not 4 kB. For
example, this fails on LoongArch which uses a 16 kB pagesize.
Reviewed By: SixWeining, xen0n, MaskRay, vitalybuka
Differential Revision: https://reviews.llvm.org/D148407
Christian Ulmann [Mon, 24 Apr 2023 06:20:46 +0000 (06:20 +0000)]
[LoopInfo] SFINAE mechanism for hoist into check
This commit introduces an SFINAE mechanism to make the LLVM hoist into
check member function not leak into the users of LoopInfo.
Depends on D148235
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D148504
Christian Ulmann [Mon, 24 Apr 2023 06:06:45 +0000 (06:06 +0000)]
[LoopInfo] Move generic LoopInfo into own files
This commit splits the generic part of `LoopInfo` into separate files.
These new `GenericLoopInfo` files are located in `llvm/Support` to be inline
with `GenericDomTree`.
Furthermore, this change ensures that MLIR's Bazel build does not have
to link against `LLVMAnalysis` just to use these template headers.
Depends on D148219
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D148235
Shengchen Kan [Mon, 24 Apr 2023 05:24:25 +0000 (13:24 +0800)]
[X86][tablgen] Fix typo in comments, NFC
Mehdi Amini [Sun, 23 Apr 2023 22:07:51 +0000 (16:07 -0600)]
Remove `-action` suffix from the tag defining an Action: it is redundant here
Differential Revision: https://reviews.llvm.org/D149036
Craig Topper [Mon, 24 Apr 2023 03:32:14 +0000 (20:32 -0700)]
[TableGen] Remove unused ForceMode and CodeGen fields from TypeInfer. NFC
As well as the ForceMode field in PatternToMatch.
Wang, Xin10 [Mon, 24 Apr 2023 00:45:43 +0000 (20:45 -0400)]
Clean come dead code
These codes deleted are dead code, we never go into it.
1. In AggressiveAntiDepBreaker.cpp, have assert AntiDepReg != 0.
2. IfConversion.cpp, Kind can only be one unique value, so isFalse && isRev
can never be true.
3. DAGCombiner.cpp, at line 3675, we have considered the condition like
```
// fold (sub x, c) -> (add x, -c)
if (N1C) {
return DAG.getNode(ISD::ADD, DL, VT, N0,
DAG.getConstant(-N1C->getAPIntValue(), DL, VT));
}
```
4. ScheduleDAGSDNodes.cpp, we have Latency > 1 at line 663
5. MasmParser.cpp, code exists in a switch-case block which decided by
the value FirstTokenKind, at line 1621, FirstTokenKind could only be
one of AsmToken::Dollar, AsmToken::At and AsmToken::Identifier.
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D148610
Fabian Tschopp [Sun, 23 Apr 2023 15:15:16 +0000 (17:15 +0200)]
[NFC] Fix typos in APFloat.h
represnted -> represented
Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D149031
Manna, Soumi [Sun, 23 Apr 2023 22:17:28 +0000 (18:17 -0400)]
[NFC][clang] Fix static analyzer concerns
Reported by Coverity:
AUTO_CAUSES_COPY
Unnecessary object copies can affect performance.
1. Inside "SemaDeclCXX.cpp" file, in <unnamed>::DiagnoseUninitializedFields(clang::Sema &, clang::CXXConstructorDecl const *): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.
2. Inside "ClangAttrEmitter.cpp" file, in clang::EmitClangAttrParsedAttrImpl(llvm::RecordKeeper &, llvm::raw_ostream &): Using the auto keyword without an & causes the copy of an object of type pair.
3. Inside "Marshallers.h" file, in clang::ast_matchers::dynamic::internal::MapAnyOfBuilderDescriptor::buildMatcherCtor(clang::ast_matchers::dynamic::SourceRange, llvm::ArrayRef<clang::ast_matchers::dynamic::ParserValue>, clang::ast_matchers::dynamic::Diagnostics *): Using the auto keyword without an & causes the copy of an object of type ParserValue.
4. Inside "CGVTables.cpp" file, in clang::CodeGen::CodeGenModule::GetVCallVisibilityLevel(clang::CXXRecordDecl const *, llvm::DenseSet<clang::CXXRecordDecl const *, llvm::DenseMapInfo<clang::CXXRecordDecl const *, void>> &): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.
5. Inside "ASTContext.cpp" file, in hasTemplateSpecializationInEncodedString(clang::Type const *, bool): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.
6. Inside "ComputeDependence.cpp" file, in clang::computeDependence(clang::DependentScopeDeclRefExpr *): Using the auto keyword without an & causes the copy of an object of type TemplateArgumentLoc.
Reviewed By: tahonermann, erichkeane
Differential Revision: https://reviews.llvm.org/D148812
Teresa Johnson [Sun, 23 Apr 2023 22:00:18 +0000 (15:00 -0700)]
[MemProf] Don't use constexpr via lambda capture due to MSVC issues (NFC)
Modifies
a104e27030587507a711cef0e2b0ddb447fe68fe slightly to switch a
constexpr used via a lambda capture to a const, due to issues with MSVC.
See https://reviews.llvm.org/D140949#inline-1438809 for context.
Fangrui Song [Sun, 23 Apr 2023 21:58:46 +0000 (14:58 -0700)]
[test] Simplify libunwind REQUIRES
Haojian Wu [Sun, 23 Apr 2023 21:54:29 +0000 (23:54 +0200)]
Daniel Kiss [Sun, 23 Apr 2023 21:16:11 +0000 (23:16 +0200)]
[lld][AArch64] Add BTI landing pad to PLT when it is accessed by a range extension thunk.
Adding BTI to those PLT's which accessed with by a range extension thunk due to those preform an indirect call.
Fixes: #62140
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D148704
Simon Pilgrim [Sun, 23 Apr 2023 20:48:25 +0000 (21:48 +0100)]
[CostModel][X86] getMemoryOpCost - increase cost of sub-32-bit vector load/stores
For 8-bit/16-bit vector loads/stores we scalarize and transfer to/from the vector unit, or use the (usually slow) PINSR/PEXTR instructions.
Fixes #59867
Simon Pilgrim [Sun, 23 Apr 2023 20:20:44 +0000 (21:20 +0100)]
[SLP][X86] Add test coverage for Issue #59867
Fangrui Song [Sun, 23 Apr 2023 18:55:12 +0000 (11:55 -0700)]
Remove ExplicitEmulatedTLS and simplify -femulated-tls handling
Currently clangDriver passes -femulated-tls and -fno-emulated-tls to cc1.
cc1 forwards the option to LLVMCodeGen and ExplicitEmulatedTLS is used
to decide the value. Simplify this by moving the Clang decision to
clangDriver and moving the LLVM decision to InitTargetOptionsFromCodeGenFlags.
Hanhan Wang [Thu, 20 Apr 2023 21:46:40 +0000 (14:46 -0700)]
[mlir][Vector] Add 16x16 strategy to vector.transpose lowering.
It adds a `shuffle_16x16` strategy LowerVectorTranspose and renames `shuffle` to `shuffle_1d`. The idea is similar to 8x8 cases in x86Vector::avx2. The general algorithm is:
```
interleave 32-bit lanes using
8x _mm512_unpacklo_epi32
8x _mm512_unpackhi_epi32
interleave 64-bit lanes using
8x _mm512_unpacklo_epi64
8x _mm512_unpackhi_epi64
permute 128-bit lanes using
16x _mm512_shuffle_i32x4
permute 256-bit lanes using again
16x _mm512_shuffle_i32x4
```
After the first stage, they got transposed to
```
0 16 1 17 4 20 5 21 8 24 9 25 12 28 13 29
2 18 3 19 6 22 7 23 10 26 11 27 14 30 15 31
32 48 33 49 ...
34 50 35 51 ...
64 80 65 81 ...
...
```
After the second stage, they got transposed to
```
0 16 32 48 ...
1 17 33 49 ...
2 18 34 49 ...
3 19 35 51 ...
64 80 96 112 ...
65 81 97 114 ...
66 82 98 113 ...
67 83 99 115 ...
...
```
After the thrid stage, they got transposed to
```
0 16 32 48 8 24 40 56 64 80 96 112 ...
1 17 33 49 ...
2 18 34 50 ...
3 19 35 51 ...
4 20 36 52 ...
5 21 37 53 ...
6 22 38 54 ...
7 23 39 55 ...
128 144 160 176 ...
129 145 161 177 ...
...
```
After the last stage, they got transposed to
```
0 16 32 48 64 80 96 112 ... 240
1 17 33 49 66 81 97 113 ... 241
2 18 34 50 67 82 98 114 ... 242
...
15 31 47 63 79 96 111 127 ... 255
```
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D148685
Simon Pilgrim [Sun, 23 Apr 2023 17:39:45 +0000 (18:39 +0100)]
[X86] Add DAG test coverage for Issue #59867 patterns
Nathan Sidwell [Fri, 21 Apr 2023 17:42:20 +0000 (13:42 -0400)]
[BOLT] Remove unsupported ELF type reloc handling
Drop unsupported ELF format reloc handling -- RewriteInstance lacks
this flexibility elsewhere.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D148946
David Green [Sun, 23 Apr 2023 16:20:28 +0000 (17:20 +0100)]
[ARM] Fix qsat for armv5te/armv6 + thumb-mode
This is a Thumb1 target, so will not have qsat instructions available. There
was a mismatch between hasBaseDSP and the instruction patterns when +dsp was
present, which is set by clang (but maybe shouldn't be). The target being
thumb1-only should override that, implying that it does not have any qadds.
Fixes #62273
Kazu Hirata [Sun, 23 Apr 2023 16:07:23 +0000 (09:07 -0700)]
[clang-tidy] Modernize FileState (NFC)
Mathieu Fehr [Fri, 10 Mar 2023 21:53:06 +0000 (22:53 +0100)]
[mlir][irdl] Add IRDL registration
This patch add support for loading IRDL dialects at runtime
with `mlir-opt`.
Given the following `dialect.irdl` file:
```mlir
module {
irdl.dialect @cmath {
irdl.type @complex {
%0 = irdl.is f32
%1 = irdl.is f64
%2 = irdl.any_of(%0, %1)
irdl.parameters(%2)
}
irdl.operation @norm {
%0 = irdl.any
%1 = irdl.parametric @complex<%0>
irdl.operands(%1)
irdl.results(%0)
}
}
```
the IRDL file can be loaded with the `mlir-opt --irdl-file=dialect.irdl`
command, and the following file can then be parsed:
```mlir
func.func @conorm(%p: !cmath.complex<f32>, %q: !cmath.complex<f32>) -> f32 {
%norm_p = "cmath.norm"(%p) : (!cmath.complex<f32>) -> f32
%norm_q = "cmath.norm"(%q) : (!cmath.complex<f32>) -> f32
%pq = arith.mulf %norm_p, %norm_q : f32
return %pq : f32
}
```
To minimize the size of this patch, the operation, attribute, and type verifier are all always returning `success()`.
Depends on D144692
Reviewed By: rriddle, Mogball, mehdi_amini
Differential Revision: https://reviews.llvm.org/D144693
Simon Pilgrim [Sun, 23 Apr 2023 10:48:50 +0000 (11:48 +0100)]
[X86] X86FixupInstTunings - add VPERMILPDri -> VSHUFPDrri mapping
Similar to the original VPERMILPSri -> VSHUFPSrri mapping added in D143787, replacing VPERMILPDri -> VSHUFPDrri should never be any slower and saves an encoding byte.
The sibling VPERMILPDmi -> VPSHUFDmi mapping is trickier as we need the same shuffle mask in every lane (and it needs to be adjusted) - I haven't attempted that yet but we can investigate it in the future if there's interest.
Fixes #61060
Differential Revision: https://reviews.llvm.org/D148999
Lang Hames [Fri, 21 Apr 2023 04:45:46 +0000 (04:45 +0000)]
Re-apply "[ORC][LLJIT] Use JITLink by default on ELF/x86-64." with fixes.
This reapplies
85c649bc02a, which was reverted in
35767e43d62 due to failures
with some example programs. The fix was to add export_executable_symbols to the
example programs.
Simon Pilgrim [Sun, 23 Apr 2023 09:32:04 +0000 (10:32 +0100)]
[X86] X86FixupInstTuning.cpp - fix comment in ProcessVPERMILPSri. NFC.
PERMILPS is only available on AVX or later (VEX/EVEX encoding)
Luo, Yuanke [Sun, 23 Apr 2023 04:49:29 +0000 (12:49 +0800)]
[X86] Precommit test case for D148980.
Craig Topper [Sun, 23 Apr 2023 07:44:39 +0000 (00:44 -0700)]
[TableGen] Remove unused method form ScopeMatcher. NFC
Akshay Khadse [Sun, 23 Apr 2023 07:28:59 +0000 (15:28 +0800)]
[Coverity] Fix uninitialized scalar members in MC
This change fixes static code analysis errors
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D148814
Noah Goldstein [Sun, 23 Apr 2023 06:57:55 +0000 (01:57 -0500)]
[X86] Transform `(cmp eq/ne trunc(X), C)` -> `(cmp eq/ne X, Zext(C))`
This previously existed for `C == 0`, but is mostly beneficial for any
`C`.
There is a slight codesize cost as we get more imm32 (as opposed to
imm8) constants in some cases. But the benefit is was get less imm16
constants (LCP stalls) and save instructions in some vec -> scalar
codegen.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D148594
Serge Pavlov [Sun, 23 Apr 2023 06:35:35 +0000 (06:35 +0000)]
[symbolizer] Change error message if module not found (recommit)
This is a recommit of
75f1f158812d, reverted in
7a443b1c493d, because
it caused compilation error in
compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp.
The error was fixed by Kasimir Georgiev in
de4c038c7ba2, but this
commit was reverted in
de088dd3a0aa, because the initial commit was
reverted.
This commit reverts both the reverting commits,
7a443b1c493d and
de088dd3a0aa.
Original commit message is below.
If llvm-symbolize did not find module, the error looked like:
LLVMSymbolizer: error reading file: No such file or directory
This message does not follow common practice: LLVMSymbolizer is not an
utility name. Also the message did not not contain the name of missed file.
With this change the error message looks differently:
llvm-symbolizer: error: 'abc': No such file or directory
This format is closer to messages produced by other utilities and allow
proper coloring.
Differential Revision: https://reviews.llvm.org/D148032
Craig Topper [Sun, 23 Apr 2023 05:37:57 +0000 (22:37 -0700)]
[TableGen] Intialize vector with constructor instead of assign. NFC
Akshay Khadse [Sun, 23 Apr 2023 04:06:54 +0000 (12:06 +0800)]
[Coverity] Fix explicit null dereferences
This change fixes static code analysis errors
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D148912
Craig Topper [Sun, 23 Apr 2023 04:04:55 +0000 (21:04 -0700)]
[TableGen] Re-work FactorNodes to avoid an extra temporary vector.
Instead of copying elements to the NewOptionsToMatchVector, we
now shift down elements in OptionsToMatch as we create holes by
pulling out equal matchers. After we finish processing the vector,
we'll trim the size to just the elements that are still in use.
Jianjian GUAN [Fri, 21 Apr 2023 02:27:17 +0000 (10:27 +0800)]
[Driver][NFC] Simplify code.
Reviewed By: benshi001, jhuber6
Differential Revision: https://reviews.llvm.org/D148908
NAKAMURA Takumi [Wed, 19 Apr 2023 14:27:20 +0000 (23:27 +0900)]
[Bazel] Rename LLVMTableGenGlobalISel to TableGenGlobalISel
NAKAMURA Takumi [Sun, 23 Apr 2023 01:26:26 +0000 (10:26 +0900)]
[CMake] Target/DirectX: Update deps
NAKAMURA Takumi [Sun, 23 Apr 2023 02:07:22 +0000 (11:07 +0900)]
[CMake] Reorder deps and reformat
Shilei Tian [Sun, 23 Apr 2023 00:56:35 +0000 (20:56 -0400)]
Revert "[OpenMP] Introduce kernel environment"
This reverts commit
35cfadfbe2decd9633560b3046fa6c17523b2fa9.
It makes a couple of buildbots unhappy because of the following test failures:
- `Transforms/OpenMP/add_attributes.ll'`
- `mapping/declare_mapper_target_data.cpp` on AMDGPU
Shilei Tian [Sun, 23 Apr 2023 00:45:00 +0000 (20:45 -0400)]
[OpenMP] Introduce kernel environment
This patch introduces per kernel environment. Previously, flags such as execution mode are set through global variables with name like `__kernel_name_exec_mode`. They are accessible on the host by reading the corresponding global variable, but not from the device. Besides, some assumptions, such as no nested parallelism, are not per kernel basis, preventing us applying per kernel optimization in the device runtime.
This is a combination and refinement of patch series D116908, D116909, and D116910.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D142569
Martin Storsjö [Fri, 14 Apr 2023 09:26:14 +0000 (09:26 +0000)]
[compiler-rt] [test] [asan] Skip the static asan testsuites on mingw targets
Mingw only provides a dynamically linked CRT (contrary to
MSVC/clang-cl), so it is expected that the static asan test
configuration doesn't work.
Skip adding these test suites in mingw configurations.
Differential Revision: https://reviews.llvm.org/D148319
Martin Storsjö [Tue, 18 Apr 2023 12:42:35 +0000 (15:42 +0300)]
[libunwind] [SEH] Clear DISPATCHER_CONTEXT when initializing a cursor
We only initialize a few fields in DISPATCHER_CONTEXT - don't leave
the rest in an uninitialized state; make sure the whole struct is
in a deterministic state.
This makes nondeterministic failures deterministic, for some cases
relating to forced unwinding on aarch64/arm (which requires filling
in parsing of the xdata for finding the exception handler and LSDA).
Differential Revision: https://reviews.llvm.org/D148660
Ian Douglas Scott [Sat, 22 Apr 2023 19:01:28 +0000 (12:01 -0700)]
[M68k] Override `CanLowerReturn` to fix assertion with large return
If it couldn't fit the return value in two registers, this caused an
error during codegen. It seems this method is implemented in other
backends but not here, and allows it to pass return values in memory
when it isn't able to do so in registers.
Seems to fix compilation of Rust code with certain return types:
https://github.com/rust-lang/rust/issues/89498
Differential Revision: https://reviews.llvm.org/D148856
Simon Pilgrim [Sat, 22 Apr 2023 19:02:27 +0000 (20:02 +0100)]
[X86] Fold PSHUF(VSHIFT(X,Y)) -> VSHIFT(PSHUF(X),Y)
PSHUFD/PSHUFLW/PSHUFHW can act as a vector move / folded load, notably helping simplify pre-AVX cases in particular.
This is a much milder alternative to refactoring canonicalizeShuffleWithBinOps to support SSE shifts nodes.
Ian Anderson [Sat, 15 Apr 2023 00:51:41 +0000 (17:51 -0700)]
[libc++] Remove the chrono include from algorithm
algorithm's include of chrono causes include cycles:
```
algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> algorithm
algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> functional -> __functional/boyer_moore_searcher.h -> array -> algorithm
algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> functional -> __functional/boyer_moore_searcher.h -> unordered_map -> algorithm
algorithm -> chrono -> __chrono/convert_to_tm.h -> __chrono/statically_widen.h -> __format/concepts.h -> __format/format_parse_context.h -> string_view -> functional -> __functional/boyer_moore_searcher.h -> vector -> algorithm
```
This is a problem for clang modules after the std mega module is broken up, because it becomes a module cycle which is a hard error.
All of the includes in the `__chrono` and `__format` headers are being used and so can't be removed. algorithm's include of chrono is already removed in C++20, whereas the array, string_view, unordered_map, vector includes of algorithm aren't removed until C++23 (and it's 4x the includes that would need removing). Unconditionally remove the chrono include from algorithm in all versions, so that the module breakup can happen (the module has to apply to all C++ versions).
Reviewed By: Mordante, #libc
Differential Revision: https://reviews.llvm.org/D148405
Simon Pilgrim [Sat, 22 Apr 2023 16:49:51 +0000 (17:49 +0100)]
[X86] Add PERMILPD tuning test coverage for Issue #61060
Simon Pilgrim [Sat, 22 Apr 2023 16:00:35 +0000 (17:00 +0100)]
[X86] combineSetCCMOVMSK - fold allof movmskps/movmskpd -> testps/testpd
Fixes #60007
Simon Pilgrim [Sat, 22 Apr 2023 14:27:40 +0000 (15:27 +0100)]
[X86] LowerBUILD_VECTOR - narrow 256/512-bit vector containing undef/freeze(undef)/zero in the upper half
Fixes #62286
Simon Pilgrim [Sat, 22 Apr 2023 13:54:27 +0000 (14:54 +0100)]
[X86] LowerBUILD_VECTOR - fold build_vector(undef,freeze(undef)) -> freeze(undef)
Noticed while triaging #62286
Ramiro Leal-Cavazos [Sat, 22 Apr 2023 14:15:26 +0000 (07:15 -0700)]
Revert "Revert "Fix handling of special and large vals in expand pattern for `round`" and "Add pattern that expands `math.roundeven` into `math.round` + arith""
This reverts commit
87cef78fa1c7bf6efc544e990894a6062d56abec.
The issue in the original revert is that a lit test expecting a `-nan`
as an output was failing on M2. Since the IEEE 754-2008 standard does
not require the sign to be printed when displaying a `nan`, this
commit changes the `CHECK` for `-nan` to one that checks the result
value bitcasted to an `i32` to ensure that input is being left
unchanged. This check should now be independent of platform being used
to run test.
Reviewed By: jpienaar, mehdi_amini
Differential Revision: https://reviews.llvm.org/D148941
Luo, Yuanke [Sat, 22 Apr 2023 12:02:14 +0000 (20:02 +0800)]
[X86] Precommit test case for D148980.
There is no cross-loop dependency for this case.
Haojian Wu [Sat, 22 Apr 2023 11:59:45 +0000 (13:59 +0200)]
LLVM GN Syncbot [Sat, 22 Apr 2023 10:56:47 +0000 (10:56 +0000)]
[gn build] Port
cd893308b5d4
Piotr Zegar [Sat, 22 Apr 2023 10:54:51 +0000 (10:54 +0000)]
[clang-tidy][NFC] Fix documentation for performance-avoid-endl
Added missing new line after code block markup and before code.
AMS21 [Sat, 22 Apr 2023 10:50:42 +0000 (10:50 +0000)]
[clang-tidy] Add `performance-avoid-endl` check
This check flags uses of `std::endl` on streams and suggests using the newline character `'\n'` instead. `std::endl` performs two operations: it writes a newline character to the output stream and then flushes the stream buffer, which can be less efficient than writing a single newline character using `'\n'`.
This fixes llvm#35321
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D148318
Mark de Wever [Fri, 15 Jul 2022 06:21:19 +0000 (08:21 +0200)]
[libc++][regex] Uses operator<=> in sub_match.
The removal of operator!= in this header will be done in a separate
commit.
Note in the synopsis of P1614R2 there is a constexpr
template<class BiIter>
constexpr auto operator<=>(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
In the implementation of P1614R2 there isn't a constexpr
template<class BiIter>
auto operator<=>(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
There doesn't seem to be an LWG-issue, but it was fixed in the Standard
by removing the constexpr in
b050fd474f11441942c88ef69b8622c8036656ac.
Implements part of:
- P1614R2 The Mothership has Landed
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D132310
Akash Banerjee [Sat, 22 Apr 2023 09:50:35 +0000 (10:50 +0100)]
Fix use of unitialized variable 'mapperFunc' to prevent unexpected behaviour.
Luo, Yuanke [Sat, 22 Apr 2023 07:39:00 +0000 (15:39 +0800)]
[X86] Precommit test case for D148980.
Rishabh Bali [Sat, 22 Apr 2023 06:29:17 +0000 (08:29 +0200)]
[mlir] Fix i8/f32 confusion in comment
Fixes https://github.com/llvm/llvm-project/issues/62275
Differential Revision: https://reviews.llvm.org/D148952
Timm Bäder [Fri, 21 Apr 2023 06:20:51 +0000 (08:20 +0200)]
[clang][Sema][NFC] Add const where appropriate
Slava Zakharin [Sat, 22 Apr 2023 06:03:33 +0000 (23:03 -0700)]
Revert "[OpenMP] Additional APIs used by the MSVC compiler for loop collapse"
This reverts commit
7aa815fc782c5e39aefeec10d9c7c4cea7231975.
Buildbots are failing, e.g.:
https://lab.llvm.org/buildbot/#/builders/84/builds/36964
https://lab.llvm.org/buildbot/#/builders/193/builds/30096
Mehdi Amini [Mon, 6 Feb 2023 05:11:30 +0000 (21:11 -0800)]
Add a breakpoint manager that matches based on File/Line/Col Locations
This will match the locations attached to the IRunits passed in as context
with an action.
This is a recommit of
d09c80515d0e after fixing the test on Windows.
Differential Revision: https://reviews.llvm.org/D144815
Aviad Cohen [Mon, 17 Apr 2023 06:44:06 +0000 (09:44 +0300)]
[mlir] tosa.reshape - Add InferTensorType interface
When this interface is used, a call to inferReturnTypeComponents()
is generated on creation and verification of the op.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D148498
Mehdi Amini [Sat, 22 Apr 2023 05:24:05 +0000 (23:24 -0600)]
Revert "Add a breakpoint manager that matches based on File/Line/Col Locations"
This reverts commit
d09c80515d0e7b1f1a81d3f18a3e799565f5e969.
This is broken on Windows