Commit Graph

487127 Commits

Author SHA1 Message Date
Alex Langford
0cea54a382
[lldb][NFCI] Remove EventData* param from BroadcastEvent (#78773)
BroadcastEvent currently takes its EventData* param and shoves it into
an Event object, which takes ownership of the pointer and places it into
a shared_ptr to manage the lifetime.

Instead of relying on `new` and passing raw pointers around, I think it
would make more sense to create the shared_ptr up front.
2024-01-22 10:46:20 -08:00
erichkeane
04952c5bec [OpenACC] Implement remaining 'simple' int-expr clauses.
'num_gangs', 'num_workers', 'device_num', and 'default_async' are all
exactly the same (for the purposes of parsing) as 'vector_length', so
implement these the same way.
2024-01-22 10:43:13 -08:00
Mark de Wever
a301fb1101
[clang][modules] Print library module manifest path. (#76451)
This implements a way for the compiler to find the modules.json
associated with the C++23 Standard library modules.

This is based on a discussion in SG15. At the moment no Standard library
installs this manifest. #75741 adds this feature in libc++.
2024-01-22 19:42:32 +01:00
azhan92
4207ad5770
[libc++] Fix noexcept behaviour of operator new helper functions (#74337)
This patch removes the noexcept specifier introduced in #69407 since the
Standard allows a new handler to throw an exception of type bad_alloc 
(or derived from it). With the noexcept specifier on the helper
functions, we would immediately terminate the program.

The patch also adds tests for the case that had regressed.

Co-authored-by: Alison Zhang <alisonzhang@ibm.com>
2024-01-22 13:38:54 -05:00
Mingming Liu
5ce286849a
[CGProfile] Use callee's PGO name when caller->callee is an indirect call. (#78610)
- With PGO, indirect call edges are constructed using value profiles, and the profile address is mapped to a function's PGO name. The PGO name is computed using a functions linkage before LTO internalization or global promotion.
- With ThinLTO, local functions [could be
promoted](2663d2cb9c/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp (L288)) to have external linkage; and with
[full](2663d2cb9c/llvm/lib/LTO/LTO.cpp (L1328))
or
[thin](2663d2cb9c/llvm/lib/LTO/LTO.cpp (L448))
LTO, global functions could be internalized. Edge construction should use a function's PGO name before its linkage is updated.
2024-01-22 10:36:03 -08:00
Stephen Tozer
f4c2ee1268 [RemoveDIs] Remove tests for redundant DPVAssigns until DPVAssigns are enabled
This patch fixes commit 89aa3355, which added tests for
the removal of redundant DPVAssigns; unlike other cases where
adding tests for DPVAssigns before they are enabled is harmless,
these tests require them to be enabled, so must be deleted until
we enable them.

Fixes failures on llvm-new-debug-iterators buildbot:
https://lab.llvm.org/buildbot/#/builders/275/builds/3581
2024-01-22 18:32:48 +00:00
Valentin Clement (バレンタイン クレメン)
5062a178bf
[flang][openacc] Lower loop directive to the new acc.loop op design (#65417)
acc.loop was redesigned in https://reviews.llvm.org/D159229. This patch
updates the lowering to match the new op.

DO CONCURRENT construct will be added in a follow up patch.

Note that the pre-commit ci will fail until D159229 is merged. 

Depends on #67355
2024-01-22 10:31:37 -08:00
Valentin Clement (バレンタイン クレメン)
3eb4178b9c
[mlir][openacc] Update acc.loop to be a proper loop like operation (#67355)
The initial design of the `acc.loop` was to be an operation that
encapsulates a loop like operation. This was an early design and we now
want to change it so the `acc.loop` operation becomes a real loop-like
operation by implementing the LoopLikeInterface.

Differential Revision: https://reviews.llvm.org/D159229

This patch is just moved from Phabricator to github
2024-01-22 10:31:29 -08:00
Petr Hosek
c0a74ad90c
[libc] Use QUEUE_TYPEOF in STAILQ_LAST (#79011)
This is to ensure this macro is compatible with both C and C++.
2024-01-22 10:25:06 -08:00
Jeremy Morse
d7fb9eb818
[DebugInfo][RemoveDIs] Handle DPValues in SelectOptimize (#79005)
When there are debug intrinsics in-between groups of select
instructions, select-optimise sinks them into the "end" block. This
needs to be replicated for DPValues, the non-instruction variable
assignment object. Implement that and add a RUN line to a test that was
sensitive to this to ensure it gets tested.

(The exact range of instructions being transformed here is a little
fiddly, hence I've gone with a helper lambda).
2024-01-22 18:12:24 +00:00
Dmitri Gribenko
7378fb3064
[libc++] Protect the libc++ implementation from CUDA SDK's __noinline__ macro (#73838)
The CUDA SDK contains an unfortunate definition for the `__noinline__`
macro. This patch works around it by using `__attribute__((noinline))`
instead of `__attribute__((__noinline__))` on CUDA. We are still waiting
for a long-term resolution to this issue in NVIDIA/cccl#1235.
2024-01-22 13:12:05 -05:00
Fangrui Song
e390bda978 [ELF] Suppress --no-allow-shlib-undefined diagnostic when a SharedSymbol is overridden by a hidden visibility Defined which is later discarded
Commit 1981b1b6b9 unexpectedly strengthened
--no-allow-shlib-undefined to catch a kind of ODR violation.
More precisely, when all three conditions are met, the new
`--no-allow-shlib-undefined` code reports an error.

* There is a DSO undef that has been satisfied by a definition from
  another DSO.
* The `SharedSymbol` is overridden by a non-exported (usually of hidden
  visibility) definition in a relocatable object file (`Defined`).
* The section containing the `Defined` is garbage-collected (it is not
  part of `.dynsym` and is not marked as live).

Technically, the hidden Defined in the executable can be intentional: it
can be meant to remain non-exported and not interact with any dynamic
symbols of the same name that might exist in other DSOs. To allow for
such use cases, allocate a new bit in
Symbol and relax the --no-allow-shlib-undefined check to before
commit 1981b1b6b9.
2024-01-22 10:09:35 -08:00
Rajveer Singh Bharadwaj
806f43e3cb
[libc++] Diagnoses insufficiently aligned pointers for std::assume_aligned during constant evaluation (#73775)
This is a `libc++` enhancement when violating alignment assumption for
`__builtin_assume_aligned`.

Fixes #64078
2024-01-22 13:06:37 -05:00
Mark de Wever
042a6a1349
[libc++][chrono] Fixes (sys|local)_time formatters. (#76456)
- The sys_time formatter is constrained, which was not implemented.
- There is a sys_days formatter which was not implemented.
- The local_time formatter uses the sys_time formatter in its
implementation so "inherited" the same issues.

Fixes: https://github.com/llvm/llvm-project/issues/73849
Fixes: https://github.com/llvm/llvm-project/issues/67983
2024-01-22 19:06:15 +01:00
Sam Clegg
19261390cc
[lld][WebAssembly] Implement --start-lib/--end-lib (#78821)
Fixes: #77960
2024-01-22 10:04:26 -08:00
Stephen Tozer
89aa3355e2
[RemoveDIs][DebugInfo] Remove redundant DPVAssigns (#78574)
DPValues are already supported by most of the utilities that remove
redundant debug info after certain passes; the exception to this is
`removeUndefDbgAssignsFromEntryBlock`, which applies only to
llvm.dbg.assigns which were previously unimplemented for DPValues. Now
that DPVAssigns exist, we have to support removing redundant instances
in the same way, which this patch implements.
2024-01-22 18:04:07 +00:00
Schrodinger ZHU Yifan
0fe20aa45e
[libc] support PIE relocations (#78993)
For some reasons, we are using `-fpie`
(libc/cmake/modules/LLVMLibCObjectRules.cmake:31) without supporting it.
According to @lntue, some of the hermetic tests are broken without
proper PIE support. This patch implements basic relocations support for
PIE.
2024-01-22 12:45:35 -05:00
Petr Hosek
02f95b7751 Revert "[libc++][format] P2637R3: Member visit (std::basic_format_arg) (#76449)"
This reverts commit 7d9b5aa65b since
std/utilities/format/format.arguments/format.arg/visit.return_type.pass.cpp
is failing on Windows when building with Clang-cl.
2024-01-22 17:23:05 +00:00
Louis Dionne
ed760d170f [libc++] Mention __cxa_init_primary_exception in the ABI changelog 2024-01-22 12:19:05 -05:00
Alexandros Lamprineas
530c72b498
[TLI] Add missing ArmPL mappings (#78474)
Adds TLI mappings for fixed and scalable vector variants of cospi(f),
fmax(f), ilogb(f) and ldexp(f).
2024-01-22 17:15:17 +00:00
Matthew Devereau
312acdfae1
[AArch64][SME] Take arm_sme.h out of draft (#78961) 2024-01-22 17:12:16 +00:00
Gareth Williamson
9a90aa01ed
[libc++][modules] Add using_if_exists attribute (#77559) (#78909)
libc on macOS does not provide at_quick_exit or quick_exit. This allows
modules to build on macOS and defer any errors to usage site of these
symbols.

Fixes: https://github.com/llvm/llvm-project/issues/77559
2024-01-22 18:11:45 +01:00
Jon Roelofs
c083b38007
[builtins][FMV][Apple] Use builtin atomic load/store, instead of libdispatch (#78807) 2024-01-22 09:10:16 -08:00
Fangrui Song
43b13341fb
[ELF] Add internal InputFile (#78944)
Based on https://reviews.llvm.org/D45375 . Introduce a new InputFile
kind `InternalKind`, use it for

* `ctx.internalFile`: for linker-defined symbols and some synthesized
`Undefined`
* `createInternalFile`: for symbol assignments and --defsym

I picked "internal" instead of "synthetic" to avoid confusion with
SyntheticSection.

Currently a symbol's file is one of: nullptr, ObjKind, SharedKind,
BitcodeKind, BinaryKind. Now it's non-null (I plan to add an
`assert(file)` to Symbol::Symbol and change `toString(const InputFile
*)`
separately).

Debugging and error reporting gets improved. The immediate user-facing
difference is more descriptive "File" column in the --cref output. This
patch may unlock further simplification.

Currently each symbol assignment gets its own
`createInternalFile(cmd->location)`. Two symbol assignments in a linker
script do not share the same file. Making the file the same would be
nice, but would require non trivial code.
2024-01-22 09:09:46 -08:00
Dominik Wójt
a859df3b0a
[libc++] Add "using-if-exists" to timespec_get in modules (#78686)
Picolibc does not provide timespec_get function. Adding
"using-if-exists" attribute fixes the modules.

This is a follow up patch for
https://github.com/llvm/llvm-project/pull/78580
2024-01-22 18:09:14 +01:00
OCHyams
76160718df Reapply [hwasan] Update dbg.assign intrinsics in HWAsan pass #78606
llvm.dbg.assign intrinsics have 2 {value, expression} pairs; fix hwasan to update
the second expression.

Fixes #76545
2024-01-22 17:07:44 +00:00
Joseph Huber
621bafd5c1
[Libomptarget] Move target table handling out of the plugins (#77150)
Summary:
This patch removes the bulk of the handling of the
`__tgt_offload_entries` out of the plugins itself. The reason for this
is because the plugins themselves should not be handling this
implementation detail of the OpenMP runtime. Instead, we expose two new
plugin API functions to get the points to a device pointer for a global
as well as a kernel type.

This required introducing a new type to represent a binary image that
has been loaded on a device. We can then use this to load the addresses
as needed. The creation of the mapping table is then handled just in
`libomptarget` where we simply look up each address individually. This
should allow us to expose these operations more generically when we
provide a separate API.
2024-01-22 11:06:47 -06:00
Fangrui Song
ebd4dc4263
[asan,test] Make alloca_loop_unpoisoning.cpp robust and fix s390x failure (#78774)
In the test from https://reviews.llvm.org/D7098, `char array[len];` is
32-byte aligned on most targets whether it is instrumented or not
(optimized by StackSafetyAnalysis), due to the the used `*FrameLowering`
being `StackRealignable`.

However, when using `SystemZELFFrameLowering`, an un-instrumented
`char array[len];` is only 8-byte aligned.

Ensure `char array[len];` gets instrumented like what we did to
`alloca_vla_interact.cpp`, to make the test pass on s390x.
2024-01-22 08:56:00 -08:00
Valentin Clement (バレンタイン クレメン)
ee6199ca3c
[mlir][openacc][NFC] Cleanup hasOnly functions for device_type support (#78800)
Just a cleanup for all the `has.*Only()` function to avoid code
duplication
2024-01-22 08:40:52 -08:00
Valentin Clement (バレンタイン クレメン)
b5df6a90f5
[mlir][openacc] Fix num_gang parser (#78792)
Nb of operand per segment is not correctly computed.
2024-01-22 08:40:33 -08:00
Jeremy Morse
f188f4589c [DebugInfo] Disable a test runline temporarily
This is a follow-up to 8c1b7fba1f -- GlobalISel currently doesn't handle
RemoveDIs mode debug-info, but will (see #75228). Disable this runline
until then.

(This is a patch-landing ordering problem)
2024-01-22 16:32:32 +00:00
Kerry McLaughlin
d4d81acb52
[AArch64][SME2] Extend SMEABIPass to handle functions with new ZT0 state (#78848)
updateNewZAFunctions is extended to generate the following on entry to a
function with either the "aarch64_pstate_za_new" or "arm_new_zt0"
attribute:
- Private-ZA interface: commit any active lazy-saves & enable PSTATE.ZA.
  - "aarch64_pstate_za_new": zero ZA.
  - "arm_new_zt0": zero ZT0.

Additionally, PSTATE.ZA should disabled before returning if the function
has a private-ZA interface.
2024-01-22 16:30:43 +00:00
carlobertolli
ae99966a27
[OpenMP] Enable automatic unified shared memory on MI300A. (#77512)
This patch enables applications that did not request OpenMP
unified_shared_memory to run with the same zero-copy behavior, where
mapped memory does not result in extra memory allocations and memory
copies, but CPU-allocated memory is accessed from the device. The name
for this behavior is "automatic zero-copy" and it relies on detecting:
that the runtime is running on a MI300A, that the user did not select
unified_shared_memory in their program, and that XNACK (unified memory
support) is enabled in the current GPU configuration. If all these
conditions are met, then automatic zero-copy is triggered.

This patch also introduces an environment variable OMPX_APU_MAPS that,
if set, triggers automatic zero-copy also on non APU GPUs (e.g., on
discrete GPUs).
This patch is still missing support for global variables, which will be
provided in a subsequent patch.

Co-authored-by: Thorsten Blass <thorsten.blass@amd.com>
2024-01-22 10:30:22 -06:00
Emma Pilkington
4897b9888f
[AMDGPU] Make a few more tests default COV agnostic (#78926) 2024-01-22 11:22:57 -05:00
Stefan Gränitz
2bb6d7b8a4 [clang-repl] Limit use of PLT offset flag to linkers that support it
Follow-up fix from https://github.com/llvm/llvm-project/pull/78959
2024-01-22 17:16:52 +01:00
Piotr Zegar
06c3c3b67c
[clang-tidy] Add bugprone-chained-comparison check (#76365)
Check that flags chained comparison expressions,
such as a < b < c or a == b == c, which may have
unintended behavior due to implicit operator
associativity.

Moved from Phabricator  (D144429).
2024-01-22 17:11:02 +01:00
Simon Pilgrim
27eb8d53ae [X86] printConstant - add ConstantVector handling 2024-01-22 15:59:55 +00:00
David Spickett
e302950023
[flang] Handle -S assemble only flag in flang-to-external-fc (#78979)
Flang was recently updated on Compiler Explorer and by default it's in
assemble only mode, you have to enable linking and executing.

This means that the default output for flang-to-external-fc is nothing,
as it doesn't know what `-S` means. You'd have to know to enable the
link to binary option to see any output.

Handle `-S` so that users of Compiler Explorer don't have to wonder why
the "compiler" is broken.
2024-01-22 15:55:05 +00:00
Andrzej Warzynski
160ddf7114 [mlir] Remove duplicate test
The removed test is identical to the one directly above.
2024-01-22 15:51:56 +00:00
Stefan Gränitz
565470ed27 [JITLink][AArch32] Implement ELF relocation R_ARM_NONE 2024-01-22 16:47:17 +01:00
Stefan Gränitz
bfb09326be [JITLink][AArch32] Implement ELF relocation R_ARM_TARGET1
Prepare a configuration switch and default to R_ARM_ABS32
2024-01-22 16:47:17 +01:00
Daniel Grumberg
c5532124dc
[clang][ExtractAPI] Ensure typedef to pointer types are preserved (#78584)
When generating declaration fragments for types that use typedefs to
pointer types ensure that we keep the user-defined typedef form instead
of desugaring the typedef.

rdar://102137655
2024-01-22 15:41:29 +00:00
Simon Pilgrim
74ab7958bd [X86] printZeroUpperMove - add support for constant vectors.
Allows cases where movss/movsd etc. are loading constant (ConstantDataSequential) sub-vectors, ensuring we pad with the correct number of zero upper elements by making repeated printConstant calls to print zeroes in a matching int/fp format.
2024-01-22 15:40:46 +00:00
Simon Pilgrim
4e64ed9780 [X86] Update X86::getConstantFromPool to take base OperandNo instead of Displacement MachineOperand
This allows us to check the entire constant address calculation, and ensure we're not performing any runtime address math into the constant pool (noticed in an upcoming patch).
2024-01-22 15:40:45 +00:00
Jeremy Morse
8c1b7fba1f
[SelectionDAG][DebugInfo][RemoveDIs] Handle entry value variables in DPValues too (#78726)
This patch abstracts visitEntryValueDbgValue to deal with the substance
of variable locations (Value, Var, Expr, DebugLoc) rather than how
they're stored. That allows us to call it from handleDebugValue, which
is similarly abstracted. This allows the entry-value behaviour (see the
test) to be supported with non-instruction debug-info too!.
2024-01-22 15:39:35 +00:00
Paul T Robinson
d9cb37c904
[Headers][X86] Add macro descriptions to ia32intrin.h (#78613)
These are largely copy-pasted from the corresponding function
descriptions. Updated _rdtsc definition because it was just plain wrong.
2024-01-22 07:38:33 -08:00
Daniel Grumberg
69fedaf830
[clang][ExtractAPI] Add support C unions in non C++ parsing mode (#77451)
Ensure that we generate correct symbol kinds and declaration fragments
for unions in C and Objective-C parsing modes.

rdar://120544091
2024-01-22 15:32:57 +00:00
Konstantin Zhuravlyov
726d940586
AMDGPU/Docs: Add link to MI300 Instruction Set Architecture (#78777) 2024-01-22 10:32:35 -05:00
Piotr Zegar
6a80e56ad0
[clang-tidy] Fix macros handling in cppcoreguidelines-prefer-member-initializer (#72037)
Produces now valid fixes for a member variables initialized with macros.
Correctly uses expansion location instead of location inside macro to
get init code.

Close #70189
2024-01-22 16:17:33 +01:00
itrofimow
51e91b64d0
[libc++abi] Implement __cxa_init_primary_exception and use it to optimize std::make_exception_ptr (#65534)
This patch implements __cxa_init_primary_exception, an extension to the 
Itanium C++ ABI. This extension is already present in both libsupc++ and 
libcxxrt. This patch also starts making use of this function in 
std::make_exception_ptr: instead of going through a full throw/catch 
cycle, we are now able to initialize an exception directly, thus making 
std::make_exception_ptr around 30x faster.
2024-01-22 10:12:41 -05:00