Christopher Di Bella [Tue, 27 Jul 2021 15:36:03 +0000 (15:36 +0000)]
Revert "Revert "[clang][pp] adds '#pragma include_instead'""
Includes regression test for problem noted by @hans.
This reverts commit
973de7185606a21fd5e9d5e8c014fbf898c0e72f.
Differential Revision: https://reviews.llvm.org/D106898
Terry Wilmarth [Thu, 15 Jul 2021 15:28:47 +0000 (10:28 -0500)]
[OpenMP] libomp: Add new experimental barrier: two-level distributed barrier
Two-level distributed barrier is a new experimental barrier designed
for Intel hardware that has better performance in some cases than the
default hyper barrier.
This barrier is designed to handle fine granularity parallelism where
barriers are used frequently with little compute and memory access
between barriers. There is no need to use it for codes with few
barriers and large granularity compute, or memory intensive
applications, as little difference will be seen between this barrier
and the default hyper barrier. This barrier is designed to work
optimally with a fixed number of threads, and has a significant setup
time, so should NOT be used in situations where the number of threads
in a team is varied frequently.
The two-level distributed barrier is off by default -- hyper barrier
is used by default. To use this barrier, you must set all barrier
patterns to use this type, because it will not work with other barrier
patterns. Thus, to turn it on, the following settings are required:
KMP_FORKJOIN_BARRIER_PATTERN=dist,dist
KMP_PLAIN_BARRIER_PATTERN=dist,dist
KMP_REDUCTION_BARRIER_PATTERN=dist,dist
Branching factors (set with KMP_FORKJOIN_BARRIER, KMP_PLAIN_BARRIER,
and KMP_REDUCTION_BARRIER) are ignored by the two-level distributed
barrier.
Patch fixed for ITTNotify disabled builds and non-x86 builds
Co-authored-by: Jonathan Peyton <jonathan.l.peyton@intel.com>
Co-authored-by: Vladislav Vinogradov <vlad.vinogradov@intel.com>
Differential Revision: https://reviews.llvm.org/D103121
Sander de Smalen [Thu, 29 Jul 2021 16:34:01 +0000 (17:34 +0100)]
[InstSimplify] Don't assume parent function when simplifying llvm.vscale.
D106850 introduced a simplification for llvm.vscale by looking at the
surrounding function's vscale_range attributes. The call that's being
simplified may not yet have been inserted into the IR. This happens for
example during function cloning.
This patch fixes the issue by checking if the instruction is in a
parent basic block.
Stella Laurenzo [Thu, 29 Jul 2021 19:06:22 +0000 (19:06 +0000)]
[MLIR][python] Export CAPI headers.
* Adds source targets (not included in the full set that downstreams use by default) to bundle mlir-c/ headers into the mlir/_mlir_libs/include directory.
* Adds a minimal entry point to get include and library directories.
* Used by npcomp to export a full CAPI (which is then used by the Torch extension to link npcomp).
Reviewed By: mikeurbach
Differential Revision: https://reviews.llvm.org/D107090
Amara Emerson [Thu, 29 Jul 2021 19:03:34 +0000 (12:03 -0700)]
[GlobalISel] Add GPtrAdd and use it in some combines.
bakhtiyar [Thu, 29 Jul 2021 18:47:08 +0000 (11:47 -0700)]
Refactor AsyncToAsyncRuntime pass to boost understandability.
Depends On D106730
Reviewed By: ezhulenev
Differential Revision: https://reviews.llvm.org/D106731
Frederic Cambus [Tue, 27 Jul 2021 12:36:13 +0000 (14:36 +0200)]
[clang] Fix a typo in the manual page: s/contraint/constraint.
While there, update hardcoded Clang version from 3.5 to 13.
Differential Revision: https://reviews.llvm.org/D106867
Frederic Cambus [Fri, 23 Jul 2021 13:34:03 +0000 (15:34 +0200)]
[clang] Fix typos in Options.td and regen ClangCommandLineReference.rst.
Differential Revision: https://reviews.llvm.org/D106664
Ahmed S. Taei [Wed, 28 Jul 2021 00:35:22 +0000 (00:35 +0000)]
Rorder mmt4d iteration domain
Move tile iterators to outer most dim
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D107003
Vy Nguyen [Thu, 29 Jul 2021 05:07:22 +0000 (01:07 -0400)]
[lld-macho] Change personalities entry type to Ptr to avoid overflowing uint32
PR51262
Differential Revision: https://reviews.llvm.org/D107035
Alexey Bataev [Thu, 29 Jul 2021 18:19:56 +0000 (11:19 -0700)]
[SLP][NFC]Add a test for split loads, NFC.
Louis Dionne [Thu, 29 Jul 2021 18:17:04 +0000 (14:17 -0400)]
[libc++][NFC] Make private header generation CMake comment more consistent
Anjan Kumar [Thu, 29 Jul 2021 18:14:41 +0000 (18:14 +0000)]
[AIX] Pass the -b option to linker on AIX
Parse the -b option in the driver and pass it to the linker if the target OS is AIX. This will establish compatibility with the other AIX compilers.
Reviewed By: Zarko Todorovski
Differential Revision: https://reviews.llvm.org/D106688
Stella Stamenova [Thu, 29 Jul 2021 17:48:57 +0000 (10:48 -0700)]
Revert "[lldb] Assert filecache and live memory match on debug under a setting"
This reverts commit
77e9d10f0fbfe04a14e6ce61753376dd78e0c2f0.
This change broke the Windows LLDB bot:
https://lab.llvm.org/buildbot/#/builders/83/builds/8784/steps/7/logs/stdio
Chris Bieneman [Thu, 29 Jul 2021 17:45:56 +0000 (12:45 -0500)]
Fixing broken docs build
Need an empty line after the code-block directive.
Chris Bieneman [Sat, 24 Jul 2021 00:43:45 +0000 (19:43 -0500)]
Support macro deprecation #pragma clang deprecated
This patch adds `#pragma clang deprecated` to enable deprecation of
preprocessor macros.
The macro must be defined before `#pragma clang deprecated`. When
deprecating a macro a custom message may be optionally provided.
Warnings are emitted at the use site of a deprecated macro, and can be
controlled via the `-Wdeprecated` warning group.
This patch takes some rough inspiration and a few lines of code from
https://reviews.llvm.org/D67935.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D106732
Arthur Eubanks [Thu, 29 Jul 2021 17:37:28 +0000 (10:37 -0700)]
[gn build] Manually add file
Since bot is broken
Alfonso Gregory [Thu, 29 Jul 2021 17:10:37 +0000 (10:10 -0700)]
[Support] Remove LLVM_ATTRIBUTE_NORETURN
Code should use C++11 [[noreturn]] or C11 _Noreturn instead.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D106899
Fangrui Song [Thu, 29 Jul 2021 16:59:44 +0000 (09:59 -0700)]
Replace LLVM_ATTRIBUTE_NORETURN with C++11 [[noreturn]]. NFC
[[noreturn]] can be used since Oct 2016 when the minimum compiler requirement was bumped to GCC 4.8/MSVC 2015.
Fangrui Song [Thu, 29 Jul 2021 16:57:10 +0000 (09:57 -0700)]
[lldb] Fix FunctionDecl::Create after D102343
Melanie Blower [Thu, 29 Jul 2021 16:41:48 +0000 (12:41 -0400)]
[clang][patch] Remove erroneous run line committed in D102343
Dawid Jurczak [Mon, 5 Jul 2021 09:42:17 +0000 (11:42 +0200)]
[DSE] Transform memset + malloc --> calloc (PR25892)
After this change DSE can eliminate malloc + memset and emit calloc.
It's https://reviews.llvm.org/D101440 follow-up.
Differential Revision: https://reviews.llvm.org/D103009
Melanie Blower [Thu, 29 Jul 2021 16:02:20 +0000 (12:02 -0400)]
[clang][patch][FPEnv] Make initialization of C++ globals strictfp aware
@kpn pointed out that the global variable initialization functions didn't
have the "strictfp" metadata set correctly, and @rjmccall said that there
was buggy code in SetFPModel and StartFunction, this patch is to solve
those problems. When Sema creates a FunctionDecl, it sets the
FunctionDeclBits.UsesFPIntrin to "true" if the lexical FP settings
(i.e. a combination of command line options and #pragma float_control
settings) correspond to ConstrainedFP mode. That bit is used when CodeGen
starts codegen for a llvm function, and it translates into the
"strictfp" function attribute. See bugs.llvm.org/show_bug.cgi?id=44571
Reviewed By: Aaron Ballman
Differential Revision: https://reviews.llvm.org/D102343
Joachim Protze [Thu, 29 Jul 2021 15:54:01 +0000 (17:54 +0200)]
[OpenMP][Tools][Tests][NFC] Address flaky archer tests
Adding more concurrent threads significantly increases the
chance that the data race can be observed during testing.
Jessica Clarke [Thu, 29 Jul 2021 15:53:27 +0000 (16:53 +0100)]
Handle subregs and superregs in callee-saved register mask
If a target lists both a subreg and a superreg in a callee-saved
register mask, the prolog will spill both aliasing registers. Instead,
don't spill the subreg if a superreg is being spilled. This case is hit by the
PowerPC SPE code, as well as a modified RISC-V backend for CHERI I maintain out
of tree.
Reviewed By: jhibbits
Differential Revision: https://reviews.llvm.org/D73170
bakhtiyar [Wed, 28 Jul 2021 22:25:00 +0000 (15:25 -0700)]
Add an escape-hatch for conversion of funcs with blocking awaits to coroutines.
Currently TFRT does not support top-level coroutines, so this functionality will allow to have a single blocking await at the top level until TFRT implements the necessary functionality.
Reviewed By: ezhulenev
Differential Revision: https://reviews.llvm.org/D106730
Tobias Gysi [Thu, 29 Jul 2021 15:03:36 +0000 (15:03 +0000)]
[mlir][linalg] Format bufferization debug print outs (NFC).
Change the formatting of the debug print outs to elide unnecessary information.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D106661
Dmitry Vyukov [Thu, 29 Jul 2021 11:50:29 +0000 (13:50 +0200)]
tsan: introduce LazyInitialize
We call non-inlinable Initialize from all interceptors/syscalls,
but most of the time runtime is already initialized and this just
introduces unnecessary overhead.
Add LazyInitialize that (1) inlinable, (2) does nothing if
.preinit_array is enabled (expected case on Linux).
Depends on D107071.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D107072
Dmitry Vyukov [Thu, 29 Jul 2021 11:33:07 +0000 (13:33 +0200)]
tsan: s/CHECK/DCHECK/ in tsan_interface_java.cpp
We are very paranoid with CHECKs in all Java entry points.
These CHECKs were added along with Java support.
At that point it wasn't clear what exactly to expect from JVM part
and if JVM part is correct or not. Thus CHECK paranoia.
These CHECKs never fired in practice, but we pay runtime cost
in every entry point all the time.
Replace CHECKs with DCHECKs.
Depends on D107069.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D107071
Dmitry Vyukov [Thu, 29 Jul 2021 11:30:16 +0000 (13:30 +0200)]
tsan: restore Initialize call in Java entry points
We used to call Initialize in every Java point.
That was removed in
6563bb53b5 ("tsan: don't use caller/current PC in Java interfaces").
The intention was to add a single Initialize to __tsan_java_init instead.
Do that.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D107069
Jez Ng [Thu, 29 Jul 2021 15:05:14 +0000 (11:05 -0400)]
[lld-macho][nfc] Simplify common-symbol-coalescing test
Jez Ng [Thu, 29 Jul 2021 15:06:40 +0000 (11:06 -0400)]
[lld-macho] Support common symbols in bitcode (but differently from ld64)
ld64 seems to handle common symbols in bitcode rather
bizarrely. They follow entirely different precedence rules from their
non-bitcode counterparts. I initially tried to emulate ld64 in D106597,
but I'm not sure the extra complexity is worth it, especially given that
common symbols are not, well, very common.
This diff accords common bitcode symbols the same precedence as regular
common symbols, just as we treat all other pairs of bitcode and
non-bitcode symbol types. The tests document ld64's behavior in detail,
just in case we want to revisit this.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D107027
Dmitry Vyukov [Thu, 29 Jul 2021 09:12:40 +0000 (11:12 +0200)]
tsan: add intrusive doubly-linked list
Add intrusive doubly-linked list container template, IList.
It will be used in the new tsan runtime.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D107050
Rosie Sumpter [Thu, 29 Jul 2021 14:50:30 +0000 (15:50 +0100)]
Revert "[LoopFlatten] Fix missed LoopFlatten opportunity"
This reverts commit
2df8bf9339e43de63d8d28e07182e1d6d7ffb843.
Reverting because it causes an assertion failure.
Kai Luo [Thu, 29 Jul 2021 14:48:30 +0000 (14:48 +0000)]
[PowerPC] Fix return type of XL compat CAS
`__compare_and_swap*` should return `i32` rather than `i1`.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D107077
Dmitry Vyukov [Thu, 29 Jul 2021 10:54:34 +0000 (12:54 +0200)]
tsan: add another test for atomics
Add a test where atomic-release happens while
another thread spins calling load-acquire.
This can expose some interesting interleavings
of release and acquire.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D107055
Guillaume Chatelet [Fri, 23 Jul 2021 09:28:51 +0000 (09:28 +0000)]
[libc] rewrite aarch64 memcmp implementation
This patch is simply rearranging the code layout so it's easier to understand.
Differential Revision: https://reviews.llvm.org/D106641
Kim-Anh Tran [Thu, 29 Jul 2021 13:30:25 +0000 (15:30 +0200)]
[DWARF5] Only fallback to manual index if no entry was found
If we succeed at gathering global variables for a compile
unit, there is no need to fallback to generating a manual index.
Reviewed By: jankratochvil
Differential Revision: https://reviews.llvm.org/D106355
Kazu Hirata [Thu, 29 Jul 2021 14:14:37 +0000 (07:14 -0700)]
[CodeGen] Remove getPseudoProbeAttribute and addPseudoProbeAttribute (NFC)
The last uses of these functions were removed on Jun 17, 2021 in
commit
bd52495518808bdbf24f4d8e9e20774d6d2e3333.
Jessica Clarke [Thu, 29 Jul 2021 14:13:58 +0000 (15:13 +0100)]
[ELF] Align the first section of a PT_TLS even if its type is SHT_NOBITS
This is somewhat of a repeat of D66658 but for sections in PT_TLS
segments. Although such sections don't need to be aligned such that
address and offset are congruent modulo the page size, they do need
to be congruent modulo the segment alignment, otherwise the
whole PT_TLS will be unaligned. We therefore use the normal calculation
to determine the section's address within the PT_LOAD rather than
bailing out early due to being SHT_NOBITS.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D106987
Jessica Clarke [Thu, 29 Jul 2021 14:13:51 +0000 (15:13 +0100)]
[ELF] Add two new tests showing broken .tbss alignment if first in PT_TLS
This is a similar problem to D66658, where we are too aggressive in not
aligning NOBITS sections, and the tests are based on the ones added for
that fix. If a .tbss section is first in a PT_TLS segment (i.e. there is
no .tdata section) then, although it doesn't need to be aligned such
that address and offset are congruent modulo the page size, they do need
to be congruent modulo the segment alignment, otherwise the whole PT_TLS
will be unaligned.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D106986
Jamie Schmeiser [Thu, 29 Jul 2021 13:59:24 +0000 (09:59 -0400)]
Set TargetCPUName for AIX to default to pwr7.
Summary:
Set the TargetCPUName for AIX to default to pwr7, removing the setting
of it based on the major/minor of the OS version, which previously
set it to pwr4 for AIX 7.1 and earlier. The old code would also set it to
pwr4 when the OS version was not specified and with the change, it will
default it to pwr7 in all cases.
Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By:hubert.reinterpretcast (Hubert Tong)
Differential Revision: https://reviews.llvm.org/D107063
Jon Chesterfield [Thu, 29 Jul 2021 13:42:32 +0000 (14:42 +0100)]
[libomptarget][amdgpu] Update printed plugin name
Augusto Noronha [Tue, 27 Jul 2021 12:22:12 +0000 (09:22 -0300)]
[lldb] Assert filecache and live memory match on debug under a setting
Sanjay Patel [Thu, 29 Jul 2021 12:47:15 +0000 (08:47 -0400)]
[DAGCombiner] don't try to partially reduce add-with-overflow ops
This transform was added with D58874, but there were no tests for overflow ops.
We need to change this one way or another because it can crash as shown in:
https://llvm.org/PR51238
Note that if there are no uses of an overflow op's bool overflow result, we
reduce it to a regular math op, so we continue to fold that case either way.
If we have uses of both the math and the overflow bool, then we are likely
not saving anything by creating an independent sub instruction as seen in
the test diffs here.
This patch makes the behavior in SDAG consistent with what we do in
instcombine AFAICT.
Differential Revision: https://reviews.llvm.org/D106983
Stefan Gränitz [Mon, 28 Jun 2021 14:58:58 +0000 (16:58 +0200)]
[Orc][examples] Adopt ExecutorProcessControl API and re-enable LLJITWithRemoteDebugging
The API change originated from D104694. The LLJITWithRemoteDebugging example and the test for it were disabled while it was in the works.
Sanjay Patel [Wed, 28 Jul 2021 18:53:47 +0000 (14:53 -0400)]
[AArch64][x86] add tests for add-with-overflow folds; NFC
There's a generic combine for these, but no test coverage.
It's not clear if this is actually a good fold.
The combine was added with D58874, but it has a bug that
can cause crashing ( https://llvm.org/PR51238 ).
Andrew Savonichev [Wed, 9 Jun 2021 09:27:34 +0000 (12:27 +0300)]
[MCA] Use LSU for the in-order pipeline
Load/Store unit is used to enforce order of loads and stores if they
alias (controlled by --noalias=false option).
Fixes PR50483 - [MCA] In-order pipeline doesn't track memory
load/store dependencies.
Differential Revision: https://reviews.llvm.org/D103955
Bradley Smith [Tue, 27 Jul 2021 13:45:58 +0000 (13:45 +0000)]
[AArch64][SVE] Fix incorrect mask type when lowering fixed type SVE gather/scatter
An incorrect mask type when lowering an SVE gather/scatter was causing
a codegen fault which manifested as the incorrect predicate size being
used for an SVE gather/scatter, (e.g.. p0.b rather than p0.d).
Fixes PR51182.
Differential Revision: https://reviews.llvm.org/D106943
Sebastian Neubauer [Thu, 29 Jul 2021 10:55:34 +0000 (12:55 +0200)]
[Utils] Do not remove comments in llc test script
When checking if two prefixes can be merged for a function,
update_llc_test_checks.py removed IR comments before comparing
llc outputs of different RUN lines.
This means, if one RUN line emited lines starting with ';' and another
RUN line emited the same lines except the ones starting with ';', both
RUNs would be merged (if they share a prefix).
However, CHECK-NEXT lines check the comments, otherwise they fail, so
the script should not merge RUNs if they contain different comments.
Differential Revision: https://reviews.llvm.org/D101312
Jesse Towner [Thu, 29 Jul 2021 11:01:19 +0000 (07:01 -0400)]
bugprone-forwarding-reference-overload: support non-type template parameters
Many concepts emulation libraries, such as the one found in Range v3, tend to
use non-type template parameters for the enable_if type expression, due to
their versatility in template functions and constructors containing variadic
template parameter packs.
Unfortunately the bugprone-forwarding-reference-overload check does not
handle non-type template parameters, as was first noted in this bug report:
https://bugs.llvm.org/show_bug.cgi?id=38081
This patch fixes this long standing issue and allows for the check to be suppressed
with the use of a non-type template parameter containing enable_if or enable_if_t in
the type expression, so long as it has a default literal value.
Jeremy Morse [Thu, 29 Jul 2021 10:45:50 +0000 (11:45 +0100)]
Follow-up to D105207, only salvage affine SCEVs to avoid a crash
SCEVToIterCountExpr only expects to be fed affine expressions, but
DbgRewriteSalvageableDVIs is feeding it non-affine induction variables.
Following this up with an obvious fix, will add test coverage too if
this avoids D105207 being reverted.
Dmitry Vyukov [Thu, 29 Jul 2021 08:26:50 +0000 (10:26 +0200)]
tsan: store ThreadRegistry in Context by value
It's unclear why we allocate ThreadRegistry separately,
I assume it's some historical leftover.
Embed ThreadRegistry into Context.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D107045
Dmitry Vyukov [Thu, 29 Jul 2021 07:44:48 +0000 (09:44 +0200)]
sanitizer_common: remove BlockingMutex and RWMutex
Remove the legacy typedefs and use Mutex/Lock types directly.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D107043
Dmitry Vyukov [Thu, 29 Jul 2021 10:01:52 +0000 (12:01 +0200)]
tsan: rename deadlock detector Mutex to UserMutex
It conflicts with sanitizer_common Mutex.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D107053
Andrzej Warzynski [Tue, 27 Jul 2021 13:09:56 +0000 (14:09 +0100)]
[flang][driver] Forward `-fopenmp`/`-fopenacc` to the host compiler
This patch only modifies `flang` - the bash wrapper script.
`-fopenmp`/`-fopenacc` are required to enable the OpenMP/OpenACC
extension in the frontend and to make sure that the required libraries
are linked when generating the final binary. This patch makes sure that
`-fopnemp`/`-fopenacc` is used for both unparsing and the code
generation (via the host compiler).
Differential Revision: https://reviews.llvm.org/D106871
Cullen Rhodes [Thu, 29 Jul 2021 09:49:08 +0000 (09:49 +0000)]
[AArch64][AsmParser] NFC: Parser.getTok() -> getTok()
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D106949
Amara Emerson [Thu, 29 Jul 2021 09:07:27 +0000 (02:07 -0700)]
[AArch64][GlobalISel] More widenToNextPow2 changes, this time for arithmetic/bitwise ops.
Kirill Bobyrev [Thu, 29 Jul 2021 09:37:10 +0000 (11:37 +0200)]
NFC: Change quotes from Unicode to ASCII
This was causing some problems for Python scripts that we have.
Context: https://reviews.llvm.org/D106792
David Spickett [Mon, 12 Apr 2021 14:40:32 +0000 (15:40 +0100)]
[lldb][AArch64] Annotate synchronous tag faults
In the latest Linux kernels synchronous tag faults
include the tag bits in their address.
This change adds logical and allocation tags to the
description of synchronous tag faults.
(asynchronous faults have no address)
Process 1626 stopped
* thread #1, name = 'a.out', stop reason = signal SIGSEGV: sync tag check fault (fault address: 0x900fffff7ff9010 logical tag: 0x9 allocation tag: 0x0)
This extends the existing description and will
show as much as it can on the rare occasion something
fails.
This change supports AArch64 MTE only but other
architectures could be added by extending the
switch at the start of AnnotateSyncTagCheckFault.
The rest of the function is generic code.
Tests have been added for synchronous and asynchronous
MTE faults.
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D105178
Mirko Brkusanin [Wed, 28 Jul 2021 16:23:50 +0000 (18:23 +0200)]
[AMDGPU][GlobalISel] Insert an and with exec before s_cbranch_vccnz if necessary
While v_cmp will AND inactive lanes with 0, that is not the case for logical
operations.
This fixes a Vulkan CTS test that would hang otherwise.
Differential Revision: https://reviews.llvm.org/D105709
Benjamin Kramer [Thu, 29 Jul 2021 09:10:07 +0000 (11:10 +0200)]
[mlir] Put back virtual ~ConversionTarget(), some users started relying on it
Benjamin Kramer [Mon, 26 Jul 2021 11:37:41 +0000 (13:37 +0200)]
[mlir] Remove the default isDynamicallyLegal hook
This is redundant with the callback variant and untested. Also remove
the callback-less methods for adding a dynamically legal op, as they
are no longer useful.
Differential Revision: https://reviews.llvm.org/D106786
Tomasz Kamiński [Thu, 29 Jul 2021 08:55:24 +0000 (10:55 +0200)]
Fix FindZ3.cmake to support static libraries and Windows
Use absolute path to link z3 to allow builds both on windows and linux
since the library name is platform dependent for Z3 (libz3 on Windows
and z3 on Linux) and MSVC does not recognized -L and -l options.
Fix CMAKE_CROSSCOMPILING that does not work correctly since it uses
Z3_BUILD_VERSION instead of Z3_BUILD_NUMBER
Fix building with the static version of z3 library (supersedes D80227).
- Build the Z3 version detection code as C++, since the static
library brings in libstdc++ symbols
- Detect threading support and link against threading, in the
(likely) case Z3 was built with threads
Exposed compilation error from building a program that is used to detect
z3 version in the warning message, to simplify troubleshooting.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D106131
Rosie Sumpter [Fri, 2 Jul 2021 09:52:35 +0000 (10:52 +0100)]
[LoopFlatten] Fix missed LoopFlatten opportunity
When the trip count of the inner loop is a constant, the InstCombine
pass now causes the transformation e.g. imcp ult i32 %inc, tripcount ->
icmp ult %j, tripcount-step (where %j is the inner loop induction
variable and %inc is add %j, step), which is now accounted for when
identifying the trip count of the loop. This is also an acceptable use
of %j (provided the step is 1) so is ignored as long as the compare
that it's used in is also the condition of the inner branch.
Differential Revision: https://reviews.llvm.org/D105802
Fraser Cormack [Wed, 28 Jul 2021 14:20:49 +0000 (15:20 +0100)]
[RISCV] Optimize floating-point "dominant value" BUILD_VECTORs
This patch aims to improve the performance of BUILD_VECTORs which are
identified as containing a dominant element. Given that most
floating-point constants themselves require a load from the constant
pool, it was possible for the optimization to actually increase the
number of individual loads on small vectors. The exception is the zero
constant -- +0.0 -- which can be materialized efficiently.
While this optimization could do with a proper cost model to weigh the
benfits of a single vector load vs. the manipulation of individual
elements -- even for integer vectors which often require several
instructions to materialize -- without a concrete RVV implementation to
work with any heuristic is likely to be both more obtuse and inaccurate.
Until then, this patch fixes at least one known obvious deficiency.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D106963
Fraser Cormack [Wed, 28 Jul 2021 14:14:39 +0000 (15:14 +0100)]
[RISCV] Add test case showing suboptimal BUILD_VECTOR lowering
The second test case added here was pointed out to me by @craig.topper
and shows how we "optimize" a two-element BUILD_VECTOR from being one
load from the constant pool to two loads from the constant pool.
The first test case shows that since materialization for the
floating-point +0.0 value is cheap and doesn't involve a load, the
optimization is more clearly beneficial here.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D106962
Diana Picus [Wed, 28 Jul 2021 09:15:58 +0000 (11:15 +0200)]
test-release.sh: Kill python2
Don't prefer python2's virtualenv when setting up the test-suite.
Always use python3 instead, since that's what we support everywhere else
anyway.
Differential Revision: https://reviews.llvm.org/D106941
Björn Schäpers [Sun, 25 Jul 2021 20:42:25 +0000 (22:42 +0200)]
[clang-format] Fix aligning with linebreaks #2
This amends
c5243c63cda3c740d6e9c7e501f6518c21688da3 to fix formatting
continued function calls with BinPacking = false.
Differential Revision: https://reviews.llvm.org/D106773
Mark de Wever [Thu, 29 Jul 2021 05:54:48 +0000 (07:54 +0200)]
[libcxx][doc] Update the build documentation.
These are the hunks of
D106770 [libc++][doc] Update the release notes
that are relevant for main.
Jun Ma [Thu, 29 Jul 2021 05:23:02 +0000 (13:23 +0800)]
[NFC][InstSimplify] Use more intuitive variable names.
Dmitry Vyukov [Wed, 28 Jul 2021 11:40:21 +0000 (13:40 +0200)]
tsan: switch from SSE3 to SSE4.2
Switch x86_64 requirement for optimized code from SSE3 to SSE4.2.
The new tsan runtime will need few instructions that are only
supported by SSE4:
_mm_max_epu32
_mm_extract_epi8
_mm_insert_epi32
SSE3 was introcued in 2004 and SSE4 in 2006:
https://en.wikipedia.org/wiki/SSE3
https://en.wikipedia.org/wiki/SSE4
We are still providing non-optimized C++ version of the code,
so either way it's possible to build tsan runtime for any CPU.
But for Go this will bump strict requirement for -race because
Go contains prebuilt versions and these will be built with -msse4.2.
But requiring a CPU produced at least in 2006 looks reasonable for
a debugging tool (more reasonable than disabling optimizations
for everybody).
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D106948
Dmitry Vyukov [Wed, 28 Jul 2021 18:38:53 +0000 (20:38 +0200)]
tsan: remove /**/ at the of multi-line macros
Prefer code readability over writeability.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D106982
Dmitry Vyukov [Thu, 29 Jul 2021 05:44:13 +0000 (07:44 +0200)]
tsan: fix java_symbolization test
We reliably remove bottom libc-guts frames only on linux/glibc.
Some bots failed on this test showing other bottom frames:
.annobin_libc_start.c libc-start.c (libc.so.6+0x249f4)
generic_start_main.isra.0 libc-start.c (libc.so.6+0x45b0c)
We can't reliably remove all of possible bottom frames.
So remove the assertion for that.
Differential Revision: https://reviews.llvm.org/D107037
Arthur O'Dwyer [Thu, 29 Jul 2021 05:34:31 +0000 (01:34 -0400)]
[libc++] Remove excess whitespace in synopsis comment. NFCI.
Freddy Ye [Thu, 29 Jul 2021 05:27:40 +0000 (13:27 +0800)]
[NFC][X86] add missing tests in clang/test/CodeGen/attr-target-mv.c
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D106849
Mehdi Amini [Thu, 29 Jul 2021 05:01:04 +0000 (05:01 +0000)]
Implement recursive support into OperationEquivalence::isEquivalentTo()
This allows to use OperationEquivalence to track structural comparison for equality
between two operations.
Differential Revision: https://reviews.llvm.org/D106422
Mehdi Amini [Thu, 29 Jul 2021 04:58:25 +0000 (04:58 +0000)]
Add `all_of_zip` to STLExtras
This takes two ranges and invokes a predicate on the element-wise pair in the
ranges. It returns true if all the pairs are matching the predicate and the ranges
have the same size.
It is useful with containers that aren't random iterator where we can't check the
sizes in O(1).
Differential Revision: https://reviews.llvm.org/D106605
Nathan Chancellor [Thu, 29 Jul 2021 04:56:23 +0000 (21:56 -0700)]
[test] Fix tools/gold/X86/comdat-nodeduplicate.ll on non-X86 hosts
When running this test on an aarch64 machine, it fails:
```
/usr/bin/ld.gold: error: .../test/tools/gold/X86/Output/comdat-nodeduplicate.ll.tmp/ab.lto.o: incompatible target
```
Specify the elf_x86_64 emulation as all of the other gold plugin tests
do.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D107020
Alfonso Gregory [Thu, 29 Jul 2021 04:40:47 +0000 (04:40 +0000)]
[libc][NFC] Add noreturn and constexpr qualifiers where appropriate
These functions make it clear to the compiler and user what the intended
behavior is so llvm can make them go as fast as possible.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D106807
Tom Stellard [Thu, 29 Jul 2021 04:06:14 +0000 (21:06 -0700)]
libcang: Add missing function to libclang.map
This function is marked with CINDEX_LINKAGE, but was never added to the
export list / linker script.
Reviewed By: jrtc27
Differential Revision: https://reviews.llvm.org/D106974
Michael Kruse [Thu, 29 Jul 2021 03:01:14 +0000 (22:01 -0500)]
[Preprocessor] -E -P: Ensure newline after 8 skipped lines.
The implementation of -fminimize-whitespace (D104601) revised the logic
when to emit newlines. There was no case to handle when more than
8 lines were skippped in -P (DisableLineMarkers) mode and instead fell
through the case intended for -fminimize-whitespace, i.e. emit nothing.
This patch will emit one newline in this case.
The newline logic is slightly reorganized. The `-P -fminimize-whitespace`
case is handled explicitly and emitting at least one newline is the new
fallback case. The choice between emitting a line marker or up to
7 empty lines is now a choice only with enabled line markers. The up to
8 newlines likely are fewer characters than a line directive, but
in -P mode this had the paradoxic effect that it would print up to
7 empty lines, but none at all if more than 8 lines had to be skipped.
Now with DisableLineMarkers, we don't consider printing empty lines
(just start a new line) which matches gcc's behavior.
The line-directive-output-mincol.c test is replaced with a more
comprehensive test skip-empty-lines.c also testing the more than
8 skipped lines behaviour with all flag combinations.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D106924
Stella Laurenzo [Thu, 29 Jul 2021 03:19:14 +0000 (03:19 +0000)]
Update file names and extensions for MLIR Python execution engine changes.
Stella Laurenzo [Thu, 29 Jul 2021 02:44:01 +0000 (02:44 +0000)]
NFC: Add missing import to integration test.
LLVM GN Syncbot [Thu, 29 Jul 2021 02:29:22 +0000 (02:29 +0000)]
[gn build] Port
61c35fb0c2c9
Ruslan Arutyunyan [Thu, 29 Jul 2021 02:05:46 +0000 (22:05 -0400)]
[libc++][modularisation] Split <compare> into internal headers.
Differential Revision: https://reviews.llvm.org/D106107
Arthur O'Dwyer [Thu, 29 Jul 2021 02:11:41 +0000 (22:11 -0400)]
[libc++] Remove unused variables in generate_private_header_tests.py. NFCI.
Jason Liu [Thu, 29 Jul 2021 02:22:10 +0000 (22:22 -0400)]
[libc++] money_get::do_get() set failbit and eofbit if iterator begin equals end
Summary:
Currently, if we pass in the same iterator for begin and end,
the long double version of do_get would throw a runtime error.
However, according to standard (https://eel.is/c++draft/locale.money.get#virtuals-1),
we should set the failbit and eofbit when no more characters are available.
Differential Revision: https://reviews.llvm.org/D100510
Guozhi Wei [Thu, 29 Jul 2021 02:00:45 +0000 (19:00 -0700)]
[MBP] findBestLoopTopHelper should exit if OldTop is not a chain header
Function findBestLoopTopHelper tries to find a new loop top block which can also
fall through to OldTop, but it's impossible if OldTop is not a chain header, so
it should exit immediately.
Differential Revision: https://reviews.llvm.org/D106329
Ben Shi [Thu, 29 Jul 2021 01:32:17 +0000 (09:32 +0800)]
[RISCV] Optimize mul in the zba extension with SH*ADD
This patch makes the following optimization, if the
immediate multiplier is not a simm12.
(mul x, (power_of_2 + 2)) => (SH1ADD x, (SLLI x, bits))
(mul x, (power_of_2 + 4)) => (SH2ADD x, (SLLI x, bits))
(mul x, (power_of_2 + 8)) => (SH3ADD x, (SLLI x, bits))
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D106648
Ben Shi [Fri, 23 Jul 2021 11:00:50 +0000 (19:00 +0800)]
[RISCV][test] Add new tests for mul optimization in the zba extension with SH*ADD
These test will show the following optimization by future patches.
(mul x, (power_of_2 + 2)) => (SH1ADD x, (SLLI x, bits))
(mul x, (power_of_2 + 4)) => (SH2ADD x, (SLLI x, bits))
(mul x, (power_of_2 + 8)) => (SH3ADD x, (SLLI x, bits))
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D106647
Arthur O'Dwyer [Tue, 2 Mar 2021 05:23:21 +0000 (00:23 -0500)]
[libc++] Implement the resolutions of LWG3506 and LWG3522.
Implement the changes in all language modes.
LWG3506 "Missing allocator-extended constructors for priority_queue"
makes the following changes:
- New allocator-extended constructors for priority_queue.
- New deduction guides targeting those constructors.
LWG3522: "Missing requirement on InputIterator template parameter
for priority_queue constructors". The iterator parameter should be
constrained to actually be an iterator type. `priority_queue{1,2}`
should be SFINAE-friendly ill-formed.
Also, do a drive-by fix in the allocator-extended move constructor:
there's no need to do a `make_heap` after moving from `__q.c` into
our own `c`, because that container was already heapified when it
was part of `__q`. [priqueue.cons.alloc] actually specifies the
behavior and does *not* mention calling `make_heap`. I think this
was just a copy-paste thinko. It dates back to the initial import
of libc++.
Differential Revision: https://reviews.llvm.org/D106824
Differential Revision: https://reviews.llvm.org/D106827
Wenlei He [Wed, 28 Jul 2021 01:00:55 +0000 (18:00 -0700)]
[ThinLTO] Disallow importing for functions with indir branch to block address
We don't allowing inlining for functions with blockaddress with uses other than strictly callbr. This is because if the blockaddress escapes the function via a global variable, inlining may lead to an invalid cross-function reference.
We check against such cases during inlining, however the check can fail for ThinLTO post-link because CFG simplification can incorrectly removes blocks based on wrong block reachability.
When we import a function with blockaddress taken in a global variable but without importing that variable, we won't go through value mapping to reflect the real address-taken-ness of the cloned blocks. For the imported clone, this leads to blocks reachable from indirect branch through global variable being incorrectly treated as unreachable and removed by SimplifyCFG.
Since inlining for such cases shouldn't be allowed in the first place, I'm marking them as ineligible for importing during pre-link to save the problem of missing address-taken-ness of imported clone as well as bad DCE and inlining.
Differential Revision: https://reviews.llvm.org/D106930
Marco Vanotti [Tue, 20 Jul 2021 01:16:34 +0000 (18:16 -0700)]
[asan][fuchsia] Implement PlatformUnpoisonStacks
This CL modifies the PlatformUnpoisonStacks so that fuchsia can
implement its own logic for unpoisoning the stacks.
For the general case, the behavior is the same as with regular asan: it
will unpoison everything from the current stack pointer until the base
of the stack (stack top).
In some situations, the current stack might not be the same as the
default stack. In those cases, the code will now unpoison the entire
default stack, and will also unpoison the current page of the stack.
Reviewed By: mcgrathr
Differential Revision: https://reviews.llvm.org/D106835
Marco Vanotti [Fri, 23 Jul 2021 22:54:24 +0000 (15:54 -0700)]
[libFuzzer] Fix CFI Directives for fuchsia
This commit fixes the CFI directives in the crash trampoline so
libunwind can get a backtrace during a crash.
In order to get a backtrace from a libfuzzer crash in fuchsia, we
resume execution in the crashed thread, forcing it to call the
StaticCrashHandler. We do this by setting a "crash trampoline" that has
all the necessary cfi directives for an unwinder to get full backtrace
for that thread.
Due to a bug in libunwind, it was not possible to restore the RSP
pointer, as it was always set to the call frame address (CFA). The
previous version worked around this issue by setting the CFA to the
value of the stack pointer at the point of the crash.
The bug in libunwind is now fixed[0], so I am correcting the CFI
annotations so that the CFA correctly points to the beginning of the
trampoline's call frame.
[0]: https://reviews.llvm.org/D106626
Reviewed By: mcgrathr
Differential Revision: https://reviews.llvm.org/D106725
Daniel Rodríguez Troitiño [Tue, 20 Jul 2021 23:40:47 +0000 (16:40 -0700)]
[llvm-objcopy][MachO] Ignore all LC_SUB_* commands.
The LC_SUB_FRAMEWORK, LC_SUB_UMBRELLA, LC_SUB_CLIENT, and LC_SUB_LIBRARY
are used to indicate related libraries, binaries or framework names.
Their only payload is the string with the name of the object. Adding
those commands to the list of ignored/skipped load commands will avoid
an error that stop the process of copying/stripping and will copy their
contents verbatim.
Additionally, in order to have a test for this case, `yaml2obj` now
allows those four commands to contain a `Content`.
Differential Revision: https://reviews.llvm.org/D106412
Jessica Paquette [Wed, 28 Jul 2021 23:03:41 +0000 (16:03 -0700)]
[AArch64][GlobalISel] Improve legalization for odd-type G_LOAD
Swap the order of widening so that we widen to the next power-of-2 first when
legalizing G_LOAD.
Also, provide a minimum type for the power of 2 to disallow s2 + s1. Clamping
ought to disallow s2 and s1, but I think it's better to be explicit about the
expected minimum size.
We probably need a similar change for G_STORE, but it seems to be a bit more
finnicky. So, let's just handle G_LOAD for now.
Differential Revision: https://reviews.llvm.org/D107013
Stella Laurenzo [Wed, 28 Jul 2021 20:00:02 +0000 (20:00 +0000)]
Break apart the MLIR ExecutionEngine from core python module.
* For python projects that don't need JIT/ExecutionEngine, cuts the number of files to compile roughly in half (with similar reduction in end binary size).
Differential Revision: https://reviews.llvm.org/D106992
Mehdi Amini [Wed, 28 Jul 2021 05:22:45 +0000 (05:22 +0000)]
Emit strong definition for TypeID storage in Op/Type/Attributes definition
By making an explicit template specialization for the TypeID provided by these classes,
the compiler will not emit an inline weak definition and rely on the linker to unique it.
Instead a single definition will be emitted in the C++ file alongside the implementation
for these classes. That will turn into a linker error what is now a hard-to-debug runtime
behavior where instances of the same class may be using a different TypeID inside of
different DSOs.
Recommit
660a56956c32b0bcd850fc12fa8ad0225a6bb880 after fixing gcc5
build.
Differential Revision: https://reviews.llvm.org/D105903
Stella Laurenzo [Wed, 28 Jul 2021 23:56:38 +0000 (23:56 +0000)]
NFC: Adapt operation.py to builtin operation print format changes.