Alexander Belyaev [Fri, 11 Nov 2022 09:52:08 +0000 (10:52 +0100)]
[mlir] Fix forward the fix for incorrect Optional<ArrayAttr> usage.
Dmitry Makogon [Fri, 11 Nov 2022 09:45:22 +0000 (16:45 +0700)]
[Test] Add test for crash in IRCE when IV is AddRec for another loop
This adds a test for https://github.com/llvm/llvm-project/issues/58912.
IRCE crashes when it tries to check whether it is possible to safely
calculate the bounds of a loop with IV AddRec which is in another loop.
Alexander Belyaev [Fri, 11 Nov 2022 09:46:04 +0000 (10:46 +0100)]
[mlir] Fix incorrect access to the Optional<ArrayAttr> underlying values.
Haojian Wu [Fri, 11 Nov 2022 09:19:28 +0000 (10:19 +0100)]
[include-cleaner] Initial version for the "Location=>Header" step
This patch implements the initial version of "Location => Header" step:
- define the interface;
- integrate into the existing workflow, and use the PragmaIncludes;
Differential Revision: https://reviews.llvm.org/D137320
David Green [Fri, 11 Nov 2022 08:27:44 +0000 (08:27 +0000)]
[AArch64] Add smull sinking extract-and-splat tests and regenerate neon-vmull-high-p8.ll. NFC
Bjorn Pettersson [Tue, 8 Nov 2022 20:19:25 +0000 (21:19 +0100)]
[opt] Remove support for using -O[0|1|2|3|s|z] with legacy PM in opt
When running a default pipeline (for a specific O-level) in opt it is
now expected that the new PM should be used. Only reason to use the
legacy PM is when testing a pass that is locked to the legacy PM (or
when testing single passes, for example used by the llc backend).
If a test should run both a default pipeline plus some other passes,
the solution would be to invoke opt twice (separating the default
pipeline execution from the execution of individual passes).
Starting with this patch "opt -O0" etc. will result in an error.
Differential Revision: https://reviews.llvm.org/D137663
Guray Ozen [Thu, 10 Nov 2022 16:55:49 +0000 (17:55 +0100)]
[mlir] Introduce device mapper attribute for `thread_dim_map` and `mapped to dims`
`scf.foreach_thread` defines mapping its loops to processors via an integer array, see an example below. A lowering can use this mapping. However, expressing mapping as an integer array is very confusing, especially when there are multiple levels of parallelism. In addition, the op does not verify the integer array. This change introduces device mapping attribute to make mapping descriptive and verifiable. Then it makes GPU transform dialect use it.
```
scf.foreach_thread (%i, %j) in (%c1, %c2) {
scf.foreach_thread (%i2, %j2) in (%c1, %c2)
{...} { thread_dim_mapping = [0, 1]}
} { thread_dim_mapping = [0, 1]}
```
It first introduces a `DeviceMappingInterface` which is an attribute interface. `scf.foreach_thread` defines its mapping via this interface. A lowering must define its attributes and implement this interface as well. This way gives us a clear validation.
The change also introduces two new attributes (`#gpu.thread<x/y/z>` and `#gpu.block<x,y,z>` ). After this change, the above code prints as below, as seen here, this way clarifies the loop mappings. The change also implements consuming of these two new attribute by the transform dialect. Transform dialect binds the outermost loops to the thread blocks and innermost loops to threads.
```
scf.foreach_thread (%i, %j) in (%c1, %c2) {
scf.foreach_thread (%i2, %j2) in (%c1, %c2)
{...} { thread_dim_mapping = [#gpu.thread<x>, #gpu.thread<y>]}
} { thread_dim_mapping = [#gpu.block<x>, #gpu.block<y>]}
```
Reviewed By: ftynse, nicolasvasilache
Differential Revision: https://reviews.llvm.org/D137413
Timm Bäder [Thu, 27 Oct 2022 10:06:44 +0000 (12:06 +0200)]
[clang][Interp] Protect Record creation against infinite recursion
This happens only in error cases, but we need to handle it anyway.
Differential Revision: https://reviews.llvm.org/D136831
Timm Bäder [Wed, 2 Nov 2022 10:20:01 +0000 (11:20 +0100)]
[clang][Interp] Support alignof()
Support alignof() and __alignof() expressions.
Fixes #58816
Differential Revision: https://reviews.llvm.org/D137240
Timm Bäder [Mon, 7 Nov 2022 13:19:48 +0000 (14:19 +0100)]
[clang][Interp] DerivedToBase casts
Differential Revision: https://reviews.llvm.org/D137545
Joshua Batista [Fri, 11 Nov 2022 06:49:35 +0000 (22:49 -0800)]
Add builtin_elementwise_sin and builtin_elementwise_cos
Add codegen for llvm cos and sin elementwise builtins
The sin and cos elementwise builtins are necessary for HLSL codegen.
Tests were added to make sure that the expected errors are encountered
when these functions are given inputs of incompatible types.
The new builtins are restricted to floating point types only.
Reviewed By: craig.topper, fhahn
Differential Revision: https://reviews.llvm.org/D135011
Vignesh Balasubramanian [Fri, 11 Nov 2022 04:46:59 +0000 (10:16 +0530)]
[OpenMP] [OMPD] Testcases for libompd
This is part of the OMPD Path set started from review.
https://reviews.llvm.org/D100181
Reviewed By: @jdoerfert, @dreachem
Craig Topper [Fri, 11 Nov 2022 06:39:28 +0000 (22:39 -0800)]
[RISCV] Remove unused CHECK lines from test. NFC
These aren't included in the check-prefixes.
Xiaodong Liu [Fri, 11 Nov 2022 06:24:54 +0000 (14:24 +0800)]
[LangRef][LoongArch] Update inline asm constraint code and operand modifier
According to:
https://reviews.llvm.org/D134157
https://reviews.llvm.org/D136841
https://reviews.llvm.org/D136835
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D137528
Matt Arsenault [Thu, 22 Sep 2022 14:51:33 +0000 (10:51 -0400)]
AtomicExpand: Support cmpxchg expansion for small FP types
Handles f16 atomics for AMDGPU.
Jordan Rupprecht [Fri, 11 Nov 2022 06:05:09 +0000 (22:05 -0800)]
Avoid fallthrough after
ffb109b6852d248c9d2e3202477dccf20aac7151
Fallthrough appears to be not intended here, as otherwise this is a completely dead store: `DOPRegIsUnique` will be overwritten by the next case.
Fangrui Song [Fri, 11 Nov 2022 05:54:43 +0000 (21:54 -0800)]
[LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally
For a local linkage GlobalObject in a non-prevailing COMDAT, it remains defined while its
leader has been made available_externally. This violates the COMDAT rule that
its members must be retained or discarded as a unit.
To fix this, update the regular LTO change D34803 to track local linkage
GlobalValues, and port the code to ThinLTO (GlobalAliases are not handled.)
This fixes two problems.
(a) `__cxx_global_var_init` in a non-prevailing COMDAT group used to
linger around (unreferenced, hence benign), and is now correctly discarded.
```
int foo();
inline int v = foo();
```
(b) Fix https://github.com/llvm/llvm-project/issues/58215:
as a size optimization, we place private `__profd_` in a COMDAT with a
`__profc_` key. When FuncImport.cpp makes `__profc_` available_externally due to
a non-prevailing COMDAT, `__profd_` incorrectly remains private. This change
makes the `__profd_` available_externally.
```
cat > c.h <<'eof'
extern void bar();
inline __attribute__((noinline)) void foo() {}
eof
cat > m1.cc <<'eof'
#include "c.h"
int main() {
bar();
foo();
}
eof
cat > m2.cc <<'eof'
#include "c.h"
__attribute__((noinline)) void bar() {
foo();
}
eof
clang -O2 -fprofile-generate=./t m1.cc m2.cc -flto -fuse-ld=lld -o t_gen
rm -fr t && ./t_gen && llvm-profdata show -function=foo t/default_*.profraw
clang -O2 -fprofile-generate=./t m1.cc m2.cc -flto=thin -fuse-ld=lld -o t_gen
rm -fr t && ./t_gen && llvm-profdata show -function=foo t/default_*.profraw
```
If a GlobalAlias references a GlobalValue which is just changed to
available_externally, change the GlobalAlias as well (e.g. C5/D5 comdats due to
cc1 -mconstructor-aliases). The GlobalAlias may be referenced by other
available_externally functions, so it cannot easily be removed.
Depends on D137441: we use available_externally to mark a GlobalAlias in a
non-prevailing COMDAT, similar to how we handle GlobalVariable/Function.
GlobalAlias may refer to a ConstantExpr, not changing GlobalAlias to
GlobalVariable gives flexibility for future extensions (the use case is niche.
For simplicity we don't handle it yet). In addition, available_externally
GlobalAlias is the most straightforward implementation and retains the aliasee
information to help optimizers.
See windows-vftable.ll: Windows vftable uses an alias pointing to a
private constant where the alias is the COMDAT leader. The COMDAT use case
is skeptical and ThinLTO does not discard the alias in the non-prevailing COMDAT.
This patch retains the behavior.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D135427
Craig Topper [Fri, 11 Nov 2022 02:00:35 +0000 (18:00 -0800)]
[RISCV] Use OPCFG format record for vsetvli in tablgen. NFC
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D137808
Craig Topper [Fri, 11 Nov 2022 01:59:47 +0000 (17:59 -0800)]
[RISCV] Add OPCFG format of vector. NFC
Refer to https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#101-vector-arithmetic-instruction-encoding
Patch by Jiejie Rong
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D137694
Matt Arsenault [Thu, 10 Nov 2022 23:38:38 +0000 (15:38 -0800)]
AMDGPU: Use generic is.fpclass enum instead of locally defined copy
The generic intrinsic uses the same bitlayout as the amdgcn intrinsic,
so re-use the enum.
Med Ismail Bennani [Fri, 11 Nov 2022 02:28:53 +0000 (18:28 -0800)]
[lldb/test] Fix app_specific_backtrace_crashlog.test (NFC)
This patch fixes app_specific_backtrace_crashlog.test.
It was failing because one of the loaded images was built with
optimization which added a new warning message between the first
`CHECK` and the `CHECK-NEXT`, breaking the expected ordering.
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Alan Zhao [Fri, 11 Nov 2022 01:48:18 +0000 (17:48 -0800)]
Revert "[LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally"
This reverts commit
89ddcff1d2d6e9f4de78f3a563a8b1987bf7ea8f.
Reason: This breaks bootstrapping builds of LLVM on Windows using
ThinLTO; see https://crbug.com/1382839
gonglingqin [Thu, 10 Nov 2022 12:06:17 +0000 (20:06 +0800)]
[Clang][LoongArch] Implement __builtin_loongarch_crc_w_d_w builtin and add diagnostics
This patch adds support to prevent __builtin_loongarch_crc_w_d_w from compiling
on loongarch32 in the front end and adds diagnostics accordingly.
Reference: https://github.com/gcc-mirror/gcc/blob/master/gcc/config/loongarch/larchintrin.h#L175-L184
Depends on D136906
Differential Revision: https://reviews.llvm.org/D137316
zhongyunde [Fri, 11 Nov 2022 01:10:14 +0000 (09:10 +0800)]
[AArch64][SVE] Support logical operation BIC with DestructiveBinary patterns
Logical operation BIC with DestructiveBinary patterns is temporarily removed as
causes an assert (commit
3c382ed71f15), so try to fix that.
The most significant being that for pseudo instructions that do not have real instructions (including movpfx'd ones) that cover all combinations of register allocation, their expansion will be broken. This is the main reason the zeroing is an experimental feature because it has known bugs.
So we add an extra LSL for movprfx expand BIC_ZPZZ_ZERO A, P, A, A when necessary.
movprfx z0.s, p0/z, z0.s
lsl z0.b, p0/m, z0.b, #0
bic z0.s, p0/m, z0.s, z0.s
Depends on D88595
Weining Lu [Fri, 11 Nov 2022 00:58:12 +0000 (08:58 +0800)]
Add missing changes for "[Clang][LoongArch] Handle -march/-m{single,double,soft}-float/-mfpu options"
Some changes in D136146 were lost by an accidentally sumbit. So recover
them.
stanley-nod [Fri, 11 Nov 2022 00:41:59 +0000 (16:41 -0800)]
[mlir][vector] Add insertOp src shape check for BubbleUpBitCastForStridedSliceInsert
Not all shape of vectors can be casted into other types, we add a check
to not fold insertOp into bitcast if the shape does not support it.
Examples of unsupported shape castings are f16 vectors to f32 if the
shape is not multiple of 2s. or int8 to int32 if shapes are not multiple
of 4.
Reviewed By: antiagainst, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D137802
Egor Zhdan [Mon, 31 Oct 2022 22:46:43 +0000 (15:46 -0700)]
[libclang] Expose completion result kind in `CXCompletionResult`
This allows clients of libclang to check whether a completion result is a keyword. Previously, keywords had `CursorKind == CXCursor_NotImplemented` and it wasn't trivial to distinguish a keyword from a pattern.
This change moves `CodeCompletionResult::ResultKind` to `clang-c` under a new name `CXCompletionResultKind`. It also tweaks `c-index-test` to print the result kind instead of `NotImplemented`, and adjusts the tests for the new output.
rdar://
91852088
Differential Revision: https://reviews.llvm.org/D136844
Jason Molenda [Thu, 10 Nov 2022 23:46:32 +0000 (15:46 -0800)]
Check m_dyld_up directly in LoadBinariesViaMetadata
In the restructuring I did in https://reviews.llvm.org/D133680 , I
call ObjectFile::LoadBinariesViaMetadata, and the process m_dyld
may be set by a method under there -- in
ProcessMachCore::LoadBinariesViaMetadata I wanted to check to see
if m_dyld_up had been set. I did this by calling the GetDynamicLoader()
method, but that method will call FindPlugin() if there is no
dynamic loader yet, and the static dynamic loader plugin was being
loaded, preventing the scan for userland binaries in a userland
corefile.
Differential Revision: https://reviews.llvm.org/D137807
rdar://
102210820
Mehdi Amini [Thu, 3 Nov 2022 20:44:53 +0000 (20:44 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in TosaOps.cpp (NFC)
Mehdi Amini [Thu, 3 Nov 2022 20:33:56 +0000 (20:33 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in SparseTensorDialect.cpp (NFC)
bixia1 [Thu, 10 Nov 2022 23:01:28 +0000 (15:01 -0800)]
[mlir][sparse] Fix a test to check all output coordinates.
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D137805
Jim Ingham [Thu, 10 Nov 2022 23:23:51 +0000 (15:23 -0800)]
Apparently I moved the wrong one to "2", then Jason moved the right
one, so this commit moves the wrong one back to no-"2"...
Nick Desaulniers [Thu, 10 Nov 2022 22:26:47 +0000 (14:26 -0800)]
[SelectDagISEL] refactor HandlePHINodesInSuccessorBlocks NFC.
While working on this code to support outputs from callbr along indirect
branches, I kept making these changes again and again. Precommit these.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D137445
Daniel Bertalan [Thu, 10 Nov 2022 21:42:19 +0000 (22:42 +0100)]
[lld-macho] Set 4-byte alignment for `__init_offsets`
dyld refuses to run initializers if this section is unaligned.
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1383240
Differential Revision: https://reviews.llvm.org/D137803
bixia1 [Thu, 10 Nov 2022 21:07:57 +0000 (13:07 -0800)]
[mlir][sparse] Fix a bug in rewriting for the convert op.
The code to retrieve the number of entries isn't correct.
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D137795
Nick Desaulniers [Thu, 10 Nov 2022 22:22:55 +0000 (14:22 -0800)]
[CodeGen][Test] simplify callbr-asm-outputs.ll with nounwind NFC
The CFI directives add noise to the test. Remove them via nounwind fn
attrs. Also remove clobbers.
Reviewed By: void
Differential Revision: https://reviews.llvm.org/D137596
Usman Nadeem [Thu, 10 Nov 2022 22:09:51 +0000 (14:09 -0800)]
[Flang] Allow registering plugin extensions with the pass builder
Pass plugins are compiled and linked dynamically by default. Setting
`LLVM_${NAME}_LINK_INTO_TOOLS` to `ON` turns the project into a
statically linked extension. Projects like Polly can be used this way by
adding `-DLLVM_POLLY_LINK_INTO_TOOLS=ON` to the `cmake` command.
The changes in this patch makes the PassBuilder in Flang aware of
statically linked pass plugins, see the documentation for more details:
https://github.com/llvm/llvm-project/blob/main/llvm/docs/WritingAnLLVMNewPMPass.rst#id21
Differential Revision: https://reviews.llvm.org/D137673
Change-Id: Id1aa501dcb4821d0ec779f375cc8e8d6b0b92fce
Sanjay Patel [Thu, 10 Nov 2022 22:10:46 +0000 (17:10 -0500)]
[InstSimplify] fold X +nnan Inf
If we exclude NaN (and therefore the opposite Inf),
anything plus Inf is Inf:
https://alive2.llvm.org/ce/z/og3dj9
Sanjay Patel [Thu, 10 Nov 2022 21:47:36 +0000 (16:47 -0500)]
[InstSimplify] add tests for fadd/fsub with inf constant operand; NFC
Michael Buch [Thu, 10 Nov 2022 18:46:02 +0000 (10:46 -0800)]
[lldb][test] TestConstStaticIntegralMember.py: fix for clang-{9,11,13}
**Summary**
The public lldb matrix bot is failing for tests compiled with clang-9, clang-11, clang-13.
This patch addresses these failures by evaluating the enum case that
doesn't cause malformed DWARF in older version of clang.
There was no particular reason we had to use `true` enum case
to reproduce the bug in #58383, so simply switch to use `false`
to get all bots passing again.
**Details**
In older versions of clang, the following snippet:
```
enum EnumBool : bool {
enum_bool_case1 = false,
enum_bool_case2 = true,
};
struct A {
const static EnumBool enum_bool_val = enum_bool_case2;
};
```
…results in following DWARF:
```
0x00000052: DW_TAG_structure_type
DW_AT_calling_convention (DW_CC_pass_by_value)
DW_AT_name ("A")
DW_AT_byte_size (0x01)
DW_AT_decl_file ("/Users/michaelbuch/Git/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/repro.cpp")
DW_AT_decl_line (6)
0x0000005b: DW_TAG_member
DW_AT_name ("enum_bool_val")
DW_AT_type (0x0000000000000068 "const EnumBool")
DW_AT_decl_file ("/Users/michaelbuch/Git/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/repro.cpp")
DW_AT_decl_line (7)
DW_AT_external (true)
DW_AT_declaration (true)
DW_AT_const_value (-1)
```
Note the `DW_AT_const_value == -1`
When evaluating `A::enum_bool_val` in the lldb we get:
```
(lldb) p A::enum_bool_val
error: expression failed to parse:
error: Couldn't lookup symbols:
__ZN1A13enum_bool_valE
```
Enabling the DWARF logs we see:
```
(arm64) clang-13.out: DWARFASTParserClang::ParseTypeFromDWARF (die = 0x00000068, decl_ctx = 0x136ac1e30 (die 0x0000000b)) DW_TAG_const_type name = '(null)')
Failed to add const value to variable A::enum_bool_val: Can't store unsigned value
18446744073709551615 in integer with 1 bits.
```
This occurs because a boolean enum is considered an unsigned integer
type, but we try to initialize it with a `-1`.
**Testing**
- Confirmed locally that top-of-tree lldb correctly
evaluates the previously failing expression when
the test program is compiled with clang-13
Differential Revision: https://reviews.llvm.org/D137793
Björn Schäpers [Thu, 10 Nov 2022 21:36:25 +0000 (22:36 +0100)]
[clang-format][NFC] More sorting in getLLVMStyle()
Seems I've missed that.
Amends
41a09a07ce4ddd1e97ce0430d1debe1dcc853890
Anastasiia Lukianenko [Thu, 10 Nov 2022 21:28:15 +0000 (22:28 +0100)]
[clang-format] Add BreakBeforeInlineASMColon configuration
If true, colons in ASM parameters will be placed after line breaks.
true:
asm volatile("string",
:
: val);
false:
asm volatile("string", : : val);
Differential Revision: https://reviews.llvm.org/D91950
Tom Stellard [Thu, 10 Nov 2022 21:18:44 +0000 (13:18 -0800)]
cmake: Inline the add_llvm_symbol_exports.py script
This fixes stand-alone builds.
Reviewed By: andrewng
Differential Revision: https://reviews.llvm.org/D137611
Tom Stellard [Thu, 10 Nov 2022 20:18:49 +0000 (12:18 -0800)]
docs: Add instructions for stand-alone builds of clang
More sub-projects will be added to the table once they have been verified
to be buildable in stand-alone mode.
Reviewed By: MaskRay, mgorny
Differential Revision: https://reviews.llvm.org/D123968
William Huang [Thu, 10 Nov 2022 00:34:07 +0000 (00:34 +0000)]
[InstCombine] PR58901 - fix bug with swapping GEP of different types
Fix https://github.com/llvm/llvm-project/issues/58901 by adding stricter check whether non-opaque GEP can be swapped. This will not affect GEP swapping optimization in the future since we are switching to opaque GEP
Reviewed By: clin1
Differential Revision: https://reviews.llvm.org/D137752
Konrad Kleine [Thu, 10 Nov 2022 11:11:33 +0000 (12:11 +0100)]
[release] Add third-party tarball to release for standalone builds
With the advent of https://reviews.llvm.org/D131919 and
https://github.com/llvm/llvm-project/commit/
a11cd0d94ed3cabf0998a0289aead05da94c86eb
the third-party directory is required to build LLVM and other packages and in standalone
builds the third-party directory is not available from the llvm tarball anymore.
Differential Revision: https://reviews.llvm.org/D137777
Anastasia Stulova [Thu, 10 Nov 2022 19:50:19 +0000 (19:50 +0000)]
Updated contact email address.
Mark de Wever [Thu, 4 Aug 2022 16:31:03 +0000 (18:31 +0200)]
[libc++] Documents details of the pre-commit CI.
This documentation aims to make it cleare how the libc++ pre-commit CI
works. For libc++ developers and other LLVM projects whose changes can
affect libc++.
This was discusses with @aaron.ballman as a follow on some unclearities
for the Clang communitee how the libc++ pre-commit CI works.
Note some parts depend on patches under review as commented in the
documentation.
Reviewed By: ldionne, #libc, philnik
Differential Revision: https://reviews.llvm.org/D133249
Sanjay Patel [Thu, 10 Nov 2022 19:09:57 +0000 (14:09 -0500)]
[VectorCombine] widen a load with subvector insert
This adapts/copies code from the existing fold that allows
widening of load scalar+insert. It can help in IR because
it removes a shuffle, and the backend can already narrow
loads if that is profitable in codegen.
We might be able to consolidate more of the logic, but
handling this basic pattern should be enough to make a small
difference on one of the motivating examples from issue #17113.
The final goal of combining loads on those patterns is not
solved though.
Differential Revision: https://reviews.llvm.org/D137341
Sanjay Patel [Thu, 10 Nov 2022 17:08:25 +0000 (12:08 -0500)]
[SystemZ] add test for mergeTruncStores miscompile; NFC
This is based on the example in issue #58883. I'm not sure
if the output currently shows the potential miscompile,
so we may want to adjust the test in a follow-up.
Matt Arsenault [Thu, 10 Nov 2022 17:09:25 +0000 (09:09 -0800)]
AArch64/GlobalISel: Regenerate some test checks to include -NEXT
Alexey Bataev [Fri, 16 Sep 2022 20:57:04 +0000 (13:57 -0700)]
[SLP]Redesign vectorization of the gather nodes.
Gather nodes are vectorized as simply vector of the scalars instead of
relying on the actual node. It leads to the fact that in some cases
we may miss incorrect transformation (non-matching set of scalars is
just ended as a gather node instead of possible vector/gather node).
Better to rely on the actual nodes, it allows to improve stability and
better detect missed cases.
Differential Revision: https://reviews.llvm.org/D135174
Anastasia Stulova [Thu, 10 Nov 2022 15:20:34 +0000 (15:20 +0000)]
[OpenCL] Fix diagnostics with templates in kernel args.
Improve checking for the standard layout type when diagnosing
the kernel argument with templated types. The check doesn't work
correctly for references or pointers due to the lazy template
instantiation.
Current fix only improves cases where nested types in the templates
do not depend on the template parameters.
Differential Revision: https://reviews.llvm.org/D134445
Jorge Gorbe Moya [Thu, 10 Nov 2022 18:25:04 +0000 (10:25 -0800)]
[lldb] Make callback-based formatter matching available from the CLI.
This change adds a `--recognizer-function` (`-R`) to `type summary add`
and `type synth add` that allows users to specify that the names in
the command are not type names but python function names.
It also adds an example to lldb/examples, and a section in the data
formatters documentation on how to use recognizer functions.
Differential Revision: https://reviews.llvm.org/D137000
Jason Molenda [Thu, 10 Nov 2022 18:21:29 +0000 (10:21 -0800)]
add LoongArchTargetParser.def to LLVM_Utils module
Weinling Lu's change from https://reviews.llvm.org/D136146
fails to build with -DLLVM_ENABLE_MODULES=1 cmake builds
like the LLDB Incremental CI bot on greendragon; this entry
is sufficient to unblock that style of build, it seems.
Alexey Bataev [Thu, 10 Nov 2022 18:12:51 +0000 (10:12 -0800)]
[SLP][NFC]Add a test for vectorization with scheduling blocks order
different than the instruction order, NFC.
Krzysztof Parzyszek [Tue, 1 Nov 2022 16:15:08 +0000 (09:15 -0700)]
Add deduction guides for IRBuilder
Differential Revision: https://reviews.llvm.org/D137173
Matt Arsenault [Thu, 10 Nov 2022 17:05:26 +0000 (09:05 -0800)]
AArch64/GlobalISel: Regenerate test checks
Renaud-K [Mon, 7 Nov 2022 19:02:57 +0000 (11:02 -0800)]
Add constant time mapping from enumeration to string in ENUM_CLASS
macro
Differential revision: https://reviews.llvm.org/D137577
Renaud-K [Thu, 10 Nov 2022 01:55:03 +0000 (17:55 -0800)]
In the case the function body is empty, shifting attributes as inserting argument is not supported
Differential revision: https://reviews.llvm.org/D137757
Caroline Concatto [Wed, 2 Nov 2022 11:32:48 +0000 (11:32 +0000)]
[AArch64]SME2 Multi vector Sel Load and Store instructions
This patch adds the assembly/disassembly for the following instruction:
SEL: Multi-vector conditionally select elements from two vectors
for 2 and 4 registers
Non-constiguous load with stride resgisters:
LD1B (scalar + immediate): Contiguous load of bytes to multiple strided vectors (immediate index).
(scalar + scalar): Contiguous load of bytes to multiple strided vectors (scalar index).
LD1D (scalar + immediate): Contiguous load of doublewords to multiple strided vectors (immediate index).
(scalar + scalar): Contiguous load of doublewords to multiple strided vectors (scalar index).
LD1H (scalar + immediate): Contiguous load of halfwords to multiple strided vectors (immediate index).
(scalar + scalar): Contiguous load of halfwords to multiple strided vectors (scalar index).
LD1W (scalar + immediate): Contiguous load of words to multiple strided vectors (immediate index).
(scalar + scalar): Contiguous load of words to multiple strided vectors (scalar index).
LDNT1B (scalar + immediate): Contiguous load non-temporal of bytes to multiple strided vectors (immediate index).
(scalar + scalar): Contiguous load non-temporal of bytes to multiple strided vectors (scalar index).
LDNT1D (scalar + immediate): Contiguous load non-temporal of doublewords to multiple strided vectors (immediate index).
(scalar + scalar): Contiguous load non-temporal of doublewords to multiple strided vectors (scalar index).
LDNT1H (scalar + immediate): Contiguous load non-temporal of halfwords to multiple strided vectors (immediate index).
(scalar + scalar): Contiguous load non-temporal of halfwords to multiple strided vectors (scalar index).
LDNT1W (scalar + immediate): Contiguous load non-temporal of words to multiple strided vectors (immediate index).
(scalar + scalar): Contiguous load non-temporal of words to multiple strided vectors (scalar index).
Non-constiguous store with stride resgisters:
ST1B (scalar + immediate): Contiguous store of bytes from multiple strided vectors (immediate index).
(scalar + scalar): Contiguous store of bytes from multiple strided vectors (scalar index).
ST1D (scalar + immediate): Contiguous store of doublewords from multiple strided vectors (immediate index).
(scalar + scalar): Contiguous store of doublewords from multiple strided vectors (scalar index).
ST1H (scalar + immediate): Contiguous store of halfwords from multiple strided vectors (immediate index).
(scalar + scalar): Contiguous store of halfwords from multiple strided vectors (scalar index).
ST1W (scalar + immediate): Contiguous store of words from multiple strided vectors (immediate index).
(scalar + scalar): Contiguous store of words from multiple strided vectors (scalar index).
STNT1B (scalar + immediate): Contiguous store non-temporal of bytes from multiple strided vectors (immediate index).
(scalar + scalar): Contiguous store non-temporal of bytes from multiple strided vectors (scalar index).
STNT1D (scalar + immediate): Contiguous store non-temporal of doublewords from multiple strided vectors (immediate index).
(scalar + scalar): Contiguous store non-temporal of doublewords from multiple strided vectors (scalar index).
STNT1H (scalar + immediate): Contiguous store non-temporal of halfwords from multiple strided vectors (immediate index).
(scalar + scalar): Contiguous store non-temporal of halfwords from multiple strided vectors (scalar index).
STNT1W (scalar + immediate): Contiguous store non-temporal of words from multiple strided vectors (immediate index).
(scalar + scalar): Contiguous store non-temporal of words from multiple strided vectors (scalar index).
The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09
This patch also adds a new SVE vector list to represent the stride loads/stores
ZPRVectorListStrided and the sets of 2 and 4 ZA registers:
ZZ_[b|h|w|d]_strided and ZZZZ_[b|h|w|d]_strided
Differential Revision: https://reviews.llvm.org/D136172
Andrzej Warzynski [Thu, 10 Nov 2022 15:54:57 +0000 (15:54 +0000)]
[flang][nfc] Add missing `REQUIRES` flag in a test
D129156 has caused a buildbot failure:
* https://lab.llvm.org/buildbot/#/builders/175/builds/20472.
Clearly `examples` is missing from the `REQUIRES` list. Sending this
without a review as a quick fix.
bixia1 [Thu, 10 Nov 2022 00:16:03 +0000 (16:16 -0800)]
[mlir][sparse] Add option enable-buffer-initialization to the sparse-tensor-codegen pass.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D137733
Nico Weber [Thu, 10 Nov 2022 15:13:51 +0000 (10:13 -0500)]
[gn build] port
e1b88c8a09be (clang resource dir uses only major version)
Tarun Prabhu [Thu, 10 Nov 2022 14:56:03 +0000 (07:56 -0700)]
[flang] Add -fpass-plugin option to flang
This patch adds the -fpass-plugin option to flang which dynamically loads LLVM
passes from the shared object passed as the argument to the flag. The behavior
of the option is designed to replicate that of the same option in clang and
thus has the same capabilities and limitations.
Features:
Multiple instances of -fpass-plugin=path-to-file can be specified and each
of the files will be loaded in that order.
The flag can be passed to both flang-new and flang-new -fc1.
The flag will be listed when the -help flag is passed to both flang-new and
flang-new -fc1. It will also be listed when the --help-hidden flag is passed.
Limitations:
Dynamically loaded plugins are not supported in clang on Windows and are not
supported in flang either.
Addenda:
Some minor stylistic changes are made in the files that were modified to
enable this functionality. Those changes make the naming of functions more
consistent, but do not change any functionality that is not directly
related to enabling -fpass-plugin.
Differential Revision: https://reviews.llvm.org/D129156
Haojian Wu [Wed, 2 Nov 2022 10:39:59 +0000 (11:39 +0100)]
[include-cleaner] Add export IWYU pragma support.
- add support to PragmaIncludes to handle IWYU export/begin_exports/end_exports
pragma;
- implement an API to retrieve the direct exporter headers;
Differential Revision: https://reviews.llvm.org/D137319
Stefan Pintilie [Wed, 9 Nov 2022 21:09:31 +0000 (15:09 -0600)]
[PowerPC] Add the SUBFUS instruction to Future CPU.
Add a new instruction called SUBUFS that does saturating subtract.
This instruction is only for Future CPU.
Reviewed By: amyk
Differential Revision: https://reviews.llvm.org/D137643
Benjamin Kramer [Thu, 10 Nov 2022 14:24:37 +0000 (15:24 +0100)]
[bazel] Provide CLANG_VERSION_MAJOR_STRING for
e1b88c8a09be25b86b13f98755a9bd744b4dbf14
Matthias Springer [Thu, 10 Nov 2022 14:04:23 +0000 (15:04 +0100)]
[mlir][vector] Support vector.extractelement distribution of 1D vectors
Ops such as `%1 = vector.extractelement %0[%pos : index] : vector<96xf32>`.
In case of an extract from a 1D vector, the source vector is distributed. The lane into which the requested position falls, extracts the element and shuffles it to all other lanes.
Differential Revision: https://reviews.llvm.org/D137336
Keith Walker [Fri, 4 Nov 2022 10:02:29 +0000 (10:02 +0000)]
[AArch64] RME MEC instructions and system registers
This patch adds assembler/disassembler support for
RME MEC (Memory Encryption Contexts).
Cache maintence instructions added:
- DC CIPAPA
- DC CIGDPAPA
System registers added:
- MECIDR_EL2
- MECID_P0_EL2
- MECID_A0_EL2
- MECID_P1_EL2
- MECID_A1_EL2
- VMECID_P_EL2
- VMECID_A_EL2
- MECID_RL_A_EL3
Differential Revision: https://reviews.llvm.org/D137431
Valentin Clement [Thu, 10 Nov 2022 14:01:38 +0000 (15:01 +0100)]
[flang][NFC] Rename RewriteLoop.cpp to ControlFlowConverter.cpp
RewriteLoop.cpp is containing more than just loop conversion. It will
soon contains the fir.select_type conversion as well. This patch
renames the file so it is in line with the pass name.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D137773
Timm Bäder [Thu, 9 Jun 2022 06:05:41 +0000 (08:05 +0200)]
[clang] Only use major version in resource dir
This causes unnecessary churn for downstreams.
For the full discussion, see https://discourse.llvm.org/t/should-we-continue-embed-the-full-llvm-version-in-lib-clang/62094
Differential Revision: https://reviews.llvm.org/D125860
LLVM GN Syncbot [Thu, 10 Nov 2022 13:53:38 +0000 (13:53 +0000)]
[gn build] Port
85f08c4197ae
LLVM GN Syncbot [Thu, 10 Nov 2022 13:53:37 +0000 (13:53 +0000)]
[gn build] Port
135a9272a4c9
Nico Weber [Thu, 10 Nov 2022 13:53:06 +0000 (08:53 -0500)]
[gn build] port
b60f801607543
Hassnaa Hamdi [Wed, 9 Nov 2022 12:24:41 +0000 (12:24 +0000)]
[AArch64][SVE][NFC] Add streaming mode SVE tests
Add sve-fixed-length testing files and enable streaming mode flag for:
and-combine.ll
bitcast.ll
reshuffle.ll
rev.ll
sdiv-pow2.ll
splat-vector.ll
int-extends.ll
Differential Revision: https://reviews.llvm.org/D137093
Krasimir Georgiev [Thu, 10 Nov 2022 13:48:45 +0000 (14:48 +0100)]
jinge90 [Thu, 10 Nov 2022 13:46:49 +0000 (21:46 +0800)]
[libunwind][NFC] Fix typo in libunwind debug string
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D137529
Signed-off-by: jinge90 <ge.jin@intel.com>
wanglei [Thu, 10 Nov 2022 13:01:05 +0000 (21:01 +0800)]
[LoongArch] Override TargetFrameLowering::spillCalleeSavedRegisters
When using `llvm.returnaddress` intrinsic, special handling is required
for the spill of the `RA` register. Otherwise it will cause the verifier
fail in some cases (e.g. pr17377.c of the GCC C Torture Suite).
Specifically:
```
*** Bad machine code: Using an undefined physical register ***
- function: f
- basic block: %bb.0 entry (0xd94d18)
- instruction: ST_D killed $r1, $r22, -40 :: (store (s64) into %stack.2)
- operand 0: killed $r1
```
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D137387
Bing1 Yu [Fri, 4 Nov 2022 06:20:43 +0000 (14:20 +0800)]
[X86] Add necessary check isReg() when updating LiveVariables in convertToThreeAddress
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D137388
Alexander Timofeev [Wed, 9 Nov 2022 22:05:44 +0000 (23:05 +0100)]
[PEI][NFC] Refactoring of the debug instructions frame index replacement
This is required for the upcoming backward PEI::replaceFrameIndices version.
Both forward and backward versions will use same code for debug instruction processing.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D137741
wanglei [Thu, 10 Nov 2022 12:28:23 +0000 (20:28 +0800)]
[LoongArch] Support parsing target specific flags for MIR
These hooks ensure that the LoongArch backend can serialize and parse
MIR correctly.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D137482
Ivan Kosarev [Thu, 10 Nov 2022 12:49:18 +0000 (12:49 +0000)]
[AMDGPU][AsmParser] Remove extra checks on missing instruction modifiers.
https://reviews.llvm.org/D137549 makes them unnecessary.
Reviewed By: dp
Differential Revision: https://reviews.llvm.org/D137638
Ivan Kosarev [Mon, 7 Nov 2022 10:22:51 +0000 (10:22 +0000)]
[AsmParser] Match mandatory operands following optional operands.
Currently, the asm parser stops matching instruction operands as soon as
the first optional operand is encountered. This leads to the need for
custom checks on missing mandatory operands that come after optional
operands.
The patch changes the parser to always match all optional and mandatory
instruction operands, thus making the custom checks unnecessary. This is
particularly useful for the AMDGPU backend where we have numerous
optional instruction modifiers.
Differential Revision: https://reviews.llvm.org/D137549
Ivan Kosarev [Thu, 10 Nov 2022 12:19:53 +0000 (12:19 +0000)]
[AsmParser] Match mandatory operands following optional operands.
Currently, the asm parser stops matching instruction operands as soon as the first optional operand is encountered. This leads to the need for custom checks on missing mandatory operands that come after optional operands.
The patch changes the parser to always match all optional and mandatory instruction operands, thus making the custom checks unnecessary. This is particularly useful for the AMDGPU backend where we have numerous optional instruction modifiers.
Reviewed By: dp
Differential Revision: https://reviews.llvm.org/D137549
Simon Pilgrim [Thu, 10 Nov 2022 11:58:45 +0000 (11:58 +0000)]
[X86] SkylakeClientModel - conversion instructions don't use Port015
Fixes a lot of throughput mismatches - the more complicated conversion instructions use SKLPort5+SKLPort01, not SKLPort5+SKLPort015 (SKLPort015 is mainly used for basic Logic + blend ops)
Fixing this should allow us to remove a lot of unnecessary scheduler overrides from SkylakeClientModel
Confirmed by both Agner + uops.info
Hassnaa Hamdi [Tue, 1 Nov 2022 14:34:29 +0000 (14:34 +0000)]
[AArch64-SVE]: Force generating code compatible to streaming mode.
When streaming mode is enabled, custom-lower arithmetic and logical fixed-width vector ops;
to force generateing code compatible to streaming mode.
Differential Revision: https://reviews.llvm.org/D135324
Yeting Kuo [Tue, 8 Nov 2022 13:18:36 +0000 (21:18 +0800)]
[RISCV][NFC] Fix unused variable warning.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D137633
wanglei [Thu, 10 Nov 2022 11:56:36 +0000 (19:56 +0800)]
[LoongArch] Added spill/reload/copy support for CFRs
1, spill/reload
When a function call is made immediately after a floating point
comparison, the result of the comparison needs to be spilled before
function call and reloaded after the function returns.
2, copy
Support `GPR` to `CFR` and `CFR` to `GRP` copys. Therefore, the correct
register class can be used in the pattern template, and the hard-coding
of mutual coping of `CFR` and `GRP` is eliminated, reducing redundant
comparison instructions.
Note: Since the `COPY` instruction between CFRs is not provided in
LoongArch, we only use `$fcc0` in the register allocation.
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D137004
Alvin Wong [Thu, 10 Nov 2022 11:32:07 +0000 (13:32 +0200)]
[LLD][MinGW] Add --error-limit=<N> option
This maps to -errorlimit:<N> in the COFF linker and is functionally
identical to the same option in the ELF and MachO linker.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D137489
Sergio Afonso [Thu, 10 Nov 2022 11:38:31 +0000 (05:38 -0600)]
[flang][OpenMP] Add parser support for Requires directive
OpenMP 5.0 adds support for the "requires" directive. This patch adds parser support for it in flang.
Differential revision: https://reviews.llvm.org/D136867
v1nh1shungry [Thu, 10 Nov 2022 11:15:41 +0000 (12:15 +0100)]
[clangd] Implement hover for string literals
Show string-literals' type and size in a hover card
Issue related: https://github.com/clangd/clangd/issues/1016
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D137650
Sander de Smalen [Thu, 10 Nov 2022 09:21:59 +0000 (09:21 +0000)]
Reland "[AArch64][SME] Disable GlobalISel/FastISel for SME functions."
It turns that the issue was unrelated to the code-changes, but only triggered
by one of the tests. The SMEABI pass incorrectly marked the CFG as preserved,
even though it modified the CFG.
This reverts commit
8bcf5df3043a906c7124b70b59eda925eddd7319.
Vladislav Vinogradov [Wed, 9 Nov 2022 12:59:15 +0000 (15:59 +0300)]
[mlir][NFC] Use fully qualified names in BufferizableOpInterface
To allow interface usage in standalone projects outside of `mlir` namespace.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D137769
Simon Pilgrim [Thu, 10 Nov 2022 10:36:00 +0000 (10:36 +0000)]
[X86] Add missing Zen3 model subtypes
This patch adds support for detecting all current Zen/Zen3+ submodels
Based off a mixture of https://github.com/torvalds/linux/blob/master/drivers/hwmon/k10temp.c#L436 and InstLatx64 https://github.com/InstLatx64/InstLatx64/tree/master/AuthenticAMD CPUID dumps and confirmed by @GGanesh
Differential Revision: https://reviews.llvm.org/D137695
Hassnaa Hamdi [Mon, 24 Oct 2022 09:47:03 +0000 (09:47 +0000)]
[AArch64-SVE][streaming-mode]: Add tests for masked/truncating/extending load/store.
Add tests for masked/truncating/extending load/store and enable streaming-mode.
Differential Revision: https://reviews.llvm.org/D136585
Tim Northover [Tue, 18 Oct 2022 11:38:14 +0000 (12:38 +0100)]
X86: call fp16-conversion functions soft-float on Darwin.
We've been shipping implementations of these with a soft-float ABI since MacOS
10.10 in 2014 and there's evidence they're in binaries now, so we can't easily
switch to %xmm0.
This emits special libcalls with casts in place to restore the soft-float ABI
for __truncdfhf2, __truncsfhf2, and __extendhfsf2.
gonglingqin [Thu, 10 Nov 2022 09:12:02 +0000 (17:12 +0800)]
[Clang][LoongArch] Implement __builtin_loongarch_dbar builtin
Differential Revision: https://reviews.llvm.org/D136906
Weining Lu [Thu, 27 Oct 2022 12:31:05 +0000 (20:31 +0800)]
[Clang][LoongArch] Define more LoongArch specific built-in macros
Define below macros according to LoongArch toolchain conventions [1].
* `__loongarch_grlen`
* `__loongarch_frlen`
* `__loongarch_lp64`
* `__loongarch_hard_float`
* `__loongarch_soft_float`
* `__loongarch_single_float`
* `__loongarch_double_float`
Note:
1. `__loongarch__` has been defined in earlier patch.
2. `__loongarch_arch` is not defined because I don't know how `TargetInfo` can get the arch name specified by `-march`.
3. `__loongarch_tune` will be defined in future.
[1]: https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html
Depends on D136146
Differential Revision: https://reviews.llvm.org/D136413
Weining Lu [Thu, 27 Oct 2022 12:28:56 +0000 (20:28 +0800)]
[Clang][LoongArch] Handle -march/-m{single,double,soft}-float/-mfpu options
This patch adds options -march, -msingle-float, -mdouble-float,
-msoft-float and -mfpu for LoongArch.
Clang options `msingle_float` and `mdouble_float` are moved from
`m_mips_Features_Group` to `m_Group` because now more than targets use
them.
Reference:
https://github.com/loongson/LoongArch-Documentation/blob/main/docs/LoongArch-toolchain-conventions-EN.adoc
TODO: add -mtune.
Differential Revision: https://reviews.llvm.org/D136146