Sanjay Patel [Tue, 31 Aug 2021 20:22:17 +0000 (16:22 -0400)]
[InstCombine] add tests for min/max intrinsics with not ops; NFC
Alexandre Ganea [Tue, 31 Aug 2021 23:03:44 +0000 (19:03 -0400)]
[LLD][COFF] Clean paths in PDB even when /pdbsourcepath is omitted
Differential Revision: https://reviews.llvm.org/D109030
Joseph Huber [Tue, 31 Aug 2021 19:03:33 +0000 (15:03 -0400)]
[OpenMP] Add an option to always inline OpenMP device functions.
Performance on GPU targets can be highly variable, sometimes inlining
everything hurts performance and sometimes it greatly improves it. Add
an option to toggle this behaviour to better investigate it.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D109014
Alex Langford [Tue, 31 Aug 2021 18:44:34 +0000 (11:44 -0700)]
[lldb] Tighten lock in Language::ForEach
It is easy to accidentally introduce a deadlock by having the callback
passed to Language::ForEach also attempt to acquire the same lock. It
is easy enough to disallow the callback from calling anything in
Language directly, but it may happen through a series of other
function/method calls.
The solution I am proposing is to tighten the lock in Language::ForEach
so that it is only held as we gather the currently loaded language
plugins. We store them in a vector and then iterate through them with
the callback so that the callback can't introduce a deadlock.
Differential Revision: https://reviews.llvm.org/D109013
wren romano [Mon, 30 Aug 2021 23:47:09 +0000 (16:47 -0700)]
[mlir][sparse] Rename the public SparseTensorStorage::asCOO to toCOO
Trying to reduce confusion by having the name of the public method match that of the private method for handling the recursion. Also adding some comments to SparseTensorStorage::fromCOO to help clarify what the recursive calls are doing in the dense case.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D108954
Andrew Browne [Tue, 31 Aug 2021 22:35:08 +0000 (15:35 -0700)]
[DFSan][NFC] Fix comment formatting.
Vy Nguyen [Tue, 31 Aug 2021 19:52:17 +0000 (15:52 -0400)]
[llvm-ar][nfc] Reword help message to be less ambiguous on what p and t do.
The current help msg isn't super clear on whether t prints the content of the files or just the list of files.
(I'd certainly thought it'd print the list of files, and accidentally had a bunch of "gargabe" printed to my terminal).
Similarly, t sounded like it'd do what p actually did.
Differential Revision: https://reviews.llvm.org/D109018
Kevin Athey [Tue, 31 Aug 2021 21:00:30 +0000 (14:00 -0700)]
Revert "[OptTable] Improve error message output for grouped short options"
This reverts commit
71d7fed3bc2ad6c22729d446526a59fcfd99bd03.
Reason: broke sanitizer bots
more info: https://reviews.llvm.org/D108770
Louis Dionne [Tue, 31 Aug 2021 20:43:06 +0000 (16:43 -0400)]
[libc++][NFC] Remove redundant friend declaration for operator==
This must have been meant to be friend-declaring operator!=, but it
turns out that it's not even necessary to make it a friend since it
does not access any private state.
rdar://
82568613
Stanislav Mekhanoshin [Mon, 30 Aug 2021 21:49:50 +0000 (14:49 -0700)]
[RegAlloc] Immediately delete dead instructions with live uses
When RA eliminated a dead def it can either immediately delete
the instruction itself or replace it with KILL to defer the
actual removal. If this instruction has a virtual register use
killing the register it will shrink the LI of the use. However,
if the LI covers the instruction and extends beyond it the
shrink will not happen. In fact that is impossible to shrink
such use because of the KILL still using it.
If later the LI of the use will be split at the KILL and the
KILL itself is eliminated after that point the new live segment
ends up at an invalid slot index.
This extremely rare condition was hit after D106408 which has
enabled rematerialization of such instructions. The replacement
with KILL is only done for rematerialized defs which became dead
and such rematerialization did not generally happen before.
The patch deletes an instruction immediately if it is a result
of rematerialization and has such use. An alternative would be
to prohibit a split at a KILL instruction, but it looks like it
is better to split a live range rather then keeping a killed
instruction just in case it can be rematerialized further.
Fixes PR51655.
Differential Revision: https://reviews.llvm.org/D108951
Nikita Popov [Tue, 31 Aug 2021 18:10:50 +0000 (20:10 +0200)]
[SLPVectorizer] Make aliasing check more precise
SLPVectorizer currently uses AA::isNoAlias() to determine whether
two locations alias. This does not work if one of the instructions
is a call. Instead, we should check getModRefInfo(), which
determines whether an arbitrary instruction modifies or references
a given location.
Among other things, this prevents @llvm.experimental.noalias.scope.decl()
and other inaccessiblmemonly intrinsics from interfering with SLP
vectorization.
Differential Revision: https://reviews.llvm.org/D109012
wlei [Tue, 31 Aug 2021 20:27:42 +0000 (13:27 -0700)]
[llvm-profgen] Support LBR only perf script
This change aims at supporting LBR only sample perf script which is used for regular(Non-CS) profile generation. A LBR perf script includes a batch of LBR sample which starts with a frame pointer and a group of 32 LBR entries is followed. The FROM/TO LBR pair and the range between two consecutive entries (the former entry's TO and the latter entry's FROM) will be used to infer function profile info.
An example of LBR perf script(created by `perf script -F ip,brstack -i perf.data`)
```
40062f 0x40062f/0x4005b0/P/-/-/9 0x400645/0x4005ff/P/-/-/1 0x400637/0x400645/P/-/-/1 ...
4005d7 0x4005d7/0x4005e5/P/-/-/8 0x40062f/0x4005b0/P/-/-/6 0x400645/0x4005ff/P/-/-/1 ...
...
```
For implementation:
- Extended a new child class `LBRPerfReader` for the sample parsing, reused all the functionalities in `extractLBRStack` except for an extension to parsing leading instruction pointer.
- `HybridSample` is reused(just leave the call stack empty) and the parsed samples is still aggregated in `AggregatedSamples`. After that, range samples, branch sample, address samples are computed and recorded.
- Reused `ContextSampleCounterMap` to store the raw profile, since it's no need to aggregation by context, here it just registered one sample counter with a fake context key.
- Unified to use `show-raw-profile` instead of `show-unwinder-output` to dump the intermediate raw profile, see the comments of the format of the raw profile. For CS profile, it remains to output the unwinder output.
Profile generation part will come soon.
Differential Revision: https://reviews.llvm.org/D108153
peter klausler [Thu, 26 Aug 2021 23:01:03 +0000 (16:01 -0700)]
[flang] Fold UNPACK and TRANSPOSE
Implement constant folding for the transformational intrinsic
functions UNPACK and TRANSPOSE.
Differential Revision: https://reviews.llvm.org/D109010
Joel E. Denny [Tue, 31 Aug 2021 19:21:16 +0000 (15:21 -0400)]
[OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in runtime (2/2)
This patch implements OpenMP runtime support for an original OpenMP
extension we have developed to support OpenACC: the `ompx_hold` map
type modifier. The previous patch in this series, D106509, implements
Clang support and documents the new functionality in detail.
Reviewed By: grokos
Differential Revision: https://reviews.llvm.org/D106510
Joel E. Denny [Tue, 31 Aug 2021 19:17:07 +0000 (15:17 -0400)]
[OpenMP][OpenACC] Implement `ompx_hold` map type modifier extension in Clang (1/2)
This patch implements Clang support for an original OpenMP extension
we have developed to support OpenACC: the `ompx_hold` map type
modifier. The next patch in this series, D106510, implements OpenMP
runtime support.
Consider the following example:
```
#pragma omp target data map(ompx_hold, tofrom: x) // holds onto mapping of x
{
foo(); // might have map(delete: x)
#pragma omp target map(present, alloc: x) // x is guaranteed to be present
printf("%d\n", x);
}
```
The `ompx_hold` map type modifier above specifies that the `target
data` directive holds onto the mapping for `x` throughout the
associated region regardless of any `target exit data` directives
executed during the call to `foo`. Thus, the presence assertion for
`x` at the enclosed `target` construct cannot fail. (As usual, the
standard OpenMP reference count for `x` must also reach zero before
the data is unmapped.)
Justification for inclusion in Clang and LLVM's OpenMP runtime:
* The `ompx_hold` modifier supports OpenACC functionality (structured
reference count) that cannot be achieved in standard OpenMP, as of
5.1.
* The runtime implementation for `ompx_hold` (next patch) will thus be
used by Flang's OpenACC support.
* The Clang implementation for `ompx_hold` (this patch) as well as the
runtime implementation are required for the Clang OpenACC support
being developed as part of the ECP Clacc project, which translates
OpenACC to OpenMP at the directive AST level. These patches are the
first step in upstreaming OpenACC functionality from Clacc.
* The Clang implementation for `ompx_hold` is also used by the tests
in the runtime implementation. That syntactic support makes the
tests more readable than low-level runtime calls can. Moreover,
upstream Flang and Clang do not yet support OpenACC syntax
sufficiently for writing the tests.
* More generally, the Clang implementation enables a clean separation
of concerns between OpenACC and OpenMP development in LLVM. That
is, LLVM's OpenMP developers can discuss, modify, and debug LLVM's
extended OpenMP implementation and test suite without directly
considering OpenACC's language and execution model, which can be
handled by LLVM's OpenACC developers.
* OpenMP users might find the `ompx_hold` modifier useful, as in the
above example.
See new documentation introduced by this patch in `openmp/docs` for
more detail on the functionality of this extension and its
relationship with OpenACC. For example, it explains how the runtime
must support two reference counts, as specified by OpenACC.
Clang recognizes `ompx_hold` unless `-fno-openmp-extensions`, a new
command-line option introduced by this patch, is specified.
Reviewed By: ABataev, jdoerfert, protze.joachim, grokos
Differential Revision: https://reviews.llvm.org/D106509
Nikita Popov [Tue, 31 Aug 2021 20:12:13 +0000 (22:12 +0200)]
[LoadStoreVectorizer] Add test for inaccessiblememonly call (NFC)
Fangrui Song [Tue, 31 Aug 2021 20:09:54 +0000 (13:09 -0700)]
[ELF][test] Fix R_AARCH64_ADR_PREL_PG_HI21 typo
Found by redfast00
Louis Dionne [Mon, 30 Aug 2021 20:01:38 +0000 (16:01 -0400)]
[libc++][NFC] Rename _LIBCPP_NODISCARD_ATTRIBUTE to _LIBCPP_NODISCARD
Differential Revision: https://reviews.llvm.org/D108940
Louis Dionne [Tue, 31 Aug 2021 14:41:13 +0000 (10:41 -0400)]
[libc++] Remove workaround for broken __is_trivially_copyable on old GCC
All supported versions of GCC now do the right thing.
Differential Revision: https://reviews.llvm.org/D108997
Sylvestre Ledru [Tue, 31 Aug 2021 19:30:22 +0000 (21:30 +0200)]
Fix some typos in the llvm docs
Michał Górny [Tue, 31 Aug 2021 19:18:40 +0000 (21:18 +0200)]
[lldb] [test] Mark fork-follow-parent-softbp.test as darwin-unsupported
Mehdi Amini [Tue, 31 Aug 2021 18:49:47 +0000 (18:49 +0000)]
Fix MLIR python binding test after changes in ASM printer
Chih-Ping Chen [Mon, 30 Aug 2021 20:38:40 +0000 (16:38 -0400)]
Moved the test to X86 as it's x86 specific.
Arthur O'Dwyer [Tue, 31 Aug 2021 18:29:24 +0000 (14:29 -0400)]
[libc++] Add missing space in (__map_value_compare&__y) etc. NFCI.
peter klausler [Fri, 27 Aug 2021 20:38:06 +0000 (13:38 -0700)]
[flang] Downgrade inappropriate error message to a warning
It may not be great practice to pass a procedure (or procedure pointer)
with an implicit interface as an actual argument to correspond with
a dummy procedure (pointer), but it's not an error. Change to a
warning, and modify tests accordingly.
Differential Revision: https://reviews.llvm.org/D108932
Nick Desaulniers [Tue, 31 Aug 2021 18:11:40 +0000 (11:11 -0700)]
[RISCVISelLowering] avoid emitting libcalls to __mulodi4() and __multi3()
Similar to D108842, D108844, D108926, D108928, and D108936.
__has_builtin(builtin_mul_overflow) returns true for 32b RISCV targets,
but Clang is deferring to compiler RT when encountering long long types.
If the semantics of __has_builtin mean "the compiler resolves these,
always" then we shouldn't conditionally emit a libcall.
Link: https://bugs.llvm.org/show_bug.cgi?id=28629
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D108939
Nikita Popov [Tue, 31 Aug 2021 18:22:47 +0000 (20:22 +0200)]
[SLPVectorizer] Add test for inaccessiblememonly call (NFC)
Fangrui Song [Tue, 31 Aug 2021 18:19:04 +0000 (11:19 -0700)]
[CMake] Remove unneeded -Wdelete-non-virtual-dtor availability check
Available and good in Clang 3.5/GCC 5.
MaheshRavishankar [Tue, 31 Aug 2021 18:10:59 +0000 (11:10 -0700)]
[mlir][Linalg] Drop output tensor from `linalg.pad_tensor` op.
The output tensor was added for tiling purposes. With use of
`TilingInterface` for tiling pad operations, there is no need for an
explicit operand for the shape of result of `linalg.pad_tensor`
op. The interface allows the tiling pattern to query the value that
can be used for the "init" needed for tiling dynamically.
Differential Revision: https://reviews.llvm.org/D108613
Nick Desaulniers [Tue, 31 Aug 2021 18:00:08 +0000 (11:00 -0700)]
[PPCISelLowering] avoid emitting libcalls to __mulodi4()
Similar to D108842, D108844, and D108926.
__has_builtin(builtin_mul_overflow) returns true for 32b PPC targets,
but Clang is deferring to compiler RT when encountering long long types.
This breaks ppc44x_defconfig + CONFIG_BLK_DEV_NBD=y builds of the Linux
kernel that are using builtin_mul_overflow with these types for these
targets.
If the semantics of __has_builtin mean "the compiler resolves these,
always" then we shouldn't conditionally emit a libcall.
This will still need to be worked around in the Linux kernel in order to
continue to support these builds of the Linux kernel for this
target with older releases of clang.
Link: https://bugs.llvm.org/show_bug.cgi?id=28629
Link: https://github.com/ClangBuiltLinux/linux/issues/1438
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D108936
Philip Reames [Tue, 31 Aug 2021 17:59:02 +0000 (10:59 -0700)]
[SCEV] Add a testcase for zero max btc with non-constant exact btc
Reduced from the ArchiveCommandLine.ll case seen in D108848.
Fangrui Song [Tue, 31 Aug 2021 18:00:16 +0000 (11:00 -0700)]
[CMake] Remove unneeded -Wnon-virtual-dtor availability check
For Clang, 3.5 is the minimum requirement which has fixed the bug.
GCC 5 is good as well.
Joe Loser [Tue, 31 Aug 2021 17:41:47 +0000 (13:41 -0400)]
[libcxx][docs] Mark LWG3153 as complete
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D108967
Mehdi Amini [Sat, 28 Aug 2021 03:03:49 +0000 (03:03 +0000)]
Add a new interface allowing to set a default dialect to be used for printing/parsing regions
Currently the builtin dialect is the default namespace used for parsing
and printing. As such module and func don't need to be prefixed.
In the case of some dialects that defines new regions for their own
purpose (like SpirV modules for example), it can be beneficial to
change the default dialect in order to improve readability.
Differential Revision: https://reviews.llvm.org/D107236
Mehdi Amini [Sat, 28 Aug 2021 03:03:15 +0000 (03:03 +0000)]
Change ASM Op printer to print the operation name in the framework instead of leaving it up to each individual operation
This aligns the printer with the parser contract: the operation isn't part of the user-controllable part of the syntax.
Differential Revision: https://reviews.llvm.org/D108804
Mehdi Amini [Sat, 28 Aug 2021 03:02:55 +0000 (03:02 +0000)]
Change dialect `printOperation()` hook to `getOperationPrinter()`
This makes the hook return a printer if available, instead of using LogicalResult to
indicate if a printer was available (and invoked). This allows the caller to detect that
the dialect has a printer for a given operation without actually invoking the printer.
It'll be leveraged in a future revision to move printing the op name itself under control
of the ASMPrinter.
Differential Revision: https://reviews.llvm.org/D108803
peter klausler [Wed, 25 Aug 2021 22:50:34 +0000 (15:50 -0700)]
[flang] Fold PACK()
Implement compile-time constant folding for the transformational
intrinsic function PACK.
Differential Revision: https://reviews.llvm.org/D108956
Vedant Kumar [Tue, 31 Aug 2021 17:49:27 +0000 (10:49 -0700)]
[profile] Specify "-V" to otool to get expected test output
Newer Xcode toolchains ship a new otool implementation that prints out
section contents in a slightly different way than otool-classic. Specify
"-V" to otool to get the expected test output.
Differential Revision: https://reviews.llvm.org/D108929
Joe Nash [Tue, 31 Aug 2021 13:03:12 +0000 (09:03 -0400)]
[AMDGPU] Enable ds_min/ds_max on more subtargets
Adds patterns for f64 ds_min/ds_max. Shrinks HasLDSFPAtomics
scope to enable f32.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D108994
Change-Id: Id890b677841ee588b20d42b1bb3f4cdbf6e9ba1a
Jessica Paquette [Tue, 31 Aug 2021 17:23:17 +0000 (10:23 -0700)]
[GlobalISel] Don't use G_FPTOSI in G_ISNAN legalization
As noted in the comments in D108227, using G_FPTOSI produces wrong results for
G_ISNAN. Drop the G_FPTOSI and perform the operation on integer types.
Elsewhere in LLVM, a bitcast would be the appropriate choice (as it is in SDAG).
GlobalISel does not distinguish between integer and FP types, so a bitcast would
be meaningless here.
David Green [Tue, 31 Aug 2021 17:19:03 +0000 (18:19 +0100)]
[ARM] Add missing validForTailPredication for VMINNM/VMAXNM
Apparently this was missing, preventing the generation of tail
predication loops containing VMINNM, VMAXNM, VMINNMA and VMAXNMA.
David Green [Tue, 31 Aug 2021 13:24:08 +0000 (14:24 +0100)]
[ARM] Test for VMINNM/VMAXNM in tail predicated loops.
Raphael Isemann [Tue, 31 Aug 2021 16:12:51 +0000 (18:12 +0200)]
[lldb] Don't save empty expressions in the multiline editor history
Right now running `expr` to start the multiline expression editor and then
pressing enter causes an empty history empty to be created for the multiline
editor. That doesn't seem very useful for users as pressing the 'up' key will
now also bring up these empty expressions.
I don't think there is ever a use case for recalling a completely empty
expression from the history, so instead don't save those entries to the history
file and make sure we never recall them when navigating over the expression
history.
Note: This is actually a Swift downstream patch that got shipped with Apple's
LLDB for many years. However, this recently started conflicting with upstream
LLDB as D100048 added a test that made sure that empty expression entries don't
crash LLDB. Apple's LLDB was never affected by this crash as it never saved
empty expressions in the first place.
Reviewed By: augusto2112
Differential Revision: https://reviews.llvm.org/D108983
LLVM GN Syncbot [Tue, 31 Aug 2021 16:45:24 +0000 (16:45 +0000)]
[gn build] Port
e983a659e51c
Mark de Wever [Mon, 30 Aug 2021 17:47:55 +0000 (19:47 +0200)]
[libc++][NFC] split <charconv>.
This move the helper types `chars_format`, `to_chars_result` and
`from_chars_result` to a separate header. The first two are needed for
D70631 the third for consistency.
The header `__charconv/ryu.h` uses these types and it can't depend on the
types in `<charconv>` in a modular build. Moving them to the ryu header
would be an odd place and doesn't work since the header is included in the
middle of `<charconv>`.
Reviewed By: #libc, ldionne, Quuxplusone
Differential Revision: https://reviews.llvm.org/D108927
Philip Reames [Tue, 31 Aug 2021 16:29:36 +0000 (09:29 -0700)]
[runtime] Move prolog/epilog block to a post-simplify strategy
The runtime unroller will try to produce a non-loop if the unroll count is 2 and thus the prolog/epilog loop would only run at most one iteration. The old implementation did this by avoiding loop construction entirely. This patches instead constructs the trivial loop and then explicitly breaks the backedge and simplifies. This does result in some additional code churn when triggered, but a) results in better quality code and b) removes a codepath which didn't work properly for multiple exit epilogs.
One oddity that I want to draw to reviewer attention is that this somehow changes revisit order. The new order looks equivalent to me, but I don't understand how creating and erasing an extra loop here creates this effect.
Differential Revision: https://reviews.llvm.org/D108521
Philip Reames [Tue, 31 Aug 2021 16:17:36 +0000 (09:17 -0700)]
[AlignFromAssume] Bailout w/non-constant alignments (pr51680)
This is a bailout for pr51680. This pass appears to assume that the alignment operand to an align tag on an assume bundle is constant. This doesn't appear to be required anywhere, and clang happily generates non-constant alignments for cases such as this case taken from the bug report:
// clang -cc1 -triple powerpc64-- -S -O1 opal_pci-min.c
extern int a[];
long *b;
long c;
void *d(long, int *, int, long, long, long) __attribute__((__alloc_align__(6)));
void e() {
b = d(c, a, 0, 0, 5, c);
b[0] = 0;
}
This was exposed by a SCEV change which allowed a non-constant alignment to reach further into the pass' code. We could generalize the pass, but for now, let's fix the crash.
Shilei Tian [Tue, 31 Aug 2021 16:15:38 +0000 (12:15 -0400)]
[OpenMP] Fix task wait doesn't work as expected in serialized team
As discussed in D107121, task wait doesn't work when a regular task T depends on
a detached task or a hidden helper task T' in a serialized team. The root cause is,
since the team is serialized, the last task will not be tracked by
`td_incomplete_child_tasks`. When T' is finished, it first releases its
dependences, and then decrements its parent counter. So far so good. For the thread
that is running task wait, if at the moment it is still spinning and trying to
execute tasks, it is fine because it can detect the new task and execute it.
However, if it happends to finish the function `flag.execute_tasks(...)`, it will
be broken because `td_incomplete_child_tasks` is 0 now.
In this patch, we update the rule to track children tasks a little bit. If the
task team encounters a proxy task or a hidden helper task, all following tasks
will be tracked.
Reviewed By: AndreyChurbanov
Differential Revision: https://reviews.llvm.org/D107496
Sanjay Patel [Tue, 31 Aug 2021 15:40:57 +0000 (11:40 -0400)]
[InstCombine] fix typos in comments; NFC
Yaron Keren [Tue, 31 Aug 2021 15:02:02 +0000 (18:02 +0300)]
[llvm-lit] unbreak clang-only builds by not assuming llvm-lit in build dir
Reviewed By: tstellar
Differential Revision: https://reviews.llvm.org/D109000
Kazu Hirata [Tue, 31 Aug 2021 15:53:51 +0000 (08:53 -0700)]
[clang] Remove redundant calls to c_str() (NFC)
Identified with readability-redundant-string-cstr.
Fanbo Meng [Tue, 31 Aug 2021 14:48:18 +0000 (10:48 -0400)]
[SystemZ][z/OS] Create html report file with text flag
Change OF_None to OF_Text flag in file creation, same reasoning as https://reviews.llvm.org/D97785
Reviewed By: abhina.sreeskantharajan
Differential Revision: https://reviews.llvm.org/D108998
Philip Reames [Tue, 31 Aug 2021 15:43:29 +0000 (08:43 -0700)]
[SCEV] If max BTC is zero, then so is the exact BTC [1 of N]
This patch is specifically the howManyLessThan case. There will be a couple of followon patches for other codepaths.
The subtle bit is explaining why the two codepaths have a difference while both are correct. The test case with modifications is a good example, so let's discuss in terms of it.
* The previous exact bounds for this example of (-126 + (126 smax %n))<nsw> can evaluate to either 0 or 1. Both are "correct" results, but only one of them results in a well defined loop. If %n were 127 (the only possible value producing a trip count of 1), then the loop must execute undefined behavior. As a result, we can ignore the TC computed when %n is 127. All other values produce 0.
* The max taken count computation uses the limit (i.e. the maximum value END can be without resulting in UB) to restrict the bound computation. As a result, it returns 0 which is also correct.
WARNING: The logic above only holds for a single exit loop. The current logic for max trip count would be incorrect for multiple exit loops, except that we never call computeMaxBECountForLT except when we can prove either a) no overflow occurs in this IV before exit, or b) this is the sole exit.
An alternate approach here would be to add the limit logic to the symbolic path. I haven't played with this extensively, but I'm hesitant because a) the term is optional and b) I'm not sure it'll reliably simplify away. As such, the resulting code quality from expansion might actually get worse.
This was noticed while trying to figure out why D108848 wasn't NFC, but is otherwise standalone.
Differential Revision: https://reviews.llvm.org/D108921
Paul Robinson [Tue, 31 Aug 2021 15:45:53 +0000 (08:45 -0700)]
Make a generic test generic again.
Tests in CodeGen/Generic should not depend on any specific target.
gbreynoo [Tue, 31 Aug 2021 15:41:08 +0000 (16:41 +0100)]
[OptTable] Improve error message output for grouped short options
As seen in https://bugs.llvm.org/show_bug.cgi?id=48880 the current
implementation for parsing grouped short options can return unclear
error messages. This change fixes the example given in the ticket in
which a flag is incorrectly given an argument. Also when parsing a
group we now keep reading past the first incorrect option and output
errors for all incorrect options in the group.
Differential Revision: https://reviews.llvm.org/D108770
Vassil Vassilev [Tue, 31 Aug 2021 15:19:17 +0000 (15:19 +0000)]
[clang-repl] Install clang-repl
This is essentially what D106813 was supposed to do but did not.
Differential revision: https://reviews.llvm.org/D108919
Hussain Kadhem [Tue, 31 Aug 2021 15:01:32 +0000 (17:01 +0200)]
[VP] implementation of sdag support for VP memory intrinsics
Followup to D99355: SDAG support for vector-predicated load/store/gather/scatter.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D105871
Louis Dionne [Tue, 31 Aug 2021 14:29:22 +0000 (10:29 -0400)]
[libc++][NFC] Add missing HIDE_FROM_ABI on implementation detail __launder
Nemanja Ivanovic [Tue, 31 Aug 2021 13:33:43 +0000 (08:33 -0500)]
Revert "[DebugInfo] Emit DW_TAG_namelist and DW_TAG_namelist_item"
This reverts commit
0a6fad754ed8f0812dd57357ce8071b02e962259.
It caused failures on a number of PowerPC bots.
Kuba Mracek [Tue, 31 Aug 2021 14:06:04 +0000 (07:06 -0700)]
[GlobalDCE] Handle relative pointers in VFE (for Swift vtables)
To support Virtual Function Elimination to Swift, this PR adds support for Swift
vtables which contain "relative pointers" instead of direct pointer references.
These are in the form of:
@symbol = ... {
i32 trunc (i64 sub (i64 ptrtoint (<type> @target to i64), i64 ptrtoint (... @symbol to i64)) to i32)
}
The PR extends GlobalDCE's way of looking up a vtable offset into a dependency
to be able to see through this expression and find the target symbol.
Differential Revision: https://reviews.llvm.org/D107645
Sanjay Patel [Tue, 31 Aug 2021 13:42:13 +0000 (09:42 -0400)]
[InstCombine] fix propagation of FMF through select-of-fnegs
The existing code was unquestionably wrong - it looked at one
fneg and ignored the other 2 instructions.
It was also untested, so it didn't make the list of bugs
flagged by Alive2.
This is an unusual propagation, but Alive2 agress that we
can intersect the fnegs and union that with the select,
then apply the results to both new instructions:
https://alive2.llvm.org/ce/z/SF8_dt
LLVM GN Syncbot [Tue, 31 Aug 2021 13:47:38 +0000 (13:47 +0000)]
[gn build] Port
3285c7a4364e
Xiang Xiao [Tue, 31 Aug 2021 13:46:37 +0000 (09:46 -0400)]
[libcxx] Remove the locale fallback for NuttX
Since these functions can handled by NuttX's libc now
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D108895
Anton Afanasyev [Tue, 31 Aug 2021 13:08:30 +0000 (16:08 +0300)]
[SLPVectorizer][Test] Add test for extractelements with (non)const indices (NFC)
Add test for an issue discussed here: https://reviews.llvm.org/D108703#2974289
Sanjay Patel [Fri, 27 Aug 2021 18:07:44 +0000 (14:07 -0400)]
[InstCombine] add tests for FMF propagation for select-of-fneg; NFC
Sanjay Patel [Tue, 31 Aug 2021 13:02:14 +0000 (09:02 -0400)]
[InstCombine] fix typo; NFC
Anton Afanasyev [Tue, 31 Aug 2021 12:25:14 +0000 (15:25 +0300)]
Revert "[SLP]No need to schedule/check parent for extract{element/value} instruction."
Revert since introduced issure reported here:
https://lists.llvm.org/pipermail/llvm-dev/2021-August/152411.html
Discussed starting from here: https://reviews.llvm.org/D108703#2974289
This reverts commit
a36bc873a269dca0c5399d72bfdd42d3ddc72671.
Michał Górny [Sun, 11 Apr 2021 11:08:05 +0000 (13:08 +0200)]
[lldb] [gdb-remote client] Remove breakpoints in forked processes
Remove software breakpoints from forked processes in order to restore
the original program code before detaching it.
Differential Revision: https://reviews.llvm.org/D100263
Andy Yankovsky [Tue, 31 Aug 2021 11:36:53 +0000 (13:36 +0200)]
Revert "[lldb] Add minidump save-core functionality to ELF object files"
This reverts commit
aafa05e03d629cc6605718c54575256d9d683659.
Broke builder on aarch64 --
https://lab.llvm.org/buildbot/#/builders/96/builds/10926
Simon Pilgrim [Tue, 31 Aug 2021 11:19:58 +0000 (12:19 +0100)]
[MCA][X86] Add basic coverage for icelake arch
Copy the skylake-avx512 tests for icelake-server coverage.
Add icelake/rocketlake/tigerlake test coverage to the relevent generic tests as well.
Andrej Korman [Tue, 31 Aug 2021 09:52:41 +0000 (11:52 +0200)]
[lldb] Add minidump save-core functionality to ELF object files
This change adds save-core functionality into the ObjectFileELF that enables
saving minidump of a stopped process. This change is mainly targeting Linux
running on x86_64 machines. Minidump should contain basic information needed
to examine state of threads, local variables and stack traces. Full support
for other platforms is not so far implemented. API tests are using LLDB's
MinidumpParser.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D108233
Simon Pilgrim [Tue, 31 Aug 2021 09:49:42 +0000 (10:49 +0100)]
[X86] Copy X86SchedSkylakeServer.td to X86SchedIceLake.td
Icelake, Rocketlake and Tigerlake targets currently use the SkylakeServer scheduler model, despite being a later microarchitecture, leading to both reported bugs (PR48110) and discrepancies when comparing llvm-mca reports to other profiling tools (OSACA, uops, uica, etc.). And tbh I'm getting sick of llvm-mca getting blamed for what are backend scheduler model issues :-(
This patch doesn't attempt to fix any of these discrepancies - there should be no changes in codegen - its a setup patch that copies the skx model, renames all the resources, adds the additional ports (but doesn't reference them yet) and updates the llvm-exegesis pfm counter mappings (based off https://sourceforge.net/p/perfmon2/libpfm4/ci/master/tree/lib/events/intel_icl_events.h).
This should make it trivial for anyone with hardware access to use llvm-exegesis reports to iteratively improve the model (my attempts to get hold of a cheap tiger lake box haven't been fruitful yet....).
I will copy the SkylakeServer llvm-mca resource tests as follow up commits - the diff should entirely be the resource renames.
Differential Revision: https://reviews.llvm.org/D108914
Douglas Yung [Tue, 31 Aug 2021 10:26:54 +0000 (03:26 -0700)]
Fix test by adding REQUIRES: x86-registered-target to skip test in configurations that do not include x86.
Tres Popp [Tue, 17 Aug 2021 13:28:26 +0000 (15:28 +0200)]
[mlir] Prevent assertion failure in DropUnitDims
Don't assert fail on strided memrefs when dropping unit dims.
Instead just leave them unchanged.
Differential Revision: https://reviews.llvm.org/D108205
marina kolpakova a.k.a. geexie [Sun, 29 Aug 2021 15:54:35 +0000 (18:54 +0300)]
[mlir][gpu] folds memref.dim of gpu.alloc
implements canonicalization which folds memref.dim(gpu.alloc(%size), %idx) -> %size
Differential Revision: https://reviews.llvm.org/D108892
Justas Janickas [Tue, 24 Aug 2021 10:59:42 +0000 (11:59 +0100)]
[OpenCL] Defines helper function for kernel language compatible OpenCL version
This change defines a helper function getOpenCLCompatibleVersion()
inside LangOptions class. The function contains mapping between
C++ for OpenCL versions and their corresponding compatible OpenCL
versions. This mapping function should be updated each time a new
C++ for OpenCL language version is introduced. The helper function
is expected to simplify conditions on OpenCL C and C++ for OpenCL
versions inside compiler code.
Code refactoring performed.
Differential Revision: https://reviews.llvm.org/D108693
Jason Molenda [Tue, 31 Aug 2021 08:32:52 +0000 (01:32 -0700)]
Use dSYM's file addr for Sections when it doesn't match binary
When adding a dSYM to a Module and it has different file addresses
from the already-present ObjectFile binary, change the Sections to
use the dSYM's file addresses so the symbol table and DWARF are
properly contained in the Sections. Previously this was only done
for IsInMemory ObjectFiles, but it's more common than that.
Differential Revision: https://reviews.llvm.org/D108889
rdar://
81504400
Shivam Gupta [Tue, 31 Aug 2021 07:31:51 +0000 (13:01 +0530)]
[NFC] Correct typo in CodeGenMapTable.cpp, patch by Jordi
CodeGenMapTable.cpp refers to TableGen as TabelGen in the comments. This appears to be a typo. This patch fixes the typo.
Differential Revision: https://reviews.llvm.org/D76343
Simon Wallis [Tue, 31 Aug 2021 07:16:26 +0000 (08:16 +0100)]
[Arm] Add assert in T2 Imm7s code emitter
Add assert to provoke failure in object file output, not just in disassembly output.
Reviewed By: yroux
Differential Revision: https://reviews.llvm.org/D107259
Shivam Gupta [Tue, 31 Aug 2021 07:01:24 +0000 (12:31 +0530)]
Fix typo in two files in Clang, patch by FusionBolt
Reviewed By: xgupta
Differential Revision: https://reviews.llvm.org/D98254
Shivam Gupta [Tue, 31 Aug 2021 06:36:00 +0000 (12:06 +0530)]
[clang] Fix Typo in AST Matcher Reference
In [[ https://clang.llvm.org/docs/LibASTMatchersReference.html | AST Matcher Reference]], the example of matcher `hasDeclContext` contained a typo.
`cxxRcordDecl` was changed to `cxxRecordDecl`.
Differential Revision: https://reviews.llvm.org/D102836
Kai Luo [Tue, 31 Aug 2021 06:46:15 +0000 (06:46 +0000)]
[AIX] Rename shared_libraries_to_archive -> objects_to_archive. NFC.
Doug Beck [Tue, 31 Aug 2021 06:30:00 +0000 (12:00 +0530)]
Fix typo s/beloinging/belonging
Differential Revision: https://reviews.llvm.org/D107099
Alexander Pivovarov [Tue, 31 Aug 2021 06:20:37 +0000 (11:50 +0530)]
Fix typo in comments
Reviewed By: MaskRay, jsji
Differential Revision: https://reviews.llvm.org/D108857
Shivam Gupta [Tue, 31 Aug 2021 06:15:00 +0000 (11:45 +0530)]
[LLDB][Docs] Move best-practices.txt contain to resources/test.rst
This file contain some old reference to files those are now either renamed or replaced.
Also this .txt file didn't generate to html during the sphnix documentation build so I send its contents to resources/test.rst file.
Signed-off-by: Shivam Gupta <shivam98.tkg@gmail.com>
Reviewed By: teemperor, mgorny, JDevlieghere
Differential Revision: https://reviews.llvm.org/D108812
Shivam Gupta [Fri, 27 Aug 2021 07:44:57 +0000 (13:14 +0530)]
[LLDB][Docs] Convert some .txt files to .rst
Upadate some .txt files to .rst for consistency as most
of the documentation is written in reStructuredText format.
Signed-off-by: Shivam Gupta <shivam98.tkg@gmail.com>
Differential Revision: https://reviews.llvm.org/D108807
Shivam Gupta [Tue, 31 Aug 2021 06:08:23 +0000 (11:38 +0530)]
[Docs][Phabricator] Mention how to create a draft revision
https://llvm.org/docs/Phabricator.html have two links to Arcnist guide but
none of them mention how to create a draft revision. It would create some less noise if
developers create draft revisoin in this(--draft) way instead of [WIP] tag way.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D108970
Shivam Gupta [Tue, 31 Aug 2021 06:03:30 +0000 (11:33 +0530)]
[Docs] Remove subversion reference from MyFirstTypoFix.rst
David Blaikie [Tue, 31 Aug 2021 05:38:40 +0000 (22:38 -0700)]
DebugInfo: Refactor/deduplicate various template argument list emission
Streamline template arguments across types, variables, and functions -
for convenient reuse in experiments related to template argument list
reconstitution (not including template argument lists in the "name" of
those entities, and leaving it to debug info consumers to rebuild the
full template name from the semantic descriptions of the argument lists)
But the change seems like a good refactoring/cleanup anyway.
I'd certainly be open to suggestions about how this might be more
streamlined - like is there no generic way to query template argument
lists across the 3 kinds of entities, rather than needing special case
code?
Stella Laurenzo [Tue, 24 Aug 2021 03:01:07 +0000 (20:01 -0700)]
[mlir][python] Apply py::module_local() to all classes.
* This allows multiple MLIR-API embedding downstreams to co-exist in the same process.
* I believe this is the last thing needed to enable isolated embedding.
Differential Revision: https://reviews.llvm.org/D108605
Heejin Ahn [Mon, 30 Aug 2021 21:48:33 +0000 (14:48 -0700)]
[WebAssembly] Free setjmpTable before exiting calls in EmSjLj
This is an improvement over D107852. We don't need to enumerate specific
function names; we can just check for `noreturn` attribute. This also
requires us to make sure `__resumeExeption` and `emscripten_longjmp`
have `noreturn` attribute too; one of them is a JS function and the
other calls a JS function so Clang does not have a way to deduce they
don't return.
This is effectively NFC, because I'm not sure if there is an additional
case this case covers; if we add a custom function call that has
`noreturn` attribute, it will be processed within the SjLj handling and
turned into `__invoke` call. So this really applies to some special
functions like `emscripten_longjmp`.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D108955
Heejin Ahn [Sat, 28 Aug 2021 05:14:49 +0000 (22:14 -0700)]
[WebAssembly] Share rethrowing BBs in LowerEmscriptenEHSjLj
There are three kinds of "rethrowing" BBs in this pass:
1. In Emscripten SjLj, after a possibly longjmping function call, we
check if the thrown longjmp corresponds to one of setjmps within the
current function. If not, we rethrow the longjmp by calling
`emscripten_longjmp`.
2. In Emscripten EH, after a possibly throwing function call, we check
if the thrown exception corresponds to the current `catch` clauses.
If not, we rethrow the exception by calling `__resumeException`.
3. When both Emscripten EH and SjLj are used, when we check for an
exception after a possibly throwing function call, it is possible
that we get not an exception but a longjmp. In this case, we
shouldn't swallow it; we should rethrow the longjmp by calling
`emscripten_longjmp`.
4. When both Emscripten EH and SjLj are used, when we check for a
longjmp after a possibly longjmping function call, it is possible
that we get not a longjmp but an exception. In this case, we
shouldn't swallot it; we should rethrow the exception by calling
`__resumeException`.
Case 1 is in Emscripten SjLj, 2 is in Emscripten EH, and 3 and 4 are
relevant when both Emscripten EH and SjLj are used. 3 and 4 were first
implemented in D106525.
We create BBs for 1, 3, and 4 in this pass. We create those BBs for
every throwing/longjmping function call, along with other BBs that
contain condition checks. What this CL does is to create a single BB
within a function for each of 1, 3, and 4 cases. These BBs are exiting
BBs in the function and thus don't have successors, so easy to be shared
between calls.
The names of BBs created are:
Case 1: `call.em.longjmp`
Case 3: `rethrow.exn`
Case 4: `rethrow.longjmp`
For the case 2 we don't currently create BBs; we only replace the
existing `resume` instruction with `call @__resumeException`. And Clang
already creates only a single `resume` BB per function and reuses it,
so we don't need to optimize this case.
Not sure what are good benchmarks for EH/SjLj, but this decreases the
size of the object file for `grfmt_jpeg.bc` (presumably from opencv) we
got from one of our users by 8.9%. Even after running `wasm-opt -O4` on
them, there is still 4.8% improvement.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D108945
Hongtao Yu [Wed, 25 Aug 2021 18:40:34 +0000 (11:40 -0700)]
[CSSPGO] Split context string to deduplicate function name used in the context.
Currently context strings contain a lot of duplicated function names and that significantly increase the profile size. This change split the context into a series of {name, offset, discriminator} tuples so function names used in the context can be replaced by the index into the name table and that significantly reduce the size consumed by context.
A follow-up improvement made in the compiler and profiling tools is to avoid reconstructing full context strings which is time- and memory- consuming. Instead a context vector of `StringRef` is adopted to represent the full context in all scenarios. As a result, the previous prevalent profile map which was implemented as a `StringRef` is now engineered as an unordered map keyed by `SampleContext`. `SampleContext` is reshaped to using an `ArrayRef` to represent a full context for CS profile. For non-CS profile, it falls back to use `StringRef` to represent a contextless function name. Both the `ArrayRef` and `StringRef` objects are underpinned by real array and string objects that are stored in producer buffers. For compiler, they are maintained by the sample reader. For llvm-profgen, they are maintained in `ProfiledBinary` and `ProfileGenerator`. Full context strings can be generated only in those cases of debugging and printing.
When it comes to profile format, nothing has changed to the text format, though internally CS context is implemented as a vector. Extbinary format is only changed for CS profile, with an additional `SecCSNameTable` section which stores all full contexts logically in the form of `vector<int>`, which each element as an offset points to `SecNameTable`. All occurrences of contexts elsewhere are redirected to using the offset of `SecCSNameTable`.
Testing
This is no-diff change in terms of code quality and profile content (for text profile).
For our internal large service (aka ads), the profile generation is cut to half, with a 20x smaller string-based extbinary format generated.
The compile time of ads is dropped by 25%.
Differential Revision: https://reviews.llvm.org/D107299
MaheshRavishankar [Tue, 31 Aug 2021 02:29:34 +0000 (19:29 -0700)]
Fix unused variable in release build.
Differential Revision: https://reviews.llvm.org/D108963
Xu Mingjie [Tue, 31 Aug 2021 02:15:57 +0000 (10:15 +0800)]
[tsan] Add environment variable TSAN_SYMBOLIZER_PATH as we do in other sanitizers
ASan, LSan, MSan and UBSan all allow to use environment variable `*SAN_SYMBOLIZER_PATH` to pass the symbolizer path, this patch add `TSAN_SYMBOLIZER_PATH` to TSan.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D108911
Nico Weber [Mon, 30 Aug 2021 18:32:29 +0000 (14:32 -0400)]
[lld/mac] Leave more room for thunks in thunk placement code
Fixes PR51578 in practice.
Currently there's only enough room for a single thunk, which for real-life code
isn't enough. The error case only happens when there are many branch statements
very close to each other (0 or 1 instructions apart), with the function at the
finalization barrier small.
There's a FIXME on what to do if we hit this case, but that suggestion sounds
complicated to me (see end of PR51578 comment 5 for why).
Instead, just leave more room for thunks. Chromium's unit_tests links fine with
room for 3 thunks. Leave room for 100, which should fix this for most cases in
practice.
There's little cost for leaving lots of room: This slop value only determines
when we finalize sections, and we insert thunks for forward jumps into
unfinalized sections. So leaving room means we'll need a few more thunks, but
the thunk jump range is 128 MiB while a single thunk is just 12 bytes.
For Chromium's unit_tests:
With a slop of 3: thunk calls = 355418, thunks = 10903
With a slop of 100: thunk calls = 355426, thunks = 10904
Chances are 100 is enough for all use cases we'll hit in practice, but even
bumping it to 1000 would probably be fine.
Differential Revision: https://reviews.llvm.org/D108930
Volodymyr Sapsai [Wed, 28 Jul 2021 16:33:44 +0000 (09:33 -0700)]
[modules] Fix miscompilation when using two RecordDecl definitions with the same name.
When deserializing a RecordDecl we don't enforce that redeclaration
chain contains only a single definition. So if the canonical decl is not
a definition itself, `RecordType::getDecl` can return different objects
before and after an include. It means we can build CGRecordLayout for
one RecordDecl with its set of FieldDecl but try to use it with
FieldDecl belonging to a different RecordDecl. With assertions enabled
it results in
> Assertion failed: (FieldInfo.count(FD) && "Invalid field for record!"),
> function getLLVMFieldNo, file llvm-project/clang/lib/CodeGen/CGRecordLayout.h, line 199.
and with assertions disabled a bunch of fields are treated as their
memory is located at offset 0.
Fix by keeping the first encountered RecordDecl definition and marking
the subsequent ones as non-definitions. Also need to merge FieldDecl
properly, so that `getPrimaryMergedDecl` works correctly and during name
lookup we don't treat fields from same-name RecordDecl as ambiguous.
rdar://
80184238
Differential Revision: https://reviews.llvm.org/D106994
Keith Smiley [Fri, 27 Aug 2021 06:36:49 +0000 (23:36 -0700)]
[llvm-cov][NFC] Add test for coverage-prefix-map remappings
This test covers acts as a regression test for these fixes:
c75a0a1e9dc29be4e00d37d0d00288afc1a6153f
dd388ba3e0b0a5f06565d0bcb6e1aebb5daac065
Differential Revision: https://reviews.llvm.org/D108805
MaheshRavishankar [Mon, 30 Aug 2021 22:55:30 +0000 (15:55 -0700)]
[mlir] Add an interface to allow operations to specify how they can be tiled.
An interface to allow for tiling of operations is introduced. The
tiling of the linalg.pad_tensor operation is modified to use this
interface.
Differential Revision: https://reviews.llvm.org/D108611
peter klausler [Tue, 24 Aug 2021 23:51:44 +0000 (16:51 -0700)]
[flang] Fold EOSHIFT
Implement constant folding for the transformational intrinsic
function EOSHIFT.
Differential Revision: https://reviews.llvm.org/D108941