Commit Graph

505261 Commits

Author SHA1 Message Date
Jan Patrick Lehr
caaf8099ef [Offload][OMPT] Add callbacks for (dis)associate_ptr (#99046)
This adds the OMPT callbacks for the API functions disassociate_ptr and
associate_ptr.
2024-07-17 10:15:19 +02:00
Abe
0905732f75 [clang-tools-extra] Fix typos in Modularize.rst (#99256)
mainly, fixed “the Clang module mechanism doesn’t support headers the
rely on other headers” => “the Clang module mechanism doesn’t support
headers that rely on other headers”. [emphasis on “the” versus “that”]
2024-07-17 09:07:17 +01:00
Mariya Podchishchaeva
a5b5208ba6 [clang] Be careful when choosing "fast path" for initialization with #embed (#99023)
When #embed appears in an initializer list, we may choose a "fast path"
if the target declaration is a char array. We simply initialize it with
string literal that contains embedded data. However we need to be
careful when checking that we actually can use this "fast path" since
char array may be nested in a struct.
2024-07-17 10:00:47 +02:00
Jay Foad
5e338f1f4a [AMDGPU] clang-tidy: use emplace_back instead of push_back. NFC. 2024-07-17 08:27:35 +01:00
Timm Bäder
d3dab0cb8d [clang][Interp][NFC] Assert initialization state in invoke{C,D}tor 2024-07-17 09:26:00 +02:00
Timm Bäder
863ad5af2d [clang][Interp][NFC] Remove Block::deref()
We already have Pointer::deref()
2024-07-17 09:26:00 +02:00
Guray Ozen
f2251f93ab [mlir][gpu] Add mlir_c_runner_utils to fix #99035
This fixes the unit test that is broken in #99035.
2024-07-17 09:23:32 +02:00
Nikolas Klauser
578c6191ef [libc++] Simplify std::is_void (#99033) 2024-07-17 09:18:17 +02:00
jeanPerier
31087c5e4c [flang] handle alloca outside of entry blocks in MemoryAllocation (#98457)
This patch generalizes the MemoryAllocation pass (alloca -> heap) to
handle fir.alloca regardless of their postion in the IR. Currently, it
only dealt with fir.alloca in function entry blocks. The logic is placed
in a utility that can be used to replace alloca in an operation on
demand to whatever kind of allocation the utility user wants via
callbacks (allocmem, or custom runtime calls to instrument the code...).

To do so, a concept of ownership, that was already implied a bit and
used in passes like stack-reclaim, is formalized. Any operation with the
LoopLikeInterface, AutomaticAllocationScope, or IsolatedFromAbove owns
the alloca directly nested inside its regions, and they must not be used
after the operation.

The pass then looks for the exit points of region with such interface,
and use that to insert deallocation. If dominance is not proved, the
pass fallbacks to storing the new address into a C pointer variable
created in the entry of the owning region which allows inserting
deallocation as needed, included near the alloca itself to avoid leaks
when the alloca is executed multiple times due to block CFGs loops.

This should fix https://github.com/llvm/llvm-project/issues/88344.

In a next step, I will try to refactor lowering a bit to introduce
lifetime operation for alloca so that the deallocation points can be
inserted as soon as possible.
2024-07-17 09:15:47 +02:00
Jay Foad
f10a78b7e4 [AMDGPU] clang-tidy: use std::make_unique. NFC. 2024-07-17 07:58:09 +01:00
cor3ntin
b330d800cb Reapply [Clang][C++26] Implement "Ordering of constraints involving fold expressions (#99022)
Implement https://isocpp.org/files/papers/P2963R3.pdf
2024-07-17 07:52:40 +02:00
WANG Rui
e316f19569 [LoongArch] Pre-commit tests for spurious mask removal. NFC 2024-07-17 13:30:14 +08:00
Guray Ozen
20861f1f2f [mlir][gpu] Use alloc OP's host_shared in cuda runtime (#99035) 2024-07-17 07:25:11 +02:00
Amir Ayupov
3fe50b6dde [BOLT] Store FileSymRefs in a multimap
With aggressive ICF, it's possible to have different local symbols
(under different FILE symbols) to be mapped to the same address.

FileSymRefs only keeps a single SymbolRef per address, which prevents
fragment matching from finding the correct symbol to perform parent
function lookup.

Work around this issue by switching FileSymRefs to a multimap. In
future, uses of FileSymRefs can be replaced with SortedSymbols which
keeps essentially the same information.

Test Plan: added ambiguous_fragment.test

Reviewers: dcci, ayermolo, maksfb, rafaelauler

Reviewed By: rafaelauler

Pull Request: https://github.com/llvm/llvm-project/pull/98992
2024-07-16 22:14:43 -07:00
Piotr Fusik
f0ac8903ea [RISCV][NFC] Fix intrinsic misspelled in a comment (#98998) 2024-07-17 07:07:33 +02:00
Craig Topper
8ca7e24b35 [RISCV] Add more vector setcc VI isel patterns.
Add more patterns isel patterns for vmseq.vi and friends with
the constant splat on the left hand side.

We can't trust the canonicalization in SimplifySetCC to keep constants
to the RHS when the splat is VMV_V_X_VL for i64 on RV32.
2024-07-16 22:01:18 -07:00
Craig Topper
6d26e57424 [RISCV] Remove accidentally duplicated isel patterns. NFC
VPatIntegerSetCCSDNode_XI_Swappable inherited from
VPatIntegerSetCCSDNode_XI and contained the same patterns.
2024-07-16 22:01:18 -07:00
Petr Hosek
6192f458f4 [libc++] Make std::lock_guard available with _LIBCPP_HAS_NO_THREADS (#98717)
This change makes `std::lock_guard` available when
`_LIBCPP_HAS_NO_THREADS` is set. This class is generic and doesn't
require threading support, and is regularly used even in environments
where threading isn't available like embedded.

fixes #89891

---------

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2024-07-16 21:58:13 -07:00
Luke Lau
9e9924cc2e [RISCV] Don't fold vmerge.vvm or vmv.v.v into vredsum.vs if AVL changed (#99006)
When folding, we currently check if the pseudo's result is not lanewise
(e.g. vredsum.vs or viota.m) and bail if we're changing the mask.
However we also need to check for the AVL too.

This patch bails if the AVL changed for these pseudos, and also renames
the pseudo table property to be more explicit.
2024-07-17 12:50:17 +08:00
hev
3850912fee [LoongArch] Enable the TypePromotion pass from AArch64 (#98868) 2024-07-17 12:21:44 +08:00
Thorsten Schütt
493d504b35 [GlobalIsel] Fix Machine Verifier errors (#99018)
temporary solution.
For discussion see https://github.com/llvm/llvm-project/pull/98894

Permanent solution could be:
REQUIRES: default_triple
2024-07-17 06:04:46 +02:00
Allen
484fdb901f [clang codegen] Fix the ci fail for PR98704 (#99267)
Different targets may have different flag on arguments, so restrict the
triple to avoid ci fail.
2024-07-17 11:44:06 +08:00
paperchalice
1b873e565e [CodeGen][NewPM] Port phi-node-elimination to new pass manager (#98867)
- Add `PHIEliminationPass `.
- Support new pass manager in `MachineBasicBlock:: SplitCriticalEdge `
2024-07-17 11:26:56 +08:00
Carl Ritson
befd44bcdc [AMDGPU] Update hasUnwantedEffectsWhenEXECEmpty (#97982)
Add barriers and s_wait_event to hasUnwantedEffectsWhenEXECEmpty.
Add a comment documenting the current expected use of the function.
2024-07-17 11:30:44 +09:00
Allen
b042af363b [clang codegen] Precommit tests for PR96025, NFC (#98704)
Add extern "C" for the function because there is difference function naming rules between Linux and Windows
2024-07-17 09:01:42 +08:00
Fangrui Song
cf6233f408 [lld-link] Change /lldemit:llvm to use the pre-codegen module
This matches ELF (#97480). clang cc1 -emit-llvm and -emit-llvm-bc for
ThinLTO backend compilation also uses `PreCodeGenModuleHook`.

While here, replace deprecated %T with %t.

Pull Request: https://github.com/llvm/llvm-project/pull/98589
2024-07-16 17:56:08 -07:00
Yeting Kuo
746cea3eb7 [VP][RISCV] Introduce vp.splat and RISC-V. (#98731)
This patch introduces a vp intrinsic for splat. It's helpful for
IR-level passes to create a splat with specific vector length.
2024-07-17 08:40:42 +08:00
Yeting Kuo
b6c4ad700b [RISCV] Remove x7 from fastcc list. (#96729)
Like #93321, this patch also tries to solve the conflict usage of x7 for
fastcc and Zicfilp. But this patch removes x7 from fastcc directly. Its
purpose is to reduce the code complexity of #93321, and we also found
that it at most increase 0.02% instruction count for most benchmarks and
it might be benefit for benchmarks.
2024-07-17 08:37:55 +08:00
Shilei Tian
f56cdd4a45 [NFC] Use named variable for test case select-from-load.ll 2024-07-16 19:46:46 -04:00
Dmitriy Chestnykh
bed625b0ad [MC,ELF] Emit warning if a string constant contains newline char (#98060)
GAS emits warning about newline in the string constant so make the same
behaviour.
2024-07-17 02:34:25 +03:00
Jie Fu
ffbda47159 [mlir] Fix build error (NFC)
/llvm-project/mlir/include/mlir/CAPI/Rewrite.h:21:63:
error: extra ';' outside of a function is incompatible with C++98 [-Werror,-Wc++98-compat-extra-semi]
DEFINE_C_API_PTR_METHODS(MlirRewriterBase, mlir::RewriterBase);
                                                              ^
1 error generated.
2024-07-17 07:13:16 +08:00
Daniel Bertalan
6ad2987a72 [lld-macho] Omit __llvm_addrsig metadata from the output (#98913)
This section contains metadata that's only relevant for Identical Code
Folding at link time, we should not include it in the output.

We still treat it like a regular section during input file parsing (e.g.
create a `ConcatInputSection` for it), as we want its relocations to be
parsed. But it should not be passed to `addInputSection`, as that's what
assigns it to an `OutputSection` and adds it to the `inputSections`
vector which specifies the inputs to dead-stripping and relocation
scanning.

This fixes a "__DATA,__llvm_addrsig, offset 0: fixups overlap" error
when using `--icf=safe` alongside `-fixup_chains`. This occurs because
all `__llvm_addrsig` sections are 8 bytes large, and the relocations
which signify functions whose addresses are taken are all at offset 0.

This makes the fix in 5fa24ac2 ("Category Merger: add support for
addrsig references") obsolete, as we no longer try to resolve symbols
referenced in `__llvm_addrsig` when writing the output file. When we do
iterate its relocations in `markAddrSigSymbols`, we do not try to
resolve their addresses.
2024-07-17 00:41:36 +02:00
Craig Topper
dbc3df1718 [RISCV] Remove unnecessary call to MachineFunction::getSubtarget. NFC
RISCVInstrInfo already caches a reference to the subtarget object
that owns it. We can use that.
2024-07-16 15:39:20 -07:00
Craig Topper
e8ab413259 [RISCV] Add capital letters to T-Head extension names in descriptions. (#99070)
This matches T-Head documentation and the capitalization we use for the
RISCVSubtarget methods.
2024-07-16 15:33:27 -07:00
PeterChou1
eab37384c1 [clang-doc] add enum test (#97679)
This patch adds a test which test the enum generation for clang-doc.
2024-07-16 18:06:12 -04:00
PeterChou1
c4610580ad [clang-doc] add nested namespace test case (#97681)
This patch adds a test to clang-doc which test the nested namespace
generation of clang-doc
2024-07-16 18:05:29 -04:00
Petr Hosek
f761e50a98 [CMake][Fuchsia] Use escaped double quote (#99246)
Using single quotes made the build to break on Windows.
2024-07-16 14:58:33 -07:00
Keith Smiley
e215cf7099 [bazel] Port changes from main (#99247)
This ports 5f8c46b887 and
4531f82c1a
2024-07-16 14:52:16 -07:00
Joseph Huber
49b2c30feb [libc][docs] Document printf support on the GPU target (#99241)
Summary:
Title
2024-07-16 16:40:37 -05:00
Fangrui Song
7bb6bb9a1f [tsan] Replace ALIGNED with alignas
Similar to #98958.

The relands 656f617ac7 , which
was reverted due to an issue in tsan_platform_mac.cpp

Pull Request: https://github.com/llvm/llvm-project/pull/98959
2024-07-16 14:35:11 -07:00
David CARLIER
41553876d3 Preadv2 pwritev2 san reapply (#99089) 2024-07-16 22:31:31 +01:00
Fangrui Song
898c116add [tsan] Avoid ALIGNED in tsan_platform_mac.cpp. NFC 2024-07-16 14:28:38 -07:00
Joseph Huber
8393ea5d1d [libc] Implement clock_gettime for the monotonic clock on the GPU (#99067)
Summary:
This patch implements `clock_gettime` using the monotonic clock. This
allows users to get time elapsed at nanosecond resolution. This is
primarily to facilitate compiling the `chrono` library from `libc++`.
For this reason we provide both `CLOCK_MONOTONIC`, which we can
implement
with the GPU's global fixed-frequency clock, and `CLOCK_REALTIME` which
we cannot. The latter is provided just to make people who use this
header happy and it will always return failure.
2024-07-16 16:17:34 -05:00
Joseph Huber
f7cee44ef2 [libc] Add strerror and strerror_k to the GPU (#99083)
Summary:
The GPU ignores `errno` primarily, but targets want these functions to
be defined for certain C standard interfaces. This patch enables them
and makes the test function on non-Linux targets.
2024-07-16 16:17:01 -05:00
Daniel Thornburgh
434c2382f1 Revert "[tsan] Replace ALIGNED with alignas" (#99240)
Reverts llvm/llvm-project#98959
2024-07-16 14:09:50 -07:00
Florian Hahn
4199f80df5 [LAA] Adjust test from a4f8705b05 so RT checks aren't always false.
Updated @B_indices_loaded_in_loop_A_stored to use a different offset
for one of the accesses we create runtime checks for; the original
version had a runtime check that was always true as the accesses always
overlapped.
2024-07-16 21:56:57 +01:00
Justin Bogner
9be5f4f5d5 [DirectX] Start documenting DXIL Resource handling (#90553)
This adds a new document about DXIL Resource Handling. I've attempted to
describe here how we intend to use TargetExtTypes to represent resources
in LLVM IR and the various intrinsics we'll need to lower these through
LLVM to DXIL.

For now this document is limited to the high level concepts and a few
details on buffer types, and there are a number of TODOs in the document
that we'll iterate on as we progress in the implementation.
2024-07-16 13:42:55 -07:00
Zequan Wu
b7b77b0fe8 Reapply [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (#98361)
This is a reapply of https://github.com/llvm/llvm-project/pull/92328 and
https://github.com/llvm/llvm-project/pull/93839.

It now passes the
[test](de3f1b6d68),
which crashes with the original reverted changes.
2024-07-16 16:22:31 -04:00
Martin Storsjö
f2d6d74cd2 [llvm-dlltool] Fix renamed imports without a separate regular import entry (#98229)
Normally, when doing renamed imports, we do this by providing a
weak alias, towards another regular import, for the symbol we
want to actually import. In a def file, this looks like this:

    regularfunc
    renamedfunc == regularfunc

However, if we want to link against a function in a DLL, where we
(intentionally) don't provide a regular import for that symbol
with the name in its DLL, doing the renamed import with a weak
alias doesn't work, as there's no symbol that the weak alias can
point towards.

We can't make up such an import either, as we may intentionally
not want to provide a regular import for that name.

This situation can either be resolved by using the "long" import
library format (as e.g. produced by GNU dlltool), or by using the
new short import library name type "export as".

This patch implements it by using the "export as" name type.

When producing a renamed import, defer emitting it until all regular
imports have been produced. If the renamed import refers to a
symbol that does exist as a regular import entry, produce a
weak alias, just as before. (This implementation also avoids needing
to know whether the symbol that the alias points towards actually
is prefixed or not, too.)

If the renamed import points at a symbol that isn't otherwise
available (or is available as a renamed symbol itself), generate
an "export as" import entry.

This name type is new, and is normally used in ARM64EC import
libraries, but can also be used for other architectures.
2024-07-16 23:19:39 +03:00
Martin Storsjö
4469650701 [llvm-dlltool] Handle import renaming using other name types, when possible (#98228)
This avoids needing to use weak aliases for these cases. (Weak
aliases only work if there's another, regular import entry that
provide the desired symbol from the DLL.)
2024-07-16 23:17:01 +03:00