Commit Graph

492912 Commits

Author SHA1 Message Date
Dave Lee
4da2b542b1 [lldb] Fix dwim-print to not delete non-result persistent variables (#85152)
`EvaluateExpression` does not always create a new persistent result. If the expression 
is a bare persistent variable, then a new persistent result is not created. This means 
the caller can't assume a new persistent result is created for each evaluation. 
However, `dwim-print` was doing exactly that: assuming a new persistent result for each 
evaluation. This resulted in a bug:

```
(lldb) p int $j = 23
(lldb) p $j
(lldb) p $j
```

The first `p $j` would not create a persistent result, and so `dwim-print` would 
inadvertently delete `$j`. The second `p $j` would fail.

The fix is to try `expr` as a persistent variable, after trying `expr` as a frame 
variable. For persistent variables, this avoids calling `EvaluateExpression`.

Resolves https://github.com/llvm/llvm-project/issues/84806

rdar://124688427
2024-03-15 16:09:24 -07:00
Jie Fu
8f2632c45f [lldb][test] Fix -Wctad-maybe-unsupported in AlarmTest.cpp (NFC)
llvm-project/lldb/unittests/Host/AlarmTest.cpp:49:7:
error: 'lock_guard' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
      std::lock_guard guard(m);
      ^
2024-03-16 06:59:07 +08:00
Jie Fu
ba97dc8c7a [lldb] Fix -Wctad-maybe-unsupported in Alarm.cpp (NFC)
llvm-project/lldb/source/Host/common/Alarm.cpp:37:5:
error: 'lock_guard' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
    std::lock_guard alarm_guard(m_alarm_mutex);
    ^
2024-03-16 06:52:12 +08:00
Joseph Huber
6818c7b8ef [libc] Update GPU testing documentation (#85459)
Summary:
This documentation was lagging reality and didn't contain much. Update
it with some more information now that it's more mature.
2024-03-15 17:49:44 -05:00
Vitaly Buka
01fa550ff6 [tsan][test] Switch SIGPROF to SIGALRM
Followup to #85188.
2024-03-15 15:44:15 -07:00
Yichen Yan
047b2b241d [NVPTX] Add -march=general option to mirror default configuration (#85222)
This PR adds `-march=generic` support for the NVPTX backend. This
fulfills a TODO introduced in #79873.

With this PR, users can explicitly request the "default" CUDA
architecture, which makes sure that no specific architecture is
specified.

This PR does not address any compatibility issues between different CUDA
versions.

---------

Co-authored-by: Joseph Huber <huberjn@outlook.com>
2024-03-15 17:16:10 -05:00
Jonas Devlieghere
d5a277d309 [lldb] Store SupportFile in FileEntry (NFC) (#85468)
This is another step towards supporting DWARF5 checksums and inline
source code in LLDB.
2024-03-15 15:03:54 -07:00
Slava Zakharin
8ebf4084f1 [NFC][flang] Reorder const and RT_API_ATTRS.
Clean-up to keep the type qualifier next to the type.

Reviewers: klausler

Reviewed By: klausler

Pull Request: https://github.com/llvm/llvm-project/pull/85180
2024-03-15 14:45:04 -07:00
Krzysztof Parzyszek
037a32a9a7 [flang][OpenMP] Convert DataSharingProcessor to omp::Clause (#81629)
[Clause representation 6/6]
2024-03-15 16:42:06 -05:00
Slava Zakharin
d8f97c067c [flang][runtime] Added Fortran::common::reference_wrapper for use on device.
This is a simplified implementation of std::reference_wrapper that can be used
in the offload builds for the device code. The methods are properly
marked with RT_API_ATTRS so that the device compilation succedes.

Reviewers: jeanPerier, klausler

Reviewed By: jeanPerier

Pull Request: https://github.com/llvm/llvm-project/pull/85178
2024-03-15 14:41:47 -07:00
LLVM GN Syncbot
6e1959d0e7 [gn build] Port 0481f049c3 2024-03-15 21:33:28 +00:00
Sterling Augustine
d4a8e979e4 Revert "[NVPTX] Use .common linkage for common globals (#84416)"
This reverts commit 8f0012d3dc.

The common-linkage.ll test fails with ptxas enabled.
2024-03-15 21:27:46 +00:00
Slava Zakharin
71e0261fb0 [flang][runtime] Added Fortran::common::optional for use on device.
This is a simplified implementation of std::optional that can be used
in the offload builds for the device code. The methods are properly
marked with RT_API_ATTRS so that the device compilation succedes.

Reviewers: klausler, jeanPerier

Reviewed By: jeanPerier

Pull Request: https://github.com/llvm/llvm-project/pull/85177
2024-03-15 14:25:47 -07:00
Ahmed Bougacha
0481f049c3 [AArch64][PAC] Support ptrauth builtins and -fptrauth-intrinsics. (#65996)
This defines the basic set of pointer authentication clang builtins
(provided in a new header, ptrauth.h), with diagnostics and IRGen
support.  The availability of the builtins is gated on a new flag,
`-fptrauth-intrinsics`.

Note that this only includes the basic intrinsics, and notably excludes
`ptrauth_sign_constant`, `ptrauth_type_discriminator`, and
`ptrauth_string_discriminator`, which need extra logic to be fully
supported.

This also introduces clang/docs/PointerAuthentication.rst, which
describes the ptrauth model in general, in addition to these builtins.

Co-Authored-By: Akira Hatanaka <ahatanaka@apple.com>
Co-Authored-By: John McCall <rjmccall@apple.com>
2024-03-15 14:17:21 -07:00
Peter Klausler
60fa2b0670 [flang] Parse !$CUF KERNEL DO <<< (*) (#85338)
Accept and represent asterisks within the parenthesized grid and block
specification lists.
2024-03-15 13:57:42 -07:00
Peter Klausler
5e21fa23bb [flang][runtime] Fix off-by-one error in EX0.0 output editing (#85428)
The maximum number of significant hexadecimal digits in EX0.0 REAL
output editing is 29, not 28. Fix by computing it at build time from the
precision of REAL(16).
2024-03-15 13:56:47 -07:00
Sam McCall
ca4c4a6758 Revert "[clang][nullability] allow _Nonnull etc on nullable class types (#82705)"
This reverts commit 92a09c0165.

This is triggering a bunch of new -Wnullability-completeness warnings
in code with existing raw pointer nullability annotations.

The intent was the new nullability locations wouldn't affect those
warnings, so this is a bug at least for now.
2024-03-15 21:55:37 +01:00
Alexander Yermolovich
a4610c7182 [BOLT][DWARF] Add support for DW_IDX_parent (#85285)
This adds support for DW_IDX_parent. If DIE has a parent then
DW_IDX_parent in Entry will point to Entry for that parent DIE.
Otherwise it will have DW_FORM_flag_present in abbrev. Which takes zero
space in Entry.

This came from

https://discourse.llvm.org/t/rfc-improve-dwarf-5-debug-names-type-lookup-parsing-speed/74151
2024-03-15 13:52:45 -07:00
OverMighty
8ff96eb100 [libc][math][c23] Add nextup{,f,f128} and nextdown{,f,f128} functions (#85431)
See https://github.com/llvm/llvm-project/issues/85283.

I had a test for `nextdownl` that was failing and I thought I should add
`nextupl` and `nextdownl` later and first make a PR for the other
functions.

cc @lntue
2024-03-15 16:46:48 -04:00
Billy Zhu
f0863a004e [MLIR][LLVM] Fix bazel build (#85462)
Fix bazel build after #80251.
2024-03-15 13:45:52 -07:00
Benjamin Maxwell
e74bcecd36 [mlir][math] Propagate scalability in polynomial approximation (#84949)
This simply updates the rewrites to propagate the scalable flags (which
as they do not alter the vector shape, is pretty simple).

The added tests are simply scalable versions of the existing vector
tests.
2024-03-15 20:08:52 +00:00
srcarroll
f75d164eea Revert "[mlir][math] Implement alternative decomposition for tanh (#8… (#85429)
…5025)"

This reverts commit 58ef9bec07.

There is a bool to float casting issue that needs to be sorted out to
make sure this is target independent
2024-03-15 14:39:57 -05:00
Jonas Devlieghere
b7dd6012eb [lldb] Show module name in progress update for downloading symbols (#85342)
Currently, we always show the argument passed to dsymForUUID in the
corresponding progress update. Most of the time this is a UUID, but it
can also be an absolute path. The former is pretty uninformative and the
latter needlessly noisy.

This changes the progress update to print the UUID and the module name,
if both are available. Otherwise, we print the UUID or the module name
depending on which one is available.

We now also unconditionally pass the module file spec and architecture
to DownloadObjectAndSymbolFile, while previously this was conditional on
the file existing on-disk. This should be harmless:

  - We already check that the file exists in DownloadObjectAndSymbolFile.
  - It doesn't make sense to check the filesystem for the architecutre.

rdar://124643548
2024-03-15 12:34:34 -07:00
Felipe Cabarcas
0e21672d99 Fixing LIBOMPTARGET_INFO message, for Copying data from device to host (#85444)
When running OpenMP offloading application with LIBOMPTARGET_INFO=-1,
the addresses of the Copying data from **device** to **host**, the
address are swap.
As an example, Currently the address would be
```
omptarget device 0 info: Mapping exists with HstPtrBegin=0x00007ffddaf0fb90, TgtPtrBegin=0x00007fb385404000, Size=8000, DynRefCount=0 (decremented, delayed deletion), HoldRefCount=0
omptarget device 0 info: Copying data from device to host, TgtPtr=0x00007ffddaf0fb90, HstPtr=0x00007fb385404000, Size=8000, Name=d
```
And it should be
```
omptarget device 0 info: Copying data from device to host, TgtPtr=0x00007fb385404000, HstPtr=0x00007ffddaf0fb90, Size=8000, Name=d
```

---------

Co-authored-by: fel-cab <fel-cab@github.com>
2024-03-15 15:25:14 -04:00
Alex MacLean
89b7b3b995 [NVPTX] support dynamic allocas with PTX alloca instruction (#84585)
Add support for dynamically sized alloca instructions with the PTX
alloca instruction introduced in PTX 7.3 
([9.7.15.3. Stack Manipulation Instructions: alloca]
(https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#stack-manipulation-instructions-alloca))
2024-03-15 11:51:46 -07:00
Justin Bogner
1b0072734f [new-prs-labeler] Add "DXContainer" patterns to the backend:DirectX label (#85446)
This should make sure PRs like #84409 get labelled.
2024-03-15 11:45:27 -07:00
Ulrich Weigand
c9062e8f78 Reapply [libomptarget] Build plugins-nextgen for SystemZ (#83978)
The plugin was not getting built as the build_generic_elf64 macro
assumes the LLVM triple processor name matches the CMake processor name,
which is unfortunately not the case for SystemZ.

Fix this by providing two separate arguments instead.

Actually building the plugin exposed a number of other issues causing
various test failures. Specifically, I've had to add the SystemZ target
to
- CompilerInvocation::ParseLangArgs
- linkDevice in ClangLinuxWrapper.cpp
- OMPContext::OMPContext (to set the device_kind_cpu trait)
- LIBOMPTARGET_ALL_TARGETS in libomptarget/CMakeLists.txt
- a check_plugin_target call in libomptarget/src/CMakeLists.txt

Finally, I've had to set a number of test cases to UNSUPPORTED on
s390x-ibm-linux-gnu; all these tests were already marked as UNSUPPORTED
for x86_64-pc-linux-gnu and aarch64-unknown-linux-gnu and are failing on
s390x for what seem to be the same reason.

In addition, this also requires support for BE ELF files in
plugins-nextgen: https://github.com/llvm/llvm-project/pull/85246
2024-03-15 19:06:43 +01:00
Petr Hosek
d717e7f7be [libc] Include double_t and float_t in math.h on baremetal (#85028)
This matches other targets.
2024-03-15 11:00:19 -07:00
Petr Hosek
500e05f5a2 [libc] Match stdlib.h baremetal entrypoints with types (#85030)
To match the entrypoints and types for baremetal, we need to include
__qsortrcompare_t and omit __atexithandler_t.
2024-03-15 10:58:14 -07:00
Petr Hosek
d6722bcbd6 [libc] Move EOF macro to stdio-macros.h (#85159)
libc++ char_traits.h assumes EOF is always available

See #85158 for more details.
2024-03-15 10:56:39 -07:00
Amir Ayupov
b431546d41 [BOLT] Check BF state in stale matching (#85339)
Only apply stale matching if the binary function is in CFG state, i.e.
has basic blocks.

Test Plan:
Updated bolt/test/X86/reader-stale-yaml.test
2024-03-15 10:55:53 -07:00
Fangrui Song
cd071253c7 [Driver] Don't alias -mstrict-align to -mno-unaligned-access
GCC ports only supports one of the options, with -mstrict-align
preferred by newer ports. They reject adding -m[no-]unaligned-access to
newer ports that use -m[no-]strict-align.
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111555).

We should not support aliases, either. Since the behavior has been
long-time for ARM (a146a48349), support
both forms for ARM for now but remove -m[no-]unaligned-access for
RISC-V/LoongArch (see also
https://github.com/riscv-non-isa/riscv-c-api-doc/pull/62).

While here, add TargetSpecific to ensure errors on unsupported targets
(https://reviews.llvm.org/D151590) and remove unneeded CC1 options.

Pull Request: https://github.com/llvm/llvm-project/pull/85350
2024-03-15 10:50:21 -07:00
Fangrui Song
b8db3e7c7d [RISCV,test] Change two -munaligned-access to GCC-supported -mno-strict-align 2024-03-15 10:46:12 -07:00
Charlie Barto
0360f3218a [asan][windows] Make tests more flexable (#85274)
Contains test changes from
https://github.com/llvm/llvm-project/pull/81677 that are simple test
changes. For the most part just makes the tests allow more flexibility
in the callstacks produced by asan.

Note: this PR has the exact changes from
https://github.com/llvm/llvm-project/pull/81677 in addition to a revert
commit to remove the ones that require other things from that PR. This
will be squashed, ofc. I just left things unsquashed for reviewing
pleasure :).

This is a non-functional-change
2024-03-15 10:42:21 -07:00
Michael Flanders
b43965adac [libc][math][c23] adds nanf128 (#85201)
Continuing #84689, this one required more changes than the others, so I
am making it a separate PR.

Extends some stuff in `str_to_float.h`, `str_to_integer.h` to work on
types wider than `unsigned long long` and `uint64_t`.

cc @lntue for review.
2024-03-15 13:31:50 -04:00
Ulrich Weigand
2210c85a66 Reapply [libomptarget] Support BE ELF files in plugins-nextgen (#85246)
Code in plugins-nextgen reading ELF files is currently hard-coded to
assume a 64-bit little-endian ELF format. Unfortunately, this assumption
is even embedded in the interface between GlobalHandler and Utils/ELF
routines, which use ELF64LE types.

To fix this, I've refactored the interface to use generic types, in
particular by using (a unique_ptr to) ObjectFile instead of
ELF64LEObjectFile, and ELFSymbolRef instead of ELF64LE::Sym.

This allows properly templating over multiple ELF format variants inside
Utils/ELF; specifically, this patch adds support for 64-bit big-endian
ELF files in addition to 64-bit little-endian files.
2024-03-15 18:28:28 +01:00
Philip Reames
bb9ca8afc0 [Hexagon][TTI] Remove two overrides which simply proxy to base class [NFC]
These serve no point, and slightly complicate a refectoring I'm working
on for this API.
2024-03-15 10:19:54 -07:00
LLVM GN Syncbot
ba2e3bd396 [gn build] Port f01a32f5c5 2024-03-15 17:01:45 +00:00
Billy Zhu
1e8dad3bef [MLIR][LLVM] Support Recursive DITypes (#80251)
Following the discussion from [this
thread](https://discourse.llvm.org/t/handling-cyclic-dependencies-in-debug-info/67526/11),
this PR adds support for recursive DITypes.

This PR adds:
1. DIRecursiveTypeAttrInterface: An interface that DITypeAttrs can
implement to indicate that it supports recursion. See full description
in code.
2. Importer & exporter support (The only DITypeAttr that implements the
interface is DICompositeTypeAttr, so the exporter is only implemented
for composites too. There will be two methods that each llvm DI type
that supports mutation needs to implement since there's nothing
general).

---------

Co-authored-by: Tobias Gysi <tobias.gysi@nextsilicon.com>
2024-03-15 09:58:25 -07:00
Alexey Bataev
9a42bdc0ae [SLP][NFC]Fix signedness to avoid comparison warning. 2024-03-15 09:56:40 -07:00
Jonas Devlieghere
fd09d510d0 [lldb] Add missing headers lldb/Host/Alarm.h 2024-03-15 09:55:15 -07:00
Alexey Bataev
39a96bc7b2 [SLP][NFC]Add a test for minbitwidth analysis of icmp, being transformed
to trunc.
2024-03-15 09:52:33 -07:00
Sean Fertile
2d80505401 [AIX] Support per global code model. (#79202)
Exploit the per global code model attribute on AIX. On AIX we need to
update both the code sequence used to access the global (either 1 or 2
instructions for small and large code model respectively) and the
storage mapping class that we emit the toc entry.

---------

Co-authored-by: Amy Kwan <akwan0907@gmail.com>
2024-03-15 12:52:04 -04:00
Fangrui Song
e115c00565 [ELF] Reject certain unknown section types (#85173)
Unknown section sections may require special linking rules, and
rejecting such sections for older linkers may be desired. For example,
if we introduce a new section type to replace a control structure (e.g.
relocations), it would be nice for older linkers to reject the new
section type. GNU ld allows certain unknown section types:

* [SHT_LOUSER,SHT_HIUSER] and non-SHF_ALLOC
* [SHT_LOOS,SHT_HIOS] and non-SHF_OS_NONCONFORMING

but reports errors and stops linking for others (unless
--no-warn-mismatch is specified). Port its behavior. For convenience, we
additionally allow all [SHT_LOPROC,SHT_HIPROC] types so that we don't
have to hard code all known types for each processor.

Close https://github.com/llvm/llvm-project/issues/84812
2024-03-15 09:50:23 -07:00
Thurston Dang
58f7251820 [msan] Re-exec with no ASLR if memory layout is incompatible on Linux (#85142)
This ports the change from TSan
(0784b1eefa).

Testing notes: run 'sudo sysctl vm.mmap_rnd_bits=32; ninja check-msan'
before and after this patch.

N.B. aggressive ASLR may also cause the app to overlap with the
allocator region; for MSan, this was fixed in
af2bf86a37
2024-03-15 09:49:00 -07:00
Jay Foad
9ecc72f399 [AMDGPU] Simplify definition of FLAT segment bits. NFC. 2024-03-15 16:47:35 +00:00
Stanislav Mekhanoshin
0b0e52836d [AMDGPU] Fix GFX11 sendmsg codes (#85299)
The code MSG_RTN_GET_TBA_TO_PC was missing, and the next code is off by
1 as a result.
2024-03-15 09:46:58 -07:00
Fangrui Song
f4335f075b [X86,AsmPrinter] Set assembler dialect for module inline asm
`clang -c -masm=intel` compiling a source file with file scope basic asm
incorrectly uses the AT&T dialect.
```
% cat a.c
asm("mov rax, rax");
% clang a.c -c -masm=intel
<inline asm>:1:1: error: unknown use of instruction mnemonic without a size suffix
mov rax, rax
^
```

Fix this by setting the assembler dialect from the MCAsmInfo object.

Note: `clang -c -flto -masm=intel a.c` still fails because of
https://reviews.llvm.org/D82862 for #34830: it tried to support AT&T
syntax for clang-cl, but the forced AT&T syntax is not compatible with
intended Intel syntax.

Pull Request: https://github.com/llvm/llvm-project/pull/85367
2024-03-15 09:38:07 -07:00
Jonas Devlieghere
f01a32f5c5 [lldb] Add an Alarm class for coalescing progress reports (#85329)
The commit introduces a new, generic, Alarm class. The class lets you to
schedule functions (callbacks) that will execute after a predefined
timeout. Once scheduled, you can cancel and reset a callback, given the
timeout hasn't expired yet.

The alarm class worker thread that sleeps until the next timeout
expires. When the thread wakes up, it checks for all the callbacks that
have expired and calls them in order. Because the callback is called
from the worker thread, the only guarantee is that a callback is called
no sooner than the timeout. A long running callback could potentially
block the worker threads and delay other callbacks from getting called.

I intentionally kept the implementation as simple as possible while
addressing the needs for the use case of coalescing progress events as
discussed in [1]. If we want to rely on this somewhere else, we can
reassess whether we need to address this class' limitations.

[1] https://discourse.llvm.org/t/rfc-improve-lldb-progress-reporting/75717/
2024-03-15 09:35:38 -07:00
SahilPatidar
186565513c [X86][AVX] Fix handling of out-of-bounds SRA shift amounts in AVX2 vector shift nodes (#84426) 2024-03-15 16:34:33 +00:00