Hristo Hristov [Fri, 28 Apr 2023 20:52:07 +0000 (23:52 +0300)]
[libc++][spaceship] Implement `operator<=>` for `optional`
Implements parts of **P1614R2**: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html
- Implemented `operator<=>` for `optional`
- Updated "optional synopsis" to match the current draft https://eel.is/c++draft/optional closer
- Implemented https://cplusplus.github.io/LWG/issue3566
- Implemented https://cplusplus.github.io/LWG/issue3746
Reviewed By: #libc, philnik, ldionne
Differential Revision: https://reviews.llvm.org/D146392
Fangrui Song [Fri, 5 May 2023 06:34:35 +0000 (23:34 -0700)]
[MC] Optimize relaxInstruction: remove SmallVector copy. NFC
Jie Fu [Fri, 5 May 2023 06:12:16 +0000 (14:12 +0800)]
[RISCV] Omit the template parameters in getSerializableMachineMemOperandTargetFlags()
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D149927
Kazu Hirata [Fri, 5 May 2023 05:42:52 +0000 (22:42 -0700)]
[clang] Replace None with std::nullopt in comments (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Fri, 5 May 2023 05:39:09 +0000 (22:39 -0700)]
[mlir] Use std::optional instead of llvm::Optional (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Fangrui Song [Fri, 5 May 2023 05:30:36 +0000 (22:30 -0700)]
[test] Update DirectX/min_vec_size.ll after shufflevector mask vector poison change
Jonas Devlieghere [Fri, 5 May 2023 05:22:50 +0000 (22:22 -0700)]
[lldb] Migrate to GetPropertyAtIndexAs for FileSpecList (NFC)
Use the templated GetPropertyAtIndexAs helper for FileSpecList.
Craig Topper [Fri, 5 May 2023 05:18:33 +0000 (22:18 -0700)]
[RISCV] Directly create MCOperands from addImplySP in Disassembler. NFC
Instead of passing a constant to DecodeGPRRegisterClass, just create
the X2 register directly.
Fangrui Song [Fri, 5 May 2023 05:17:56 +0000 (22:17 -0700)]
[MC] registerSymbol: change an output paramter to return value
Jonas Devlieghere [Fri, 5 May 2023 05:07:37 +0000 (22:07 -0700)]
[lldb] Eliminate {Get,Set}PropertyAtIndexAsFileSpec (NFC)
This patch is a continuation of
6f8b33f6dfd0 and eliminates the
{Get,Set}PropertyAtIndexAsFileSpec functions.
LLVM GN Syncbot [Fri, 5 May 2023 05:00:42 +0000 (05:00 +0000)]
[gn build] Port
917b3a7e6206
Jonas Devlieghere [Fri, 5 May 2023 04:52:19 +0000 (21:52 -0700)]
[lldb] Move Core/FileSpecList -> Utility/FileSpecList (NFC)
There's no reason for FileSpecList to live in lldb/Core while FileSpec
lives in lldb/Utility. Move FileSpecList next to FileSpec.
LiaoChunyu [Fri, 5 May 2023 04:53:43 +0000 (12:53 +0800)]
[RISCV] Remove unused def simm12_plus1 from RISCVInstrInfo.td. NFC
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D149925
Jonas Devlieghere [Fri, 5 May 2023 04:45:00 +0000 (21:45 -0700)]
[lldb] Remove SetPropertyAtIndexAsLanguage (NFC)
After
6f8b33f6dfd0 this function has no callers anymore.
Zhenkai Weng [Fri, 5 May 2023 03:53:22 +0000 (20:53 -0700)]
[FuzzMutate] Make ShuffleBlockStrategy deterministic
This revision makes ShuffleBlockStrategy deterministic by replacing
SmallPtrSet with other data structures that has a deterministic iteration
order.
Reviewed By: Peter
Differential Revision: https://reviews.llvm.org/D149676
Fangrui Song [Fri, 5 May 2023 03:47:34 +0000 (20:47 -0700)]
[SPIRV] Adapt itaniumDemangle change after itaniumDemangle
Brad Smith [Fri, 5 May 2023 00:53:57 +0000 (20:53 -0400)]
[SPARC][MC] Fix encoding of backwards BPr branches
Make sure that the upper bits of the offset is placed in bits 20-21 of the
instruction word.
This fixes the encoding of backwards (negative offset) BPr branches.
(Previously, the upper two bits of the offset would overwrite parts of the rs1
field, causing it to branch on the wrong register, with the wrong offset)
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D144012
Craig Topper [Fri, 5 May 2023 02:44:43 +0000 (19:44 -0700)]
[RISCV] Promote i1 shuffles to i8 shuffles.
Otherwise I think we extract and use a build_vector. There may be
some more improvements that can be made and there might be some
cases that we should do something different for, but this seemed like a
decent starting point.
Reviewed By: luke
Differential Revision: https://reviews.llvm.org/D149724
Joseph Huber [Fri, 5 May 2023 02:36:52 +0000 (21:36 -0500)]
[libc] Fix hanging test on NVPTX due to lack of warp sync
Previously this wasn't implemented because it's effectively a no-op.
However, this should be safe to emit on sm_60 architectures. It's
important because it carries semantic importance for whether or not
something can be moved. So we should always emit this instrinsic.
Differential Revision: https://reviews.llvm.org/D149923
Luo, Yuanke [Fri, 5 May 2023 01:50:19 +0000 (09:50 +0800)]
[Coverity] Big parameter passed by value.
Tom Stellard [Fri, 5 May 2023 01:45:48 +0000 (18:45 -0700)]
[SeparateConstOffsetFromGEP] Fix bug handling negative offsets
Fix bug constants and sub instructions
When finding constants in a chain starting with the RHS operator of
sub instructions, we were negating the constant before zero extending
it, which is incorrect.
Unfortunately, I was unable to find a simple way to implement this
transformation correctly, so for now I just disabled this optimization
for constants that feed into the RHS of a sub.
Resolves #62379
Transformation from alive2.llvm.org:
define i16 @src(i8 %a, i8 %b, i8 %c) {
entry:
%0 = sub nuw nsw i8 %c, %a
%1 = sub nuw nsw i8 %b, %0
%2 = zext i8 %1 to i16
ret i16 %2
}
Before/Bad:
define i16 @tgt(i8 %a, i8 %b, i8 %c) {
entry:
%0 = zext i8 %a to i16
%1 = zext i8 %b to i16
%c_neg = sub i8 0, %c
%c_zext = zext i8 %c_neg to i16
%2 = sub i16 0, %0
%3 = sub i16 %1, %2
%4 = add i16 %3, %c_zext
ret i16 %4
}
Correct:
define i16 @tgt(i8 %a, i8 %b, i8 %c) {
entry:
%0 = zext i8 %a to i16
%1 = zext i8 %b to i16
%c_zext = zext i8 %c to i16
%c_neg = sub i16 0, %c_zext
%2 = sub i16 0, %0
%3 = sub i16 %1, %2
%4 = add i16 %3, %c_neg
ret i16 %4
}
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149507
Luo, Yuanke [Fri, 5 May 2023 01:14:04 +0000 (09:14 +0800)]
[Coverity] Big parameter passed by value.
Craig Topper [Fri, 5 May 2023 00:48:30 +0000 (17:48 -0700)]
[RISCV] Restrict valid indices for cm.jalt to be in [32,255].
Reviewed By: jrtc27
Differential Revision: https://reviews.llvm.org/D149901
Advenam Tacet [Fri, 5 May 2023 00:43:51 +0000 (17:43 -0700)]
[ASan][libcxx] Annotating std::vector with all allocators
This revision is a part of a series of patches extending
AddressSanitizer C++ container overflow detection
capabilities by adding annotations, similar to those existing
in std::vector, to std::string and std::deque collections.
These changes allow ASan to detect cases when the instrumented
program accesses memory which is internally allocated by
the collection but is still not in-use (accesses before or
after the stored elements for std::deque, or between the size and
capacity bounds for std::string).
The motivation for the research and those changes was a bug,
found by Trail of Bits, in a real code where an out-of-bounds read
could happen as two strings were compared via a std::equals function
that took iter1_begin, iter1_end, iter2_begin iterators
(with a custom comparison function).
When object iter1 was longer than iter2, read out-of-bounds on iter2
could happen. Container sanitization would detect it.
In revision D132522, support for non-aligned memory buffers (sharing
first/last granule with other objects) was added, therefore the
check for standard allocator is not necessary anymore.
This patch removes the check in std::vector annotation member
function (__annotate_contiguous_container) to support
different allocators.
Additionally, this revision fixes unpoisoning in std::vector.
It guarantees that __alloc_traits::deallocate may access returned memory.
Originally suggested in D144155 revision.
If you have any questions, please email:
- advenam.tacet@trailofbits.com
- disconnect3d@trailofbits.com
Reviewed By: #libc, #sanitizers, philnik, vitalybuka, ldionne
Spies: mikhail.ramalho, manojgupta, ldionne, AntonBikineev, ayzhao, hans, EricWF, philnik, #sanitizers, libcxx-commits
Differential Revision: https://reviews.llvm.org/D136765
Joseph Huber [Mon, 1 May 2023 13:17:39 +0000 (08:17 -0500)]
[libc] Change GPU startup and loader to use multiple kernels
The GPU has a different execution model to standard `_start`
implementations. On the GPU, all threads are active at the start of a
kernel. In order to correctly intitialize and call the constructors we
want single threaded semantics. Previously, this was done using a
makeshift global barrier with atomics. However, it should be easier to
simply put the portions of the code that must be single threaded in
separate kernels and then call those with only one thread. Generally,
mixing global state between kernel launches makes optimizations more
difficult, similarly to calling a function outside of the TU, but for
testing it is better to be correct.
Depends on D149527 D148943
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D149581
Joseph Huber [Thu, 4 May 2023 19:53:28 +0000 (14:53 -0500)]
[libc] Enable multiple threads to use RPC on the GPU
The execution model of the GPU expects that groups of threads will
execute in lock-step in SIMD fashion. It's both important for
performance and correctness that we treat this as the smallest possible
granularity for an RPC operation. Thus, we map multiple threads to a
single larger buffer and ship that across the wire.
This patch makes the necessary changes to support executing the RPC on
the GPU with multiple threads. This requires some workarounds to mimic
the model when handling the protocol from the CPU. I'm not completely
happy with some of the workarounds required, but I think it should work.
Uses some of the implementation details from D148191.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D148943
Craig Topper [Fri, 5 May 2023 00:20:58 +0000 (17:20 -0700)]
[DAGCombiner][RISCV] Enable reassociation for VP_FMA in visitFADDForFMACombine.
Reviewed By: fakepaper56
Differential Revision: https://reviews.llvm.org/D149911
Alexander Shaposhnikov [Fri, 5 May 2023 00:02:26 +0000 (00:02 +0000)]
Revert "[Clang][Sema] Fix comparison of constraint expressions"
This reverts commit
3a540229341e3c8dc6d8ee61309eafaf943ea254.
A new regression is discovered and needs to be investigated.
Craig Topper [Thu, 4 May 2023 23:56:14 +0000 (16:56 -0700)]
[RISCV] Add vp.icmp/fcmp to RISCVTargetLowering::canSplatOperand.
Alex Langford [Thu, 4 May 2023 23:49:30 +0000 (16:49 -0700)]
Revert "[lldb] Expose a const iterator for SymbolContextList"
This reverts commit
04aa943be8ed5c03092e2a90112ac638360ec253.
This broke the debian buildbot and I'm not sure why. Reverting so I can
investigate.
Jonas Devlieghere [Thu, 4 May 2023 16:26:58 +0000 (09:26 -0700)]
[lldb] Use templates to simplify {Get,Set}PropertyAtIndex (NFC)
Use templates to simplify {Get,Set}PropertyAtIndex. It has always
bothered me how cumbersome those calls are when adding new properties.
After this patch, SetPropertyAtIndex infers the type from its arguments
and GetPropertyAtIndex required a single template argument for the
return value. As an added benefit, this enables us to remove a bunch of
wrappers from UserSettingsController and OptionValueProperties.
Differential revision: https://reviews.llvm.org/D149774
Alex Langford [Thu, 4 May 2023 20:26:58 +0000 (13:26 -0700)]
[lldb] Expose a const iterator for SymbolContextList
There are many situations where we'll iterate over a SymbolContextList
with the pattern:
```
SymbolContextList sc_list;
// Fill in sc_list here
for (auto i = 0; i < sc_list.GetSize(); i++) {
SymbolContext sc;
sc_list.GetSymbolAtContext(i, sc);
// Do work with sc
}
```
Adding an iterator to iterate over the instances directly means we don't
have to do bounds checking or create a copy of every element of the
SymbolContextList.
Differential Revision: https://reviews.llvm.org/D149900
Mikhail R. Gadelha [Thu, 4 May 2023 21:34:01 +0000 (18:34 -0300)]
[libc] Enable linux directory entries syscalls in riscv64
This patch updates the struct dirent to be on par with glibc (by adding
a missing d_type member) and update the readdir call to use SYS_getdents64
instead of SYS_getdents.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D147738
Valentin Clement [Thu, 4 May 2023 22:00:45 +0000 (15:00 -0700)]
[mlir][openacc][NFC] Remove braces on single statement bodies
Update format to stick to https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
Jon Chesterfield [Thu, 4 May 2023 21:30:53 +0000 (22:30 +0100)]
[libc][rpc] Update locking to work on volta
Carefully work around not knowing the thread mask that nvptx intrinsic
functions require.
If the warp is converged when calling try_lock, a single rpc call will handle
all lanes within it. Otherwise more than one rpc call with thread masks that
compose to the unknown one will occur.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D149897
Jon Chesterfield [Thu, 4 May 2023 21:44:33 +0000 (22:44 +0100)]
Revert "[libc][rpc] Update locking to work on volta"
This reverts commit
b1323738649e96aac943f3773ec7336df110eea5.
Jon Chesterfield [Thu, 4 May 2023 21:30:53 +0000 (22:30 +0100)]
[libc][rpc] Update locking to work on volta
Carefully work around not knowing the thread mask that nvptx intrinsic
functions require.
If the warp is converged when calling try_lock, a single rpc call will handle
all lanes within it. Otherwise more than one rpc call with thread masks that
compose to the unknown one will occur.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D149897
Sam McCall [Tue, 2 May 2023 14:22:40 +0000 (16:22 +0200)]
Give NullabilityKind a printing operator<<
This is more useful for debug/test than getNullabilitySpelling:
- default form has uglifying underscores
- non-default form crashes on NullableResult
- both return unhelpfully verbose strings for Unspecified
- operator<< works with gtest, formatv, etc
Differential Revision: https://reviews.llvm.org/D149650
Vitaly Buka [Thu, 4 May 2023 20:56:22 +0000 (13:56 -0700)]
[NFC][HWASAN] Switch to verbose CHECKs
Advenam Tacet [Thu, 4 May 2023 21:16:06 +0000 (14:16 -0700)]
[ASan][libcxx] A way to turn off annotations for containers with a specific allocator
This revision is part of our efforts to support container annotations with (almost) every allocator.
That patch is necessary to enable support for most annotations (D136765). Without a way to turn off annotations, it's hard to use ASan with area allocators (no calls to destructors).
This is an answer to a request about it. This patch provides a solution to the aforementioned issue by introducing a new template structure `__asan_annotate_container_with_allocator`, which allows the disabling of container annotations for a specific allocator.
This patch also introduces `_LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS` FTM.
To turn off annotations, it is sufficient to create a template specialization with a false value using a [Unary Type Trait](https://en.cppreference.com/w/cpp/types/integral_constant).
The proposed structure is being used in the code enabling annotations for all allocators in `std::vector`, `std::basic_string`, and `std::deque`. (D136765 D146214 D146815)
Possibility to do it was added to ASan API in rGdd1b7b797a116eed588fd752fbe61d34deeb24e4 commit.
For context on not calling a destructor, look at https://eel.is/c++draft/basic.life#5 and notes there, you may also read a discussion in D136765.
Reviewed By: ldionne, philnik, #libc, hans
Spies: EricWF, mikhail.ramalho, #sanitizers, libcxx-commits, hans, vitalybuka
Differential Revision: https://reviews.llvm.org/D145628
Martin Braenne [Thu, 4 May 2023 07:42:05 +0000 (07:42 +0000)]
[clang][dataflow] Eliminate intermediate `ReferenceValue`s from `Environment::DeclToLoc`.
For the wider context of this change, see the RFC at
https://discourse.llvm.org/t/70086.
After this change, global and local variables of reference type are associated
directly with the `StorageLocation` of the referenced object instead of the
`StorageLocation` of a `ReferenceValue`.
Some tests that explicitly check for an existence of `ReferenceValue` for a
variable of reference type have been modified accordingly.
As discussed in the RFC, I have added an assertion to `Environment::join()` to
check that if both environments contain an entry for the same declaration in
`DeclToLoc`, they both map to the same `StorageLocation`. As discussed in
https://discourse.llvm.org/t/70086/5, this also necessitates removing
declarations from `DeclToLoc` when they go out of scope.
In the RFC, I proposed a gradual migration for this change, but it appears
that all of the callers of `Environment::setStorageLocation(const ValueDecl &,
SkipPast` are in the dataflow framework itself, and that there are only a few of
them.
As this is the function whose semantics are changing in a way that callers
potentially need to adapt to, I've decided to change the semantics of the
function directly.
The semantics of `getStorageLocation(const ValueDecl &, SkipPast SP` now no
longer depend on the behavior of the `SP` parameter. (There don't appear to be
any callers that use `SkipPast::ReferenceThenPointer`, so I've added an
assertion that forbids this usage.)
This patch adds a default argument for the `SP` parameter and removes the
explicit `SP` argument at the callsites that are touched by this change. A
followup patch will remove the argument from the remaining callsites,
allowing the `SkipPast` parameter to be removed entirely. (I don't want to do
that in this patch so that semantics-changing changes can be reviewed separately
from semantics-neutral changes.)
Reviewed By: ymandel, xazax.hun, gribozavr2
Differential Revision: https://reviews.llvm.org/D149144
Alexey Bataev [Thu, 4 May 2023 20:32:35 +0000 (13:32 -0700)]
[SLP][NFC]Do not try to revectorize instructions with constant operands, NFC.
The pass should not try to revectorize instructions with constant
operands, which were not folded by the IRBuilder. It prevents the
non-terminating loop in the SLP vectorizer for non foldable constant
operations.
Arthur Eubanks [Thu, 4 May 2023 20:07:27 +0000 (13:07 -0700)]
[AggressiveInstCombine] Only fold consecutive shifts of loads with constant shift amounts
This is what the code assumed but never actually checked.
Fixes https://github.com/llvm/llvm-project/issues/62509.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149896
Alex Langford [Thu, 4 May 2023 00:41:58 +0000 (17:41 -0700)]
[lldb][NFCI] Add unittests for ObjCLanguage::MethodName
I have a patch to refactor this class and I'd like a unittest in place
to make sure I don't break anything.
Differential Revision: https://reviews.llvm.org/D149804
Jon Chesterfield [Thu, 4 May 2023 20:45:18 +0000 (21:45 +0100)]
Revert "[libc][rpc] Land helpers from D148943"
This reverts commit
09ceb4729f1ca8781718d41b7876b68820baadba.
Florian Hahn [Thu, 4 May 2023 20:40:22 +0000 (21:40 +0100)]
[VPlan] Reorder cases in switch (NFC).
Reorder cases to make sure they are ordered properly in preparation
for D149081.
Jason Molenda [Thu, 4 May 2023 20:23:51 +0000 (13:23 -0700)]
Add AArch64 MASK watchpoint support in debugserver
Add suport for MASK style watchpoints on AArch64 in debugserver
on Darwin systems, for watching power-of-2 sized memory ranges.
More work needed in lldb before this can be exposed to the user
(because they will often try watching memory ranges that are not
exactly power-of-2 in size/alignment) but this is the first part
of adding that capability.
Differential Revision: https://reviews.llvm.org/D149792
rdar://
108233371
Jason Molenda [Thu, 4 May 2023 20:13:30 +0000 (13:13 -0700)]
Recognize `addressing_bits` kv in stop reply packet
If a remote stub provides the addressing_bits kv pair in
the stop reply packet, update the Process address masks with
that value as it possibly changes during the process runtime.
This is an unusual situation, most likely a JTAG remote stub
and some very early startup code that is setting up the page
tables. Nearly all debug sessions will have a single address
mask that cannot change during the lifetime of a Process.
Differential Revision: https://reviews.llvm.org/D149803
rdar://
61900565
Jon Chesterfield [Thu, 4 May 2023 19:53:07 +0000 (20:53 +0100)]
[libc][rpc] Land helpers from D148943
walter erquinigo [Wed, 3 May 2023 02:40:12 +0000 (21:40 -0500)]
[LLDB] Add a hook to notify REPLs that an expression was evaluated
REPL implementations don't have an easy way to know that an expression has been evaluated, so I'm adding a simple function for that. In the future we can add another hook for meta commands.
Differential Revision: https://reviews.llvm.org/D149719
walter erquinigo [Wed, 3 May 2023 02:12:43 +0000 (21:12 -0500)]
[lldb] Make some functions useful to REPLs public
`StartEventHandlerThread` and `StopEventHandlerThread` are available to the SwiftREPL even though they are protected because SwiftREPL is a friend class of Debugger. I'm developing my own REPL and having access to these functions, including `FlushProcessOutput`, is desirable.
Differential Revision: https://reviews.llvm.org/D149717
Ilya Kuklin [Thu, 4 May 2023 19:36:25 +0000 (12:36 -0700)]
[MSP430] Get the DWARF pointer size from MCAsmInfo instead of DataLayout.
This change will allow to put code pointers in DWARF info fields that are larger than actual pointer size, e.g. 16-bit pointers into 32-bit fields.
The need for this came up while creating support for MSP430 in LLDB. MSP430-GCC already generates DWARF info with 32-bit fields, so this change is necessary for LLDB to maintain compatibility with both GCC and LLVM binaries. Moreover, right now in LLDB there is no support for having DWARF pointer size different from ELF header type, e.g. 16-bit DWARF info within ELF32, and it seems there is no such thing as ELF16.
Since other mainline targets are made to have the same pointer size in both MCAsmInfo and DataLayout, there is no need to change anything there.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D148042
William Huang [Tue, 2 May 2023 22:35:04 +0000 (22:35 +0000)]
[llvm-profdata] Change default output format of llvm-profdata to ExtBinary
ExtBinary is compatible to, and more superior than Binary format, which is the current default output format. In the long run we are looking to only support ExtBinary format and Text format (for visual inspection), and drop Binary format as well. Since Binary format was the default, we expect many users are still using it, so let's change the default output format first, and hopefully the usage decreases over time
Reviewed By: davidxl, hoy
Differential Revision: https://reviews.llvm.org/D149700
Joseph Huber [Thu, 4 May 2023 19:12:43 +0000 (14:12 -0500)]
[libc] Remove support for atomic test due to failing on sm_60
This test fails on sm_60 because of the atomics codegen. We test atomics
indirectly with the `rpc` so we still have coverage.
Differential Revision: https://reviews.llvm.org/D149887
Siva Chandra Reddy [Thu, 4 May 2023 19:09:19 +0000 (19:09 +0000)]
Revert "[libc] Improve the add_libc_test rule."
This reverts commit
fb6faf4798b1cb327e719898e2ea6eff7f597c49 as the
aarch64 builders are failing.
Siva Chandra Reddy [Wed, 3 May 2023 08:00:37 +0000 (08:00 +0000)]
[libc] Improve the add_libc_test rule.
A target for the test named ${fq_target_name} has been added. It depends
on ${fq_target_name}.__unit__ and ${fq_target_name}.__hermetic__ as
relevant.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D149730
Tom Stellard [Thu, 4 May 2023 18:52:22 +0000 (11:52 -0700)]
docs: Document policy around GitHub branches
See discussion in #56643.
Reviewed By: rengolin, jhenderson, ldionne
Differential Revision: https://reviews.llvm.org/D147276
NagaChaitanya Vellanki [Thu, 4 May 2023 18:35:42 +0000 (11:35 -0700)]
[clang][ExtractAPI] Add semicolon to function declaration fragments
Add missing semicolon at the end of function declarations to fragments
Reviewed By: dang
Differential Revision: https://reviews.llvm.org/D149737
Nikolas Klauser [Tue, 2 May 2023 22:08:46 +0000 (15:08 -0700)]
[libc++][PSTL] Replace _PSTL_ASSERT with _LIBCPP_ASSERT
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D149605
Shafik Yaghmour [Thu, 4 May 2023 18:23:16 +0000 (11:23 -0700)]
Fix build bots due to missing a commit thay change 2b to 23
Fixing build bot breaks due to
b4692f29263006c7ea519c7b11c9082384f0af53
Alexandre Ganea [Thu, 4 May 2023 17:01:13 +0000 (13:01 -0400)]
[llvm-objdump][COFF] Skip empty export entries when dumping the export table
Before this patch, export entries with empy RVA were displayed in the output. In some cases, when the module had exports with sparse ordinals, `llvm-objdump` used to print a lot of `0 0` lines.
We now skip over these empty entries in the output, just as `dumpbin` or binutils `objdump` does.
Differential Revision: https://reviews.llvm.org/D149610
Michael Liao [Thu, 4 May 2023 18:27:33 +0000 (14:27 -0400)]
[clang] Fix another case where CPlusPlus2b is still used.
Michael Liao [Thu, 4 May 2023 18:22:38 +0000 (14:22 -0400)]
[clang] Fix build after https://reviews.llvm.org/D149553
- `CXXPre2bCompat` is referenced somewhere after being removed.
- More warning messages on c++2b need refining
Joseph Huber [Thu, 4 May 2023 16:22:38 +0000 (11:22 -0500)]
[libc] Maintain proper alignment for the hermetic tests malloc
We use a bump pointer to implement malloc for the hermetic tests.
Currently, we bump the pointer up by any amount. This means that calling
`malloc(1)` will misalign the buffer so any following `malloc(8)`
accesses will not be aligned. This causes problems in architectures
which require alignment.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149863
Arthur Eubanks [Thu, 4 May 2023 18:17:55 +0000 (11:17 -0700)]
[gn build] Fix tblgen CodeGen dependencies
Matches the CMake build, otherwise we're rebuilding tblgen (and everything else) when there's a change almost anywhere in LLVM.
Felipe de Azevedo Piovezan [Thu, 4 May 2023 16:30:59 +0000 (12:30 -0400)]
[MIRParser][nfc] Factor out code parsing debug MD nodes
This commit splits a function that both parses MD nodes from YAML into
DI{Expr,Loc,Variable} objects AND adds an entry to the MF variable table, so
that each of those jobs is done separately.
It will enable subsequent patches to reuse the MD node parsing code.
Differential Revision: https://reviews.llvm.org/D149870
Valentin Clement [Thu, 4 May 2023 18:15:04 +0000 (11:15 -0700)]
[flang][openacc] Lower data clause on compute construct to data operand ops
This patch lowers the data clause on the OpenACC compute construct
to their corresponding acc data operand operation.
The decomposition is the same as in D149673.
Note that `private` and `firstprivate` are not lowered to data operand operation as they do not have one and will likely have dedicated design/process.
Depends on D149673
Reviewed By: razvanlupusoru, jeanPerier
Differential Revision: https://reviews.llvm.org/D149785
Florian Hahn [Thu, 4 May 2023 18:12:02 +0000 (19:12 +0100)]
[VPlan] Remove setEntry to avoid leaks when replacing entry.
Update the HCFG builder to directly connect the created CFG to the
existing Plan's entry. This allows removing `setEntry`, which can cause
leaks when the existing entry is replaced.
Should fix
https://lab.llvm.org/buildbot/#/builders/5/builds/33455/steps/13/logs/stdio
Mehdi Amini [Thu, 4 May 2023 16:40:56 +0000 (09:40 -0700)]
Restore mlir-opt `--run-reproducer` option to opt-in running a reproducer
When tooling out there produces a reproducer that is archived, the first thing
a user is likely to expect is to process this as they do with any MLIR file.
However https://reviews.llvm.org/D126447 changed the behavior of mlir-opt to
eliminate the `--run-reproducer` option and instead automatically run it when
present in the input file. This creates a discrepancy in how mlir-opt behaves
when fed with an input file, and is surprising for users.
The explicit passing of `--run-reproducer` to express user-intent seems more
in line with what is expected from `mlir-opt`.
Reviewed By: rriddle, jpienaar
Differential Revision: https://reviews.llvm.org/D149820
Shafik Yaghmour [Thu, 4 May 2023 18:05:25 +0000 (11:05 -0700)]
[Clang] Updating handling of defaulted comparison operators to reflect changes from P2448R2
Prior to P2448R2 we were more aggressive in diagnosing ill-formed
constexpr functions. Many of these restrictions were relaxed and now it
is not required for defaulted comparison operators to call constexpr
functions.
This behavior is extended to before C++23 and diagnostic for it's use
can be enabled w/ -pedantic or -Wc++2b-default-comp-relaxed-constexpr
This fixes: https://github.com/llvm/llvm-project/issues/61238
Differential Revision: https://reviews.llvm.org/D146090
Dave Lee [Thu, 4 May 2023 17:58:48 +0000 (10:58 -0700)]
[lldb] Remove unused g_objc_Tagged_ISA constants (NFC)
Last use removed in
f7420453e80b9294273009efcebaceac2383269e.
Mark de Wever [Sun, 30 Apr 2023 19:23:30 +0000 (21:23 +0200)]
[libc++][test] Selects proper C++23 field.
D149553 changes the name of the LangOptions member. This change allows
libc++ to work with either name.
Reviewed By: philnik, #libc
Differential Revision: https://reviews.llvm.org/D149554
Valentin Clement [Thu, 4 May 2023 17:36:41 +0000 (10:36 -0700)]
[flang][openacc] Lower data construct operand to data operand operations
This patch lowers the data clause on the OpenACC data construct
to their corresponding acc data operand operation.
The copy clause is decomposed into acc.copyin before and acc.copyout after
the acc.data operation.
The copyout close is decomposed into acc.create before and acc.copyout after
the acc.data operation.
The attach clause is decomposed into acc.attach before and acc.detach after
the acc.data operation.
Depends on D149601
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D149673
Jon Chesterfield [Thu, 4 May 2023 17:33:19 +0000 (12:33 -0500)]
[libc][rpc] Pass lane_mask into lock functions
Will be necessary for correct locking on volta.
API-only change to help with rebasing the rest of the stack on this.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D149871
Amir Ayupov [Wed, 3 May 2023 23:40:29 +0000 (16:40 -0700)]
[BOLT] Remove redundant dumps in AsmDump
Dumping jump table and tail call fdata is covered by subsequent iteration over
successors.
Reviewed By: #bolt, maksfb
Differential Revision: https://reviews.llvm.org/D149799
Peiming Liu [Thu, 4 May 2023 17:20:44 +0000 (17:20 +0000)]
[mlir][sparse] fix build error.
Reviewed By: aartbik, vzakhari
Differential Revision: https://reviews.llvm.org/D149874
Mark de Wever [Sun, 30 Apr 2023 13:27:00 +0000 (15:27 +0200)]
[clang] Use -std=c++23 instead of -std=c++2b
During the ISO C++ Committee meeting plenary session the C++23 Standard
has been voted as technical complete.
This updates the reference to c++2b to c++23 and updates the __cplusplus
macro.
Drive-by fixes c++1z -> c++17 and c++2a -> c++20 when seen.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D149553
David Stone [Thu, 4 May 2023 17:06:53 +0000 (13:06 -0400)]
[clang][Sema][NFC] Move `EnterExpressionEvaluationContext` to its own file
Sema.h is huge. This makes a small reduction to it by moving
EnterExpressionEvaluationContext into a new header, since it is an
independent component.
Differential Revision: https://reviews.llvm.org/D149796
Alexey Lapshin [Thu, 4 May 2023 16:13:29 +0000 (18:13 +0200)]
Fix test bot breakage from
06b617064a997574df409c7d846b6f6b492f5124
This addresses the issue found by: https://lab.llvm.org/buildbot#builders/178/builds/4571
Alexey Bataev [Thu, 4 May 2023 16:03:02 +0000 (09:03 -0700)]
[SLP]Fix a crash trying finding insert point for GEP nodes with non-gep
insts.
If the vectorizable GEP node is built, which should not be scheduled,
and at least one node is a non-gep instruction, need to insert the
vectorized instructions before the last instruction in the list, not
before the first one, otherwise the instructions may be emitted in the
wrong order.
Fangrui Song [Thu, 4 May 2023 16:42:25 +0000 (09:42 -0700)]
MS inline asm: remove obsolete code adding AOK_SizeDirective (e.g. dword ptr)
The AOK_SizeDirective part from
5b37c181291210bedfbb7a6af5d51229f3652ef0
(2014-08) seems unneeded nowadays (the root cause has likely been fixed
elsewhere). The part abuses that `call dword ptr foo` assembles the same way as `call
foo` in Intel syntax, which is going to be fixed (changed) by D149579.
The generated object files for
CodeGen/ms-inline-asm{,-functions,-variables,-static-variable}.c and
CodeGenCXX/ms-inline-asm-fields.cpp are unchanged
(-mno-incremental-linker-compatible) with just this patch. When D149579 is
subsequently applied, the FIXME part of `kptr` in
CodeGen/ms-inline-asm-functions.c will be fixed.
Differential Revision: https://reviews.llvm.org/D149695
Teresa Johnson [Thu, 4 May 2023 16:37:25 +0000 (09:37 -0700)]
Revert "Restore "[MemProf] Context disambiguation cloning pass [patch 3/4]""
This reverts commit
bfe7205975a63a605ff3faacd97fe4c1bf4c19b3, and follow
on fix
e3e6bc699574550f2ed1de07f4e5bcdddaa65557, due to some remaining
instability exposed by the bot enabling expensive checks:
https://lab.llvm.org/buildbot/#/builders/42/builds/9842
Valentin Clement [Thu, 4 May 2023 16:39:04 +0000 (09:39 -0700)]
[flang][openacc] Lower copyout, detach and delete to data exit operations
Add support to lower data exit operations and use it for the
copyout, detach and delete clause on the `!$acc exit data` construct.
This patch refactor the data entry op creation so most part of the code
can be shared with the data exit op.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D149601
Mehdi Amini [Thu, 4 May 2023 16:35:25 +0000 (09:35 -0700)]
Remove obsolete patch for arcanist: this is already in the upstream project now
Nikolas Klauser [Tue, 2 May 2023 22:01:00 +0000 (15:01 -0700)]
[libc++][PSTL] Move all the OpenMP conditionals into a single block
All the used OpenMP pragmas are available with OpenMP 4.0, so they can all share a single conditional block.
Reviewed By: ldionne, #libc
Spies: yaxunl, sstefan1, guansong, jplehr, libcxx-commits, sunshaoce
Differential Revision: https://reviews.llvm.org/D149603
Fangrui Song [Thu, 4 May 2023 16:21:18 +0000 (09:21 -0700)]
EntryExitInstrumenter: skip naked functions
The asm in a naked function may reasonably expect the argument registers and the
return address register (if present) to be live.
When using -pg and -finstrument-functions, functions are instrumented by adding
a function call to `_mcount/__cyg_profile_func_enter/__cyg_profile_func_enter_bare`/etc,
which will clobber these registers. If the return address register is clobbered,
the function will be unable to return to the caller, possibly causing an
infinite loop.
```
__attribute__((naked)) void g() {
#if defined(__arm__)
__asm__("bx lr");
#else
__asm__("ret");
#endif
}
int main() { g(); }
```
It seems that the only one reasonable way to handle the combination is to
disable instrumenting for naked functions.
GCC PR: https://gcc.gnu.org/PR109707
Close https://github.com/llvm/llvm-project/issues/62504
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D149721
Slava Zakharin [Thu, 4 May 2023 15:47:28 +0000 (08:47 -0700)]
[flang][hlfir] Generate explicit HLFIR type cast for implicit logical<->integer conversion.
hlfir.assign, in general, ends up calling the Assign runtime that asserts
that the types of LHS and RHS match. In case of implicit logical<->integer
conversions (allowed as an extension) the operands of hlfir.assign
have non-matching types. This change makes sure that the lowering
produces explicit type cast (either as a scalar fir.convert or
as a hlfir.elemental producing array expression).
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D149765
Peiming Liu [Mon, 17 Apr 2023 20:09:47 +0000 (20:09 +0000)]
[mlir][sparse] group tensor id and levels into pairs in loop emitter
This addressed some unresolved comments in https://reviews.llvm.org/D142930
Reviewed By: aartbik, wrengr
Differential Revision: https://reviews.llvm.org/D148565
Nikolas Klauser [Wed, 3 May 2023 21:42:21 +0000 (14:42 -0700)]
[libc++][PSTL][NFC] Fix the naming in the SIMD backend
Reviewed By: ldionne, #libc
Spies: sstefan1, jplehr, libcxx-commits, miyuki
Differential Revision: https://reviews.llvm.org/D149787
Akash Banerjee [Tue, 2 May 2023 17:21:12 +0000 (18:21 +0100)]
[OpenMP][OMPIRBuilder] Migrate MapCombinedInfoTy from Clang to OpenMPIRBuilder
This patch migrates the MapCombinedInfoTy from Clang codegen to OpenMPIRBuilder.
Differential Revision: https://reviews.llvm.org/D149666
Florian Hahn [Thu, 4 May 2023 15:29:49 +0000 (16:29 +0100)]
[VPlan] Clean up preheader block after
b85a402dd899fc.
Fix a leak introduced in
b85a402dd899fc and flagged by LSan
https://lab.llvm.org/buildbot#builders/5/builds/33452
Joseph Huber [Thu, 4 May 2023 15:16:54 +0000 (10:16 -0500)]
[libc][Docs] Add warning about running GPU tests with parallelism
Now that a large amount of GPU tests can be run in parallel, we should
document spurious failures. It is a well-known issue that launching many
GPU applications in parallel can lead to various problems, the worst of
which being an indefinite hang.
Differential Revision: https://reviews.llvm.org/D149857
Siyuan Zhu [Thu, 4 May 2023 14:59:07 +0000 (16:59 +0200)]
[ValueTracking] add UGT/UGE and SGT/SGE in `isImpliedCondOperands`
Partially `fix` https://github.com/llvm/llvm-project/issues/62441.
Extend isImpliedCondOperands() to handle ugt/uge and sgt/sge predicates.
alive2 proof: https://alive2.llvm.org/ce/z/jLFDAv and
https://alive2.llvm.org/ce/z/Z8idUd
Differential Revision: https://reviews.llvm.org/D149510
Siyuan Zhu [Thu, 4 May 2023 14:57:38 +0000 (16:57 +0200)]
[InstSimplify] Test case for icmp imply (NFC)
ugt/uge/sgt/sge test for the extension to isImpliedCondOperands
case from issue 62441 and 61393:
(X >> Z) <=(u) Y ==> X <=(to u) Y and (X > Y +_{nuw} 1) ==> X != Y
Differential Revision: https://reviews.llvm.org/D149512
Alvin Wong [Sat, 22 Apr 2023 18:13:48 +0000 (02:13 +0800)]
[compiler-rt][interception][win] Add error messages for some errors
Depends on D149002
Differential Revision: https://reviews.llvm.org/D149346
Alvin Wong [Sat, 29 Apr 2023 22:51:48 +0000 (06:51 +0800)]
[compiler-rt][interception][asan][win] Improve error reporting
Add a callback from interception to allow asan on Windows to produce
better error messages. If an unrecoverable error occured when
intercepting functions, print a message before terminating.
Additionally, when encountering unknown instructions, a more helpful
message containing the address and the bytes of the unknown instruction
is now printed to help identify the issue and make it easier to propose
a fix.
Depends on D149549
Differential Revision: https://reviews.llvm.org/D149002
Alvin Wong [Sat, 22 Apr 2023 18:04:16 +0000 (02:04 +0800)]
[compiler-rt][interception][win] Don't crash on unknown instructions
Do not treat unknown instructions as a fatal error. In most cases,
failure to intercept a function is reported by the caller, though
requires setting verbosity to 1 or higher to be visible.
Better error message reporting for asan will be added in a separate
patch.
Differential Revision: https://reviews.llvm.org/D149549
Alvin Wong [Sat, 22 Apr 2023 12:54:33 +0000 (20:54 +0800)]
[compiler-rt][asan][win] Intercept exceptions for i686 MinGW
The i686-w64-windows-gnu target does not use SEH (which MSVC uses),
but DWARF-2 exception handling or possibly sjlj depending on the
toolchain build options. On this target we have to actually intercept
functions in libc++ and libunwind which handles throwing exceptions.
This fixes the `TestCases/intercept-rethrow-exception.cpp` test.
The x86_64-w64-windows-gnu target already works because it uses SEH
which is handled by intercepting RaiseException, so this change does not
affect x86_64.
Depends on https://reviews.llvm.org/D148990
Differential Revision: https://reviews.llvm.org/D148991
Alvin Wong [Sat, 22 Apr 2023 11:26:08 +0000 (19:26 +0800)]
[compiler-rt][interception][win] Add more assembly patterns
These assembly patterns are needed to intercept some libc++ and
libunwind functions built by Clang for i686-w64-windows-gnu target.
Differential Revision: https://reviews.llvm.org/D148990
Louis Dionne [Tue, 2 May 2023 21:50:06 +0000 (17:50 -0400)]
[libc++] Add missing test for std::hash<std::filesystem::path>
Differential Revision: https://reviews.llvm.org/D149696