Simon Pilgrim [Sat, 25 Sep 2021 11:57:33 +0000 (12:57 +0100)]
[InstCombine] Ensure shifts are in range for (X << C1) / C2 -> X fold.
We can get here before out of range shift amounts have been handled - limit to BW-2 for sdiv and BW-1 for udiv
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38078
Markus Böck [Sat, 25 Sep 2021 11:13:11 +0000 (13:13 +0200)]
[CMake] Consistently use the LibXml2::LibXml2 target instead of LIBXML2_LIBRARIES
Linking against the LibXml2::LibXml2 target has the advantage of not only importing the library, but also adding the include path as well as any definitions the library requires. In case of a static build of libxml2, eg. a define is set on Windows to remove any DLL imports and export.
LLVM already makes use of the target, but c-index-test and lldb were still linking against the library only.
The workaround for Mac OS-X that I removed seems to have also been made redundant since https://reviews.llvm.org/D84563 I believe
Differential Revision: https://reviews.llvm.org/D109975
Simon Pilgrim [Sat, 25 Sep 2021 10:58:06 +0000 (11:58 +0100)]
[IR] DIBuilder::createEnumerator - pass APSInt by const reference
Avoid unnecessary copy by value.
Simon Pilgrim [Sat, 25 Sep 2021 10:56:35 +0000 (11:56 +0100)]
[DAG] combineShiftToMULH - move getValueType() inside assert. NFCI.
Avoids an unnecessary (void).
Kunwar Shaanjeet Singh Grover [Sat, 25 Sep 2021 10:31:17 +0000 (16:01 +0530)]
[MLIR] Add functionality to remove redundant local variables
This patch adds functionality to FlatAffineConstraints to remove local
variables using equalities. This helps in keeping output representation of
FlatAffineConstraints smaller.
This patch is part of a series of patches aimed at generalizing affine
dependence analysis.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D110056
David Green [Sat, 25 Sep 2021 10:32:25 +0000 (11:32 +0100)]
[ARM] Fix Arm block placement creating branches after jump tables.
Given:
- A jump table
- Which jumps to the next block
- The next block ends in a WLS
- Where the WLS conditionally jumps to block earlier in the program.
The Arm block placement pass would attempt to move the block containing
the WLS earlier, as the WLS instruction can only branch forward. In
doing so it would add a branch from the jumptable block to the WLS
block, thinking it previously fell-through.
This in itself would be fine, if a little inefficient, but the constant
island pass expects all instructions after a jump-table branch to have
been removed by analyzeBranch. So it gets confused and can assign the
same labels to multiple jump table blocks.
I've changed the condition to the same as used in analyzeBranch.
Dmitry Vyukov [Sat, 25 Sep 2021 09:56:53 +0000 (11:56 +0200)]
tsan: uninline RacyStacks::operator==
It's only used during race reporting.
There is no point in polluting the main header file with it.
Reviewed By: xgupta
Differential Revision: https://reviews.llvm.org/D110470
Simon Pilgrim [Sat, 25 Sep 2021 09:50:54 +0000 (10:50 +0100)]
[TTI] getUserCost - Ensure a vector insert/extract index is in unsigned 32-bit range
Otherwise fallback to the generic 'unknown index' path
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29050
Jim Lin [Sat, 25 Sep 2021 03:25:02 +0000 (11:25 +0800)]
[RISCV] Fix incorrect operand type of inst alias for InstR4
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D110381
Matheus Izvekov [Fri, 24 Sep 2021 20:18:54 +0000 (22:18 +0200)]
[clang] set templates as invalid when any of the parameters are invalid
See PR51872 for the original repro.
This fixes a crash when converting a templated constructor into a deduction
guide, in case any of the template parameters were invalid.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D110460
Amara Emerson [Sat, 25 Sep 2021 01:25:23 +0000 (18:25 -0700)]
[AArch64][AMDGPU] Re-generate some tests with CHECK-NEXT to prepare for a patch.
Petr Hosek [Sat, 25 Sep 2021 00:56:00 +0000 (17:56 -0700)]
[CMake] Pass through CMAKE_READELF to subbuilds
This matches handling of other CMake variables.
Differential Revision: https://reviews.llvm.org/D110463
Jason Molenda [Sat, 25 Sep 2021 00:11:54 +0000 (17:11 -0700)]
Add pragma to make it easier to find "image list" impl
I couldn't find it; make this easier for next time.
David Blaikie [Mon, 20 Sep 2021 04:03:20 +0000 (21:03 -0700)]
DebugInfo: Use the signedness of the underlying enum when encoding enum non-type-template-parameters
This improves the accuracy of the debug info and improves round tripping
through -gsimple-template-names.
River Riddle [Fri, 24 Sep 2021 23:45:25 +0000 (23:45 +0000)]
[mlir:ElementsAttr] Avoid crash on empty contiguous ranges
We currently, incorrectly, assume that a range always has at least
one element when building a contiguous range. This commit adds
a proper empty check to avoid crashing.
Differential Revision: https://reviews.llvm.org/D110457
modimo [Fri, 24 Sep 2021 23:42:30 +0000 (16:42 -0700)]
[llvm-profdata] Extend support of --topn to sample profiles
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D110449
Nico Weber [Fri, 24 Sep 2021 22:48:08 +0000 (18:48 -0400)]
[llvm] Remove LLVM_CHECK_ENABLED_PROJECTS again
This reverts commit
55f0b337087136554122f942fea951a357bc4a49 and
follow-up reverts commit
e9ea03c62ccc1ed4e3ed4f20e37640cfdd76cbcf.
LLVM_EXTERNAL_PROJECTS is sufficient, see https://reviews.llvm.org/D110016
Nico Weber [Fri, 24 Sep 2021 22:43:51 +0000 (18:43 -0400)]
Revert "[Driver] Correctly handle static C++ standard library"
This reverts commit
03142c5f67788bcc1573f76732d0fccd75c6b965.
Breaks check-asan if system ld doesn't support --push-state, even
if lld was built and is used according to lit's output.
See comments on https://reviews.llvm.org/D110128
Konrad Kleine [Fri, 24 Sep 2021 22:29:13 +0000 (00:29 +0200)]
[llvm] Improve export.sh with help and snapshot
This change adds the ability to create source tarballs for unreleased or untagged code by providing the `--git-ref <GIT_REF>` flag to the `llvm/utils/release/export.sh` script. This is useful for creating daily snapshot tarballs that can easily be consumed by packagers who want to build a daily snapshot.
The default behavior of `export.sh` hasn't changed.
You may also provide a `--template` argument to say how the artifacts
are supposed to be named (as suggested by @hans).
The `-help` output of `export.sh` was changed quite significantly to look like this:
```
Export the Git sources and build tarballs from them.
Usage: export.sh [-release|--release <major>.<minor>.<patch>]
[-rc|--rc <num>]
[-final|--final]
[-git-ref|--git-ref <git-ref>]
[-template|--template <template>]
Flags:
-release | --release <major>.<minor>.<patch> The version number of the release
-rc | --rc <num> The release candidate number
-final | --final When provided, this option will disable the rc flag
-git-ref | --git-ref <git-ref> (optional) Use <git-ref> to determine the release and don't export the test-suite files
-template | --template <template> (optional) Possible placeholders: $PROJECT $YYYYMMDD $GIT_REF $RELEASE $RC.
Defaults to '${PROJECT}-${RELEASE}${RC}.src.tar.xz'.
The following list shows the filenames (with <placeholders>) for the artifacts
that are being generated (given that you don't touch --template).
* llvm-<RELEASE><RC>.src.tar.xz
* clang-<RELEASE><RC>.src.tar.xz
* compiler-rt-<RELEASE><RC>.src.tar.xz
* libcxx-<RELEASE><RC>.src.tar.xz
* libcxxabi-<RELEASE><RC>.src.tar.xz
* libclc-<RELEASE><RC>.src.tar.xz
* clang-tools-extra-<RELEASE><RC>.src.tar.xz
* polly-<RELEASE><RC>.src.tar.xz
* lldb-<RELEASE><RC>.src.tar.xz
* lld-<RELEASE><RC>.src.tar.xz
* openmp-<RELEASE><RC>.src.tar.xz
* libunwind-<RELEASE><RC>.src.tar.xz
* flang-<RELEASE><RC>.src.tar.xz
Additional files being generated:
* llvm-project-<RELEASE><RC>.src.tar.xz (the complete LLVM source project)
* test-suite-<RELEASE><RC>.src.tar.xz (only when not using --git-ref)
To ease the creation of snapshot builds, we also provide these files
* llvm-release-<YYYYMMDD>.txt (contains the <RELEASE> as a text)
* llvm-rc-<YYYYMMDD>.txt (contains the rc version passed to the invocation of export.sh)
* llvm-git-revision-<YYYYMMDD>.txt (contains the current git revision sha1)
Example values for the placeholders:
* <RELEASE> -> 13.0.0
* <YYYYMMDD> ->
20210414
* <RC> -> rc4 (will be empty when using --git-ref)
In order to generate snapshots of the upstream main branch you could do this for example:
export.sh --git-ref upstream/main --template '${PROJECT}-${YYYYMMDD}.src.tar.xz'
```
Reviewed By: tstellar
Differential Revision: https://reviews.llvm.org/D101446
Wei Mi [Fri, 24 Sep 2021 22:35:07 +0000 (15:35 -0700)]
Add "REQUIRES: zlib" in forward-compatible.test since it handles compressed file.
Wei Mi [Fri, 24 Sep 2021 22:20:16 +0000 (15:20 -0700)]
Fixed a bug in https://reviews.llvm.org/rG8eb617d719bdc6a4ed7773925d2421b9bbdd4b7a.
For compressed profile when reading an unknown section, the data reader pointer
adjustment was incorrect. This patch fixed that.
Craig Topper [Fri, 24 Sep 2021 21:29:55 +0000 (14:29 -0700)]
[RISCV] Add another isel optimization for (and (shl X, c2), c1).
Where c1 is a shifted mask with 32-c2 leading zeros and c3 trailing
zeros and c3>c2. We can select it as (slli (srliw X, c3-c2), c3).
Jonas Devlieghere [Fri, 24 Sep 2021 22:06:39 +0000 (15:06 -0700)]
[dsymutil] Update union-fwd-decl.test for Windows
Remove path separators from CHECK-lines in union-fwd-decl.test
Jonas Devlieghere [Fri, 24 Sep 2021 21:59:58 +0000 (14:59 -0700)]
[lldb] Copy the system debugserver in LLDB.framework
When using the system debugserver for testing, copy the binary in the
LLDB.framework Resource directory instead of the build's bin directory.
rdar://
82998263
Lang Hames [Fri, 24 Sep 2021 20:51:36 +0000 (13:51 -0700)]
[ORC] Allow construction of an ExecutorAddrRange from an addr and a size.
David Blaikie [Mon, 20 Sep 2021 04:04:03 +0000 (21:04 -0700)]
WIP: Verify -gsimple-template-names=mangled values
Clang will encode names that should be able to be simplified as
"_STNname|<template, args>" (eg: "_STNt1|<int>") - this verification
mode will detect these names, decode them, create the original name
("t1<int>") and the simple name ("t1") - letting the simple name run
through the usual rebuilding logic - then compare the two sources of the
full name - the rebuilt and the _STN encoding.
This helps ensure that -gsimple-template-names is lossless.
Jonas Devlieghere [Fri, 24 Sep 2021 20:23:29 +0000 (13:23 -0700)]
[dsymutil] Track incompleteness across unions
When determining the incompleteness of a DIE based on its children, make
sure we propagate it across union types. See test case for an example.
Without this patch we never emit the definition of Container_ivars.
Differential revision: https://reviews.llvm.org/D110443
wlei [Sun, 19 Sep 2021 23:17:37 +0000 (16:17 -0700)]
[llvm-profgen] Unify output format of different unsymbolized profiles
Differential Revision: https://reviews.llvm.org/D110080
wlei [Fri, 24 Sep 2021 05:53:12 +0000 (22:53 -0700)]
[AutoFDO][llvm-profgen] Report zero count for unexecuted part of function code
In order to be consistent with compiler that interprets zero count as unexecuted(cold), this change reports zero-value count for unexecuted part of function code. For the implementation, it leverages the range counter, initializes all the executed function range with the zero-value. After all ranges are merged and converted into disjoint ranges, the remaining zero count will indicates the unexecuted(cold) part of the function.
This change also extends the current `findDisjointRanges` method which now can support adding zero-value range.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D109713
Lei Zhang [Fri, 24 Sep 2021 20:57:46 +0000 (16:57 -0400)]
[mlir][tosa] Do not fold transpose with quantized types
For such cases, the type of the constant DenseElementsAttr is
different from the transpose op return type.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D110446
wlei [Thu, 23 Sep 2021 03:00:24 +0000 (20:00 -0700)]
[AutoFDO][llvm-profgen] Profile generation for LBR(non-CS) sample
This patch introduces non-CS AutoFDO profile generation into LLVM. The profile is supposed to be well consumed by compiler using `-fprofile-sample-use=[profile]`.
After range and branch counters are extracted from the LBR sample, here we go through each addresses for symbolization, create FunctionSamples and populate its sub fields like TotalSamples, BodySamples and HeadSamples etc. For inlined code, as we need to map back to original code, so we always add body samples to the leaf frame's function sample.
Reviewed By: wenlei, hoy
Differential Revision: https://reviews.llvm.org/D109551
Diego Caballero [Wed, 22 Sep 2021 17:11:45 +0000 (17:11 +0000)]
[mlir] Create a generic reduction detection utility
This patch introduces a generic reduction detection utility that works
across different dialecs. It is mostly a generalization of the reduction
detection algorithm in Affine. The reduction detection logic in Affine,
Linalg and SCFToOpenMP have been replaced with this new generic utility.
The utility takes some basic components of the potential reduction and
returns: 1) the reduced value, and 2) a list with the combiner operations.
The logic to match reductions involving multiple combiner operations disabled
until we can properly test it.
Reviewed By: ftynse, bondhugula, nicolasvasilache, pifon2a
Differential Revision: https://reviews.llvm.org/D110303
wlei [Fri, 24 Sep 2021 06:43:08 +0000 (23:43 -0700)]
[llvm-profgen] Ignore invalid perf line in LBR record
Similar to https://reviews.llvm.org/D109637, there is a whole invalid line of message in perfscript.
```
warning: Invalid address in LBR record at line
14118674: Processed
14138923 events and lost 1 chunks!
warning: Invalid address in LBR record at line
14118676: Check IO/CPU overload!
```
This only happened for LBR only perfscript, hybridperfscript have a check of " 0x" to make sure it's the LBR perf line.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D110424
Stanislav Mekhanoshin [Thu, 23 Sep 2021 23:03:48 +0000 (16:03 -0700)]
[AMDGPU] Limit promote alloca max size in functions
Non-entry functions have 32 caller saved VGPRs available. If we
promote alloca to consume more registers we will have to spill
CSRs. There is no reason to eliminate scratch access to get
another scratch access instead.
Differential Revision: https://reviews.llvm.org/D110372
LLVM GN Syncbot [Fri, 24 Sep 2021 20:30:26 +0000 (20:30 +0000)]
[gn build] Port
c0d889995e70
LLVM GN Syncbot [Fri, 24 Sep 2021 20:30:25 +0000 (20:30 +0000)]
[gn build] Port
a9ae2436fc0d
Lang Hames [Fri, 24 Sep 2021 18:35:03 +0000 (11:35 -0700)]
[ORC] Add 'contains' and 'overlaps' operations to ExecutorAddrRange.
Also includes unit tests for not-yet tested operations like comparison and
to/from pointer conversion.
Anirudh Prasad [Fri, 24 Sep 2021 20:25:27 +0000 (16:25 -0400)]
[SystemZ][z/OS] Introduce the GOFFMCAsmInfo Interface for z/OS
- This patch adds in the GOFFMCAsmInfo interfaces for the z/OS target.
- This patch decouples the previously existing SystemZMCAsmInfo interface for the ELF target and the z/OS target.
- This patch also removes a small test in the SystemZAsmLexerTest.cpp. The reason for this is because, the test is set up for the s390x-ibm-linux (SystemZ ELF triple), and the test checks a function which is overridden only for the z/OS target. The reason we can't change the test to use a z/OS triple outright is because there is still missing support which prevents the successful running of a test (assert in AsmParser.cpp due to missing GOFFAsmParser support)
Reviewed By: uweigand, abhina.sreeskantharajan
Differential Revision: https://reviews.llvm.org/D110077
Nikita Popov [Fri, 24 Sep 2021 18:42:47 +0000 (20:42 +0200)]
[IR] Handle large element size when calculating GEP indices
This is a fix for the issue reported at
https://reviews.llvm.org/D110043#3019942:
The ElementSize is a uint64_t and as such may be larger than the
index space, or be negative in the index space. This is UB, but
shouldn't cause assertion failures.
We address this by detecting whether the size is too large and
use a zero index in that case (which is always conservatively
correct).
Differential Revision: https://reviews.llvm.org/D110437
River Riddle [Fri, 24 Sep 2021 19:56:01 +0000 (19:56 +0000)]
[mlir:OpAsm] Factor out the common bits of (Op/Dialect)Asm(Parser/Printer)
This has a few benefits:
* It allows for defining parsers/printer code blocks that
can be shared between operations and attribute/types.
* It removes the weird duplication of generic parser/printer hooks,
which means that newly added hooks only require touching one class.
Differential Revision: https://reviews.llvm.org/D110375
Valentin Clement [Fri, 24 Sep 2021 20:10:12 +0000 (22:10 +0200)]
[flang][fir] Add support to mangle/deconstruct namelist group name
Add support to create unique name for namelist group and be able to
deconstruct them.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D110331
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Michael Kruse [Fri, 24 Sep 2021 19:23:55 +0000 (14:23 -0500)]
[Polly] Fix wrong redirect in test case.
Sanjay Patel [Fri, 24 Sep 2021 17:27:02 +0000 (13:27 -0400)]
[InstCombine] fold lshr(trunc(lshr X, C1)) C2
Only the multi-use cases are changing here because there's
another fold that catches the simpler patterns.
But that other fold is the source of infinite loops when we
try to add D110170, so removing that is planned as a follow-up.
Attempt to show the general proof in Alive2:
https://alive2.llvm.org/ce/z/Ns1uS2
Note that the overshift fold-to-zero tests are not
currently handled by instsimplify. If they were, we
could assert that the shift amount sum is less than
the source bitwidth.
Sanjay Patel [Fri, 24 Sep 2021 16:04:46 +0000 (12:04 -0400)]
[InstCombine] match variable names and code comments; NFC
Teresa Johnson [Fri, 24 Sep 2021 19:41:03 +0000 (12:41 -0700)]
Fix bot failure by adding needed dependence
Fix bot failure from
96cb97c4533a0a02c2d62ffb1121cd275aa43dd5, e.g.:
https://lab.llvm.org/buildbot/#/builders/61/builds/15203
llvm-lto now needs to link in IPO.
River Riddle [Fri, 24 Sep 2021 19:32:23 +0000 (19:32 +0000)]
[mlir:MemRef] Move DmaStartOp/DmaWaitOp to ODS
These are among the last operations still defined explicitly in C++. I've
tried to keep this commit as NFC as possible, but these ops
definitely need a non-NFC cleanup at some point.
Differential Revision: https://reviews.llvm.org/D110440
Teresa Johnson [Fri, 24 Sep 2021 00:22:54 +0000 (17:22 -0700)]
[ThinLTO] Update combined index for SamplePGO indirect calls to locals
In ThinLTO for locals we normally compute the GUID from the name after
prepending the source path to get a unique global id. SamplePGO indirect
call profiles contain the target GUID without this uniquification,
however (unless compiling with -funique-internal-linkage-names).
In order to correctly handle the call edges added to the combined index
for these indirect calls, during importing and bitcode writing we
consult a map of original to full GUID to identify the actual callee.
However, for a large application this was consuming a lot of compile
time as we need to do this repeatedly (especially during importing where
we may traverse call edges multiple times).
To fix this implement a suggestion in one of the FIXME comments, and
actually modify the call edges during a single traversal after the index
is built to perform the fixups once. I combined this fixup with the dead
code analysis performed on the index in order to avoid adding an
additional walk of the index. The dead code analysis is the first
analysis performed on the index.
This reduced the time required for a large thin link with SamplePGO by
about 20%.
No new test added, but I confirmed that there are existing tests that
will fail when no fixup is performed.
Differential Revision: https://reviews.llvm.org/D110374
Lei Zhang [Fri, 24 Sep 2021 19:21:11 +0000 (15:21 -0400)]
[mlir][tosa] Add some transpose folders
* If the input is a constant splat value, we just
need to reshape it.
* If the input is a general constant with one user,
we can also constant fold it, without bloating
the IR.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D110439
Siva Chandra Reddy [Wed, 22 Sep 2021 21:31:50 +0000 (21:31 +0000)]
[libc] Add an implementation of qsort.
A fuzzer for qsort has also been added.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D110382
Anirudh Prasad [Fri, 24 Sep 2021 18:59:29 +0000 (14:59 -0400)]
[NFC] Replace hard-coded usages of SystemZ::R15D with SpecialRegisters API
This patch changes hard-coded usages of SystemZ::R15D with calls to the getStackPointerRegister function. Uses in the LowerCall function are avoided to avoid merge conflicts with an expected upcoming patch.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D109702
Nikita Popov [Fri, 24 Sep 2021 19:12:51 +0000 (21:12 +0200)]
[DSE] Add additional capture tests (NFC)
These test other escape sources and the case of multiple
underlying objects.
Paul Robinson [Fri, 24 Sep 2021 00:44:41 +0000 (17:44 -0700)]
[TargetLibraryInfo] Correctly handle sqrt*_finite
Other <math>_finite calls are marked as unavailable except on GNU/Linux;
it looks like the sqrt set was just overlooked.
Differential Revision: https://reviews.llvm.org/D110418
Leonard Chan [Fri, 24 Sep 2021 18:51:26 +0000 (11:51 -0700)]
[compiler-rt] Add shared_cxxabi requirement to some tests
This adds REQUIRES: shared_cxxabi to a bunch of tests that would fail if this
weak reference in sanitizer common was undefined. This is necessary in cases
where libc++abi.a is statically linked in. Because there is no strong reference
to __cxa_demangle in compiler-rt, then if libc++abi is linked in via a static
archive, then the linker will not extract the archive member that would define
that weak symbol. This causes a handful of tests to fail because this leads to
the symbolizer printing mangled symbols where tests expect them demangled.
Technically, this feature is WAI since sanitizer runtimes shouldn't fail if
this symbol isn't resolved, and linking statically means you wouldn't need to
link in all of libc++abi. As a workaround, we can simply make it a requirement
that these tests use shared libc++abis.
Differential Revision: https://reviews.llvm.org/D109639
David Green [Fri, 24 Sep 2021 18:30:49 +0000 (19:30 +0100)]
[ARM] Addition jump table plus while loop block placement pass test.
Also regenerated the file, whilst here.
Louis Dionne [Fri, 24 Sep 2021 18:21:58 +0000 (14:21 -0400)]
[libc++][NFC] Update status of old issue LWG2560 -- we implement it properly
David Blaikie [Fri, 24 Sep 2021 18:15:53 +0000 (11:15 -0700)]
DebugInfo: Move the '=' version of -gsimple-template-names to the frontend
Based on feedback from Paul Robinson on 38c09ea that the 'mangled' mode
is only useful as an LLVM-developer-internal tool in combination with
llvm-dwarfdump --verify, so demote that to a frontend-only (not driver)
option. The driver support is simply -g{no-,}simple-template-names to
switch on simple template names, without the option to use the mangled
template name scheme there.
Jay Foad [Fri, 24 Sep 2021 17:43:17 +0000 (18:43 +0100)]
[LiveIntervals] Fix asan debug build failures
Call RemoveMachineInstrFromMaps before erasing instrs.
repairIntervalsInRange will do this for you after erasing the
instruction, but it's not safe to rely on it because assertions in
SlotIndexes::removeMachineInstrFromMaps refer to fields in the erased
instruction.
This fixes asan buildbot failures caused by D110328.
Louis Dionne [Fri, 24 Sep 2021 18:10:19 +0000 (14:10 -0400)]
[libc++][NFC] Mark LWG3158 as implemented
It has been implemented in
59e26308e60a.
Anirudh Prasad [Fri, 24 Sep 2021 18:05:55 +0000 (14:05 -0400)]
[SystemZ][z/OS] Add GOFF Support to the DataLayout
- This patch adds in the GOFF mangling support to the LLVM data layout string. A corresponding additional line has been added into the data layout section in the language reference documentation.
- Furthermore, this patch also sets the right data layout string for the z/OS target in the SystemZ backend.
Reviewed By: uweigand, Kai, abhina.sreeskantharajan, MaskRay
Differential Revision: https://reviews.llvm.org/D109362
River Riddle [Fri, 24 Sep 2021 17:51:20 +0000 (17:51 +0000)]
[mlir:OpConversion] Remove the remaing usages of the deprecated matchAndRewrite methods
This commits updates the remaining usages of the ArrayRef<Value> based
matchAndRewrite/rewrite methods in favor of the new OpAdaptor
overload.
Differential Revision: https://reviews.llvm.org/D110360
River Riddle [Fri, 24 Sep 2021 17:50:58 +0000 (17:50 +0000)]
[mlir:OpConversionPattern] Add overloads for taking an Adaptor instead of ArrayRef
This has been a TODO for a long time, and it brings about many advantages (namely nice accessors, and less fragile code). The existing overloads that accept ArrayRef are now treated as deprecated and will be removed in a followup (after a small grace period). Most of the upstream MLIR usages have been fixed by this commit, the rest will be handled in a followup.
Differential Revision: https://reviews.llvm.org/D110293
Mark de Wever [Wed, 15 Sep 2021 16:29:22 +0000 (18:29 +0200)]
[NFC][libc++] Update clang-format style.
Changes the style as requested by @ldionne in D103368.
Reviewed By: ldionne, #libc, Quuxplusone
Differential Revision: https://reviews.llvm.org/D109835
Stanislav Mekhanoshin [Fri, 24 Sep 2021 16:53:51 +0000 (09:53 -0700)]
Revert "Allow rematerialization of virtual reg uses"
Reverted due to two distcint performance regression reports.
This reverts commit
92c1fd19abb15bc68b1127a26137a69e033cdb39.
Erich Keane [Fri, 24 Sep 2021 17:24:17 +0000 (10:24 -0700)]
Fix test from 8dd42f, capitalization in test
Erich Keane [Fri, 24 Sep 2021 17:19:06 +0000 (10:19 -0700)]
Add test for DR1307, which we have already implemented.
Also regenerated cxx_dr_status.html
Louis Dionne [Fri, 24 Sep 2021 17:10:44 +0000 (13:10 -0400)]
[libc++] Refactor the tests for common_view to reduce duplication
Simon Pilgrim [Fri, 24 Sep 2021 17:08:56 +0000 (18:08 +0100)]
[ConstantFold] ConstantFoldGetElementPtr - use APInt::isNegative() instead of getSExtValue() to support big ints
Fixes fuzz test: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39197
Simon Pilgrim [Fri, 24 Sep 2021 17:00:05 +0000 (18:00 +0100)]
[SCCP] Regenerate bigint test checks
Albion Fung [Fri, 24 Sep 2021 17:17:50 +0000 (12:17 -0500)]
[PowerPC][NFC] Add test case in preparation for codegen change
This test case tests doubles inserted into vector ints,
and help make apparent the optimizations a future patch
will make.
liuke [Fri, 24 Sep 2021 17:14:09 +0000 (13:14 -0400)]
Fix wrong FixIt about union in cppcoreguidelines-pro-type-member-init
At most one variant member of a union may have a default member
initializer. The case of anonymous records with multiple levels of
nesting like the following also needs to meet this rule. The original
logic is to horizontally obtain all the member variables in a record
that need to be initialized and then filter to the variables that need
to be fixed. Obviously, it is impossible to correctly initialize the
desired variables according to the nesting relationship.
See Example 3 in class.union
union U {
U() {}
int x; // int x{};
union {
int k; // int k{}; <== wrong fix
};
union {
int z; // int z{}; <== wrong fix
int y;
};
};
Erich Keane [Fri, 24 Sep 2021 15:31:26 +0000 (08:31 -0700)]
Write test for CWG1772/CWG1762/CWG1779, mark them 'done', and update
cxx_dr_status.html
I noticed that these two DRs are currently working correctly, so I
added a pair of lit tests that check the AST (which is most useful for
CWG1779, since 'dependent' is really only observable in an ast dump) to
make sure __func__ works correctly in dependent cases, and in lambda
operator().
Also noticed that CWG1762, mostly an 'example' change, works correctly,
so added a test so that it gets marked 'done' as well.
Additionally, I regenerated cxx_dr_status.html, updating it for Clang
13's release, based on the cwg_status.html from August 12, 2021.
Differential Revision: https://reviews.llvm.org/D109956
Victor Huang [Fri, 24 Sep 2021 15:46:56 +0000 (10:46 -0500)]
[PowerPC] Mark splat immediate instructions as rematerializable
This patch marks splat immediate instructions XXSPLTIW and XXSPLTIDP as
rematerializable to prevent MachineLICM from moving them out of loops.
Reviewed By: lei, amy
Differential revision: https://reviews.llvm.org/D108823
Hans Wennborg [Fri, 24 Sep 2021 16:44:20 +0000 (18:44 +0200)]
Re-apply "[JumpThreading] Ignore free instructions"
It seems the crashes we saw wasn't caused by this (see comments on the review).
> This is basically D108837 but for jump threading. Free instructions
> should be ignored for the threading decision. JumpThreading already
> skips some free instructions (like pointer bitcasts), but does not
> skip various free intrinsics -- in fact, it currently gives them a
> fairly large cost of 2.
>
> Differential Revision: https://reviews.llvm.org/D110290
This reverts commit
4604695d7c20e72b551a1a5224f3de877cb41bd3.
Valentin Clement [Fri, 24 Sep 2021 16:49:40 +0000 (18:49 +0200)]
Revert "[flang][fir] Add support to mangle/deconstruct namelist group name"
This reverts commit
3593ae4312f6156c9ca50d46cdb55a8dfad782d0.
Stanislav Mekhanoshin [Fri, 24 Sep 2021 00:34:13 +0000 (17:34 -0700)]
[AMDGPU] Always reserve flat scratch SGPR for architected flat scratch
With architected flat scratch it becomes readonly. We must always
reserve SGPR pair for it even if we do not use scratch at all since
an attempt to write to SGPRs mapped to FLAT_SCRATCH results in
memory violation.
This is not needed since GFX10 with architected flat scratch though
since special SGPRs are not carving space from normal SGPRs.
Differential Revision: https://reviews.llvm.org/D110376
Alex Zinenko [Fri, 24 Sep 2021 16:26:19 +0000 (18:26 +0200)]
[mlir] Linalg: ensure tile-and-pad always creates padding as requested
Initially, the padding transformation and the related operation were only used
to guarantee static shapes of subtensors in tiled operations. The
transformation would not insert the padding operation if the shapes were
already static, and the overall code generation would actively remove such
"noop" pads. However, this transformation can be also used to pack data into
smaller tensors and marshall them into faster memory, regardless of the size
mismatches. In context of expert-driven transformation, we should assume that,
if padding is requested, a potentially padded tensor must be always created.
Update the transformation accordingly. To do this, introduce an optional
`packing` attribute to the `pad_tensor` op that serves as an indication that
the padding is an intentional choice (as opposed to side effect of type
normalization) and should be left alone by cleanups.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D110425
Quinn Pham [Tue, 14 Sep 2021 18:56:21 +0000 (13:56 -0500)]
[PowerPC] Add range check for vec_genpcvm builtins
This patch adds range checking for some Power10 altivec builtins. Range
checking is done in SemaChecking.
Reviewed By: #powerpc, lei, Conanap
Differential Revision: https://reviews.llvm.org/D109780
Florian Hahn [Fri, 24 Sep 2021 14:41:47 +0000 (15:41 +0100)]
Recommit "[DSE] Track earliest escape, use for loads in isReadClobber."
This reverts the revert commit
df56fc6ebbee6c458b0473185277b7860f7e3408.
This version of the patch adjusts the location where the EarliestEscapes
cache is cleared when an instruction gets removed. The earliest escaping
instruction does not have to be a memory instruction.
It could be a ptrtoint instruction like in the added test
@earliest_escape_ptrtoint, which subsequently gets removed. We need to
invalidate the EarliestEscape entry referring to the ptrtoint when
deleting it.
This fixes the crash mentioned in
https://bugs.chromium.org/p/chromium/issues/detail?id=1252762#c6
Fraser Cormack [Fri, 24 Sep 2021 15:45:13 +0000 (16:45 +0100)]
[MC][NFC] Add end-of-namespace comments
Dmitry Vyukov [Fri, 24 Sep 2021 15:48:48 +0000 (17:48 +0200)]
tsan: don't use pipe2 in tests
MacOS buildbots failed:
stress.cpp:57:7: error: use of undeclared identifier 'pipe2'
https://green.lab.llvm.org/green//job/clang-stage1-RA/24209/consoleFull#-
3468768778254eaf0-7326-4999-85b0-
388101f2d404
Fix the test to not use pipe2.
Differential Revision: https://reviews.llvm.org/D110423
Simon Pilgrim [Fri, 24 Sep 2021 14:30:04 +0000 (15:30 +0100)]
[X86][SSE] combineMulToPMADDWD - replace sext(v8i16) -> zext(v8i16)
As suggested on D108522, if we're sign extending a v4i16 source before multiplying as a v4i32, then we can replace that with a zero extension and rely on the implicit sign-extension of PMADDWD.
Mark de Wever [Thu, 23 Sep 2021 16:15:02 +0000 (12:15 -0400)]
[libc++] Require a C++20 capable compiler.
This enforces libcxx and its benchmarks are compiled by a C++20 capable
compiler. Based on review comments in D103413.
Differential Revision: https://reviews.llvm.org/D110338
Sanjay Patel [Fri, 24 Sep 2021 15:31:11 +0000 (11:31 -0400)]
[x86] convert logic-of-FP-compares to FP logic-of-vector-compares
This is motivated by the examples and discussion in:
https://llvm.org/PR51245
...and related bugs.
By using vector compares and vector logic, we can convert 2 'set'
instructions into 1 'movd' or 'movmsk' and generally improve
throughput/reduce instructions.
Unfortunately, we don't have a complete vector compare ISA before
AVX, so I left SSE-only out of this patch. Ie, we'd need extra logic
ops to simulate the missing predicates for SSE 'cmpp*', so it's not
as clearly a win.
Differential Revision: https://reviews.llvm.org/D110342
Sanjay Patel [Fri, 24 Sep 2021 15:24:14 +0000 (11:24 -0400)]
[InstCombine] add tests for lshr-trunc-lshr; NFC
Louis Dionne [Fri, 24 Sep 2021 15:37:26 +0000 (11:37 -0400)]
[libc++][NFC] Add missing link to a ranges review
Kazu Hirata [Fri, 24 Sep 2021 15:08:57 +0000 (08:08 -0700)]
[Transforms/Utils] Remove redundant declaration computeSyntheticCounts (NFC)
Igor Kudrin [Fri, 24 Sep 2021 15:02:36 +0000 (22:02 +0700)]
[llvm-objcopy][NFC] Add a helper method RelocationSectionBase::getNamePrefix()
Refactor handleArgs() to use that method.
Differential Revision: https://reviews.llvm.org/D110350
Paul Robinson [Fri, 24 Sep 2021 14:36:01 +0000 (07:36 -0700)]
[TargetLibraryInfo][AMDGPU] Minor cleanup, NFC
Sanjay Patel [Fri, 24 Sep 2021 14:37:38 +0000 (10:37 -0400)]
Revert "[InstCombine] fold cast of right-shift if high bits are not demanded (2nd try)"
This reverts commit
bb9333c3504a4a02b982526ad8264d14c6ec1ad4.
This exposes another existing bug that causes an infinite loop as shown in
D110170
...so reverting while I look at another fix.
Dmitry Vyukov [Fri, 24 Sep 2021 13:55:31 +0000 (15:55 +0200)]
tsan: add a stress test
The stress test does various assorted things
(memory accesses, function calls, atomic operations,
thread creation/join, intercepted libc calls)
in multiple threads just to stress various parts
of the runtime.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D110416
Hans Wennborg [Fri, 24 Sep 2021 14:14:53 +0000 (16:14 +0200)]
Revert "[JumpThreading] Ignore free instructions"
It caused compiler crashes, see comment on the code review for repro.
> This is basically D108837 but for jump threading. Free instructions
> should be ignored for the threading decision. JumpThreading already
> skips some free instructions (like pointer bitcasts), but does not
> skip various free intrinsics -- in fact, it currently gives them a
> fairly large cost of 2.
>
> Differential Revision: https://reviews.llvm.org/D110290
This reverts commit
1e3c6fc7cb9d2ee6a5328881f95d6643afeadbff.
Dmitry Vyukov [Fri, 24 Sep 2021 12:54:47 +0000 (14:54 +0200)]
tsan: add a test for flushing memory
Add a test for __tsan_flush_memory() and for background
flushing of the runtime memory.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D110409
Nico Weber [Fri, 24 Sep 2021 13:56:56 +0000 (09:56 -0400)]
Revert "[DSE] Track earliest escape, use for loads in isReadClobber."
This reverts commit
5ce89279c0986d0bcbe526dce52f91dd0c16427c.
Makes clang crash, see comments on https://reviews.llvm.org/D109844
Frederic Cambus [Fri, 24 Sep 2021 13:34:16 +0000 (19:04 +0530)]
[compiler-rt] Use portable "#!/usr/bin/env bash" shebang for tests.
In build_symbolizer.sh we can safely remove the -eu argument from the shebang (which is an unportable construct), as the scripts sets **-e** and **-u** already.
Differential Revision: https://reviews.llvm.org/D110039
Cullen Rhodes [Fri, 24 Sep 2021 11:37:33 +0000 (11:37 +0000)]
[SystemZ] NFC: Remove unused intrinsic template arg 'name'
Identified in D109359.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D109598
Michał Górny [Fri, 24 Sep 2021 08:28:58 +0000 (10:28 +0200)]
[lldb] [Host] Refactor Socket::DecodeHostAndPort() to use LLVM API
Refactor Socket::DecodeHostAndPort() to use LLVM API over redundant
LLDB API. In particular, this means llvm::Regex, llvm::Error return
type and llvm::to_integer().
While at it, change the port type from int32_t to uint16_t. The method
never returns any value outside this range, and using the correct type
allows us to rely on getAsInteger()'s implicit overflow check.
Differential Revision: https://reviews.llvm.org/D110391
David Sherwood [Fri, 24 Sep 2021 12:31:38 +0000 (13:31 +0100)]
[Analysis] Fix another issue when querying vscale attributes on functions
There are several places in the code that are currently broken where
we assume an Instruction is always a member of a BasicBlock that
lives in a Function. This is a problem specifically when
attempting to get the vscale_range attribute. This patch adds checks
that an Instruction's parent also has a parent!
I've added a test for a function-less @llvm.vscale intrinsic call here:
unittests/Analysis/ValueTrackingTest.cpp
Valentin Clement [Fri, 24 Sep 2021 12:05:23 +0000 (14:05 +0200)]
[flang][fir] Add support to mangle/deconstruct namelist group name
Add support to create unique name for namelist group and be able to
deconstruct them.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D110331
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Michał Górny [Fri, 24 Sep 2021 11:33:51 +0000 (13:33 +0200)]
Revert "[lldb] [Host] Refactor Socket::DecodeHostAndPort() to use LLVM API"
This reverts commit
a6daf99228bc16fb7f2596d67a0d00fef327ace5. It causes
buildbot regressions, I'll investigate.
Michał Górny [Fri, 24 Sep 2021 08:28:58 +0000 (10:28 +0200)]
[lldb] [Host] Refactor Socket::DecodeHostAndPort() to use LLVM API
Refactor Socket::DecodeHostAndPort() to use LLVM API over redundant
LLDB API. In particular, this means llvm::Regex, llvm::Error return
type and llvm::to_integer().
While at it, change the port type from int32_t to uint16_t. The method
never returns any value outside this range, and using the correct type
allows us to rely on getAsInteger()'s implicit overflow check.
Differential Revision: https://reviews.llvm.org/D110391