Benjamin Kramer [Sat, 28 Jan 2023 10:04:57 +0000 (11:04 +0100)]
[bazel] Adjust lsp-server-support include paths for
305d71853965
Benjamin Kramer [Sat, 28 Jan 2023 10:01:07 +0000 (11:01 +0100)]
[bazel] Add a dep from target asm parsers to :TargetParser
This is needed for the AArch64 asm parser after
9ea00fc74c3c
Chenguang Wang [Sat, 28 Jan 2023 09:58:55 +0000 (10:58 +0100)]
[bazel][mlir] Remove references to SubElementInterfaces.
It was removed in D142272.
This commit is manually verified with:
bazel test --config=generic_clang @llvm-project//mlir/unittests:ir_tests
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D142789
Kazu Hirata [Sat, 28 Jan 2023 08:49:38 +0000 (00:49 -0800)]
[RISCV] Use llvm::bit_floor and std::clamp (NFC)
Kazu Hirata [Sat, 28 Jan 2023 08:45:19 +0000 (00:45 -0800)]
Use std::optional instead of llvm::Optional (NFC)
Craig Topper [Sat, 28 Jan 2023 07:41:06 +0000 (23:41 -0800)]
[RISCV] Refine the (mul (zext.w X), C) -> mulhu isel heuristic.
We try to shift both X and C left by 32 to replace the zext.w
with a SLLI and use mulhu. If C is already a simm32, this likely
makes a constant that is more expensive to materialize.
Shivam Gupta [Sat, 28 Jan 2023 05:01:33 +0000 (10:31 +0530)]
[Docs] Fix a statement wrt instruction alignment of 0
Noah Goldstein [Fri, 27 Jan 2023 23:26:41 +0000 (17:26 -0600)]
Recommit "Reorder (shl (add/sub (shl x, C0), y), C1) -> (add/sub (shl x, C0 + C1), (shl y, C1))" 2nd Try
First time caused build failure:
https://lab.llvm.org/buildbot/#/builders/183/builds/10447
but after investigating it seems to be unrelated. The same
test/build passed later with the original commit here:
https://lab.llvm.org/buildbot/#/builders/183/builds/10448
This is just expanding the existing pattern that exists for AND/XOR/OR
and gets a bit more parallelism in from the instruction sequence.
Alive2:
Add - https://alive2.llvm.org/ce/z/dSmPkV
Sub1 - https://alive2.llvm.org/ce/z/6rpi5V
Sub2 - https://alive2.llvm.org/ce/z/UfYeUd
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D141875
Noah Goldstein [Fri, 27 Jan 2023 23:26:19 +0000 (17:26 -0600)]
Recommit "Add optimizations for icmp eq/ne (mul(X, Y), 0)" 2nd Try
First time caused build failure:
https://lab.llvm.org/buildbot/#/builders/183/builds/10447
but after investigating it seems to be unrelated. The same
test/build passed later with the original commit here:
https://lab.llvm.org/buildbot/#/builders/183/builds/10448
1. Add checks if X and/or Y are odd. The Odd values are unnecessary to
the icmp: isZero(Odd * N) == isZero(N)
2. If neither X nor Y is known odd, then if X * Y cannot overflow AND
if X and/or Y is non-zero, the non-zero values are unnecessary to the
icmp.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D140850
Kazu Hirata [Sat, 28 Jan 2023 02:33:25 +0000 (18:33 -0800)]
[X86] Use llvm::bit_ceil (NFC)
The argument is known to be nonzero, so we can safely switch to
llvm::bit_ceil.
Matt Arsenault [Sat, 28 Jan 2023 02:14:05 +0000 (22:14 -0400)]
llvm-reduce: Add REQUIRES: default_triple to test
Allegedly fixes test failure if there are no targets built.
Matt Arsenault [Sat, 28 Jan 2023 02:00:25 +0000 (22:00 -0400)]
LoopStrengthReduce: Convert AMDGPU tests to opaque pointers
Matt Arsenault [Thu, 3 Nov 2022 06:42:58 +0000 (23:42 -0700)]
AMDGPU: Support atomicrmw uinc_wrap/udec_wrap
For now keep the exising intrinsics working.
Mircea Trofin [Sat, 28 Jan 2023 01:58:20 +0000 (17:58 -0800)]
Fix "not all control paths return a value" introduced by D142642
Flash Sheridan [Sat, 28 Jan 2023 01:57:59 +0000 (17:57 -0800)]
Added a note that "%p" is also a Lit token and needs to be escaped.
Differential revision: https://reviews.llvm.org/D140730
Flash Sheridan [Sat, 28 Jan 2023 01:51:18 +0000 (17:51 -0800)]
Explain code coverage with Lit in docs/SourceBasedCodeCoverage.rst
The documentation for code coverage in clang/docs/SourceBasedCodeCoverage.rst omits a couple of crucial steps when using it with Lit.
This patch should fix that.
Differential revision: https://reviews.llvm.org/D140730
River Riddle [Sat, 28 Jan 2023 00:32:36 +0000 (16:32 -0800)]
[mlir][NFC] Move the headers for lsp-server-support to include/
This makes it a bit easier to share the functionality for building
language servers, and makes the API public. No real functional
change, as the API was already intended for this anyways.
Differential Revision: https://reviews.llvm.org/D142790
zhongyunde [Sat, 28 Jan 2023 01:09:10 +0000 (09:09 +0800)]
[AArch64] Fix crash for expandMOVImm
Fix https://github.com/llvm/llvm-project/issues/59892
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D141258
Peter Klausler [Tue, 3 Jan 2023 18:09:37 +0000 (10:09 -0800)]
[flang] Catch out-of-range constant arguments to CHAR/ACHAR
When folding the intrinsic functions CHAR and ACHAR, emit an
error message if the argument is out of the valid range for the
kind of the result.
Differential Revision: https://reviews.llvm.org/D142754
LLVM GN Syncbot [Sat, 28 Jan 2023 01:04:03 +0000 (01:04 +0000)]
[gn build] Port
5b8dc7c8a552
Mircea Trofin [Thu, 26 Jan 2023 15:58:17 +0000 (07:58 -0800)]
[mlgo] Introduce an "InteractiveModelRunner"
This is a model runner for ML researchers using environments like
CompilerGym. In such environments, researchers host the compiler and
want to be able to observe the problem space (features) at each decision
step of some optimization pass, at which point the compiler is stopped,
waiting for the host makes a decision and provide an advice back to
the compiler, which then continues its normal operation, and so on.
The InteractiveModelRunner supports this scenario for the feature set
exposed by the compiler at a given time. It uses 2 files - ideally FIFO
pipes - one to pass data to the host, the other to get advices back from
the host. This means this scenario is supported with no special
dependencies. The file creation and deletion is the responsibility of
the host. Hooking up this model evaluator to a MLGO-ed pass is the
responsibilty of the pass author, and subsequent patches will do so for
the current set of mlgo passes, and offer an API to easily "just opt in"
by default when mlgo-ing a new pass.
The data protocol is that of the training logger: the host sees a training
log doled out observation by observation by reading from one of the
files, and passes back its advice as a serialized tensor (i.e. tensor value
memory dump) via the other file.
There are some differences wrt the log seen during training: the
interactive model doesn't currently include the outcome (because it should be
identical to the decision, and it's also not present in the "release"
mode); and partial rewards aren't currently communicated back.
The assumption - just like with the training logger - is that the host
is co-located, thus avoiding any endianness concerns. In a distributed
environment, it is up to the hosting infrastructure to intermediate
that.
Differential Revision: https://reviews.llvm.org/D142642
Peter Klausler [Wed, 11 Jan 2023 22:31:49 +0000 (14:31 -0800)]
[flang] Portability warnings for an ambiguous ASSOCIATED() case
The standard's specification for the ASSOCIATED() intrinsic function
describes its optional second argument (TARGET=) as being required
to be a valid target for a pointer assignment statement in which the
first argument (POINTER=) was the left-hand side. Some Fortran compilers
apparently interpret this text as a requirement that the POINTER= argument
actually be a valid left-hand side to a pointer assignment statement,
and emit an error if it is not so. This particularly affects the
use of an explicit NULL pointer as the first argument.
Such usage is well-defined, benign, useful, and supported by at least
two other compilers, so we should continue to accept it. This patch
adds a portability warning and some documentation.
In order to implement the portability warning in the best way, the
special checks on calls to the ASSOCIATED() intrinsic function have
been moved from intrinsic processing to Semantics/check-calls.cpp,
whence they have access to semantics' toolchest. Special checks for
other intrinsic functions might also migrate in the future in order
to keep them all in one place.
Differential Revision: https://reviews.llvm.org/D142768
Kirill Stoimenov [Sat, 28 Jan 2023 00:46:12 +0000 (00:46 +0000)]
[LSAN] Disable leak_check_before_thread_started for hwasan
Noah Goldstein [Sat, 28 Jan 2023 00:44:45 +0000 (18:44 -0600)]
Revert "Reorder (shl (add/sub (shl x, C0), y), C1) -> (add/sub (shl x, C0 + C1), (shl y, C1))"
This reverts commit
edd80befeeb92000800ded2a6f3dcdfd672d95ea.
Caused test failures in Clangd: https://lab.llvm.org/buildbot/#/builders/183/builds/10447
reverting while investigating.
Noah Goldstein [Sat, 28 Jan 2023 00:44:02 +0000 (18:44 -0600)]
Revert "Add optimizations for icmp eq/ne (mul(X, Y), 0)"
This reverts commit
aa250ceb3ff15d55bb506b4bc8196f143133d8b5.
Caused test failures in Clangd: https://lab.llvm.org/buildbot/#/builders/183/builds/10447
reverting while investigating.
Craig Topper [Sat, 28 Jan 2023 00:39:54 +0000 (16:39 -0800)]
[RISCV] Teach computeKnownBits that vsetvli returns <= 65536.
Resolves a FIXME. We could do even better taking into account SEW/LMUL.
Craig Topper [Fri, 27 Jan 2023 23:52:31 +0000 (15:52 -0800)]
[ValueTracking] Teach computeKnownBits about riscv.vsetvli.opt and riscv.vsetvlimax.opt intrinsics.
These are like the intrinsic without opt, but don't have side effects.
Add missing test cases for riscv.vsetvlimax.
Matt Arsenault [Fri, 27 Jan 2023 21:58:20 +0000 (17:58 -0400)]
llvm-reduce: Parse file from the opened buffer instead of the file
If this wasn't bitcode this was opening a second MemoryBuffer.
Matt Arsenault [Fri, 27 Jan 2023 18:32:07 +0000 (14:32 -0400)]
llvm-reduce: Use WithColor in another place
Use more consistently capitalized/colorized/punctuated error messages.
Matt Arsenault [Fri, 27 Jan 2023 20:36:42 +0000 (16:36 -0400)]
llvm-reduce: Use ThreadPool feature to wait for tasks to complete
Don't use the hackier barrier I wrote using the task queue.
Matt Arsenault [Fri, 27 Jan 2023 18:47:18 +0000 (14:47 -0400)]
llvm-reduce: Use consistent type for reducer function
Kirill Stoimenov [Fri, 27 Jan 2023 23:40:39 +0000 (23:40 +0000)]
[LSAN][HWASAN] Run LSAN tests with HWASAN enabled
A lot of tests are disabled by using UNSUPPORTED. The plan is to remove UNSUPPORTED for tests that are fixed.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D142676
Adrian Prantl [Fri, 27 Jan 2023 00:42:31 +0000 (16:42 -0800)]
Manual DWARF index: don't skip over -gmodules debug info
This fixes a regression introduced by
https://reviews.llvm.org/D131437. The intention of the patch was to
avoid indexing DWO skeleton units, but it also skipped over full DWARF
compile units linked via a -gmodules DW_AT_dwo_name attribute. This
patch restores the functionality and adds a test for it.
Differential Revision: https://reviews.llvm.org/D142683
Peter Klausler [Fri, 27 Jan 2023 23:51:20 +0000 (15:51 -0800)]
[flang] Fix shared library build
A recent patch introduced a dependency upon Semantics from
Evaluate; fixing immediately.
Alexander Yermolovich [Fri, 27 Jan 2023 23:49:01 +0000 (15:49 -0800)]
[BOLT][DWARF] Add logging for split dwarf
Added logging when bolt is processing binary with split dwarf.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D142576
Noah Goldstein [Fri, 27 Jan 2023 23:26:41 +0000 (17:26 -0600)]
Reorder (shl (add/sub (shl x, C0), y), C1) -> (add/sub (shl x, C0 + C1), (shl y, C1))
This is just expanding the existing pattern that exists for AND/XOR/OR
and gets a bit more parallelism in from the instruction sequence.
Alive2:
Add - https://alive2.llvm.org/ce/z/dSmPkV
Sub1 - https://alive2.llvm.org/ce/z/6rpi5V
Sub2 - https://alive2.llvm.org/ce/z/UfYeUd
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D141875
Noah Goldstein [Fri, 27 Jan 2023 23:26:51 +0000 (17:26 -0600)]
Add tests for reoredering (shift (add (shift x, C0), y), C1); NFC
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D141874
Noah Goldstein [Fri, 27 Jan 2023 23:26:19 +0000 (17:26 -0600)]
Add optimizations for icmp eq/ne (mul(X, Y), 0)
1. Add checks if X and/or Y are odd. The Odd values are unnecessary to
the icmp: isZero(Odd * N) == isZero(N)
2. If neither X nor Y is known odd, then if X * Y cannot overflow AND
if X and/or Y is non-zero, the non-zero values are unnecessary to the
icmp.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D140850
Noah Goldstein [Fri, 27 Jan 2023 23:25:57 +0000 (17:25 -0600)]
Add tests for binops with conditions/assume constraints
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D140849
River Riddle [Sat, 21 Jan 2023 05:39:13 +0000 (21:39 -0800)]
[mlir] Promote the SubElementInterfaces to a core Attribute/Type construct
This commit restructures the sub element infrastructure to be a core part
of attributes and types, instead of being relegated to an interface. This
establishes sub element walking/replacement as something "always there",
which makes it easier to rely on for correctness/etc (which various bits of
infrastructure want, such as Symbols).
Attribute/Type now have `walk` and `replace` methods directly
accessible, which provide power API for interacting with sub elements. As
part of this, a new AttrTypeWalker class is introduced that supports caching
walked attributes/types, and a friendlier API (see the simplification of symbol
walking in SymbolTable.cpp).
Differential Revision: https://reviews.llvm.org/D142272
Michael Buch [Fri, 27 Jan 2023 23:21:49 +0000 (23:21 +0000)]
[lldb][Test] TestVSCode_completions.py: fix expected type strings
Fixes build failures following https://reviews.llvm.org/D141828
Aart Bik [Fri, 27 Jan 2023 22:29:31 +0000 (14:29 -0800)]
[mlir][sparse] fixed typo
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D142784
Peter Klausler [Fri, 6 Jan 2023 01:04:10 +0000 (17:04 -0800)]
[flang][parser] Diagnose an invalid space
In free form, don't silently skip over an invalid space between
an underscore and a kind parameter.
Differential Revision: https://reviews.llvm.org/D142760
Peter Klausler [Sun, 1 Jan 2023 15:35:37 +0000 (07:35 -0800)]
[flang] Correct procedure pointer (or dummy) compatibility check
Fix a subtle bug in procedure compatibility checking with base
derived types vs. their extensions to ensure that a procedure
expecting an extended type cannot be associated with a pointer
(or dummy procedure) to a procedure expecting a base type.
subroutine s1(base); ... subroutine s2(extended)
procedure(s1), pointer :: p
p => s2 ! <- must be caught as an error
Differential Revision: https://reviews.llvm.org/D142753
Michael Buch [Sun, 15 Jan 2023 03:26:41 +0000 (03:26 +0000)]
Reland "[lldb] Add support for DW_AT_default_value in template params"
**Summary**
This patch makes LLDB understand the `DW_AT_default_value` on
template argument DIEs. As a result, type summaries will no
longer contain the defaulted template arguments, reducing
noise substantially. E.g.,
Before:
```
(lldb) v nested
(std::vector<std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::allocator<std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator <char> > > > > >) nested = size=0 {}
```
After:
```
(lldb) v nested
(std::vector<std::vector<std::basic_string<char> > >) nested = size=0 {}
```
See discussion in https://reviews.llvm.org/D140423
**Testing**
* Adjust API tests
* Added unit-test
Differential Revision: https://reviews.llvm.org/D141828
Peter Klausler [Fri, 30 Dec 2022 23:26:44 +0000 (15:26 -0800)]
[flang] Prohibit multiple separate module procedure definitions
Ensure that non-BIND(C) separate module procedures are not
defined more than once.
Differential Revision: https://reviews.llvm.org/D142750
Peter Klausler [Thu, 29 Dec 2022 19:36:20 +0000 (11:36 -0800)]
[flang] Don't apply intrinsic assignment check for PURE subprograms to defined assignment
A semantic constraint on assignments in PURE subprograms (C1594) applies
only to an intrinsic assignment and should not be checked in the case of
a defined assignment.
Differential Revision: https://reviews.llvm.org/D142748
Dave Lee [Tue, 24 Jan 2023 23:53:17 +0000 (15:53 -0800)]
[lldb][test] Set minimum compiler_versions
Set compiler_versions on these tests, as they fail if tested on lower compiler
versions versions.
Differential Revision: https://reviews.llvm.org/D142513
Peter Klausler [Sat, 31 Dec 2022 00:18:05 +0000 (16:18 -0800)]
[flang] Catch obscure error in defined assignment
A subroutine that implements a defined assignment cannot have
a dummy argument for its second operand (the RHS of the assignment)
with the POINTER or ALLOCATABLE attributes, since the RHS of
an assignment is always an expression. This problem is flagged
as a fatal error in other compilers, so let's make it fatal here
as well.
Differential Revision: https://reviews.llvm.org/D142752
Artem Belevich [Thu, 26 Jan 2023 21:28:31 +0000 (13:28 -0800)]
[NVPTX] Infer AS of pointers passed to kernels as integers.
When pointers are passed within aggregates, we sometimes end up with IR that
loads them as integers and the converts them back to pointers. Typically it's
due to a memcpy or SROA. E.g. https://godbolt.org/z/xM3n5daaa
Normally we treat all pointers passed to a CUDA kernel as global pointers and
the same treatment should be applied to the pointers we load/store as integers.
Differential Revision: https://reviews.llvm.org/D142664
Krzysztof Drewniak [Mon, 23 Jan 2023 16:33:43 +0000 (16:33 +0000)]
[mlri][ExecutionEngine] Don't globaly set CMake prefixes to find HIP
The HIP CMake files expect to find their own dependencies and don't
use or respect PATHS or HINTS, relying on CMAKE_PREFIX_PATH to contain
/opt/rocm and /opt/rocm/hip . This is not great for the rest of the
build. Therefore, copy the CMake prefix path, add the ROCm
directories, find HIP, and reset the path to its old value.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D142391
Daniel Thornburgh [Fri, 27 Jan 2023 20:23:35 +0000 (12:23 -0800)]
[llvm-cov] Fix logic error in debuginfod lookup.
Differential Revision: https://reviews.llvm.org/D136702
Joseph Huber [Fri, 27 Jan 2023 19:04:50 +0000 (13:04 -0600)]
[libc] Add code for detecting NVIDIA GPUs as well
Recently the `nvptx-arch` tool was added to address the lack of a
similar tool for detecting locally installed NVIDIA GPUs. This patch
adds similar functionality for the already existing `amdgpu-arch` tool
in libc. These will be used to run tests on the user's system in the
future. On a system with both GPUs installed we will just go with the
first GPU detected. In the future we may want to configure the tests to
run on both of them.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D142776
Joseph Huber [Fri, 27 Jan 2023 18:08:28 +0000 (12:08 -0600)]
[libc] Do not install to the default triple in GPU mode
Currently this logic causes the `libcgpu.a` to be installed to the
user's default triple. The GPU target isn't really true to this in a
cross-compiling sense so we should just default to the regular `/lib`
directory
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D142774
Peter Klausler [Fri, 20 Jan 2023 00:42:59 +0000 (16:42 -0800)]
[flang] Don't fold STORAGE_SIZE() on polymorphic argument
More generally, don't return a successful result from
Fortran::evaluate::DynamicType::MeasureSizeInBytes() when the
type is polymorphic.
Differential Revision: https://reviews.llvm.org/D142772
Siva Chandra Reddy [Tue, 10 Jan 2023 19:33:45 +0000 (19:33 +0000)]
[libc] Use a prebuilt libc-hdrgen binary if available.
This feature will primarily by used by the runtimes build. In the
runtimes build, we build libc-hdrgen once for the host and use it
to build the libc for other targets. So, the host libc-hdrgen is
like a prebuilt passed to the target builds.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D141426
Philip Reames [Fri, 27 Jan 2023 19:52:22 +0000 (11:52 -0800)]
Revert "[BranchRelaxation] Move faulting_op check into callee [nfc]"
This reverts commit
c549da959b81902789a17918c5b95d4449e6fdfa. Per buildbots, this was not NFC.
Philip Reames [Fri, 27 Jan 2023 19:48:14 +0000 (11:48 -0800)]
[RISCV][InsertVSETVLI] Handle partially transparent instructions in PRE
The PRE implementation was being overly strict when checking to see if a vsetvli was removed in the current block. For instructions which don't use all the fields of VTYPE or VL, we can propagate a changed state past the first instruction with an SEW operand and remove a vsetvli later in the block. We do need to be careful now to ensure that the state convergences before the end of the block or we'd invalidate the cached data flow results.
Taking a step back, we're modeling the effect of the emitVSETVLIs pass which runs just after PRE. This is unfortunate, and makes me think we should probably reevaluate doing the PRE as a post-pass instead of as surgery in the data flow phases. Doing that requires us to get more aggressive about mutating user written vsetvlis which we've tried not to do up to now, but well, maybe it's time? Anyways, that's a thought for the future, not something I'm proposing doing now.
Differential Revision: https://reviews.llvm.org/D142409
Ben Langmuir [Tue, 24 Jan 2023 21:21:11 +0000 (13:21 -0800)]
[clang][deps] Fix modulemap file path for implementation of module
Use the name "as requested" for the path of the implemented module's
modulemap file, just as we do for other modulemap file paths. This fixes
fatal errors with modules where we tried to find framework headers
relative to the wrong directory when imported by an implementation file
of the same module.
rdar://
104619123
Differential Revision: https://reviews.llvm.org/D142501
Peiming Liu [Wed, 18 Jan 2023 18:19:32 +0000 (18:19 +0000)]
[mlir][sparse] refactoring isAdmissibleTensorExp into codegen
This patch moves some utils into CodegenEnv class, it should make the code easier to follow and it eliminates several indirect value assignment that use `ptr**`.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D142040
Philip Reames [Fri, 27 Jan 2023 19:23:53 +0000 (11:23 -0800)]
[BranchRelaxation] Move faulting_op check into callee [nfc]
Mostly to remove a special case from an upcoming patch.
Jonas Paulsson [Tue, 10 Jan 2023 00:51:11 +0000 (18:51 -0600)]
[SystemZ] Fix handling of vectors and their exposure of the vector ABI.
- Global vector variables expose the vector ABI through their alignments only
if they are >=16 bytes in size.
- Vectors passed between functions expose the vector ABI only if they are
<=16 bytes in size.
LLVM test suite builds with gcc/clang now give the same gnu attributes emitted.
Reviewed By: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D141409
Tom Stellard [Fri, 27 Jan 2023 19:23:19 +0000 (11:23 -0800)]
workflows: Fix libclc tests
libclc requires using cmake files to detect the LLVM installation instead
of llvm-config so we need to update our cmake invocation.
Reviewed By: thieta
Differential Revision: https://reviews.llvm.org/D142716
Tom Stellard [Fri, 27 Jan 2023 19:15:54 +0000 (11:15 -0800)]
libclc: Fix building against an llvm build directory
Reviewed By: thieta
Differential Revision: https://reviews.llvm.org/D142718
Erich Keane [Fri, 27 Jan 2023 19:06:07 +0000 (11:06 -0800)]
Fix recursive error for constraints depending on itself incorrectly
Fixes: #60323
https://github.com/llvm/llvm-project/issues/60323
The problem is that we are profiling the 'Expr' components directly,
however when they contain an unresolved lookup, those canonicalize
identically. The result was the two versions of calls to 'go' were
canonicalized identically.
This patch fixes this by ensuring we consider the declaration the
constraint is attached to, when possible. When not, we skip the
diagnostic.
The result is that we are relaxing our diagnostic in some cases (Of
which I couldn't come up with a reproducer), such that we might see
overflows when evaluating constraints that depend on themselves in a way
that they are not attached to a declaration directly, such as if
they are nested requirements, though the hope is this won't be a
problem, since the 'parent' named constraint would catch this. I'm
hopeful that the 'worst case' is that we catch recursion 'later' in the
process, instead of immediately.
Tom Stellard [Fri, 27 Jan 2023 19:06:18 +0000 (11:06 -0800)]
workflows: Bump python version on Windows to try to fix lldb failure
Reviewed By: thieta
Differential Revision: https://reviews.llvm.org/D142719
Piotr Zegar [Wed, 25 Jan 2023 18:00:33 +0000 (18:00 +0000)]
[clang-tidy] Fix warning in portability-simd-intrinsics
When portability-simd-intrinsics.Suggest were set to false,
produced warning were missing source location,
and due to that such warning coudn't be NOLINTed.
Added missing tests.
Fixes issues: https://github.com/llvm/llvm-project/issues/52831
Differential Revision: https://reviews.llvm.org/D142565
Tom Stellard [Fri, 27 Jan 2023 18:50:01 +0000 (10:50 -0800)]
libclc: Set CMAKE_CXX_STANDARD to 17 to match llvm
Reviewed By: thieta
Differential Revision: https://reviews.llvm.org/D142720
Amir Ayupov [Fri, 27 Jan 2023 17:48:13 +0000 (09:48 -0800)]
[CMake] Include clang-bolt bootstrap target in BOLT-PGO.cmake
Preemptively include clang-bolt target in BOLT-PGO CMake cache file,
in preparation of https://reviews.llvm.org/D139454 to avoid breaking
bolt-x86_64-ubuntu-clang-bolt-lto-pgo buildbot.
Jorge Gorbe Moya [Thu, 26 Jan 2023 22:23:41 +0000 (14:23 -0800)]
[lldb] Make SBSection::GetSectionData call Section::GetSectionData.
`SBSection::GetSectionData` and `Section::GetSectionData` are
implemented differently, and the `SBSection` method doesn't handle
compressed sections correctly.
Differential Revision: https://reviews.llvm.org/D142672
Arthur Eubanks [Tue, 17 Jan 2023 01:47:12 +0000 (17:47 -0800)]
[gn build] Enable check-bolt on Linux
It builds but not all tests pass, mostly due to missing libbolt_rt_instr.a.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D141881
Qiao Zhang [Fri, 27 Jan 2023 17:49:29 +0000 (18:49 +0100)]
Fix tsan problem where the per-thread shared_ptr() can be locked right before the cache is destroyed causing a race where it tries to remove an entry from a destroyed cache.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D142394
Jason Molenda [Fri, 27 Jan 2023 17:39:31 +0000 (09:39 -0800)]
disable-language-runtime-unwindplans desc rewrite to be searchable
The description for disable-language-runtime-unwindplans did not
include likely search terms ("backtrace", "stack"), rewrite it
to include those so it is more easily discoverable with apropos.
The text is still not the clearest description of what a language
runtime is / what it might do, but this is better.
Differential Revision: https://reviews.llvm.org/D142663
Jason Molenda [Fri, 27 Jan 2023 17:37:34 +0000 (09:37 -0800)]
Don't flag memory-only mach-o corefiles as invalid
It is possible to have a memory-only mach-o corefile, with the
threads provided by an os-plugin thread provider, or a scripted
process, in Python.
Differential Revision: https://reviews.llvm.org/D142662
rdar://
102579544
Joseph Huber [Fri, 27 Jan 2023 17:29:47 +0000 (11:29 -0600)]
[LinkerWrapper] Add support for --[no-]whole-archive into the linker wrapper
Summary:
This patch adds support for `--[no-]whole-archive` to the linker
wrapper. This allows us to bypass the symbol resolution logic that is
normally used for static archives. For multi-architecture binaries this
also allows us to build for every single member.
Stefan Gränitz [Fri, 27 Jan 2023 15:48:05 +0000 (16:48 +0100)]
[Verifier][WinEH] Check funclet tokens on intrinsic calls that may lower to function calls
WinEHPrepare requires funclet operand bundles ("tokens") on function calls from EH funclets to prevent them from getting removed as "implausible" calls. This includes calls to intrinsic functions that lower to function calls in the course of IR transformations (e.g. ObjC ARC runtime calls).
We can not detect such cases in WinEHPrepare itself, because at this point they mixed up with valid implausible calls. These must be removed to guarantee that the EH backend can assign unique colors and EH state numbers to all blocks.
This patch allows the IR Verifier to detect missing and dangling funclet tokens. Non-conforming IR becomes illegal and miscompilations are detected early. In order to find funclet pad instructions for funclets that extend over multiple blocks, we have to calculate EH funclet colors. As coloring can be expensive, it runs on-demand and results are cached per function.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D138123
Stefan Gränitz [Tue, 24 Jan 2023 11:29:53 +0000 (12:29 +0100)]
Lift EHPersonalities from Analysis to IR (NFC)
Computing EH-related information was only relevant for analysis passes so far. Lifting it to IR will allow the IR Verifier to calculate EH funclet coloring and validate funclet operand bundles in a follow-up step.
Reviewed By: rnk, compnerd
Differential Revision: https://reviews.llvm.org/D138122
Matthias Springer [Fri, 27 Jan 2023 16:49:26 +0000 (17:49 +0100)]
[mlir][sparse] Implement BufferizableOpInterface for additional ops
The handling of unknown ops will be tightened in a subsequent change. All sparse_tensor ops should implement BufferizableOpInterface, otherwise, they are treated as "unknown" and additional buffer allocs/copies may be inserted around them.
Differential Revision: https://reviews.llvm.org/D142005
Matthias Springer [Fri, 27 Jan 2023 16:49:14 +0000 (17:49 +0100)]
[mlir][sparse][NFC] Disallow writing into sparse_tensor.to_... results
Writing into the memrefs returned by `sparse_tensor.to_values` etc. can cause additional copies during bufferization.
Differential Revision: https://reviews.llvm.org/D142728
Joseph Huber [Fri, 27 Jan 2023 16:44:16 +0000 (10:44 -0600)]
[LinkerWrapper][NFC] Remove unused options
Summary:
These options are no longer used, we don't need to keep them.
Michael Buch [Fri, 27 Jan 2023 14:17:02 +0000 (14:17 +0000)]
[lldb][CXXModuleHandler] Set TemplateArgument::IsDefaulted
Since https://reviews.llvm.org/D141827 this field gets used
to print type names. Thus propagate it after importing TemplateArguments
from modules.
**Testing**
* Confirmed that this fixes the ongoing `import-std-module` test
failures.
Differential Revision: https://reviews.llvm.org/D142714
Michael Buch [Fri, 27 Jan 2023 14:09:48 +0000 (14:09 +0000)]
[clang][ASTImporter] Propagate TemplateArgument::IsDefaulted during import
With https://reviews.llvm.org/D141826 `TemplateArgument`s have an
additional field that indicates their defaulted-ness. This gets
used during debug-info generation and in the `clang::TypePrinter`.
This patch copies the field during the import process so consumers
of the ASTImporter can benefit from the other Clang components that
read the field.
**Testing**
* Added unit-test
* Checked that this fixes (in addition to a follow-up LLDB patch)
fix current test failures in LLDB
Differential Revision: https://reviews.llvm.org/D142713
Matthias Springer [Fri, 27 Jan 2023 16:25:55 +0000 (17:25 +0100)]
[mlir][NFC] GreedyPatternRewriteDriver: Merge region-based and multi-op-based drivers
Deduplicate large parts of the worklist processing (`GreedyPatternRewriteDriver::processWorklist`).
The new class hierarchy is as follows:
```
GreedyPatternRewriteDriver (abstract)
^
|
-----------------------------------
| |
RegionPatternRewriteDriver MultiOpPatternRewriteDriver
```
Also update the Markdown documentation.
Differential Revision: https://reviews.llvm.org/D141396
Sacha Ballantyne [Fri, 27 Jan 2023 15:31:42 +0000 (15:31 +0000)]
[flang] Add Count to simplified intrinsics
This patch adds a simplfiied version of count for the simplify intrinsics pass, allowing the function to be inlined.
This was done specifically to help improve performance for exchange2, and provides a ~12% performance increase.
Reviewed By: vzakhari, Leporacanthicus
Differential Revision: https://reviews.llvm.org/D142209
Nico Weber [Fri, 27 Jan 2023 16:26:55 +0000 (11:26 -0500)]
[gn] merge
650bbc56203c9
Needed to link e.g. LexTests after
ca446037af0.
Aaron Ballman [Fri, 27 Jan 2023 16:17:42 +0000 (11:17 -0500)]
Correct the link to the latest C DR status page for C11 and C17
We were linking against:
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2148.htm
However, the latest DR page for the 400s is:
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm
Tue Ly [Fri, 27 Jan 2023 15:15:46 +0000 (10:15 -0500)]
[libc][math] Implement asinhf function correctly rounded for all rounding modes.
Implement asinhf function correctly rounded for all rounding modes.
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D142681
Mark de Wever [Fri, 27 Jan 2023 16:01:55 +0000 (17:01 +0100)]
[libc++] Disables a test in clang-17.
This test already had issues and bumping main to 17 causes them to fail
again.
Florian Hahn [Fri, 27 Jan 2023 16:02:29 +0000 (16:02 +0000)]
[SCCP] Add test cases with switch on range containing undef.
Aaron Ballman [Fri, 27 Jan 2023 16:01:12 +0000 (11:01 -0500)]
Stop diagnosing member and array access in offsetof as an extension
This was a mistake from
e7300e75b51a7e7d4e81975b4be7a6c65f9a8286
(https://reviews.llvm.org/D133574) caused by us accidentally tracking
an older copy of the C DR list for DR496. The text in
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2396.htm#dr_496 makes
it clear that subobjects are allowed, which means member and array
access expressions are allowed.
This backs out the changes from the previous commit that relate to this
diagnostic.
Nico Weber [Fri, 27 Jan 2023 15:59:54 +0000 (10:59 -0500)]
[gn] port
a3b0dde4edb9 (llvm-cov -> Debuginfod dep)
Samuel Parker [Fri, 27 Jan 2023 15:31:54 +0000 (15:31 +0000)]
Revert "[DAGCombine] fp_to_sint isSaturatingMinMax"
This reverts commit
85395af27241ab9c8d5763b8afcaa07f1bab26d5.
This is causing trouble with scalable vectors.
Lucas Prates [Wed, 25 Jan 2023 12:15:00 +0000 (12:15 +0000)]
[NFC][AArch64] Get extension strings directly from ArchInfo in target parser
Reviewed By: tmatheson
Differential Revision: https://reviews.llvm.org/D142541
Tue Ly [Mon, 9 Jan 2023 15:05:41 +0000 (10:05 -0500)]
[libc][cmake] Fix LIBC_TARGET_OS query from compiler triple for `darwin`.
Currently LIBC_TARGET_OS query from compiler triple returns `apple` for
macOS. This change will fix it back to `darwin` as before.
Differential Revision: https://reviews.llvm.org/D141282
Tom Stellard [Fri, 27 Jan 2023 14:57:35 +0000 (06:57 -0800)]
Workflows: Fix version-check.py script for when there is no RC tag yet
Reviewed By: thieta
Differential Revision: https://reviews.llvm.org/D142598
Matthias Springer [Fri, 27 Jan 2023 14:44:12 +0000 (15:44 +0100)]
[mlir] GreedyPatternRewriteDriver: Move strict mode to GreedyPatternRewriteDriver
`strictMode` is moved to GreedyRewriteConfig to simplify the API and state of rewriter classes. The region-based GreedyPatternRewriteDriver now also supports strict mode.
MultiOpPatternRewriteDriver becomes simpler: fewer method must be overridden.
Differential Revision: https://reviews.llvm.org/D142623
Florian Hahn [Fri, 27 Jan 2023 14:09:25 +0000 (14:09 +0000)]
[SCCP] Use range info to prove AddInst has NSW flag.
This patch updates SCCP to use the value ranges of AddInst operands to
try to prove the AddInst does not overflow in the signed sense and
adds the NSW flag. The reasoning is done with
makeGuaranteedNoWrapRegion (thanks @nikic for point it out!).
Follow-ups will include extending this to more
OverflowingBinaryOperators.
Depends on D142387.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D142390
Matthias Springer [Fri, 27 Jan 2023 13:14:41 +0000 (14:14 +0100)]
[mlir] GreedyPatternRewriteDriver: All entry points take a config
The multi-op entry point now also takes a GreedyPatternRewriteConfig and respects config.maxNumRewrites. The scope is also a part of the config now.
Differential Revision: https://reviews.llvm.org/D142614
Michael Buch [Fri, 27 Jan 2023 13:03:57 +0000 (13:03 +0000)]
[lldb][Target] GetScratchTypeSystems: sort TypeSystems with strict weak ordering
`std::sort` requires a comparison operator that obides by strict weak
ordering. `operator<=` on pointer does not and leads to undefined
behaviour. Specifically, when we grow the `scratch_type_systems` vector
slightly larger (and thus take `std::sort` down a slightly different
codepath), we segfault. This happened while working on a patch that
would in fact grow this vector. In such a case ASAN reports:
```
$ ./bin/lldb ./lldb-test-build.noindex/lang/cpp/complete-type-check/TestCppIsTypeComplete.test_builtin_types/a.out -o "script -- lldb.target.FindFirstType(\"void\")"
(lldb) script -- lldb.target.FindFirstType("void")
=================================================================
==59975==ERROR: AddressSanitizer: container-overflow on address 0x000108f6b510 at pc 0x000280177b4c bp 0x00016b7d7430 sp 0x00016b7d7428
READ of size 8 at 0x000108f6b510 thread T0
#0 0x280177b48 in std::__1::shared_ptr<lldb_private::TypeSystem>::shared_ptr[abi:v15006](std::__1::shared_ptr<lldb_private::TypeSystem> const&)+0xb4 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x177b48)
(BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
#1 0x280dcc008 in void std::__1::__introsort<std::__1::_ClassicAlgPolicy, lldb_private::Target::GetScratchTypeSystems(bool)::$_3&, std::__1::shared_ptr<lldb_private::TypeSystem>*>(std::__1::shared_ptr<lldb_private::TypeSystem>*, std::__1::shared_
ptr<lldb_private::TypeSystem>*, lldb_private::Target::GetScratchTypeSystems(bool)::$_3&, std::__1::iterator_traits<std::__1::shared_ptr<lldb_private::TypeSystem>*>::difference_type)+0x1050 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblld
b.17.0.0git.dylib:arm64+0xdcc008) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
#2 0x280d88788 in lldb_private::Target::GetScratchTypeSystems(bool)+0x5a4 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xd88788) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
#3 0x28021f0b4 in lldb::SBTarget::FindFirstType(char const*)+0x624 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x21f0b4) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
#4 0x2804e9590 in _wrap_SBTarget_FindFirstType(_object*, _object*)+0x26c (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x4e9590) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
#5 0x1062d3ad4 in cfunction_call+0x5c (/opt/homebrew/Cellar/python@3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/Python:arm64+0xcfad4) (BuildId: c9efc4bbb1943f9a9b7cc4e91fce477732000000200000000100000000000d00)
<--- snipped --->
0x000108f6b510 is located 400 bytes inside of 512-byte region [0x000108f6b380,0x000108f6b580)
allocated by thread T0 here:
#0 0x105209414 in wrap__Znwm+0x74 (/Applications/Xcode2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.3/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:arm64e+0x51414) (BuildId:
0a44828ceb64337bbfff60b22cd838f0320000
00200000000100000000000b00)
#1 0x280dca3b4 in std::__1::__split_buffer<std::__1::shared_ptr<lldb_private::TypeSystem>, std::__1::allocator<std::__1::shared_ptr<lldb_private::TypeSystem>>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<std::__1::shared_pt
r<lldb_private::TypeSystem>>&)+0x11c (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xdca3b4) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
#2 0x280dc978c in void std::__1::vector<std::__1::shared_ptr<lldb_private::TypeSystem>, std::__1::allocator<std::__1::shared_ptr<lldb_private::TypeSystem>>>::__push_back_slow_path<std::__1::shared_ptr<lldb_private::TypeSystem> const&>(std::__1::s
hared_ptr<lldb_private::TypeSystem> const&)+0x13c (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xdc978c) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
#3 0x280d88dec in std::__1::vector<std::__1::shared_ptr<lldb_private::TypeSystem>, std::__1::allocator<std::__1::shared_ptr<lldb_private::TypeSystem>>>::push_back[abi:v15006](std::__1::shared_ptr<lldb_private::TypeSystem> const&)+0x80 (/Users/mic
haelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xd88dec) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
#4 0x280d8857c in lldb_private::Target::GetScratchTypeSystems(bool)+0x398 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0xd8857c) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
#5 0x28021f0b4 in lldb::SBTarget::FindFirstType(char const*)+0x624 (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x21f0b4) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
#6 0x2804e9590 in _wrap_SBTarget_FindFirstType(_object*, _object*)+0x26c (/Users/michaelbuch/Git/lldb-build-main-no-modules/lib/liblldb.17.0.0git.dylib:arm64+0x4e9590) (BuildId: ea963d2c0d47354fb647f5c5f32b76d932000000200000000100000000000d00)
#7 0x1062d3ad4 in cfunction_call+0x5c (/opt/homebrew/Cellar/python@3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/Python:arm64+0xcfad4) (BuildId: c9efc4bbb1943f9a9b7cc4e91fce477732000000200000000100000000000d00)
#8 0x10627fff0 in _PyObject_MakeTpCall+0x7c (/opt/homebrew/Cellar/python@3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/Python:arm64+0x7bff0) (BuildId: c9efc4bbb1943f9a9b7cc4e91fce477732000000200000000100000000000d00)
#9 0x106378a98 in _PyEval_EvalFrameDefault+0xbcf8 (/opt/homebrew/Cellar/python@3.11/3.11.1/Frameworks/Python.framework/Versions/3.11/Python:arm64+0x174a98) (BuildId: c9efc4bbb1943f9a9b7cc4e91fce477732000000200000000100000000000d00)
```
Differential Revision: https://reviews.llvm.org/D142709
Lucas Prates [Tue, 24 Jan 2023 17:44:15 +0000 (17:44 +0000)]
[NFC][AArch64] Get default features directly from ArchInfo and CpuInfo objects
This updates the AArch64's Target Parser and its uses to capture
information about default features directly from ArchInfo and CpuInfo
objects, instead of relying on an API function to access them
indirectly.
Reviewed By: tmatheson
Differential Revision: https://reviews.llvm.org/D142540