Eli Friedman [Fri, 13 May 2022 20:36:16 +0000 (13:36 -0700)]
[GlobalIsel] Fix fallback if stack protector isn't supported.
When GlobalISel fails, we need to report the error, and we need to set
the FailedISel property. We skipped those steps if stack protector
insertion failed, which led to a very strange miscompile.
Differential Revision: https://reviews.llvm.org/D125584
Egor Zhdan [Fri, 13 May 2022 21:05:28 +0000 (22:05 +0100)]
[Clang] Fix DriverKit tests on Linux
Some new DriverKit tests were added in https://reviews.llvm.org/D121911, and unfortunately they fail on Linux build bots.
Alexey Bataev [Fri, 13 May 2022 19:08:08 +0000 (12:08 -0700)]
[SLP]Do not look for buildvector sequence, if the index is reused.
If the insert indes was used already or is not constant, we should stop
looking for unique buildvector sequence, it mustbe splitted to
2 different buildvectors.
Joseph Huber [Fri, 13 May 2022 20:29:39 +0000 (16:29 -0400)]
[Libomptarget] Build the static library without CUDA installed
Summary:
This patch allows users to compile the static library without CUDA
installed on the system. This requires the new flag `--cuda-feature` to
indicate that we need `+ptx61` in order to compile the runtime.
Joseph Huber [Fri, 13 May 2022 20:16:15 +0000 (16:16 -0400)]
[CUDA] Add a flag to manually specify the target feature to use with CUDA
Summary:
Normally we parse through the CUDA installation to disover the needed
features. However, we may want to build libraries on targets that do not
currently have CUDA installed but still need to know which features to
make use of when creating the PTX or bitcode. This flag is a simple way
to specify this so we can compile certain codes withotu a valid CUDA
installation.
Ideally this could be done via an -Xarch or simimlar flag but currently
they cannot handle this. We would need to support using an -Xarch flag
that takes multiple arguments that then pass them to the -Xclang
functionality.
Amir Ayupov [Fri, 13 May 2022 20:14:45 +0000 (13:14 -0700)]
[BOLT][CMAKE] Fix DYLIB build
Move BOLT libraries out of `LLVM_LINK_COMPONENTS` to `target_link_libraries`.
Addresses issue #55432.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D125568
River Riddle [Wed, 11 May 2022 22:49:24 +0000 (15:49 -0700)]
[TableGen] Add a new json textmate description for syntax highlighting
There isn't really a good pre-existing syntax highlighter for tablegen, so this
commit adds a textmate version that covers nearly everything in the current
spec.
Differential Revision: https://reviews.llvm.org/D125427
Amir Ayupov [Fri, 13 May 2022 14:12:40 +0000 (07:12 -0700)]
[BOLT][TEST] Fix testing on macos
- Fix common (arch-independent) tests to explicitly target -linux triple.
- Override the triple inside arch-specific tests.
- Add cflags to common tests.
- Update individual tests.
- Expand pipe stderr `|&` shorthand.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D125548
Egor Zhdan [Wed, 16 Mar 2022 19:31:04 +0000 (19:31 +0000)]
[Clang] Add DriverKit support
This is the second patch that upstreams the support for Apple's DriverKit.
The first patch: https://reviews.llvm.org/D118046.
Differential Revision: https://reviews.llvm.org/D121911
Jonas Devlieghere [Fri, 13 May 2022 19:15:05 +0000 (12:15 -0700)]
[lldb] Parallelize fetching symbol files in crashlog.py
When using dsymForUUID, the majority of time symbolication a crashlog
with crashlog.py is spent waiting for it to complete. Currently, we're
calling dsymForUUID sequentially when iterating over the modules. We can
drastically cut down this time by calling dsymForUUID in parallel. This
patch uses Python's ThreadPoolExecutor (introduced in Python 3.2) to
parallelize this IO-bound operation.
The performance improvement is hard to benchmark, because even with an
empty local cache, consecutive calls to dsymForUUID for the same UUID
complete faster. With warm caches, I'm seeing a ~30% performance
improvement (~90s -> ~60s). I suspect the gains will be much bigger for
a cold cache.
dsymForUUID supports batching up multiple UUIDs. I considered going that
route, but that would require more intrusive changes. It would require
hoisting the logic out of locate_module_and_debug_symbols which we
explicitly document [1] as a feature of Symbolication.py to locate
symbol files.
[1] https://lldb.llvm.org/use/symbolication.html
Differential reviison: https://reviews.llvm.org/D125107
Amara Emerson [Thu, 5 May 2022 20:55:49 +0000 (13:55 -0700)]
[GlobalISel] Combine G_SHL, G_ASHR, G_SHL of undef shifts to undef.
Differential Revision: https://reviews.llvm.org/D125041
Amir Ayupov [Fri, 13 May 2022 19:14:17 +0000 (20:14 +0100)]
[BOLT][NFC] Use refs for loop variables to avoid copies
Addresses warnings when built with Apple Clang.
Reviewed By: yota9
Differential Revision: https://reviews.llvm.org/D125483
Amir Ayupov [Fri, 13 May 2022 18:56:45 +0000 (19:56 +0100)]
[BOLT][NFC] Suppress unused variable warnings
Address warnings in Release build without assertions.
Tip @tschuett for reporting the issue #55404.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D125475
Fangrui Song [Fri, 13 May 2022 19:02:14 +0000 (12:02 -0700)]
[ELF][test] Add an input section description test with "()" in the filename
Fangrui Song [Fri, 13 May 2022 18:53:03 +0000 (11:53 -0700)]
[ELF][test] Clean up linkerscript/{filename-spec.s,group.s}
Amir Ayupov [Thu, 12 May 2022 17:29:41 +0000 (18:29 +0100)]
[BOLT][CMAKE] Add missing clauses to bolt/runtime/CMakeLists.txt
Fix build with Apple Clang.
Tip @tschuett for reporting the issue #55404.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D125480
Louis Dionne [Fri, 13 May 2022 18:43:43 +0000 (14:43 -0400)]
[runtimes] Fix how we trigger CI
For example, we used to trigger CI even for commits that touched a file
whose path contained 'cmake', even if it's not the root cmake directory.
Fix that.
Joseph Huber [Tue, 10 May 2022 19:00:53 +0000 (15:00 -0400)]
[OpenMP] Use the new OpenMP device static library when doing LTO
The previous patches allowed us to create a static library containing
all the device code. This patch uses that library to perform the device
runtime linking late when performing LTO. This in addition to
simplifying the libraries, allows us to transparently handle the runtime
library as-needed without needing Clang to manually pass the necessary
library in the linker wrapper job.
Depends on D125315
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D125333
Joseph Huber [Tue, 10 May 2022 12:49:08 +0000 (08:49 -0400)]
[Libomptarget] Build the device runtime as a static library
This patch adds the necessary CMake configuration to build a static
library version of the device runtime, `libomptarget.devicertl.a`.
Various improvements in how we handle static libraries and generating
offloading code should allow us to treat the device library as a regular
project without needing to invoke the clang front-end directly. Here we
generate a job for each offloading architecture supported. Each
offloading architecture will be embedded into the static library and
used as-needed by the host.
This library will primarily be used to replace the bitcode library when
performing LTO. Currently, we need to manually pass in the bitcode
library which requires foreknowledge of the offloading architecture.
This approach lets us handle that in the linker wrapper instead.
Furthermore this should improve our interface to the device runtime. We
can now build it fully under a release build and have all the expected
entry points, as well as supporting debug builds.
Depends on D125265 D125256 D125260 D125314 D125563
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D125315
Joseph Huber [Fri, 13 May 2022 17:07:46 +0000 (13:07 -0400)]
[Libomptarget] Remove global include directory from libomptarget
We used to globally include the libomptarget include directory for all
projects. This caused some conflicts with the other files named
"Debug.h". This patch changes the cmake to include these files via the
target include instead.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D125563
Joseph Huber [Tue, 10 May 2022 13:45:39 +0000 (09:45 -0400)]
[OpenMP] Don't set device runtime debugging flags if using '-nogpulib'
We use globals to configure debugging at compile-time for the device
runtime. Because these are only used by the OpenMP runtime we shouldn't
define them if we aren't using the device runtime. When a user passes in
'-nogpulib' this indicates that we are not using the device runtime, so
we should check for the precense of this flag and not emit these globals
if used.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D125314
Joseph Huber [Mon, 9 May 2022 19:48:58 +0000 (15:48 -0400)]
[OpenMP] Don't include the device wrappers if -nostdinc is used
OpenMP uses several wrapper hearders to provide the definitions of
needed symbols contained in the host. However, some users may use the
`-nostdinc` option to override these definitions themselves. The OpenMP
wrapper headers are stored in the same location as the clang install. If
the user passes `-nostdinc` then this include directory is never looked
at by default which means that including these wrappers will always
fail. These headers should instead be included manually if they are
needed with a `-nostdinc` build.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D125265
Joseph Huber [Mon, 9 May 2022 19:10:04 +0000 (15:10 -0400)]
[OpenMP] Add `__CUDA_ARCH__` definition when offloading with OpenMP
Currently we define the `__CUDA_ARCH__` macro only in CUDA mode. This
patch allows us to use this macro in OpenMP-offloading mode when
targeting NVPTX.
Reviewed By: tra, tianshilei1992
Differential Revision: https://reviews.llvm.org/D125256
Joseph Huber [Tue, 10 May 2022 21:33:41 +0000 (17:33 -0400)]
[Libomptarget] Address existing warnings in the device runtime library
This patche attemps to address the current warnings in the OpenMP
offloading device runtime. Previously we did not see these because we
compiled the runtime without the standard warning flags enabled.
However, these warnings are used when we now build the static library
version of this runtime. This became extremely noisy when coupled with
the fact the we compile each file roughly 32 times when all the
architectures are considered. So it would be ideal to not have all these
warnings show up when building.
Most of these errors were simply implicit switch-case fallthroughs,
which can be addressed using C++17's fallthrough attribute. Additionally
there was a volatile variable that was being casted away. This is most
likely safe to remove because we cast it away before its even used and
didn't seem to affect anything in testing.
Depends on D125260
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D125339
Joseph Huber [Mon, 9 May 2022 18:22:59 +0000 (14:22 -0400)]
[Libomptarget] Allow the device runtime to be compiled for the host
Currently the OpenMP offloading device runtime is only expected to be
compiled for the specific architecture it's targeting. This is
problematic if we want to make compiling the device runtime more general
via the standar `clang` driver rather than invoking the clang front-end
directly. This patch addresses this by primarily changing the declare
type to `nohost` so the host will not contain any of this code.
Additionally we forward declare the functions that are defined via
variants, otherwise these would cause problems on the host.
Reviewed By: jdoerfert, tianshilei1992
Differential Revision: https://reviews.llvm.org/D125260
Louis Dionne [Fri, 13 May 2022 16:15:15 +0000 (12:15 -0400)]
[runtimes][NFC] Remove dead code for Standalone builds
Standalone builds have been deprecated and then removed for a while now.
Trying to use standalone builds leads to a fatal CMake error, so this
code is all dead. Remove it to clean things up.
Differential Revision: https://reviews.llvm.org/D125561
Simon Pilgrim [Fri, 13 May 2022 18:06:51 +0000 (19:06 +0100)]
Fix implicit double -> float truncation warnings. NFCI.
Fangrui Song [Fri, 13 May 2022 18:06:01 +0000 (11:06 -0700)]
[ELF] Disallow input section description without a filename
GNU ld does not allow `.foo : { (*foo) }`, but we may recognize it as three
input section descriptions: file "(" with any section name, file "*foo" with
any section name, file ")" with any section name. Disallow the error-prone usage.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D125523
Craig Topper [Fri, 13 May 2022 17:57:35 +0000 (10:57 -0700)]
Revert "[RISCV] Enable subregister liveness tracking for RVV."
This reverts most of
ed242b54c9c2aa84a47f66af5b8497d93646b68d
I'm seeing failures in our intrinsic testing on qemu that seem
related to this. Reverting while I investigate.
I've left the command line option in place for directed testing.
It defaults to off.
Petr Hosek [Fri, 13 May 2022 17:45:08 +0000 (10:45 -0700)]
[CMake] Disable libedit in Fuchsia toolchain
We don't need libedit in our toolchain build.
Differential Revision: https://reviews.llvm.org/D125570
Simon Pilgrim [Fri, 13 May 2022 17:31:15 +0000 (18:31 +0100)]
DAGCombiner.cpp - break if-else chains that always return (style)
Louis Dionne [Fri, 13 May 2022 17:24:57 +0000 (13:24 -0400)]
[libunwind] Remove -Wsign-conversion warning
Philip Reames [Fri, 13 May 2022 16:51:23 +0000 (09:51 -0700)]
[RISCV] Address post-commit feedback from af5e09b
Philip Reames [Fri, 13 May 2022 16:29:35 +0000 (09:29 -0700)]
[RISCV] Precommit tests showing missed vlenb optimizations
Louis Dionne [Tue, 10 May 2022 14:35:49 +0000 (10:35 -0400)]
[libc++abi][NFCI] Refactor demangling_terminate_handler to reduce nesting
This keeps the same logic, but uses early return to avoid multiple layers
of nested ifs and make the code simpler to follow.
Differential Revision: https://reviews.llvm.org/D125476
Hongtao Yu [Mon, 9 May 2022 20:23:59 +0000 (13:23 -0700)]
[CSSPGO][CSProfileConverter] Remove call target samples when including callee samples into caller.
When a flat CS profile is converted to a nested profile, the call target samples for inlined callee contexts are left over in the callsite target map. This could cause indirect call promotion to function improperly. One issue is that the inlined callsites are treated with double amount of samples. The other is the inlined callsites are reconsidered for subsequent PGO ICP.
I'm fixing this by excluding call targets from the callsite for inlined targets. While fixing this I found that callsite target sum and the number of body samples for that callsite could be mismatched. {D122609} has an explanation and a fix for that on llvm-profgen side. For now I'm tolerating it in this change.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D125266
Philip Reames [Fri, 13 May 2022 16:01:19 +0000 (09:01 -0700)]
[RISCV] Add llvm.read.register support for vlenb
This patch adds minimal support for lowering an read.register intrinsic with vlenb as the argument. Note that vlenb is an implementation constant, so it is never allocatable.
This was split off a patch to eventually replace PseudoReadVLENB with a COPY MI because doing so revealed a couple of optimization opportunities which really seemed to warrant individual patches and tests. To write those patches, I need a way to write the tests involving vlenb, and read.register seemed like the right testing hook.
Differential Revision: https://reviews.llvm.org/D125552
Chris Lattner [Fri, 13 May 2022 14:38:50 +0000 (15:38 +0100)]
[ParseResult] Mark this as LLVM_NODISCARD (like LogicalResult) and fix issues.
There are a lot of cases where we accidentally ignored the result of some
parsing hook. Mark ParseResult as LLVM_NODISCARD just like ParseResult is.
This exposed some stuff to clean up, so do.
Differential Revision: https://reviews.llvm.org/D125549
Mike Rice [Thu, 12 May 2022 16:33:53 +0000 (09:33 -0700)]
[OpenMP] Fix declare simd use on in-class member template function
Return the Decl when parsing the template member declaration so the
'omp declare simd' pragma can be applied to it. Previously a nullptr
was returned causing an error applying the pragma.
Fixes #52700.
Differential Revision: https://reviews.llvm.org/D125493
Nikita Popov [Fri, 13 May 2022 15:19:19 +0000 (17:19 +0200)]
[InstSimplify] Add additional implied condition tests (NFC)
Balazs Benics [Fri, 13 May 2022 15:06:55 +0000 (17:06 +0200)]
Revert "[clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks"
This reverts commit
7e3ea55da88a9d7feaa22f29d51f89fd0152a189.
Looks like this breaks tests: http://45.33.8.238/linux/76033/step_8.txt
Balazs Benics [Fri, 13 May 2022 10:34:45 +0000 (12:34 +0200)]
[analyzer] Introduce clang_analyzer_dumpSvalType introspection function
In some rare cases the type of an SVal might be interesting.
This introspection function exposes this information in tests.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D125532
Balazs Benics [Fri, 13 May 2022 15:04:34 +0000 (17:04 +0200)]
[analyzer][NFC] Tighten some of the SValBuilder return types
This is purely a cosmetic change.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D125463
Sanjay Patel [Fri, 13 May 2022 14:30:58 +0000 (10:30 -0400)]
[SDAG] freeze operand when expanging urem
This is a potential miscompile as discussed in issue #55291.
The related IR transform was patched with:
d428f09b2c9d49f6a32
Sanjay Patel [Fri, 13 May 2022 14:28:22 +0000 (10:28 -0400)]
[x86] add test to show potential miscompile with undef value; NFC
This is based on:
c2a5a87500d92c
Balazs Benics [Fri, 13 May 2022 14:54:13 +0000 (16:54 +0200)]
[clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks
The check should not report includes wrapped by `extern "C" { ... }` blocks,
such as:
```lang=C++
#ifdef __cplusplus
extern "C" {
#endif
#include "assert.h"
#ifdef __cplusplus
}
#endif
```
This pattern comes up sometimes in header files designed to be consumed
by both C and C++ source files.
The check now reports false reports when the header file is consumed by
a C++ translation unit.
In this change, I'm not emitting the reports immediately from the
`PPCallback`, rather aggregating them for further processing.
After all preprocessing is done, the matcher will be called on the
`TranslationUnitDecl`, ensuring that the check callback is called only
once.
Within that callback, I'm recursively visiting each decls, looking for
`LinkageSpecDecls` which represent the `extern "C"` specifier.
After this, I'm dropping all the reports coming from inside of it.
After the visitation is done, I'm emitting the reports I'm left with.
For performance reasons, I'm sorting the `IncludeMarkers` by their
corresponding locations.
This makes the scan `O(log(N)` when looking up the `IncludeMarkers`
affected by the given `extern "C"` block. For this, I'm using
`lower_bound()` and `upper_bound()`.
Reviewed By: whisperity
Differential Revision: https://reviews.llvm.org/D125209
PeixinQiao [Fri, 13 May 2022 14:43:12 +0000 (22:43 +0800)]
[flang] Warn for the limit on name length
As fortran 2018 C601, the maximum length of a name is 63 characters.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D125371
Nikita Popov [Fri, 13 May 2022 14:41:27 +0000 (16:41 +0200)]
[LoopVectorize] Regenerate test checks (NFC)
zhijian [Fri, 13 May 2022 14:40:15 +0000 (10:40 -0400)]
[AIX] support write operation of big archive.
SUMMARY
1. Enable supporting the write operation of big archive.
2. the first commit come from https://reviews.llvm.org/D104367
3. refactor the first commit and implement writing symbol table.
4. fixed the bugs and add more test cases in the second commit.
Reviewers: James Henderson
Differential Revision: https://reviews.llvm.org/D123949
Simon Pilgrim [Fri, 13 May 2022 14:29:51 +0000 (15:29 +0100)]
[X86] LowerStore - use is64BitVector() wrapper. NFCI.
Kristof Beyls [Fri, 13 May 2022 14:28:06 +0000 (16:28 +0200)]
Update my office hours
Aaron Puchert [Fri, 13 May 2022 14:26:31 +0000 (16:26 +0200)]
Try to disambiguate between overloads on Mac
Presumably Mac has a different understanding of how long `long` is.
Should fix a build error introduced by D125429 that's not visible on
other architectures.
Jay Foad [Fri, 13 May 2022 13:17:23 +0000 (14:17 +0100)]
[APInt] Fix documentation of *OrSelf methods
Document that truncOrSelf, zextOrSelf and sextOrSelf only enforce
an upper or lower bound on the bitwidth of the result.
Aaron Ballman [Fri, 13 May 2022 14:23:23 +0000 (10:23 -0400)]
Remove a stale FIXME comment; NFC
Sanjay Patel [Fri, 13 May 2022 13:15:22 +0000 (09:15 -0400)]
[ValueTracking] recognize sub X, (X % Y) as not overflowing
I fixed some poison-safety violations on related patterns in InstCombine
and noticed that we missed adding nsw/nuw on them, so this adds clauses
to the underlying analysis for that.
We need the undef input restriction to make this safe according to Alive2:
https://alive2.llvm.org/ce/z/48g9K8
Differential Revision: https://reviews.llvm.org/D125500
Sanjay Patel [Thu, 12 May 2022 20:08:51 +0000 (16:08 -0400)]
[InstCombine] add tests for sub with rem operand; NFC
Nico Weber [Fri, 13 May 2022 13:48:01 +0000 (09:48 -0400)]
Revert "In MSVC compatibility mode, friend function declarations behave as function declarations"
This reverts commit
ad47114ad8500c78046161d492ac13a8e3e610eb.
See discussion on https://reviews.llvm.org/D124613.
Stephen Long [Fri, 13 May 2022 13:39:19 +0000 (06:39 -0700)]
[MSVC] Add support for pragma function
MSVC pragma function tells the compiler to generate calls to functions in the pragma function list, instead of using the builtin. Needs https://reviews.llvm.org/D124701
https://docs.microsoft.com/en-us/cpp/preprocessor/function-c-cpp?view=msvc-170
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D124702
Jonas Paulsson [Tue, 8 Mar 2022 20:51:43 +0000 (15:51 -0500)]
[SystemZ] Patchset for expanding memcpy/memset using at most two stores.
* Set MaxStoresPerMemcpy and MaxStoresPerMemset to 2.
* Optimize stores of replicated values in SystemZ::combineSTORE(). This
handles the now expanded memory operations and as well some other
pre-existing cases.
* Reject a big displacement in isLegalAddressingMode() for a vector type.
* Return true from shouldConsiderGEPOffsetSplit().
Reviewed By: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D122105
Nikita Popov [Fri, 13 May 2022 13:29:20 +0000 (15:29 +0200)]
[ControlHeightReduction] Simplify addToMergedCondition() (NFC)
Ken Matsui [Fri, 13 May 2022 13:09:32 +0000 (09:09 -0400)]
Suggest typo corrections for preprocessor directives
When a preprocessor directive is unknown outside of a skipped
conditional block, we give an error diagnostic because we don't know
how to proceed with preprocessing. But when the directive is in a
skipped conditional block, we would not diagnose it on the theory that
the directive may be known to an implementation other than Clang.
Now, for unknown directives inside a skipped conditional block, we
diagnose the unknown directive as a warning if it is sufficiently
similar to a directive specific to preprocessor conditional blocks. For
example, we'll warn about `#esle` and suggest `#else` but we won't warn
about `#progma` because it's not a directive specific to preprocessor
conditional blocks.
Fixes #51598
Differential Revision: https://reviews.llvm.org/D124726
David Sherwood [Fri, 6 May 2022 14:14:06 +0000 (15:14 +0100)]
[LoopVectorize] Add overflow checks when tail-folding with scalable vectors
In InnerLoopVectorizer::getOrCreateVectorTripCount there is an
assert that the known minimum value for the VF is a power of 2
when tail-folding is enabled. However, for scalable vectors the
value of vscale may not be a power of 2, which means we have
to worry about the possibility of overflow. I have solved this
problem by adding preheader checks that prevent us from entering
the vector body if the canonical IV would overflow, i.e.
if ((IntMax - TripCount) < (VF * UF)) ... skip vector loop ...
Differential Revision: https://reviews.llvm.org/D125235
Nikita Popov [Fri, 13 May 2022 08:38:33 +0000 (10:38 +0200)]
[InstSimplify] Fold and/or using implied conditions
This adds two conjugated folds:
* A | B -> B if A implies B (https://alive2.llvm.org/ce/z/R6GU4j)
* A & B -> A if A implies B (https://alive2.llvm.org/ce/z/EGMqyy)
If A and B are icmps themselves, we will usually fold this through
other logic already (though the tests show a couple additional cases
we previously missed). However, isImpliedCond() also supports A
being of the form X & Y, which allows us to handle cases like
(X & Y) | B where X implies B. This addresses the regression from
D125398.
Something that notably doesn't work yet is the (X | Y) & B case.
This is due to an asymmetry in the isImpliedCondition()
implementation that will have to be addressed separately.
Differential Revision: https://reviews.llvm.org/D125530
Simon Pilgrim [Fri, 13 May 2022 13:07:27 +0000 (14:07 +0100)]
[SLP][X86] Add common CHECK prefix to sub-128-bit vector tests
Nico Weber [Fri, 13 May 2022 12:56:54 +0000 (08:56 -0400)]
fix typos to cycle bots
Louis Dionne [Tue, 1 Mar 2022 13:42:13 +0000 (08:42 -0500)]
[libc++] Overhaul how we select the ABI library
This patch overhauls how we pick up the ABI library. Instead of setting
ad-hoc flags, it creates interface targets that can be linked against by
the rest of the build, which is easier to follow and extend to support
new ABI libraries.
This is intended to be a NFC change, however there are some additional
simplifications and improvements we can make in the future that would
require a slight behavior change.
Differential Revision: https://reviews.llvm.org/D120727
Aaron Ballman [Fri, 13 May 2022 12:25:40 +0000 (08:25 -0400)]
Silence some false positive -Wstrict-prototype warnings
Before issuing the warning about use of a strict prototype, check if
the declarator is required to have a prototype through some other means
determined at parse time.
This silences false positives in OpenCL code (where the functions are
forced to have a prototype) and block literal expressions.
Nikita Popov [Fri, 13 May 2022 10:48:52 +0000 (12:48 +0200)]
[IRBuilder] Add IsInBounds parameter to CreateGEP()
We commonly want to create either an inbounds or non-inbounds GEP
based on a boolean value, e.g. when preserving inbounds from
existing GEPs. Directly accept such a boolean in the API, rather
than requiring a ternary between CreateGEP and CreateInBoundsGEP.
This change is not entirely NFC, because we now preserve an
inbounds flag in a constant expression edge-case in InstCombine.
Florian Hahn [Fri, 13 May 2022 12:19:41 +0000 (13:19 +0100)]
[ConstraintElimination] Simplify ssub(A,B) if B s>=b && B s>=0.
A first patch to use the reasoning in ConstraintElimination to simplify
sub with overflow to a regular sub, if the operation is guaranteed to
not overflow.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D125264
Aaron Puchert [Fri, 13 May 2022 11:47:22 +0000 (13:47 +0200)]
Comment parsing: Treat properties as zero-argument inline commands
That is more accurate, and using a separate class in TableGen seems
appropriate since these are not parts of the text but properties of the
declaration itself.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D125473
Aaron Puchert [Fri, 13 May 2022 11:37:30 +0000 (13:37 +0200)]
Comment parsing: Allow inline commands to have 0 or more than 1 argument
That's required to support `\n`, but can also be used for other commands.
We already had the infrastructure in place to parse a varying number of
arguments, we simply needed to generalize it so that it would work not
only for block commands.
This should fix #55319.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D125429
Aaron Puchert [Fri, 13 May 2022 11:36:05 +0000 (13:36 +0200)]
Comment parsing: Specify argument numbers for some block commands
The command traits have a member NumArgs for which all the parsing
infrastructure is in place, but no command was setting it to a value
other than 0. By doing so we get warnings when passing an empty
paragraph to \retval (the first argument is the return value, then comes
the description). We also take \xrefitem along for the ride, although as
the documentation states it's unlikely to be used directly.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D125422
Nathan Sidwell [Mon, 28 Mar 2022 19:55:45 +0000 (12:55 -0700)]
[demangler] Avoid special-subst code duplication
We need to expand special substitutions in four different ways. This
refactors to only have one conversion from enum to string, and derive
the other 3 needs off that.
The SpecialSubstitution node is derived from the
ExpandedSpecialSubstitution. While this may seem unintuitive, it
works out quite well, as SpecialSubstitution can then use the former's
getBaseName and remove an unneeded 'basic_' prefix, for those
substitutions that are instantiations (to known typedef). Similarly
all those instantiations use the same set of template arguments (with
'basic_string', getting an additional 'allocator' arg).
Expansion tests were added in D123134, and remain unchanged.
Reviewed By: MaskRay, dblaikie
Differential Revision: https://reviews.llvm.org/D125257
Denys Shabalin [Mon, 9 May 2022 10:46:36 +0000 (12:46 +0200)]
[mlir] Fix declaration of nano time function in benchmark infra
In
d4555698f89af373f43dcb4aa1587231496bcd31, the name of nano precision timer function has changed from `nano_time` to `nanoTime`, but benchmarks were not updated to reflect that. This change addresses the discrepancy.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D125217
Simon Pilgrim [Fri, 13 May 2022 11:08:02 +0000 (12:08 +0100)]
[X86] Add tests for vector widening with freeze(undef)
As noted on D103874, the 'no-op' vector widening intrinsics currently depend on undef shuffle mask indices, moving to poison we need to adjust this to reference a 'undefined' second vector operand, which will be a freeze(undef).
Whisperity [Wed, 11 May 2022 13:33:27 +0000 (15:33 +0200)]
[ASTMatchers][clang-tidy][NFC] Hoist `forEachTemplateArgument` matcher into the core library
Fixes the `FIXME:` related to adding `forEachTemplateArgument` to the
core AST Matchers library.
Reviewed By: aaron.ballman
Differential Revision: http://reviews.llvm.org/D125383
Groverkss [Fri, 13 May 2022 10:44:27 +0000 (16:14 +0530)]
[MLIR] Fix areIdsUnique in AffineStructures
This patch fixes a bug in areIdsUnique where it ignores the [start, end] range.
No test case is added since there are no use cases through IR from where it
can be tested, and it is hard to create a unittest since we do not currently
have Values in unittests.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D124735
Nikita Popov [Fri, 13 May 2022 10:42:53 +0000 (12:42 +0200)]
[InstCombine] Fix unused variable warning (NFC)
Nikita Popov [Fri, 13 May 2022 10:42:03 +0000 (12:42 +0200)]
[IRBuilder] Remove redundant createGEP() overloads (NFC)
ArrayRef<Value *> also accepts a single Value *, there's no need
to create separate overloads for this.
Tres Popp [Fri, 13 May 2022 10:33:06 +0000 (12:33 +0200)]
Add cmake dependency for TensorToLinalg
Pavel Samolysov [Fri, 13 May 2022 09:57:16 +0000 (12:57 +0300)]
[ArgPromotion] Add tests for already seen offsets (NFC)
If a load with the same offset has already been seen but the load had
a lower alignment, the pass has to check whether the pointer is
dereferenceable and is sufficiently aligned (so, the new alignment must
be taken into account).
Tres Popp [Wed, 11 May 2022 12:10:12 +0000 (14:10 +0200)]
[mlir] Add TensorToLinalgPass
This pass is to handle computationally complex operations like
tensor.pad which are not simply lowered to the exact same operation in
the memref dialect.
Differential Revision: https://reviews.llvm.org/D125384
Nikita Popov [Fri, 13 May 2022 10:07:57 +0000 (12:07 +0200)]
[InstSimplify] Add tests for and/or with implied conditions (NFC)
LLVM GN Syncbot [Fri, 13 May 2022 09:48:26 +0000 (09:48 +0000)]
[gn build] Port
3a24df992cf8
Archibald Elliott [Fri, 13 May 2022 09:40:43 +0000 (10:40 +0100)]
[ARM] Pass for Cortex-A57 and Cortex-A72 Fused AES Erratum
This adds a late Machine Pass to work around a Cortex CPU Erratum
affecting Cortex-A57 and Cortex-A72:
- Cortex-A57 Erratum 1742098
- Cortex-A72 Erratum 1655431
The pass inserts instructions to make the inputs to the fused AES
instruction pairs no longer trigger the erratum. Here the pass errs on
the side of caution, inserting the instructions wherever we cannot prove
that the inputs came from a safe instruction.
The pass is used:
- for Cortex-A57 and Cortex-A72,
- for "generic" cores (which are used when using `-march=`),
- when the user specifies `-mfix-cortex-a57-aes-1742098` or
`mfix-cortex-a72-aes-1655431` in the command-line arguments to clang.
Reviewed By: dmgreen, simon_tatham
Differential Revision: https://reviews.llvm.org/D119720
Alex Zinenko [Fri, 13 May 2022 09:41:23 +0000 (11:41 +0200)]
[mlir] use dynamic sections in MLIR Doxygen
Due to an apparent bug in the Doxygen version <1.8.16 used to generate
documentation for MLIR, parts of the navigation (specifically, the lists
of inherited methods for classes) are unusable due to dynsections.js
missing from the output generated by Doxygen. Setting this flag makes
Doxygen always produce the file.
Archibald Elliott [Fri, 13 May 2022 09:38:19 +0000 (10:38 +0100)]
[NFC][ARM] Tests for Cortex-A57 and Cortex-A72 Fused AES Erratum
These are the tests for the pass added in
https://reviews.llvm.org/D119720
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D122747
Matthias Springer [Fri, 13 May 2022 09:32:14 +0000 (11:32 +0200)]
[mlir][sparse][NFC] Use RewriterBase/OpBuilder when possible
Most functions do not need a PatternRewriter or ConversionPatternRewriter.
Differential Revision: https://reviews.llvm.org/D125466
Matthias Springer [Fri, 13 May 2022 09:26:40 +0000 (11:26 +0200)]
[mlir][bufferize][NFC] Make getContiguousMemRefType a static function
No need to expose this as public API anymore.
Differential Revision: https://reviews.llvm.org/D125361
Zakk Chen [Tue, 10 May 2022 15:36:13 +0000 (08:36 -0700)]
[RISCV] Add the passthru operand for RVV unmasked segment load IR intrinsics.
The goal is support tail and mask policy in RVV builtins.
We focus on IR part first.
If the passthru operand is undef, we use tail agnostic, otherwise
use tail undisturbed.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D125323
Sam Parker [Fri, 13 May 2022 08:42:52 +0000 (09:42 +0100)]
[TypePromotion] Avoid some unnecessary truncs
Recommit.
Check for legal zext 'sinks' before inserting a trunc.
Differential Revision: https://reviews.llvm.org/D115451
Jay Foad [Thu, 20 Jan 2022 09:38:24 +0000 (09:38 +0000)]
[GlobalISel] Change ConstantFoldVectorBinop to return vector of APInt
Previously it built MIR for the results and returned a Register.
This avoids building constants for earlier elements of the vector if
later elements will fail to fold, and allows CSEMIRBuilder::buildInstr
to avoid unconditionally building a copy from the result.
Use a new helper function MachineIRBuilder::buildBuildVectorConstant
to build a G_BUILD_VECTOR of G_CONSTANTs.
Differential Revision: https://reviews.llvm.org/D117758
Sam Parker [Fri, 13 May 2022 08:22:12 +0000 (09:22 +0100)]
[NFC][TypePromotion][AArch64] Tests
Simplify existing test and also add it as a codegen test for aarch64.
Daniel Kiss [Fri, 13 May 2022 07:12:07 +0000 (09:12 +0200)]
[libunwind][AArch64] Add support for DWARF expression for RA_SIGN_STATE.
Program may set the RA_SIGN_STATE pseudo register by expressions.
Libunwind expected only the DW_CFA_AARCH64_negate_ra_state could change the value
of the register which leads to runtime errors on PAC enabled systems.
In the recent version of the aadwarf64[1] a limitation is added[2] to forbid the mixing the
DW_CFA_AARCH64_negate_ra_state with other DWARF Register Rule Instructions.
[1] https://github.com/ARM-software/abi-aa/releases/tag/2022Q1
[2] https://github.com/ARM-software/abi-aa/pull/129
Reviewed By: #libunwind, MaskRay
Differential Revision: https://reviews.llvm.org/D123692
Endre Fülöp [Wed, 11 May 2022 08:54:48 +0000 (10:54 +0200)]
[analyzer] Add taint to the BoolAssignmentChecker
BoolAssignment checker is now taint-aware and warns if a tainted value is
assigned.
Original author: steakhal
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D125360
Dmitry Makogon [Thu, 12 May 2022 09:48:12 +0000 (16:48 +0700)]
[RS4GC] Cache BDVs and bases alogn with IsKnownBase flag (NFC)
This refactors RS4GC to cache results returned findBaseDefiningValue
and also gets rid of BaseDefiningValueResult by caching the
IsKnownBase flag for BDVs and bases.
Differential Revision: https://reviews.llvm.org/D125000
Lian Wang [Thu, 12 May 2022 08:28:41 +0000 (08:28 +0000)]
[LegalizeTypes][VP] Add integer promotion support for vp.setcc
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D125453
Alex Bradbury [Fri, 13 May 2022 05:55:31 +0000 (06:55 +0100)]
[WebAssembly] Implement ref.is_null MC layer support and codegen
Custom type-checking (in WebAssemblyAsmTypeCheck.cpp) is used to
workaround the fact that separate variants of the instruction are
defined for externref and funcref.
Based on an initial patch by Paulo Matos <pmatos@igalia.com>.
Differential Revision: https://reviews.llvm.org/D123484
Timm Bäder [Thu, 12 May 2022 08:49:42 +0000 (10:49 +0200)]
[compiler-rt] Add NO_EXEC_STACK_DIRECTIVE on s390x
Differential Revision: https://reviews.llvm.org/D125454
Timm Bäder [Thu, 5 May 2022 10:09:52 +0000 (12:09 +0200)]
[clang][preprocessor] Fix unsigned-ness of utf8 char literals
UTF8 char literals are always unsigned.
Fixes https://github.com/llvm/llvm-project/issues/54886
Differential Revision: https://reviews.llvm.org/D124996