Sam McCall [Tue, 21 Jun 2022 22:20:38 +0000 (00:20 +0200)]
[pseudo] Store reduction sequences by pointer in heaps, instead of by value.
Copying sequences around as the heap resized is significantly expensive.
This speeds up glrParse by ~35% (2.4 => 3.25 MB/s)
Differential Revision: https://reviews.llvm.org/D128307
Matthias Springer [Thu, 23 Jun 2022 17:28:46 +0000 (19:28 +0200)]
[mlir][bufferization][NFC] Make `escape` a dialect attribute
All bufferizable ops that bufferize to an allocation receive a `bufferization.escape` attribute during TensorCopyInsertion.
Differential Revision: https://reviews.llvm.org/D128137
Peter Klausler [Fri, 17 Jun 2022 21:12:13 +0000 (14:12 -0700)]
[flang] Fix bogus errors from SIZE/SHAPE/UBOUND on assumed-shape
While it is indeed an error to use SIZE, SHAPE, or UBOUND on an
assumed-shape dummy argument without also supplying a DIM= argument
to the intrinsic function, it is *not* an error to use these intrinsic
functions on sections or expressions of such arrays. Refine the test
used for the error message.
Differential Revision: https://reviews.llvm.org/D128391
Sam McCall [Tue, 21 Jun 2022 20:19:06 +0000 (22:19 +0200)]
[pseudo] Turn glrReduce into a class, reuse storage across calls.
This is a ~5% speedup, we no longer have to allocate the priority queues and
other collections for each reduction step where we use them.
It's also IMO easier to understand the structure of a class with methods vs a
function with nested lambdas.
Differential Revision: https://reviews.llvm.org/D128301
Philip Reames [Thu, 23 Jun 2022 17:19:45 +0000 (10:19 -0700)]
[RISCV] Fix a crash in InsertVSETVLI where we hadn't properly guarded for a SEWLMULRatioOnly abstract state
A forward abstract state can be in the special SEWLMULRatioOnly state which means we're not allowed to inspect its fields. The scalar to vector move case was mising a guard, and we'd crash on an assert. Test cases included.
Florian Hahn [Thu, 23 Jun 2022 16:46:15 +0000 (18:46 +0200)]
[ConstraintElimination] Use stable_sort to sort worklist.
If there are multiple constraints in the same block, at the moment the
order they are processed may be different depending on the sort
implementation.
Use stable_sort to ensure consistent ordering.
Joseph Huber [Mon, 13 Jun 2022 19:26:55 +0000 (15:26 -0400)]
[Offloading] Embed the target features in the OffloadBinary
The target features are necessary for correctly compiling most programs
in LTO mode. Currently, these are derived in clang at link time and
passed as an arguemnt to the linker wrapper. This is problematic because
it requires knowing the required toolchain at link time, which should
not be necessry. Instead, these features should be embedded into the
offloading binary so we can unify them in the linker wrapper for LTO.
This also required changing the offload packager to interpret multiple
arguments as concatenation with a comma. This is so we can still use the
`,` separator for the argument list.
Depends on D127246
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D127686
Arthur Eubanks [Wed, 22 Jun 2022 19:40:03 +0000 (12:40 -0700)]
[docs][NewPM] Add more info on why accessing mutable outer analyses is disallowed
Reviewed By: asbirlea, rnk
Differential Revision: https://reviews.llvm.org/D128374
Peter Klausler [Fri, 17 Jun 2022 19:14:46 +0000 (12:14 -0700)]
[flang][runtime] Handle READ of non-UTF-8 data into multi-byte CHARACTER
When a READ statement reads into a CHARACTER(2 or 4) variable from a
unit whose encoding is not UTF-8, don't copy bytes directly; they must
each be zero-extended.
Differential Revision: https://reviews.llvm.org/D128390
Arthur Eubanks [Thu, 23 Jun 2022 16:56:31 +0000 (09:56 -0700)]
[test][GlobalOpt] Update precommitted test
Peter Klausler [Fri, 17 Jun 2022 18:45:14 +0000 (11:45 -0700)]
[flang][runtime] Respect PAD='NO' on READ/WRITE
The check for the PAD= setting should examine the mutable modes
of the current I/O statement, not the persistent modes of the
I/O unit.
Differential Revision: https://reviews.llvm.org/D128389
gpetters94 [Tue, 21 Jun 2022 16:51:18 +0000 (16:51 +0000)]
Adding a named op for grouped convolutions
Sam McCall [Tue, 21 Jun 2022 19:47:14 +0000 (21:47 +0200)]
[pseudo] Add a fast-path to GLR reduce when both pop and push are trivial
In general we split a reduce into pop/push, so concurrently-available reductions
can run in the correct order. The data structures for this are expensive.
When only one reduction is possible at a time, we need not do this: we can pop
and immediately push instead.
Strictly this is correct whenever we yield one concurrent PushSpec.
This patch recognizes a trivial but common subset of these cases:
- there must be no pending pushes and only one head available to pop
- the head must have only one reduction rule
- the reduction path must be a straight line (no multiple parents)
On my machine this speeds up by 2.12 -> 2.30 MB/s = 8%
Differential Revision: https://reviews.llvm.org/D128299
Sam McCall [Thu, 23 Jun 2022 16:16:49 +0000 (18:16 +0200)]
Reland "[pseudo] Track heads as GSS nodes, rather than as "pending actions"."
This reverts commit
2c80b5319870b57fbdbb6c9cef9c86c26c65371d.
Fixes LRTable::buildForTest to create states that are referenced but
have no actions.
Peter Klausler [Fri, 17 Jun 2022 18:20:29 +0000 (11:20 -0700)]
[flang] Fix READ/WRITE with POS= on stream units, with refactoring
First, ExternalFileUnit::SetPosition was being used both as a utility
within the class' member functions as well as an API from I/O statement
processing. Make it private, and add APIs for SetStreamPos and SetDirectRec.
Second, ensure that SetStreamPos for POS= positioning in a stream
doesn't leave the current record number and endfile record number
in an arbitrary state. In stream I/O they are used only to manage
end-of-file detection, and shouldn't produce false positive results
from IsAtEnd() after repositioning.
Differential Revision: https://reviews.llvm.org/D128388
Sam McCall [Thu, 23 Jun 2022 16:16:03 +0000 (18:16 +0200)]
Revert "[pseudo] Track heads as GSS nodes, rather than as "pending actions"."
This reverts commit
e3ec054dfdf48f19cb6726cb3f4965b9ab320ed9.
Tests fail in asserts mode: https://lab.llvm.org/buildbot/#/builders/109/builds/41217
Philip Reames [Thu, 23 Jun 2022 16:11:24 +0000 (09:11 -0700)]
[BasicTTI] Avoid crash when costing scalable select expansion
If the target has chosen to expand a scalable vector type, BasicTTI tries to scalarize and we'd crash. As a minimum, we should return an invalid cost instead.
The added test provide coverage for the moment, but given they show a number of gaps in RISCV costing, they're likely not to cover this code path long term.
Jonas Devlieghere [Thu, 23 Jun 2022 15:08:36 +0000 (08:08 -0700)]
[lldb] Make thread safety the responsibility of the log handlers
Drop the thread-safe flag and make the locking strategy the
responsibility of the individual log handler.
Previously we got away with a non-thread safe mode because we were using
unbuffered streams that rely on the underlying syscalls/OS for
synchronization. With the introduction of log handlers, we can have
arbitrary logic involved in writing out the logs. With this patch the
log handlers can pick the most appropriate locking strategy for their
particular implementation.
Differential revision: https://reviews.llvm.org/D127922
Jonas Devlieghere [Thu, 23 Jun 2022 15:06:17 +0000 (08:06 -0700)]
[lldb] Support a buffered logging mode
This patch adds a buffered logging mode to lldb. A buffer size can be
passed to `log enable` with the -b flag. If no buffer size is specified,
logging is unbuffered.
Differential revision: https://reviews.llvm.org/D127986
Valentin Clement [Thu, 23 Jun 2022 16:04:50 +0000 (18:04 +0200)]
[flang] Handle boxed characters that are values when doing a conversion
Character conversion requires memory storage as it operates on a
sequence of code points.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D128438
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Val Donaldson [Thu, 23 Jun 2022 16:03:06 +0000 (18:03 +0200)]
[flang] Increase support for intrinsic module procedures
* Make Semantics test doconcurrent01.f90 an expected failure pending a fix
for a problem in recognizing a PURE prefix specifier for a specific procedure
that occurs in new intrinsic module source code,
* review update
* review update
* Increase support for intrinsic module procedures
The f18 standard defines 5 intrinsic modules that define varying numbers
of procedures, including several operators:
2 iso_fortran_env
55 ieee_arithmetic
10 ieee_exceptions
0 ieee_features
6 iso_c_binding
There are existing fortran source files for each of these intrinsic modules.
This PR adds generic procedure declarations to these files for procedures
that do not already have them, together with associated specific procedure
declarations. It also adds the capability of recognizing intrinsic module
procedures in lowering code, making it possible to use existing language
intrinsic code generation for intrinsic module procedures for both scalar
and elemental calls. Code can then be generated for intrinsic module
procedures using existing options, including front end folding, direct
inlining, and calls to runtime support routines. Detailed code generation
is provided for several procedures in this PR, with others left to future PRs.
Procedure calls that reach lowering and don't have detailed implementation
support will generate a "not yet implemented" message with a recognizable name.
The generic procedures in these modules may each have as many as 36 specific
procedures. Most specific procedures are generated via macros that generate
type specific interface declarations. These specific declarations provide
detailed argument information for each individual procedure call, similar
to what is done via other means for standard language intrinsics. The
modules only provide interface declarations. There are no procedure
definitions, again in keeping with how language intrinsics are processed.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D128431
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
LLVM GN Syncbot [Thu, 23 Jun 2022 15:49:40 +0000 (15:49 +0000)]
[gn build] Port
4045b62d4cc9
Craig Topper [Thu, 23 Jun 2022 15:41:12 +0000 (08:41 -0700)]
[RISCV] Disable <vscale x 1 x *> types with Zve32x or Zve32f.
According to the vector spec, mf8 is not supported for i8 if ELEN
is 32. Similarily mf4 is not suported for i16/f16 or mf2 for i32/f32.
Since RVVBitsPerBlock is 64 and LMUL is calculated as
((MinNumElements * ElementSize) / RVVBitsPerBlock) this means we
need to disable any type with MinNumElements==1.
For generic IR, these types will now be widened in type legalization.
For RVV intrinsics, we'll probably hit a fatal error somewhere. I plan
to work on disabling the intrinsics in the riscv_vector.h header.
Reviewed By: arcbbb
Differential Revision: https://reviews.llvm.org/D128286
Nico Weber [Wed, 22 Jun 2022 14:58:33 +0000 (10:58 -0400)]
[lld/mac] Add a few TimeTraceScopes
Identical literal folding takes ~1.4% of the time, and was missing
from the trace.
Signature computation still needs ~2.2% of the time, so probably worth
explicitly marking its contribution to "Write output file" (9.1%)
Differential Revision: https://reviews.llvm.org/D128343
Craig Topper [Thu, 23 Jun 2022 15:30:43 +0000 (08:30 -0700)]
[RISCV] Add macrofusion infrastructure and one example usage.
This adds the macrofusion plumbing and support fusing LUI+ADDI(W).
This is similar to D73643, but handles a different case. Other cases
can be added in the future.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D128393
Joe Nash [Mon, 20 Jun 2022 13:41:38 +0000 (09:41 -0400)]
[AMDGPU] gfx11 Select on Buffer Atomic FAdd Rtn type
Reviewed By: #amdgpu, foad, rampitec
Differential Revision: https://reviews.llvm.org/D128205
Florian Hahn [Thu, 23 Jun 2022 15:27:33 +0000 (17:27 +0200)]
Revert "[ConstraintElimination] Transfer info from ULT to signed system."
This reverts commit
316e106f49c4c86f3485d69d1539e2aed12251c0.
This breaks a bot with expensive checks.
Sam McCall [Tue, 21 Jun 2022 19:22:22 +0000 (21:22 +0200)]
[pseudo] Track heads as GSS nodes, rather than as "pending actions".
IMO this model is simpler to understand (borrowed from the LR0 patch D127357).
It also makes error recovery easier to implement, as we have a simple list of
head nodes lying around to recover from when needed.
(It's not quite as nice as LR0 in this respect though).
It's slightly slower (2.24 -> 2.12 MB/S on my machine = 5%) but nothing close
to as bad as LR0.
However
- I think we'd have to eat a litle performance loss otherwise to implement
error recovery.
- this frees up some complexity budget for optimizations like fastpath push/pop
(this + fastpath is already faster than head)
- I haven't changed the data structure here and it's now pretty dumb, we can
make it faster
Differential Revision: https://reviews.llvm.org/D128297
Mark de Wever [Tue, 28 Dec 2021 17:48:04 +0000 (18:48 +0100)]
[libc++][format] Copy code to new location.
This is a helper patch to ease the reviewing of D128139.
The originals will be removed at a later time when all formatters are
converted to the new style. (Floating-point and pointer aren't up for
review yet.)
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D128367
Florian Hahn [Thu, 23 Jun 2022 15:17:01 +0000 (17:17 +0200)]
[ConstraintElimination] Transfer info from ULT to signed system.
If A u< B holds, then A s>= 0 && A s< B holds if B s>= 0.
https://alive2.llvm.org/ce/z/RrNxHh
Jan Svoboda [Thu, 23 Jun 2022 15:15:13 +0000 (17:15 +0200)]
[clang][driver] NFC, test: Make test output order-independent
Daniel Bertalan [Thu, 23 Jun 2022 15:07:15 +0000 (11:07 -0400)]
[lld-macho] Use source information in duplicate symbol errors
Similarly to how undefined symbol diagnostics were changed in D128184,
we now show where in the source file duplicate symbols are defined at:
ld64.lld: error: duplicate symbol: _foo
>> defined in bar.c:42
>> /path/to/bar.o
>> defined in baz.c:1
>> /path/to/libbaz.a(baz.o)
For objects that don't contain DWARF data, the format is unchanged.
A slight difference to undefined symbol diagnostics is that we don't
print the name of the symbol on the third line, as it's already
contained on the first line.
Differential Revision: https://reviews.llvm.org/D128425
Bradley Smith [Fri, 17 Jun 2022 10:45:27 +0000 (10:45 +0000)]
[AArch64][SVE] Match (add x (lsr/asr y c)) -> usra/ssra x y c
Differential Revision: https://reviews.llvm.org/D128045
Baptiste Saleil [Thu, 23 Jun 2022 14:16:20 +0000 (10:16 -0400)]
[AMDGPU] Flush the vmcnt counter in loop preheaders when necessary
waitcnt vmcnt instructions are currently generated in loop bodies before using
values loaded outside of the loop. In some cases, it is better to flush the
vmcnt counter in a loop preheader before entering the loop body. This patch
detects these cases and generates waitcnt instructions to flush the counter.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D115747
Nico Weber [Thu, 23 Jun 2022 14:35:48 +0000 (10:35 -0400)]
Revert "[fastalloc] Support allocating specific register class in fastalloc"
This reverts commit
719658d078c4093d1ee716fb65ae94673df7b22b.
Breaks a few things, see comments on https://reviews.llvm.org/D128437
There's disagreement about the best fix.
So let's keep HEAD green while discussions are happening.
Joseph Huber [Thu, 23 Jun 2022 14:36:25 +0000 (10:36 -0400)]
[Binary] Fix leftoever line
Joseph Huber [Thu, 23 Jun 2022 14:22:05 +0000 (10:22 -0400)]
[Binary] Reserve the correct size for the OffloadBinary
Summary:
When writing the offload binary, we use a SmallVector. We already know
the size that we expect the buffer to take up so we should reserve all
that memory up-front to improve performance. Also this patch adds some
extra sanity checks for the binary format for safety.
Nikita Popov [Thu, 23 Jun 2022 14:30:02 +0000 (16:30 +0200)]
[BasicAA] Add test for call incorrectly treated as escape source (NFC)
David Green [Thu, 23 Jun 2022 14:25:24 +0000 (15:25 +0100)]
[ValueTracking] Teach isKnownNonZero that a vscale is never 0.
A llvm.vscale will always be at least 1, never zero. Teaching that to
isKnownNonZero can help fold away some statically known compares.
Differential Revision: https://reviews.llvm.org/D128217
Ilya Biryukov [Thu, 23 Jun 2022 13:52:16 +0000 (15:52 +0200)]
[Sema] Fix assertion failure when instantiating requires expression
Fixes #54629.
The crash is is caused by the double template instantiation.
See the added test. Here is what happens:
- Template arguments for the partial specialization get instantiated.
- This causes instantitation into the corrensponding requires
expression.
- `TemplateInsantiator` correctly handles instantiation of parameters
inside `RequiresExprBody` and instantiates the constraint expression
inside the `NestedRequirement`.
- To build the substituted `NestedRequirement`, `TemplateInsantiator`
calls `Sema::BuildNestedRequirement` calls
`CheckConstraintSatisfaction`, which results in another template
instantiation (with empty template arguments). This seem to be an
implementation detail to handle constraint satisfaction and is not
required by the standard.
- The recursive template instantiation tries to find the parameter
inside `RequiresExprBody` and fails with the corresponding assertion.
Note that this only happens as both instantiations happen with the class
partial template specialization set as `Sema.CurContext`, which is
considered a dependent `DeclContext`.
To fix the assertion, avoid doing the recursive template instantiation
and instead evaluate resulting expressions in-place.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D127487
Florian Hahn [Thu, 23 Jun 2022 14:04:45 +0000 (16:04 +0200)]
[LSR] Move transform test from test/Analysis to test/Transforms.
Also auto-generate check lines.
Jay Foad [Thu, 23 Jun 2022 13:59:30 +0000 (14:59 +0100)]
[AMDGPU] Use -check-prefixes in a test. NFC.
Florian Hahn [Thu, 23 Jun 2022 13:57:59 +0000 (15:57 +0200)]
[ConstraintElimination] Transfer info from SLT to unsigned system.
If A s< B holds, then A u< also holds, if A s>= 0.
https://alive2.llvm.org/ce/z/J4JZuN
chenglin.bi [Thu, 23 Jun 2022 13:47:45 +0000 (21:47 +0800)]
[InstCombine] Optimise shift+and+boolean conversion pattern to simple comparison
if (`C1` is pow2) & (`(C2 & ~(C1-1)) + C1)` is pow2):
((C1 << X) & C2) == 0 -> X >= (Log2(C2+C1) - Log2(C1));
https://alive2.llvm.org/ce/z/EJAl1R
((C1 << X) & C2) != 0 -> X < (Log2(C2+C1) - Log2(C1));
https://alive2.llvm.org/ce/z/3bVRVz
And remove dead code.
Fix: https://github.com/llvm/llvm-project/issues/56124
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D126591
Sam McCall [Thu, 9 Jun 2022 07:06:19 +0000 (09:06 +0200)]
[pseudo] Add xfail tests for a simple-declaration/function-definition ambiguity
I expect to eliminate this ambiguity at the grammar level by use of guards,
because it interferes with brace-based error recvoery.
Differential Revision: https://reviews.llvm.org/D127400
Rodrigo Dominguez [Tue, 30 Mar 2021 17:53:17 +0000 (13:53 -0400)]
[AMDGPU] GFX11: remove ShaderType from ds_ordered_count offset field
In GFX11 ShaderType is determined by the hardware and should no longer
be written into bits[3:2] of the ds_ordered_count offset field.
Differential Revision: https://reviews.llvm.org/D128196
Jay Foad [Thu, 23 Jun 2022 13:06:48 +0000 (14:06 +0100)]
[AMDGPU] Precommit test for D128196
Ruiling Song [Wed, 22 Jun 2022 02:50:46 +0000 (10:50 +0800)]
AMDGPU: Don't crash on global_ctor/dtor declaration
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D128320
Valentin Clement [Thu, 23 Jun 2022 12:57:24 +0000 (14:57 +0200)]
[flang] Add lowering TODO for separate module procedures
MODULE FUNCTION and MODULE SUBROUTINE currently cause lowering crash:
"symbol is not mapped to any IR value" because special care is needed
to handle their interface.
Add a TODO for now.
Example of program that crashed and will hit the TODO:
```
module mod
interface
module subroutine sub
end subroutine
end interface
contains
module subroutine sub
x = 42
end subroutine
end module
```
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D128412
Co-authored-by: Jean Perier <jperier@nvidia.com>
Nikita Popov [Thu, 23 Jun 2022 09:44:20 +0000 (11:44 +0200)]
[llvm-c] Add LLVMGetAggregateElement() function
This adds LLVMGetAggregateElement() as a wrapper for
Constant::getAggregateElement(), which allows fetching a
struct/array/vector element without handling different possible
underlying representations.
As the changed echo test shows, previously you for example had to
treat ConstantArray (use LLVMGetOperand) and ConstantDataArray
(use LLVMGetElementAsConstant) separately, not to mention all the
other possible representations (like PoisonValue).
I've deprecated LLVMGetElementAsConstant() in favor of the new
function, which is strictly more powerful (but I could be convinced
to drop the deprecation).
This is partly motivated by https://reviews.llvm.org/D125795,
which drops LLVMConstExtractValue() because the underlying constant
expression no longer exists. This function could previously be used
as a poor man's getAggregateElement().
Differential Revision: https://reviews.llvm.org/D128417
Nikita Popov [Wed, 22 Jun 2022 14:29:15 +0000 (16:29 +0200)]
[X86][AMX] Update tests to use opaque pointers (NFC)
There are some codegen differences here, because presence of
bitcasts affects AMX codegen in minor ways (the bitcasts are not
always in the input IR, but may be added by X86PreAMXConfig
for example).
Differential Revision: https://reviews.llvm.org/D128424
Jacques Pienaar [Thu, 23 Jun 2022 12:31:31 +0000 (05:31 -0700)]
[mlir][pdll] Add new tablegen helper NFC
Command line option injected by tablegen rule cannot be respected by
PDLL here, so add new helper function that is copy of original without
any additional flags injected. This avoids compilation failure when
compiler warnings are disabled.
Kept it as a mechanical copy.
Fixes #55716
Nicolas Vasilache [Thu, 23 Jun 2022 09:29:43 +0000 (02:29 -0700)]
[mlir][Transform] Fix implementation of the generic apply that is based on applyToOne.
The result of applying an N-result producing transformation to M payload ops
is an M-wide result, each containing N result operations.
This requires a transposition of the results obtained by calling `applyToOne`.
This revision fixes the issue and adds more advanced tests that exercise the behavior.
Differential Revision: https://reviews.llvm.org/D128414
Jeroen Dobbelaere [Thu, 23 Jun 2022 12:18:49 +0000 (14:18 +0200)]
Revert "[tbaa] Handle base classes in struct tbaa"
This reverts commit
cdc59e2202c11a6a5dfd2ec83531523c58eaae45.
The Verifier finds a problem in a stage2 build. Reverting so Bruno can investigate.
Paulo Matos [Thu, 23 Jun 2022 12:10:52 +0000 (14:10 +0200)]
[WebAssembly] Update test to run it in opaque pointers mode
When opaque pointers was enabled, -no-opaque-pointers were added to some tests in order not to change behaviour. We now revert this and fix the test.
Reviewed By: asb, tlively
Differential Revision: https://reviews.llvm.org/D128282
Sergey Kosukhin [Wed, 22 Jun 2022 13:10:33 +0000 (16:10 +0300)]
[compiler-rt] Fix false positive detection of a target in compile-only mode
When `compiler-rt` is configured as a runtime, the configure-time target
detection for builtins is done in compile-only mode, which is basically a
test of whether the newly-built `clang` can compile a simple program with
an additional flag (`-m32` and `-m64` in my case). The problem is that on
my Debian system `clang` can compile `int foo(int x, int y) { return x + y; }`
with `-m32` but fails to include `limits.h` (or any other target-specific
header) for the `i386` target:
```
$ /path/to/build/./bin/clang --target=x86_64-unknown-linux-gnu -DVISIBILITY_HIDDEN -O3 -DNDEBUG -m32 -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -MD -MT CMakeFiles/clang_rt.builtins-i386.dir/absvdi2.c.o -MF CMakeFiles/clang_rt.builtins-i386.dir/absvdi2.c.o.d -o CMakeFiles/clang_rt.builtins-i386.dir/absvdi2.c.o -c /path/to/src/compiler-rt/lib/builtins/absvdi2.c
In file included from /path/to/src/compiler-rt/lib/builtins/absvdi2.c:13:
In file included from /path/to/src/compiler-rt/lib/builtins/int_lib.h:93:
In file included from /path/to/build/lib/clang/15.0.0/include/limits.h:21:
In file included from /usr/include/limits.h:25:
/usr/include/features.h:364:12: fatal error: 'sys/cdefs.h' file not found
^~~~~~~~~~~~~
1 error generated.
```
This is an attempt to make the target detection more robust: extend the test
program with `#include <limits.h>`.
Differential Revision: https://reviews.llvm.org/D127975
Tobias Hieta [Thu, 23 Jun 2022 12:04:23 +0000 (14:04 +0200)]
[NFC] remove trailing whitespace
LLVM GN Syncbot [Thu, 23 Jun 2022 11:53:18 +0000 (11:53 +0000)]
[gn build] Port
2c3bbac0c715
Nikolas Klauser [Thu, 23 Jun 2022 10:23:41 +0000 (12:23 +0200)]
[libc++] Implement ranges::move{, _backward}
This patch also adds a new optimization to `std::move`. It unwraps three `reverse_iterator`s if the wrapped iterator is a `contiguous_iterator` and the iterated type is trivially_movable. This allows us to simplify `ranges::move_backward` to a forward to `std::move` without any pessimization.
Reviewed By: var-const, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D126616
Valentin Clement [Thu, 23 Jun 2022 11:43:38 +0000 (13:43 +0200)]
[flang] Lowering passing variables to OPTIONAL VALUE
The case where the dummy argument is OPTIONAL was missing in the
handling of VALUE numerical and logical dummies (passBy::BaseAddressValueAttribute).
This caused segfaults while unconditionally copying actual arguments that were legally
absent at runtime.
Takes this bug as an opportunity to share the code that lowers arguments
that must be passed by BaseAddress, BaseAddressValueAttribute, BoxChar,
and CharBoxValueAttribute.
It has to deal with the exact same issues (being able to make contiguous
copies of the actual argument, potentially conditionally at runtime,
and potentially requiring a copy-back).
The VALUE case is the same as the non value case, except there is never
a copy-back and there is always a copy-in for variables. This two
differences are easily controlled by a byValue flag.
This as the benefit of implementing CHARACTER, VALUE for free that was
previously a hard TODO.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D128418
Co-authored-by: Jean Perier <jperier@nvidia.com>
Florian Hahn [Thu, 23 Jun 2022 11:44:41 +0000 (13:44 +0200)]
[VPlan] Update unit test after
569d84fe99e63.
Bruno De Fraine [Thu, 23 Jun 2022 11:25:05 +0000 (13:25 +0200)]
[tbaa] Handle base classes in struct tbaa
This is a fix for the miscompilation reported in https://github.com/llvm/llvm-project/issues/55384
Not adding a new test case since existing test cases already cover base classes (including new-struct-path tbaa).
Reviewed By: jeroen.dobbelaere
Differential Revision: https://reviews.llvm.org/D126956
Florian Hahn [Thu, 23 Jun 2022 11:36:02 +0000 (13:36 +0200)]
[VPlan] Remove dead recipes across whole plan.
This extends removeDeadRecipe to remove recipes across the whole plan.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D127580
Kristof Beyls [Wed, 15 Jun 2022 13:09:03 +0000 (15:09 +0200)]
[docs] Document and publish LLVM community calendar
Let's introduce and publish an LLVM community calendar.
The idea is that organizers of events such as online sync-ups or office hours
invite calendar@llvm.org to the event they're creating. That way, the calendar
publicly visible at
https://calendar.google.com/calendar/u/0/embed?src=calendar@llvm.org will show
the event.
The hope is that having a single calendar showing all LLVM events makes it
easier for both new comers and experienced people to discover events they're
interested in.
This patch partially implements https://github.com/llvm/llvm-project/issues/55426
We could also give pointers to the calendar in a few other places, e.g. from
the main LLVM page, but let's introduce the incrementally.
Differential Revision: https://reviews.llvm.org/D127852
Aaron Ballman [Thu, 23 Jun 2022 11:22:00 +0000 (07:22 -0400)]
Fix sphinx build for clang-tools-extra
I think it doesn't like the non-ASCII characters in the block, so using
a text block to disable syntax highlighting.
This should fix:
https://lab.llvm.org/buildbot/#/builders/115/builds/29888
Kiran Chandramohan [Thu, 23 Jun 2022 10:55:30 +0000 (10:55 +0000)]
[Flang] Call the CSE pass in the pass pipeline
During the upstreaming process, it was decided to move contents
of the FIR CSE pass to the MLIR pass. Most of the FIR CSE changes
that are used are already moved to the MLIR pass. This patch calls
the MLIR CSE pass in places where the FIR CSE pass is called in the
pass pipeline.
Note: This is part of upstreaming from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project.
Reviewed By: awarzynski, clementval
Differential Revision: https://reviews.llvm.org/D128365
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>
Nikita Popov [Thu, 23 Jun 2022 10:44:46 +0000 (12:44 +0200)]
[Clang] Don't test register allocation
This test was broken by
719658d078c4093d1ee716fb65ae94673df7b22b.
How did an assembly test get into clang/test?
David Spickett [Thu, 23 Jun 2022 10:33:05 +0000 (10:33 +0000)]
Revert "[LLDB] Handle DIE with DW_AT_low_pc and empty ranges"
This reverts commit
1beededc0e7d86d09cee972f0b9f0030a139cab4.
Due to failures on the Arm/AArch64 build bots:
https://lab.llvm.org/buildbot/#/builders/96/builds/25032
Nikita Popov [Thu, 23 Jun 2022 10:18:28 +0000 (12:18 +0200)]
[X86] Update some AMX tests to use opaque pointers (NFC)
This only touches IR tests (or tests without codegen changes).
Dmitry Preobrazhensky [Thu, 23 Jun 2022 10:07:45 +0000 (13:07 +0300)]
[AMDGPU][MC][GFX11] Correct disassembly of VOP3.DPP8 opcodes
Fix bug #56163.
Add W32/W64 tests for all VOP3.DPP opcodes.
Differential Revision: https://reviews.llvm.org/D128369
isuckatcs [Wed, 8 Jun 2022 21:23:07 +0000 (23:23 +0200)]
[analyzer] Structured binding to arrays
Introducing structured binding to data members and more.
To handle binding to arrays, ArrayInitLoopExpr is also
evaluated, which enables the analyzer to store information
in two more cases. These are:
- when a lambda-expression captures an array by value
- in the implicit copy/move constructor for a class
with an array member
Differential Revision: https://reviews.llvm.org/D126613
Nikita Popov [Mon, 20 Jun 2022 15:38:04 +0000 (17:38 +0200)]
[IR] Export ConstantFold.h header (NFC)
This is in preparation for https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179.
As part of that change, we'll want to invoke some of these constant
folding APIs explicitly, as it won't happen as part of
ConstantExpr::getXYZ() anymore.
Ideally, we'd merge these with the DL-aware constant folding APIs
and only call those, but this is not easily possible for some
current usages (most important IRBuilder, which uses DL-independent
constant folding by default, and some major layering changes would
be needed to change that).
This is basically a reboot of D115035 with different motivation.
Differential Revision: https://reviews.llvm.org/D128213
Balázs Kéri [Thu, 23 Jun 2022 08:24:45 +0000 (10:24 +0200)]
[clang][analyzer] Fix StdLibraryFunctionsChecker 'mkdir' return value.
The functions 'mkdir', 'mknod', 'mkdirat', 'mknodat' return 0 on success
and -1 on failure. The checker modeled these functions with a >= 0
return value on success which is changed to 0 only. This fix makes
ErrnoChecker work better for these functions.
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D127277
Weining Lu [Thu, 23 Jun 2022 09:07:42 +0000 (17:07 +0800)]
[LoongArch] Combine ((x & shifted_mask) >> shamt) to bstrpick.{w/d}
This is an improvement to LoongArch codegen. In D127206 we combined
((x >> shamt) & shifted_mask) to bstrpick and here we do a similar
combination when certain conditions are met.
Thanks to @xen0n for reminding me.
Differential Revision: https://reviews.llvm.org/D128191
Florian Hahn [Thu, 23 Jun 2022 09:04:51 +0000 (11:04 +0200)]
[ConstraintElimination] Transfer info from SGT to unsigned system.
If A >s B then A >=u 0, if B >=s -1.
https://alive2.llvm.org/ce/z/cncGKi
Adrian Kuegel [Wed, 22 Jun 2022 11:50:30 +0000 (13:50 +0200)]
[mlir] Add an additional check to vectorizeStaticLinalgOpPrecondition.
We need to make sure that the types used in the body are valid element types
for VectorType.
Differential Revision: https://reviews.llvm.org/D128336
Luo, Yuanke [Thu, 23 Jun 2022 01:18:47 +0000 (09:18 +0800)]
[fastalloc] Support allocating specific register class in fastalloc
The base RA support infrastructure that only allow a specific register
class be allocated in RA pss. Since greedy RA, basic RA derived from
base RA, they all allow allocating specific register class. Fast RA
doesn't support allocating register for specific register class. This
patch is to enable ShouldAllocateClass in fast RA, so that it can
support allocating register for specific register class.
Differential Revision: https://reviews.llvm.org/D126771
Fangrui Song [Thu, 23 Jun 2022 06:16:31 +0000 (23:16 -0700)]
Revert D115462 "[SLP]Improve shuffles cost estimation where possible."
This reverts commit
cac60940b771a0685d058a5b471c84cea05fdc46.
Caused -Os -fsanitize=memory -march=haswell miscompile to pytorch/cpuinfo.
See my latest comment (may update) on D115462.
Fangrui Song [Thu, 23 Jun 2022 05:31:01 +0000 (22:31 -0700)]
Revert "[SLP]Fix a crash when insert subvector is out of range."
This reverts commit
f1ee2738b3d70fea803ac1f3401c2fc9f61e514a.
Revert due to the revert of a dependent commit `[SLP]Improve shuffles cost estimation where possible.`
Craig Topper [Thu, 23 Jun 2022 06:04:30 +0000 (23:04 -0700)]
[RISCV] Refactor code to remove some small wrapper methods and merge two functions together. NFC
chenglin.bi [Thu, 23 Jun 2022 05:21:51 +0000 (13:21 +0800)]
Revert "[SelectionDAG][DAGCombiner] Reuse exist node by reassociate"
This reverts commit
6c951c5ee6d0b848877cb8ac7a9cb2a9ef9ebbb5.
Serguei Katkov [Tue, 21 Jun 2022 08:57:44 +0000 (15:57 +0700)]
[RS4GC] Handle freeze case for vector
Finding BDV for vector value does not handle freeze instruction.
Adding its handling as it is done for scalar case.
Reviewed By: apilipenko
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D128254
Valentin Clement [Thu, 23 Jun 2022 04:54:03 +0000 (06:54 +0200)]
[flang] Fixes several bugs relating to initialization expressions. An (#1493)
Fixes several bugs relating to initialization expressions. An
initialization expression has no access to dynamic resources like the
stack or the heap. It must reduce to a relocatable expression that the
loader can complete at runtime.
Adds regression test.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D128380
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Charlie Barto [Thu, 23 Jun 2022 04:34:19 +0000 (21:34 -0700)]
[GlobalISel][TableGen] Qualify calls to llvm::format that have ::std:: types as parameters
... to avoid ambiguity in overload resolution when ADL finds `std::format`.
Differential Revision: https://reviews.llvm.org/D119213
wangpc [Thu, 23 Jun 2022 03:11:09 +0000 (11:11 +0800)]
[TableGen] Add new operator !exists
We can cast a string to a record via !cast, but we have no mechanism
to check if it is valid and TableGen will raise an error if failed to
cast. Besides, we have no semantic null in TableGen (we have `?` but
different backends handle uninitialized value differently), so operator
like `dyn_cast<>` is hard to implement.
In this patch, we add a new operator `!exists<T>(s)` to check whether
a record with type `T` and name `s` exists. Self-references are allowed
just like `!cast`.
By doing these, we can write code like:
```
class dyn_cast_to_record<string name> {
R value = !if(!exists<R>(name), !cast<R>(name), default_value);
}
defvar v = dyn_cast_to_record<"R0">.value; // R0 or default_value.
```
Reviewed By: tra, nhaehnle
Differential Revision: https://reviews.llvm.org/D127948
LLVM GN Syncbot [Thu, 23 Jun 2022 02:41:57 +0000 (02:41 +0000)]
[gn build] Port
2962f9df7ca3
John Regehr [Tue, 21 Jun 2022 23:30:52 +0000 (17:30 -0600)]
stop llvm-reduce from introducing undefs
Differential Revision: https://reviews.llvm.org/D128317
Okwan Kwon [Wed, 22 Jun 2022 22:59:53 +0000 (15:59 -0700)]
[mlir][linalg] move isElementwise() to Linalg/Utils (NFC)
Differential Revision: https://reviews.llvm.org/D128398
Julian Lettner [Thu, 23 Jun 2022 01:19:31 +0000 (18:19 -0700)]
[ASan][Darwin] XFAIL test; atos does not show line numbers for globals
atos currently doesn't show source line numbers for global variables, so
global-location.cpp is failing after we switched from ASan-specific
metadata to normal symbolication.
See:
https://reviews.llvm.org/D127552
Matt Arsenault [Fri, 17 Jun 2022 22:24:28 +0000 (18:24 -0400)]
AMDGPU: Add missing implicit uses in tests
These tests were deleting the copy instruction, defeating
the purpose of having it.
Matt Arsenault [Fri, 10 Jun 2022 19:07:39 +0000 (15:07 -0400)]
AMDGPU: Fix invalid liveness after si-optimize-exec-masking-pre-ra
This was leaving behind a use at the deleted instruction which the
verifier would fail during allocation.
Matt Arsenault [Wed, 15 Jun 2022 21:04:05 +0000 (17:04 -0400)]
InlineSpiller: Don't fold spills into undef reads
This was producing a load into a dead register which was a verifier
error.
Fazlay Rabbi [Thu, 23 Jun 2022 00:10:31 +0000 (17:10 -0700)]
[OpenMP] Add handling cases when filter(tid) appears with default(none)
Differential Revision: https://reviews.llvm.org/D128397
Mingming Liu [Wed, 1 Jun 2022 22:21:59 +0000 (15:21 -0700)]
[SampleProfile][Inline] Annotate sample profile inline remarks with link phase (prelink/postlink) information.
Differential Revision: https://reviews.llvm.org/D126833
Paul Walker [Thu, 24 Feb 2022 18:40:23 +0000 (18:40 +0000)]
[SVE] Make ISD::SPLAT_VECTOR a legal operation.
The implication of this patch being AArch64ISD::DUP no longer
supports scalable vectors.
Differential Revision: https://reviews.llvm.org/D128265
jackalcooper [Tue, 21 Jun 2022 16:28:36 +0000 (12:28 -0400)]
[mlir][vulkan-runner] fix VK_ERROR_INCOMPATIBLE_DRIVER error
On macOS, Vulkan is emulated by MoltenVK. Some extra flags are
required for "building robust and portable Vulkan based
applications that are good citizens in the Vulkan ecosystem".
More information:
https://vulkan.lunarg.com/doc/sdk/1.3.216.0/mac/getting_started.html
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D128173
Nikolas Klauser [Wed, 22 Jun 2022 19:10:57 +0000 (21:10 +0200)]
[libc++] Implement P0154R1 (Hardware inference size)
`__GCC_CONSTRUCTIVE_SIZE` and `__GCC_DESTRUCTIVE_SIZE` are available since GCC 12. I'm assuming clang will also implement these for compatability with libstdc++.
Reviewed By: ldionne, #libc
Spies: h-vetinari, libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D122276
Nikolas Klauser [Wed, 22 Jun 2022 09:14:04 +0000 (11:14 +0200)]
[libc++] Simplify the visibility attributes
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D128007
Fangrui Song [Wed, 22 Jun 2022 23:19:17 +0000 (16:19 -0700)]
[ELF][test] Clean up thinlto*
Florian Mayer [Wed, 15 Jun 2022 22:31:05 +0000 (15:31 -0700)]
[MTE] [HWASan] Use LoopInfo for reachability queries.
The reachability queries default to "reachable" after exploring too many
basic blocks. LoopInfo helps it skip over the whole loop.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D127917