River Riddle [Thu, 16 Dec 2021 01:49:29 +0000 (01:49 +0000)]
[PDLL] Add support for tuple types and expressions
Tuples are used to group multiple elements into a single
compound value. The values in a tuple can be of any type, and
do not need to be of the same type. There is also no limit to
the number of elements held by a tuple.
Tuples will be used to support multiple results from
Constraints and Rewrites (added in a followup), and will also
make it easier to support more complex primitives (such as
range based maps that can operate on multiple values).
Differential Revision: https://reviews.llvm.org/D115297
River Riddle [Thu, 16 Dec 2021 01:49:11 +0000 (01:49 +0000)]
[PDLL] Add support for `op` Operation expressions
An operation expression in PDLL represents an MLIR operation. In
the match section of a pattern, this expression models one of
the input operations to the pattern. In the rewrite section of
a pattern, this expression models one of the operations to
create. The general structure of the operation expression is very
similar to that of the "generic form" of textual MLIR assembly:
```
let root = op<my_dialect.foo>(operands: ValueRange) {attr = attr: Attr} -> (resultTypes: TypeRange);
```
For now we only model the components that are within PDL, as PDL
gains support for blocks and regions so will this expression.
Differential Revision: https://reviews.llvm.org/D115296
River Riddle [Thu, 16 Dec 2021 01:48:54 +0000 (01:48 +0000)]
[PDLL] Add support for literal Attribute and Type expressions
This allows for using literal attributes and types within PDLL,
which simplifies building both constraints and rewriters. For
example, checking if an attribute is true is as simple as
`attr<"true">`.
Differential Revision: https://reviews.llvm.org/D115295
River Riddle [Thu, 16 Dec 2021 01:48:35 +0000 (01:48 +0000)]
[PDLL] Add support for parsing pattern metadata
This allows for overriding the metadata of a pattern and
providing information such as the benefit, bounded recursion,
and more in the future.
Differential Revision: https://reviews.llvm.org/D115294
River Riddle [Thu, 16 Dec 2021 01:48:19 +0000 (01:48 +0000)]
[mlir][PDLL] Add an initial frontend for PDLL
This is a new pattern rewrite frontend designed from the ground
up to support MLIR constructs, and to target PDL. This frontend
language was proposed in https://llvm.discourse.group/t/rfc-pdll-a-new-declarative-rewrite-frontend-for-mlir/4798
This commit starts sketching out the base structure of the
frontend, and is intended to be a minimal starting point for
building up the language. It essentially contains support for
defining a pattern, variables, and erasing an operation. The
features mentioned in the proposal RFC (including IDE support)
will be added incrementally in followup commits.
I intend to upstream the documentation for the language in a
followup when a bit more of the pieces have been landed.
Differential Revision: https://reviews.llvm.org/D115093
Julian Lettner [Thu, 16 Dec 2021 01:29:08 +0000 (17:29 -0800)]
[TSan][Darwin] Fix CheckAndProtect() for MappingAppleAarch64
In the new TSan runtime refactoring this line was changed:
```
ProtectRange(MetaShadowEnd(), TraceMemBeg());
-->
ProtectRange(MetaShadowEnd(), HeapMemBeg());
```
But for `MappingAppleAarch64` the app heap comes before the shadow,
resulting in:
```
CHECK failed: tsan_platform_posix.cpp:83 "((beg)) <= ((end))" (0xe00000000, 0x200000000)
```
rdar://
86521924
Differential Revision: https://reviews.llvm.org/D115834
Fangrui Song [Thu, 16 Dec 2021 01:59:30 +0000 (17:59 -0800)]
[ELF] Change Symbol::verdefIndex from uint32_t to uint16_t
The SHT_GNU_version index is 16-bit, so the 32-bit value is a waste.
Technically non-default version index 0x7fff uses version index 0xffff,
but it is impossible in practice.
This change decreases sizeof(SymbolUnion) from 80 to 72 on ELF64 platforms.
Memory usage decreases by 1% when linking a large executable.
Richard Smith [Thu, 16 Dec 2021 01:46:22 +0000 (17:46 -0800)]
Julian Lettner [Tue, 14 Dec 2021 23:23:48 +0000 (15:23 -0800)]
[Darwin] Remove workaround for symbolication in iOS simulator runtimes
A while ago we added some code to the sanitizer runtimes for iOS
simulators to allow `atos` (external process) to inspect the sanitized
process during report generation to enable symbolication. This was done
by setting the `__check_mach_ports_lookup` env var early during process
startup which came with a couple of complications.
This workaround is not required anymore and removing it fixes TSan in
the iOS simulator after the new TSan runtime landed.
(https://reviews.llvm.org/D112603)
Relevant/reverted revisions:
https://reviews.llvm.org/D78178
https://reviews.llvm.org/D78179
https://reviews.llvm.org/D78525
rdar://
86472733
Differential Revision: https://reviews.llvm.org/D115767
Arthur O'Dwyer [Fri, 3 Dec 2021 19:55:57 +0000 (14:55 -0500)]
[libc++] Enable the optimized _IsSame on GCC as well as Clang.
However, there's a problem on both GCC and Clang: they can't mangle
`__is_same(T,U)` if it appears anywhere that affects mangling. That's
a hard error. And it turns out that GCC puts dependent return types
into the mangling more aggressively than Clang, so for GCC's benefit
we need to avoid using raw `_IsSame` in the return type of
`swap(tuple&, tuple&)`. Therefore, make `__all` into a named type
instead of an alias.
If we ever need to support a compiler without the __is_same builtin,
we can make this an alias template for `is_same<T,U>::type`.
Differential Revision: https://reviews.llvm.org/D115100
Fangrui Song [Thu, 16 Dec 2021 01:15:31 +0000 (17:15 -0800)]
[ELF] Speed up ObjFile<ELFT>::createInputSection
* Group ".note" section name checks
* Move shouldMerge check to the caller
Vincent Lee [Thu, 9 Dec 2021 02:25:20 +0000 (18:25 -0800)]
[lld-macho] Make writing map file asynchronous
For large applications that write to map files, writing map files can take quite
a bit of time. Sorting the biggest contributors to link times, writing map files
ranks in at 2nd place, with load input files being the biggest contributor of
link times. Avoiding writing map files on the critical path (and having its own
thread) saves ~2-3 seconds when linking chromium framework on a 16-Core
Intel Xeon W.
```
base diff difference (95% CI)
sys_time 1.617 ± 0.034 1.657 ± 0.026 [ +1.5% .. +3.5%]
user_time 28.536 ± 0.245 28.609 ± 0.180 [ -0.1% .. +0.7%]
wall_time 23.833 ± 0.271 21.684 ± 0.194 [ -9.5% .. -8.5%]
samples 31 24
```
Reviewed By: #lld-macho, oontvoo, int3
Differential Revision: https://reviews.llvm.org/D115416
Arthur O'Dwyer [Thu, 16 Dec 2021 00:21:51 +0000 (19:21 -0500)]
[libc++] Reorder a comment pertaining to `struct __two`. NFC.
Fangrui Song [Thu, 16 Dec 2021 00:08:17 +0000 (16:08 -0800)]
[ELF] Symbol::replace: remove dead code
Yuanfang Chen [Thu, 16 Dec 2021 00:03:16 +0000 (16:03 -0800)]
[Verifier] Make error message precise about which variable is being diagnosed.
NFCI.
LLVM GN Syncbot [Wed, 15 Dec 2021 23:47:26 +0000 (23:47 +0000)]
[gn build] Port
2b4876157562
Eric Schweitz [Tue, 14 Dec 2021 17:28:53 +0000 (09:28 -0800)]
Add a new memory allocation rewrite pass.
This pass can reclassify memory allocations (fir.alloca, fir.allocmem)
based on heuristics and settings. The intention is to allow better
performance and workarounds for conditions such as environments with
limited stack space.
Currently, implements two conversions from stack to heap allocation.
1. If a stack allocation is an array larger than some threshold value
make it a heap allocation.
2. If a stack allocation is an array with a runtime evaluated size make
it a heap allocation.
Add a lit test for both suboptions.
Reviewed By: PeteSteinfeld, vdonaldson
Differential Revision: https://reviews.llvm.org/D115763
Fangrui Song [Wed, 15 Dec 2021 23:43:35 +0000 (15:43 -0800)]
[LTO][WPD] Simplify mustBeUnreachableFunction and test after D115492
An well-formed IR function definition must have an entry basic block and
a well-formed IR basic block must have one terminator so the emptiness
check can be simplified.
Also simplify the test a bit.
Reviewed By: luna
Differential Revision: https://reviews.llvm.org/D115780
Nico Weber [Wed, 15 Dec 2021 23:39:21 +0000 (18:39 -0500)]
[gn build] Remove unhelpful default for goma_dir
The default hasn't worked in over 9 months now.
Getting a friendly error message if this isn't set is more useful than getting
a bad default value.
Differential Revision: https://reviews.llvm.org/D115833
Matt Arsenault [Wed, 15 Dec 2021 23:35:01 +0000 (18:35 -0500)]
AMDGPU: Update pass pipeline test
Matt Arsenault [Sat, 11 Dec 2021 17:04:02 +0000 (12:04 -0500)]
Inliner: Correctly merge amdgpu-unsafe-fp-atomics attribute
It seems we don't have already have any target specific attributes
handled in the inliner. Include a separate tablegen file to define the
rules, similar to the target specific intrinsics.
Matt Arsenault [Sat, 11 Dec 2021 17:02:34 +0000 (12:02 -0500)]
AMDGPU: Add baseline test for unsafe fp atomics attribute inlining
Fangrui Song [Wed, 15 Dec 2021 23:30:18 +0000 (15:30 -0800)]
[ELF] ObjFile<ELFT>::initializeSymbols: avoid StringRefZ from undefined symbols
Matt Arsenault [Wed, 15 Dec 2021 16:20:33 +0000 (11:20 -0500)]
AMDGPU: Use v_accvgpr_mov_b32 when copying AGPR tuples on gfx90a
This is an optimization, but also fixes a compile failure when no free
VGPRs are available. The problem still exists for gfx908 where a
scratch register is still required. This also still exists for the
SGPR to AGPR case.
Matt Arsenault [Mon, 13 Dec 2021 20:55:13 +0000 (15:55 -0500)]
AMDGPU: Combine is.shared/is.private of null/undef
Matt Arsenault [Wed, 15 Dec 2021 16:01:03 +0000 (11:01 -0500)]
AMDGPU: Regenerate checks
Matt Arsenault [Tue, 14 Dec 2021 22:55:25 +0000 (17:55 -0500)]
AMDGPU: Remove AMDGPUFixFunctionBitcasts pass
This was a workaround for not supporting indirect calls when
instcombine didn't eliminate constant expression casts of the callee
at -O0. Indirect calls are supposed to work now, so drop the hack.
Fangrui Song [Wed, 15 Dec 2021 23:19:35 +0000 (15:19 -0800)]
[ELF] SymbolTable::insert: keep @@ in the name
* Avoid the name truncation quirk in SymbolTable::insert: the truncated name will be replaced by @@ again.
* Allow foo and foo@@v1 in different files to be diagnosed as duplicate definition error (GNU ld behavior)
* Avoid potential redundant strlen on symbol name due to StringRefZ in ObjFile<ELFT>::initializeSymbols
Andrew Smith [Wed, 15 Dec 2021 23:08:33 +0000 (23:08 +0000)]
[clang-format] Remove spurious JSON binding when DisableFormat = true
Relevant issue: https://github.com/llvm/llvm-project/issues/52705
When the `DisableFormat` option of `clang-format` is set to `true` and a JSON file is formatted, the ephemeral variable binding that is added to the top-level object is not removed from the formatted file. For example, this JSON:
```
{
"key": "value"
}
```
Is reformatted to:
```
x = {
"key": "value"
}
```
Which is not valid JSON syntax. This fix avoids the addition of this binding when `DisableFormat` is set to `true`, ensuring that it cannot be left behind when formatting is disabled.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D115769
Fixes #52705
mydeveloperday [Wed, 15 Dec 2021 23:05:24 +0000 (23:05 +0000)]
[clang-format] put non-empty catch block on one line with AllowShortBlocksOnASingleLine: Empty
https://github.com/llvm/llvm-project/issues/52715
Fixes #52715
`AllowShortBlocksOnASingleLine` seems to never be checked for "Empty" as such if its used it will be considered "Always" as we only ever check `AllowShortBlocksOnASingleLine != Never`
This impacts C++ as well as C# hence the slightly duplicated test.
Reviewed By: curdeius, jbcoe
Differential Revision: https://reviews.llvm.org/D115794
Adrian Prantl [Wed, 15 Dec 2021 22:54:03 +0000 (14:54 -0800)]
Remove redundant check (NFC)
Adrian Prantl [Wed, 15 Dec 2021 22:48:30 +0000 (14:48 -0800)]
Use StringRef instead of char* (NFC)
Arthur Eubanks [Thu, 9 Dec 2021 21:52:44 +0000 (13:52 -0800)]
[NFC] Remove more calls to getAlignment()
These are deprecated and should be replaced with getAlign().
Some of these asserts don't do anything because Load/Store/AllocaInst never have a 0 align value.
Arthur Eubanks [Thu, 9 Dec 2021 21:30:44 +0000 (13:30 -0800)]
[FunctionComparator] Use getAlign() instead of getAlignment()
getAlignment() is deprecated.
Arthur Eubanks [Thu, 9 Dec 2021 21:20:06 +0000 (13:20 -0800)]
[SafeStack] Use Align instead of uint64_t
It is better typed, and the calls to getAlignment() are deprecated.
Differential Revision: https://reviews.llvm.org/D115466
Noah Shutty [Wed, 15 Dec 2021 22:13:13 +0000 (22:13 +0000)]
[Debuginfod] Fix debuginfod unit test when $HOME is not writable.
The directory returned from `cache_directory` may not be writable if the unit tests are run with limited permissions (e.g. if $HOME is not writable).
This fixes a unit test of the debuginfod client to set the cache path to the system temporary directory to avoid this issue.
Reviewed By: estewart08
Differential Revision: https://reviews.llvm.org/D115813
Arjun P [Wed, 15 Dec 2021 21:36:27 +0000 (03:06 +0530)]
[MLIR] Simplex: Assert on the restoreRow return value instead of ignoring it
Previously, the LogicalResult return value of restoreRow was being ignored in
places where it was expected to always be success. Instead, check the result
and go to an `llvm_unreachable` if it turns out to be failure.
Hanhan Wang [Wed, 15 Dec 2021 21:53:47 +0000 (13:53 -0800)]
[mlir][Vector] Further fix to avoid infinite loop in InnerOuterDimReductionConversion
If all the dims are reduction dims, it is already in inner-most/outer-most
reduction form.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D115820
Nikolas Klauser [Wed, 15 Dec 2021 19:54:24 +0000 (20:54 +0100)]
[libc++] Implement P0798R8 (Monadic operations for std::optional)
Implement P0798R8
Reviewed By: #libc, ldionne, Quuxplusone
Spies: tcanens, Quuxplusone, ldionne, Wmbat, arichardson, Mordante, libcxx-commits
Differential Revision: https://reviews.llvm.org/D113408
Peter Klausler [Mon, 13 Dec 2021 21:53:45 +0000 (13:53 -0800)]
[flang] Avoid code duplication in mixed expressions
Rather than represent the mixed real/complex subexpression x*(a,b)
as (x*a,x*b), use (x,0)*(a,b) to avoid a potential code duplication
in current lowering code. Same for mixed division, and for mixed
integer*complex and integer/complex cases.
Differential Review: https://reviews.llvm.org/D115732
Fangrui Song [Wed, 15 Dec 2021 21:15:02 +0000 (13:15 -0800)]
[ELF] Replace make<Defined> with makeDefined. NFC
This removes SpecificAlloc<Defined> and makes my lld executable 1.5k smaller.
This drops the small memory waste due to the separate BumpPtrAllocator.
Fangrui Song [Wed, 15 Dec 2021 21:02:38 +0000 (13:02 -0800)]
[ELF] ObjFile<ELFT>::initializeSymbols: Simplify this->symbols[i]. NFC
Sam McCall [Wed, 15 Dec 2021 20:59:54 +0000 (21:59 +0100)]
[AST] Add more testcases to QualTypeNamesTest. NFC
These all currently pass, but are tricky cases not currently covered.
https://reviews.llvm.org/D114251 would break them in its current state.
Sam McCall [Wed, 15 Dec 2021 20:53:58 +0000 (21:53 +0100)]
[AST] Fix QualTypeNamesTest, which was spuriously passing
The empty VisitDecl() meant all assertions were skipped.
Meanwhile the assertions have rotted as some type printing has changed.
The test is still in the wrong directory, because it requires TestVisitor.h
which uses Tooling APIs.
Fangrui Song [Wed, 15 Dec 2021 20:54:38 +0000 (12:54 -0800)]
[ELF] ObjFile<ELFT>::initializeSymbols: Batch allocate local symbols
and detangle local/global symbol initialization.
My x86-64 lld executable is 8k smaller due to the removal of SpecificAlloc<Undefined>.
mydeveloperday [Wed, 15 Dec 2021 19:36:22 +0000 (19:36 +0000)]
[clang-format] C# switch expression formatting differs from normal switch formatting
https://github.com/llvm/llvm-project/issues/52677
clang-format doesn't format C# switch expressions very well.
Start with this small use case and try and improve the output. I'll look for other examples to add as tests
Reviewed By: curdeius
Differential Revision: https://reviews.llvm.org/D115673
Fixes #52677
LLVM GN Syncbot [Wed, 15 Dec 2021 19:34:58 +0000 (19:34 +0000)]
[gn build] Port
8179e1fd519d
Yitzhak Mandelbaum [Tue, 14 Dec 2021 17:18:09 +0000 (17:18 +0000)]
[clang][dataflow] Add simplistic constant-propagation analysis.
Adds a very simple constant-propagation analysis for demo and testing purposes.
Differential Revision: https://reviews.llvm.org/D115740
Scott Linder [Tue, 14 Dec 2021 19:27:36 +0000 (19:27 +0000)]
[ADT] Add new type traits for type pack indexes
Similar versions of these already exist, this effectively just just
factors them out into STLExtras. I plan to use these in future patches.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D100672
Florian Hahn [Wed, 15 Dec 2021 19:07:25 +0000 (19:07 +0000)]
[SCEV] Add test where result depends on order loop guards are applied.
This patch adds 2 test cases where we fail to determine a tight bound on
the backedge taken count because the ULT condition is applied before the
signed conditions. The order the conditions are applied impacts which
min/max folds are applied.
Craig Topper [Wed, 15 Dec 2021 19:03:57 +0000 (11:03 -0800)]
[RISCV] Rename Zbs test cases to match instruction names. NFC
The Zbs instructions uses to start with 'sb' but now start with 'b'.
Update test names accordingly.
Alexey Bataev [Wed, 15 Dec 2021 19:05:28 +0000 (11:05 -0800)]
[SLP][NFC] Add a test for inefficient reordering, NFC.
Felix Berger [Wed, 15 Dec 2021 18:35:31 +0000 (13:35 -0500)]
[ASTMatchers] Make ParamIndex unsigned.
This fixes a compiler error/warning in
https://lab.llvm.org/buildbot/#/builders/36/builds/15377.
Differential Revision: https://reviews.llvm.org/D115809
Reviewed-by: sammccall
Yuanfang Chen [Wed, 15 Dec 2021 18:26:52 +0000 (10:26 -0800)]
[Sema] Mark explicit specialization declaration in a friend invalid
Down the path, if there is a implicit instantiation, this may trigger
the assertion "Member specialization must be an explicit specialization"
in `clang::FunctionDecl::setFunctionTemplateSpecialization`.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D113245
Yuanfang Chen [Wed, 15 Dec 2021 18:25:37 +0000 (10:25 -0800)]
Revert "[Sema] Mark explicit specialization declaration in a friend invalid"
This reverts commit
8cb6ecbc4da2b0cfd8dcf04f612dc413716d27a1.
Nothing wrong with the commit. It is missing Phabricator informations.
Yuanfang Chen [Tue, 14 Dec 2021 20:27:07 +0000 (12:27 -0800)]
[Sema] Mark explicit specialization declaration in a friend invalid
Down the path, if there is a implicit instantiation, this may trigger
the assertion "Member specialization must be an explicit specialization"
in `clang::FunctionDecl::setFunctionTemplateSpecialization`.
Fangrui Song [Wed, 15 Dec 2021 18:20:10 +0000 (10:20 -0800)]
[ELF] Slightly speed up -z keep-text-section-prefix
Arnold Schwaighofer [Mon, 13 Dec 2021 20:33:15 +0000 (12:33 -0800)]
Teach the backend to make references to swift_async_extendedFramePointerFlags weak if it emits it
When references to the symbol `swift_async_extendedFramePointerFlags`
are emitted they have to be weak.
References to the symbol `swift_async_extendedFramePointerFlags` get
emitted only by frame lowering code. Therefore, the backend needs to track
references to the symbol and mark them weak.
Differential Revision: https://reviews.llvm.org/D115672
Guillaume Chatelet [Wed, 15 Dec 2021 17:50:32 +0000 (17:50 +0000)]
[libc][NFC][bazel] remove unneeded bzl_library
Stanislav Mekhanoshin [Wed, 15 Dec 2021 17:17:25 +0000 (09:17 -0800)]
[InstCombine] (~a & b & c) | ~(a | b) -> (c | ~b) & ~a
Transform
```
(~a & b & c) | ~(a | b) -> (c | ~b) & ~a
```
and swapped case
```
(~a | b | c) & ~(a & b) -> (c & ~b) | ~a
```
```
----------------------------------------
define i4 @src(i4 %a, i4 %b, i4 %c) {
%0:
%or1 = or i4 %b, %a
%not1 = xor i4 %or1, 15
%not2 = xor i4 %a, 15
%and1 = and i4 %b, %not2
%and2 = and i4 %and1, %c
%or2 = or i4 %and2, %not1
ret i4 %or2
}
=>
define i4 @tgt(i4 %a, i4 %b, i4 %c) {
%0:
%notb = xor i4 %b, 15
%or = or i4 %notb, %c
%nota = xor i4 %a, 15
%and = and i4 %or, %nota
ret i4 %and
}
Transformation seems to be correct!
```
```
----------------------------------------
define i4 @src(i4 %a, i4 %b, i4 %c) {
%0:
%and1 = and i4 %b, %a
%not1 = xor i4 %and1, 15
%not2 = xor i4 %a, 15
%or1 = or i4 %b, %not2
%or2 = or i4 %or1, %c
%and2 = and i4 %or2, %not1
ret i4 %and2
}
=>
define i4 @tgt(i4 %a, i4 %b, i4 %c) {
%0:
%notb = xor i4 %b, 15
%and = and i4 %notb, %c
%nota = xor i4 %a, 15
%or = or i4 %and, %nota
ret i4 %or
}
Transformation seems to be correct!
```
Differential Revision: https://reviews.llvm.org/D113037
Felix Berger [Wed, 24 Nov 2021 18:45:36 +0000 (13:45 -0500)]
[clang] ASTMatchers: Fix out-of-bounds access in foreachArgumentWithParamType.
The matcher crashes when a variadic function pointer is invoked because the
FunctionProtoType has fewer parameters than arguments.
Matching of non-variadic arguments now works.
Differential Revision: https://reviews.llvm.org/D114559
Reviewed-by: sammccall
Jing Bao [Wed, 15 Dec 2021 17:22:40 +0000 (09:22 -0800)]
[WebAssembly] Add simd-vector-trunc.ll test missing from 2a4a229
This test was authored as part of the same revision, D109481, but I (tlively)
accidentally left it out when committing.
David Spickett [Wed, 15 Dec 2021 16:39:00 +0000 (16:39 +0000)]
[clang] Require x86 target for tbaa test
Added in https://reviews.llvm.org/D115320.
Failing on our bots that only build Arm/AArch64 targets:
https://lab.llvm.org/buildbot/#/builders/188/builds/6951
Jacques Pienaar [Wed, 15 Dec 2021 16:21:38 +0000 (08:21 -0800)]
[mlir] Flip Complex & SCF dialects to _Both (NFC)
Following
https://llvm.discourse.group/t/psa-ods-generated-accessors-will-change-to-have-a-get-prefix-update-you-apis/4476
Markus Böck [Wed, 15 Dec 2021 15:59:04 +0000 (16:59 +0100)]
[clang-tidy][#51939] Exempt placement-new expressions from 'bugprone-throw-keyword-missing'
The purpose of this checker is to flag a missing throw keyword, and does so by checking for the construction of an exception class that is then unused.
This works great except that placement new expressions are also flagged as those lead to the construction of an object as well, even though they are not temporary (as that is dependent on the storage).
This patch fixes the issue by exempting the match if it is within a placement-new.
Fixes https://github.com/llvm/llvm-project/issues/51939
Differential Revision: https://reviews.llvm.org/D115576
Zaara Syeda [Wed, 15 Dec 2021 15:31:45 +0000 (15:31 +0000)]
[LoopUnroll] Disable loop unroll when user explicitly asks for unroll-and-jam
If a loop isn't forced to be unrolled, we want to avoid unrolling it when there
is an explicit unroll-and-jam pragma. This is to prevent automatic unrolling
from interfering with the user requested transformation.
Missed adding the testcase in earlier commit.
Differential Revision: https://reviews.llvm.org/D114886
Jan Svoboda [Tue, 14 Dec 2021 11:36:59 +0000 (12:36 +0100)]
[clang][deps] NFC: Move entry initialization into member functions
This is a prep-patch for making `CachedFileSystemEntry` initialization more lazy.
Carlo Bertolli [Wed, 15 Dec 2021 15:33:17 +0000 (15:33 +0000)]
[OpenMP] Increase opportunity for parallel kernel launch in AMDGPUs: add multiple hsa queue's per device in plugin
This patch extends the AMDGPU plugin for OpenMP target offloading from using a single HSA queue to multiple queues (four in this patch) per device. This enables concurrent threads to concurrently submit kernel launches to the same GPU.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D115771
Jan Svoboda [Fri, 10 Dec 2021 13:16:29 +0000 (14:16 +0100)]
[clang][deps] NFC: Use clearer wording around entry initialization
The code and documentation around `CachedFileSystemEntry` use the following terms:
* "invalid stat" for `llvm::ErrorOr<llvm::vfs::Status>` that is *not* an error and contains an unknown status,
* "initialized entry" for an entry that contains "invalid stat",
* "valid entry" for an entry that contains "invalid stat", synonymous to "initialized" entry.
Having an entry be "valid" while it contains an "invalid" status object is counter-intuitive.
This patch cleans up the wording by referring to the status as "unknown" and to the entry as either "initialized" or "uninitialized".
Joe Nash [Tue, 14 Dec 2021 19:28:42 +0000 (14:28 -0500)]
[AMDGPU] Extract helper function in AsmParser. NFC
NFC refactor to extract useful helper function isRegOrInline.
Reviewed By: rampitec, dp
Differential Revision: https://reviews.llvm.org/D115753
Change-Id: Ief52db9a62615c053fb5f429248657b97cb41453
Mogball [Wed, 15 Dec 2021 06:42:36 +0000 (06:42 +0000)]
[mlir][scf] Add getNumRegionInvocations to IfOp
Implements the RegionBranchOpInterface method getNumRegionInvocations to `scf::IfOp` so that, when the condition is constant, the number of region executions can be analyzed by `NumberOfExecutions`.
Reviewed By: jpienaar, ftynse
Differential Revision: https://reviews.llvm.org/D115087
Simon Pilgrim [Wed, 15 Dec 2021 14:30:26 +0000 (14:30 +0000)]
[X86] LowerRotate - use vXi8 custom lowering for non-uniform constant amounts
Instead of bailing and using the default expansion, we can more efficiently use the shl(unpack(x,x),unpack(amt,zero)) pattern for vXi8 rotl, as we'll then use vXi16 fast PMULLW (or PSLLVW).
This required some minor changes to improve constant folding during unpack shuffle creation and convertShiftLeftToScale to support constants that have already been lowered to constant pools.
Alexey Bataev [Fri, 10 Dec 2021 15:43:52 +0000 (07:43 -0800)]
[SLP]Do not represent splats as node with the reused scalars.
No need to represent splats as a node with the reused scalars, it may
increase the cost (currently pass just ignores extra shuffle cost and it
is still not correct).
Differential Revision: https://reviews.llvm.org/D115800
Matthias Springer [Wed, 15 Dec 2021 14:18:51 +0000 (23:18 +0900)]
[mlir][linalg][bufferize] Replace remaining bvm usage with new API
* Call `replaceOp` instead of `mapBuffer`.
* Remove bvm and all helper functions around bvm.
* Simplify FuncOp bufferization and rely on existing functionality to generate ToMemrefOps for function BlockArguments.
Differential Revision: https://reviews.llvm.org/D115515
Guillaume Chatelet [Wed, 15 Dec 2021 14:17:24 +0000 (15:17 +0100)]
Embed licence into package
Ed Maste [Mon, 22 Nov 2021 21:56:35 +0000 (16:56 -0500)]
[Driver] Default to contemporary FreeBSD profiling behaviour
Prior to FreeBSD 14, FreeBSD provided special _p.a libraries for use
with -pg. They are no longer used or provided. If the target does
not specify a major version (e.g. amd64-unknown-freebsd, rather than
amd64-unknown-freebsd12) default to the new behaviour.
Differential Revision: https://reviews.llvm.org/D114396
Alexey Bataev [Wed, 15 Dec 2021 13:57:58 +0000 (05:57 -0800)]
[SLP][NFC]Add a test for broadcast cost with undefs, NFC.
Kadir Cetinkaya [Wed, 15 Dec 2021 13:33:34 +0000 (14:33 +0100)]
[clangd] Add ) to signature-help triggers
It is important for nested function calls.
Differential Revision: https://reviews.llvm.org/D115799
Andrew Wei [Wed, 15 Dec 2021 12:52:00 +0000 (20:52 +0800)]
[AArch64][SVE] Lower shuffles to permute instructions: rev/revb/revh/revw
Attempt to lower a shuffle as a permute instruction(rev/revb/revh/revw) for fixed length SVE.
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D114960
Nikita Popov [Wed, 15 Dec 2021 13:10:27 +0000 (14:10 +0100)]
[CodeGen] Avoid some pointer element type accesses
Sam McCall [Sat, 11 Dec 2021 02:14:05 +0000 (03:14 +0100)]
[Sema] Add FixIt when a C++ out-of-line method has extra/missing const
Differential Revision: https://reviews.llvm.org/D115567
Jay Foad [Tue, 14 Dec 2021 15:47:44 +0000 (15:47 +0000)]
[AMDGPU] Use v_fma_f16 on GFX10
Teach convertToThreeAddress to use the V_FMA_F16_gfx9 pseudo (i.e. the
standard instruction in GFX9 onwards) instead of V_FMA_F16 (the legacy
pseudo for GFX8 compatibility, which is no longer supported in GFX10).
This follows the example of macToMad in SIFoldOperands.
Differential Revision: https://reviews.llvm.org/D115731
Jay Foad [Tue, 14 Dec 2021 15:08:31 +0000 (15:08 +0000)]
[AMDGPU] Improve zeroesHigh16BitsOfDest for GFX9 legacy opcodes
Pseudos like V_MAD_U16 and V_FMA_F16 map down to what GFX9 calls
v_mad_legacy_u16 and v_fma_legacy_f16, which are documented to have the
same zeroing behaviour as on GFX8.
Differential Revision: https://reviews.llvm.org/D115729
Nikita Popov [Wed, 15 Dec 2021 12:06:28 +0000 (13:06 +0100)]
[CodeGen] Pass element type to EmitCheckedInBoundsGEP()
Same as for other GEP creation methods.
Chuanqi Xu [Wed, 15 Dec 2021 12:59:50 +0000 (20:59 +0800)]
[docs] Give the reason why the support for coroutine is partial
This helps user to know what level of support there
is (roughly) for coroutine feature.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D115778
Markus Böck [Wed, 15 Dec 2021 12:54:23 +0000 (13:54 +0100)]
[mlir][LLVMIR] Add `llvm.umin` and `llvm.umax` intrinsics
Ops for the signed counterparts "llvm.smin" and "llvm.smax" already exist. This patch adds the unsigned versions as well.
Differential Revision: https://reviews.llvm.org/D115796
Jay Foad [Wed, 15 Dec 2021 12:28:28 +0000 (12:28 +0000)]
[AMDGPU] Skip some work on subtargets without scalar stores. NFC.
Simon Pilgrim [Wed, 15 Dec 2021 12:21:18 +0000 (12:21 +0000)]
[DAG] SelectionDAG::isSplatValue - add *_EXTEND_VECTOR_INREG handling
Fixes #52719
Simon Pilgrim [Wed, 15 Dec 2021 12:01:50 +0000 (12:01 +0000)]
[X86] Add PR52719 test cases
gysit [Wed, 15 Dec 2021 12:14:35 +0000 (12:14 +0000)]
[mlir][linalg] Replace LinalgOps.h and LinalgTypes.h by a single header.
After removing the range type, Linalg does not define any type. The revision thus consolidates the LinalgOps.h and LinalgTypes.h into a single Linalg.h header. Additionally, LinalgTypes.cpp is renamed to LinalgDialect.cpp to follow the convention adopted by other dialects such as the tensor dialect.
Depends On D115727
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D115728
Dmitri Gribenko [Wed, 15 Dec 2021 11:47:10 +0000 (12:47 +0100)]
Explicitly convert StringRef to std::string for compatibility with libstdc++ 5.4.0
For some reason, the user-defined implicit conversion from StringRef to
std::string is not invoked by std::map::emplace in libstdc++ 5.4.0, even
though it works fine on modern systems.
Nikita Popov [Wed, 15 Dec 2021 10:55:16 +0000 (11:55 +0100)]
[CodeGen] Avoid some deprecated Address constructors
Some of these are on the critical path towards making something
minimal work with opaque pointers.
Simon Pilgrim [Wed, 15 Dec 2021 11:17:10 +0000 (11:17 +0000)]
[X86] Enable v16i8/v32i8/v64i8 rotation on AVX512 targets
We currently rely on generic promotion to vXi16/vXi32 types for rotation lowering on various AVX512 targets.
We can more efficiently perform this by making use of the shl(unpack(x,x),amt) style pattern that we already use for vXi8 rotation by splat amounts, either by widening to a larger vector type or unpacking lo/hi halves of the subvectors so we can access whatever vXi16/vXi32 per-element shifts are supported.
This uncovered an issue in the supportedVectorShiftWithImm/supportedVectorVarShift legality checkers which was using hasAVX512() instead of useAVX512Regs() to detect support for 512-bit vector shifts.
NOTE: I'm actually hoping to eventually reuse this code for shl(unpack(y,x),amt) funnel shift lowering (vXi8 and wider), but initially I just want to ensure we have efficient ISD::ROTL lowering for all targets.
Differential Revision: https://reviews.llvm.org/D115180
Nikita Popov [Wed, 15 Dec 2021 10:24:27 +0000 (11:24 +0100)]
[CodeGen] Prefer CreateElementBitCast() where possible
CreateElementBitCast() can preserve the pointer element type in
the presence of opaque pointers, so use it in place of CreateBitCast()
in some places. This also sometimes simplifies the code a bit.
Gabor Marton [Tue, 14 Dec 2021 15:46:20 +0000 (16:46 +0100)]
[analyzer] Expand conversion check to check more expressions for overflow and underflow
This expands checking for more expressions. This will check underflow
and loss of precision when using call expressions like:
void foo(unsigned);
int i = -1;
foo(i);
This also includes other expressions as well, so it can catch negative
indices to std::vector since it uses unsigned integers for [] and .at()
function.
Patch by: @pfultz2
Differential Revision: https://reviews.llvm.org/D46081
Simon Moll [Wed, 15 Dec 2021 10:31:37 +0000 (11:31 +0100)]
[VE] SHL,SRA,SRL v256i32|64 isel and tests
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D115734
Haojian Wu [Wed, 15 Dec 2021 10:30:23 +0000 (11:30 +0100)]
[clangd] Disable the NOLINTBBEGIN testcase in clangd.
NOLINTBEGIN is disabled, in
529833377ccdf4381f8bc9961bfa96ec4f5e2eed
Alex Zinenko [Wed, 15 Dec 2021 10:30:46 +0000 (11:30 +0100)]
[bazel] drop some unnecessary dependencies in mlir
Tres Popp [Sat, 23 Oct 2021 11:23:28 +0000 (13:23 +0200)]
[mlir] Use rewriter in linalg Detensorize
This is to allow rollbacks on failures of dialect lowering to succeed.
Differential Revision: https://reviews.llvm.org/D115789
Nikita Popov [Wed, 15 Dec 2021 10:03:58 +0000 (11:03 +0100)]
[CodeGen] Avoid some uses of deprecated Address constructor
Explicitly pass in the element type instead.