Commit Graph

531819 Commits

Author SHA1 Message Date
Chuanqi Xu
e5f100676e [clangd] [C++20] [Modules] Add modules suffix for 'Header' Source Switch (#131591)
Support the trivial "header"/source switch for module interfaces.

I initially thought the naming are bad and we should rename it. But
later I feel it is better to split patches as much as possible.

From the codes it looks like there are problems. e.g., `isHeaderFile`.
But let's try to fix them in different patches.
2025-03-25 09:43:13 +08:00
Valentin Clement (バレンタイン クレメン)
5be9082fed [flang][cuda] Carry over the dynamic shared memory size to gpu.launch_func (#132837) 2025-03-24 18:37:19 -07:00
Kazu Hirata
4c68061254 [Vectorize] Fix a warning
This patch fixes:

  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:855:52: error:
  unused variable 'SupportedOp' [-Werror,-Wunused-const-variable]
2025-03-24 17:38:47 -07:00
Paul Kirth
c1ed4f6423 [clang-doc] Format test files (#132428)
Many of the test files had an inconsistent formatting. This patch ran
clang-format over them using the project's .clang-format file, with
column limit = 0, to prevent test directives from being split over
multiple lines.
2025-03-24 17:27:16 -07:00
Han-Kuan Chen
71a0cfd932 [SLP] Make getSameOpcode support interchangeable instructions. (#127450)
We use the term "interchangeable instructions" to refer to different
operators that have the same meaning (e.g., `add x, 0` is equivalent to
`mul x, 1`).
Non-constant values are not supported, as they may incur high costs with
little benefit.

---------

Co-authored-by: Alexey Bataev <a.bataev@gmx.com>
2025-03-25 08:24:46 +08:00
Paul Kirth
ece59a8cb9 Reland Support for mustache templating language (#132467)
The last version of this patch had memory leaks due to using the
BumpPtrAllocator for data types that required destructors to run to
release heap memory (e.g. via std::vector and std::string). This version
avoids that by using smart pointers, and dropping support for
BumpPtrAllocator.

We should refactor this code to use the BumpPtrAllocator again, but that
can be addressed in future patches, since those are more invasive
changes that need to refactor many of the core data types to avoid
owning allocations.

Adds Support for the Mustache Templating Language. See specs here:
https://mustache.github.io/mustache.5.html This patch implements
support+tests for majority of the features of the language including:

    - Variables
    - Comments
    - Lambdas
    - Sections

This meant as a library to support places where we have to generate
HTML, such as in clang-doc.

Co-authored-by: Peter Chou <peter.chou@mail.utoronto.ca>
2025-03-24 17:23:25 -07:00
Joseph Huber
25bf4e262c [Offload] Remove handling for COV4 binaries from offload/ (#131033)
Summary:
We moved from cov4 to cov5 a long time ago, and it guards simplifying
some front end code, so we should be able to move up with this.
2025-03-24 18:58:20 -05:00
Shilei Tian
ff8aa300d6 [AMDGPU] Remove outdated COV6 warning (#132814) 2025-03-24 19:57:07 -04:00
Paul Kirth
0aa4c35beb [libc][__support] Fix -Wimplicit-int-conversion warning (#132839)
Newer versions of clang now warn about these, so use explicit
conversion instead.
2025-03-24 16:47:07 -07:00
David Benjamin
e6de45a229 [tsan] Don't treat uncontended pthread_once as a potentially blocking region (#132477)
guard_acquire is a helper function used to implement TSan's
__cxa_guard_acquire and pthread_once interceptors.
https://reviews.llvm.org/D54664 introduced optional hooks to support
cooperative multi-threading. It worked by marking the entire
guard_acquire call as a potentially blocking region.

In principle, only the contended case needs to be a potentially blocking
region. This didn't matter for __cxa_guard_acquire because the compiler
emits an inline fast path before calling __cxa_guard_acquire. That is,
once we call __cxa_guard_acquire at all, we know we're in the contended
case.

https://reviews.llvm.org/D107359 then unified the __cxa_guard_acquire
and pthread_once interceptors, adding the hooks to pthread_once.
However, unlike __cxa_guard_acquire, pthread_once callers are not
expected to have an inline fast path. The fast path is inside the
function.

As a result, TSan unnecessarily calls into the cooperative
multi-threading engine on every pthread_once call, despite applications
generally expecting pthread_once to be fast after initialization. Fix
this by deferring the hooks to the contended case inside guard_acquire.
2025-03-24 19:30:15 -04:00
Joseph Huber
ef2735d243 [Flang] Detect endianness in the preprocessor (#132767)
Summary:
Currently we use `TestBigEndian` in CMake to determine endianness. This
doesn't work on all platforms and is deprecated since CMake 3.20.
Instead of using CMake, we can just use the GNU/Clang preprocessor
definitions.

The only difficulty is MSVC, mostly because they don't support the same
macros. But, as far as I'm aware, MSVC / Windows targets are always
little endian, and if not we can just override it for that specific
target in the future.
2025-03-24 18:29:05 -05:00
Krzysztof Parzyszek
c221d64206 [flang] Remove mentions of evaluate::Variable<T> (#132805)
The template itself was not defined anywhere. The closest thing was a
forward declaration in flang/include/flang/Evaluate/variable.h.
2025-03-24 18:26:57 -05:00
Thurston Dang
3ce3d889f6 [asan] Re-exec without ASLR if needed on 64-bit Linux (#132682)
This generalizes https://github.com/llvm/llvm-project/pull/131975 to non-32-bit Linux (i.e., 64-bit Linux).

This works around an edge case in 64-bit Linux, whereby the memory layout is incompatible if the stack size is unlimited AND ASLR entropy is 31+ bits (see https://github.com/google/sanitizers/issues/856#issuecomment-2747076811).

More generally, this "re-exec without ASLR if layout is incompatible" is a hammer that can work around most shadow mapping issues, without incurring the overhead of using a dynamic shadow.
2025-03-24 16:24:38 -07:00
joaosaffran
567b0f8923 [HLSL] Add support to branch/flatten attributes to switch (#131739)
closes: [#125754](https://github.com/llvm/llvm-project/issues/125754)

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-03-24 16:17:19 -07:00
Jannick Kremer
20fc2d5aa5 [libclang/python] Add some bindings to the Cursor interface (#132377)
Make Cursor hashable
Add `Cursor.has_attr()`
Add `Cursor.specialized_template`

This covers the Cursor interface changes added by #120590

---------

Co-authored-by: Mathias Stearn <redbeard0531@gmail.com>
2025-03-25 00:08:32 +01:00
Sarah Spall
14d25613cb [HLSL] Finish exposing half types and intrinsics always (#132804)
We previously made an implementation error when adding half overloads
for HLSL library functionality. The half type is always defined in HLSL
and half intrinsics should not be conditionally included.
When native 16-bit types are disabled half is a unique 32-bit float type
with lesser promotion rank than float.

Apply pattern #81782 to intrinsics added in #95999.
Closes #132793
2025-03-24 15:34:58 -07:00
LLVM GN Syncbot
0adc672ed4 [gn build] Port 9a82f742b4 2025-03-24 21:56:36 +00:00
Helena Kotas
9a82f742b4 [HLSL][NFC] Refactor HLSLExternalSemaSource (#131032)
Moving builder classes into separate files
`HLSLBuiltinTypeDeclBuilder.cpp`/`.h`, changing a some
`HLSLExternalSemaSource` methods to private and removing unused methods.

This is a prep work before we start adding more builtin types and
methods, like textures, resource constructors or matrices. For example
constructors could make use of the `BuiltinTypeMethodBuilder`, but this
helper class was defined in `HLSLExternalSemaSource.cpp` after the
method that creates a constructor. Rather than reshuffling the code one
big source file I am moving the builders into a separate cpp & header
file and placing the helper classes declarations up top.

Currently the new header only exposes `BuiltinTypeDeclBuilder` to
`HLSLExternalSemaSource`. In the future but we might decide to expose
more helper classes as needed.
2025-03-24 14:56:05 -07:00
Georgios Pinitas
3df92197bb [mlir][tosa] Support DenseResourceElementsAttr in TOSA transpose folders (#124532)
Handle dense resource attributes in the transpose TOSA folder.
Currently their interface does not align with the rest of the
`ElementsAttr` when it comes to data accessing hence the special
handling.

Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
2025-03-24 21:48:22 +00:00
Alexey Samsonov
5a668bdb98 [libc] Migrate sys/epoll tests to use ErrnoCheckingTest. (#132823)
This is similar to PR #132107 but for tests for sys/epoll.h functions.

ErrnoCheckingTest ensures that errno is properly reset at the beginning
of the test case, and is validated at the end of it, so that the manual
code such as the one proposed in PR #131650 would not be necessary.
2025-03-24 13:54:46 -07:00
Min-Yih Hsu
7fa104ed20 [TableGen][MCSched] Update error messages on the range of Acquire/ReleaseAtCycle (#131908)
I was looking at the value range of AcquireAtCycle / ReleaseAtCycle, and
I noticed that while the TableGen error messages said AcquireAtCycle has
to be less than ReleaseAtCycle, in reality they are actually allowed to
be the same. This patch fixes it and add more test cases.
2025-03-24 13:42:28 -07:00
David Green
06e2fd962a [AArch64] Regenerate complex-int-to-fp.ll. NFC 2025-03-24 20:35:22 +00:00
Sam Elliott
4fb9650b21 [clang][docs] Release Note for RISC-V qci-(no)nest
These were omitted from the original PR (#129957)
2025-03-24 13:04:00 -07:00
Jerry-Ge
1b9d475453 [mlir][tosa] Align validation profiles and extensions to TOSA v1.0 spec (#132768)
- Add missing int16 extension for concat operator
- Remove int16 extension for cast operator
- Add pro_int and pro_fp profiles for const_shape operator

Signed-off-by: Jerry Ge <jerry.ge@arm.com>
2025-03-24 13:01:15 -07:00
Carlos Galvez
0fb4ef40b1 Revert "[clang-tidy] Avoid processing declarations in system headers … (#132743)
…(#128150)"

This was too aggressive, and leads to problems for downstream users:
https://github.com/llvm/llvm-project/pull/128150#issuecomment-2739803409

Let's revert and reland it once we have addressed the problems.

This reverts commit e4a8969e56.

Co-authored-by: Carlos Gálvez <carlos.galvez@zenseact.com>
2025-03-24 20:47:57 +01:00
Florian Hahn
5b38fb59df [VPlan] Remove remaining references to VPScalarPHIRecipe (NFC).
VPScalarPHIRecipe has been replaced by VPInstructions with PHI opcodes.
Strip remaining dead references to VPScalarPHIRecipe.
2025-03-24 19:37:00 +00:00
Justin Bogner
368c7f72b9 [DirectX] Match DXC's resource order in DX container (#130233)
DXC and the DXIL validator expect resources in a DX container to be
specifically ordered CBuffers, Samplers, SRVs, and then UAVs. Match this
behaviour so that we can pass the validator.

Fixes #130232.
2025-03-24 12:33:54 -07:00
Roland McGrath
6f4ddefe5b [libc] Remove extraneous ASSERT_ERRNO_* macro definitions (#132812)
These are no longer meant to be defined in each
framework-specific header, but ZxTest.h wasn't updated.
2025-03-24 12:25:43 -07:00
Peter Collingbourne
11044de3dc Reapply "lit: Move RUN at line comment after the command."
This reverts commit 57e89c97c2.

Updated lit tests.
2025-03-24 12:01:49 -07:00
Alex MacLean
10fd5b925f [NVPTX] Auto-Upgrade !"align" metadata on return values to stackalign (#131726)
This commit follows up 0191307b by auto-upgrading !"align" metadata on
return values to stackalign. This allows us to remove all logic to check
the metadata from NVPTXUtilities.
2025-03-24 12:00:44 -07:00
LLVM GN Syncbot
a76f678849 [gn build] Port f7a32b85b5 2025-03-24 18:53:27 +00:00
LLVM GN Syncbot
d319cc84e4 [gn build] Port 7f920e2e5f 2025-03-24 18:53:27 +00:00
LLVM GN Syncbot
9201e4a086 [gn build] Port 30bb0c443e 2025-03-24 18:53:26 +00:00
LLVM GN Syncbot
590a5978d6 [gn build] Port 2f1416bbcd 2025-03-24 18:53:25 +00:00
LLVM GN Syncbot
7aab2889d7 [gn build] Port 03557169e0 2025-03-24 18:53:24 +00:00
Peter Collingbourne
57e89c97c2 Revert "lit: Move RUN at line comment after the command."
This reverts commit 8d3dc1ed56.

Test needs to be updated.
2025-03-24 11:47:56 -07:00
MaheshRavishankar
e4172196a7 [mlir][TilingInterface] Make tileAndFuseConsumerOfSlice take surrounding loops as an argument. (#132082)
This gets the consumer fusion method in sync with the corresponding
producer fusion method `tileAndFuseProducerOfSlice`. Not taking this as
input required use of complicated analysis to retrieve the surrounding
loops which are very fragile. Just like the producer fusion method, the
loops need to be taken in as an argument, with typically the loops being
created by the tiling methods.

Some utilities are added to check that the loops passed in are perfectly
nested (in the case of an `scf.for` loop nest.

This is change 1 of N to simplify the implementation of tile and fuse
consumers.

---------

Signed-off-by: MaheshRavishankar <mahesh.ravishankar@gmail.com>
2025-03-24 11:41:26 -07:00
Peter Collingbourne
8d3dc1ed56 lit: Move RUN at line comment after the command.
When a developer copy/pastes a failing command line into their
shell to rerun it, they have to manually delete the "RUN: at line
N:" prefix. To make life easier for such developers, let's make it
possible to copy/paste a command without needing to modify it while
still showing the line number in the output by moving the line number
to a comment at the end of the command line.

Reviewers: jroelofs, MaskRay

Reviewed By: jroelofs, MaskRay

Pull Request: https://github.com/llvm/llvm-project/pull/132485
2025-03-24 11:29:57 -07:00
Karlo Basioli
6c68cc4df1 Fix bazel demangle include error caused by #126688 (#132790) 2025-03-24 17:48:01 +00:00
Karlo Basioli
63e0da45a1 Fix bazel DWARF include error caused by #131645 (#132789) 2025-03-24 17:47:47 +00:00
Bruno Cardoso Lopes
8a2a694438 [MLIR][LLVM] Support dso_local_equivalent constants (#132131)
Create a new operation `DSOLocalEquivalentOp`, following the steps of
other constants.

This is similar in a way to `AddressOfOp` but with specific semantics:
only support functions and function aliases (no globals) and extern_weak
linkage is not allowed.

An alternative approach is to use a new `UnitAttr` in `AddressOfOp` and
check that attribute to enforce specific semantics in the verifiers. The
drawback is going against what other constants do and having to add more
attributes in the future when we introduce `no_cfi`, `blockaddress`,
etc.

While here, improve the error message for other missing constants.
2025-03-24 10:43:53 -07:00
Austin Kerbow
e75f586b81 [AMDGPU] Relax lds dma waitcnt with no aliasing pair (#131842)
If we cannot find any lds DMA instruction that is aliased by some load
from lds, we will still insert vmcnt(0). This is overly cautious since
handling inter-thread dependences is normally managed by the memory
model instead of the waitcnt pass, so this change updates the behavior
to be more inline with how other types of memory events are handled.
2025-03-24 10:38:47 -07:00
Timm Baeder
061b1d1149 [clang][bytecode] Redo RUN lines in the builtin-functions test (#132762)
Make sure we run each configuration once with the bytecode interpreter
and once with the current one. Add a triple to the one that was
previously without.
2025-03-24 18:33:36 +01:00
Min-Yih Hsu
77648476f2 [MC] Account for AcquireAtCycle in getReciprocalThroughput (#132653)
Previously `MCSchedModel::getReciprocalThroughput` ignored
`AcquireAtCycle` completey, this patch fixes it by using the largest
`(ReleaseAtCycle - AcquireAtCycle) / NumUnits` as inverse throughput.

Here are some technical explanations:
https://myhsu.xyz/llvm-sched-interval-throughput

---------

Co-authored-by: Julien Villette <julien.villette@sipearl.com>
2025-03-24 10:24:08 -07:00
Louis Dionne
aa80388cf9 [libc++] Ensure that we vectorize algorithms on all Clang-based compilers (#132090)
Otherwise, we wouldn't vectorize on compilers like AppleClang when in
reality we know perfectly well how to do it.
2025-03-24 13:22:40 -04:00
Martin Licht
ef4f479dab [libc++] Documentation for _LIBCPP_REMOVE_TRANSITIVE_INCLUDES (#130560)
Closes #130486

---------

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2025-03-24 18:20:20 +01:00
Lei Wang
8f3f93cd78 [SampleFDO] Match functions with the same base function name (#126688)
Sometimes, there may be no matched anchors but the functions still
match. e.g. if the function’s template typename changes, all the
callsites that use the type are mismatched and the caller function that
contains those callsite are mismatched. Introduce a check to match the
functions if their demangled base names are the same.
2025-03-24 10:11:55 -07:00
Jay Foad
02ed65912e [AMDGPU] 4-align TTMP triples (#132759)
Follow up to e4284a7c70 "[AMDGPU] 4-align SGPR triples".

Previously TTMP triples like ttmp[3:5] were aligned on a 3-TTMP boundary
which has no basis in hardware.

Aligning them on a 4-TTMP boundary matches what we do for SGPRs, which
reduces the number of extra register classes synthesized by TableGen,
bringing the total number down from 653 to 615.
2025-03-24 17:11:39 +00:00
Eric Astor
34fa037c4f [ms] [llvm-ml] Remove unused function (#132777)
This was missed in an earlier PR.
2025-03-24 12:56:21 -04:00
Piotr Fusik
9b8bcd288a [RISCV][test] Add a test for vector hasAndNot 2025-03-24 17:54:18 +01:00