532151 Commits

Author SHA1 Message Date
A. Jiang
af267993a7
[libc++] Re-implement LWG2770 again * 2 (#132598)
1013fe3c0cfd7582e94ef2d4bfd79da7ea1a1289 used to implement LWG2770, but
cb0d4df97490ec2d2b1cdf7574d26b1bc4063599 made LWG2770 unimplemented
again because of CWG2386.

This patch re-implements LWG2770, while keeping the libc++-specific
implementation strategy (which is controversial as noted in LWG4040).

Drive-by:
- Make the test coverage for the controversial part noted in LWG4040
libc++-only.
- Add the previously missed entry for LWG2770 to the documentation.
2025-03-26 07:38:02 +08:00
Christopher Ferris
134cb8877e
[scudo] Use a tryLock in secondary release to OS (#132827)
In the caching part of the secondary path, when about to try to release
memory to the OS, we always wait while acquiring the lock. However, if
multiple threads are attempting this at the same time, all other threads
will likely do nothing when the release call is made. Change the
algorithm to skip the release if there is another release in process.

Also, pull the lock outside the releaseOlderThan function. This is so
that in the store path, we use the tryLock and skip if another thread is
releasing. But in the path where a forced release call is being made,
that call will wait for release to complete which guarantees that all
entries are released when requested.
2025-03-25 16:32:16 -07:00
Michael Jones
c995db3e34
[libc] Add exceptional values for sinhf16/coshf16 (#133002)
The rounding of the result when using an FMA instruction for hyperbolic
sin/cos on float16 was off by 1 bit for a few cases. This patch adds
extra exceptional cases to handle these.
2025-03-25 16:29:48 -07:00
Midhunesh
d75a40a9c1
Add cmake option to enable/disable searching PATH for symbolizer (#129012)
Introduced a cmake option that is disabled by default that suppresses
searching via the PATH variable for a symbolizer. The option will be
enabled for downstream builds where the user will need to specify the
symbolizer path more explicitly, e.g., by using ASAN_SYMBOLIZER_PATH.
2025-03-25 16:29:35 -07:00
Andy Kaylor
bff94d774c
[CIR] Emit allocas into the proper lexical scope (#132468)
Alloca operations were being emitted into the entry block of the current
function unconditionally, even if the variable they represented was
declared in a different scope. This change upstreams the code for
handling
insertion of the alloca into the proper lexcial scope. It also adds a
CIR-to-CIR transformation to hoist allocas to the function entry block,
which is necessary to produce the expected LLVM IR during lowering.
2025-03-25 16:13:57 -07:00
Zequan Wu
e04d739522 Fix test breakage on https://github.com/llvm/llvm-project/pull/128619/ (2) 2025-03-25 16:01:05 -07:00
Emilio Cota
2da4ce8624
Revert "[mlir] Fix DistinctAttributeUniquer deleting attribute storage when crash reproduction is enabled" (#133000)
Reverts llvm/llvm-project#128566. See as well the discussion in
llvm/llvm-project#132935.
2025-03-25 22:40:06 +00:00
Slava Zakharin
b022f676fc
[flang] Include needed CMake files. (#133012)
`FlangCommon.cmake` uses some CMake macros without including
the corresponding modules. This change makes it self-sufficient.
2025-03-25 15:39:05 -07:00
Jeffrey Byrnes
e5641f6584
[AMDGPU] Autogen checks for mfma-loop.ll (#133004)
Needed for a RegisterCoalescing patch
2025-03-25 15:24:40 -07:00
Kazu Hirata
e87921304b
[Vectorize] Avoid repeated hash lookups (NFC) (#132661)
Co-authored-by: Florian Hahn <flo@fhahn.com>
2025-03-25 15:18:15 -07:00
Vitaly Buka
03817f0ec0
[NFC][sanitizer] Clang-format sanitizer_symbolizer_posix_libcdep.cpp (#133011) 2025-03-25 15:18:04 -07:00
Zequan Wu
cec4f423e9 Fix test breakage on https://github.com/llvm/llvm-project/pull/128619/ 2025-03-25 15:11:59 -07:00
Florian Mayer
542797317a
[NFC] [clang] rename InlinedTrapFuncMap to InlinedSubprogramMap (#132993) 2025-03-25 15:03:04 -07:00
Andy Kaylor
df011313cf
[CIR] Remove failing binop test (#133001)
When CIR binop support was commited, it accidentally included a test for
functionality that was removed during the review process
(cir.binop.overflow). This test, of course, fails.

This change removes the failing test. It will be re-added when the
corresponding op is added.
2025-03-25 14:41:30 -07:00
Alexey Samsonov
f0b752e921
[libc][bazel] Stop creatng "public" library targets in libc_function. (#132995)
All downstream users are migrated, so we no longer need to produce
"public"/"release" cc_library target for each libc_function macro
invocation. Instead, we only create internal target (for testing), and
some filegroups, which will be picked up by the libc_release_library
invocation.

This allows us to get rid of "weak" argument to libc_function - this
decision is also postponed to libc_release_library configuration.

Fixes #130327.
2025-03-25 14:38:37 -07:00
Matheus Izvekov
960615954e
[clang] fix crash with ADL for member pointers with dependent class (#132977) 2025-03-25 18:15:55 -03:00
Morris Hafner
2f3c93743f
[CIR] Add binary operators (#132420)
This patch adds upstreams support for BinOp including lvalue
assignments. Note that this does not include ternary ops,
BinOpOverflowOp, pointer arithmetic, ShiftOp and SelectOp which are
required for logical binary operators.

---------

Co-authored-by: Morris Hafner <mhafner@nvidia.com>
Co-authored-by: Andy Kaylor <akaylor@nvidia.com>
2025-03-25 14:12:27 -07:00
Florian Hahn
577631f0a5
Reapply "[VPlan] Add transformation to narrow interleave groups. (#106441)"
This reverts commit ff3e2ba9eb94217f3ad3525dc18b0c7b684e0abf.

The recommmitted version limits to transform to cases where no
interleaving is taking place, to avoid a mis-compile when interleaving.

Original commit message:

This patch adds a new narrowInterleaveGroups transfrom, which tries
convert a plan with interleave groups with VF elements to a plan that
instead replaces the interleave groups with wide loads and stores
processing VF elements.

This effectively is a very simple form of loop-aware SLP, where we
use interleave groups to identify candidates.

This initial version is quite restricted and hopefully serves as a
starting point for how to best model those kinds of transforms.

Depends on https://github.com/llvm/llvm-project/pull/106431.

Fixes https://github.com/llvm/llvm-project/issues/82936.

PR: https://github.com/llvm/llvm-project/pull/106441
2025-03-25 20:57:10 +00:00
Pete Chou
a074831cd9
[TableGen] Inherit properties from the nearest allocatable superclass. (#127018)
Previously isAlocatable was updated to allow inheritance from any
superclass for a generated register class, but other properties are
still inherited from its nearest superclass. This could cause
a generated regclass inherit undesired properties, e.g., tsflags, from
an unallocatable superclass due to the topological inheritance order.

This change updates to inherit properties from the nearest allocatable
superclass if possible and includes a test to demonstrate a potential
incorrect inheritance of tsflags.
2025-03-25 15:54:06 -05:00
Alex MacLean
fd3a6b6005
[NVPTX] Improve modeling of inline PTX (#130675)
Improve the modeling of the memory effects and instruction cost of
inline assembly.

- MemoryEffects: The CUDA spec states that inline assembly is not
assumed to have any side-effects or read or write to memory. An inline
assembly may be treated as NoModRef unless it is explictly marked as
having side effects or has an explicit memory clobber.
https://docs.nvidia.com/cuda/inline-ptx-assembly/index.html#incorrect-optimization

> Normally any memory that is written to will be specified as an out
operand, but if there is a hidden read or write on user memory (for
example, indirect access of a memory location via an operand), or if you
want to stop any memory optimizations around the asm() statement
performed during generation of PTX, you can add a “memory” clobbers
specification after a 3rd colon.

- InstructionCost: This change implements very rough string parsing
system to count the number of instructions in an inline-asm. There are
corner cases it will not handle well, but in general this is an
improvement over the current cost of the number of arguments plus one.
2025-03-25 13:46:16 -07:00
Bruno Cardoso Lopes
e7e242e7ad
[MLIR][LLVM] Fix debug value/declare import in face of landing pads (#132871)
Debug value/declare operations imported before landing pad operations at
the bb start break invoke op verification:

```
error: first operation in unwind destination should be a llvm.landingpad operation
```

This this issue by making the placement slightly more smart.
2025-03-25 13:15:51 -07:00
Cyndy Ishida
9aecbdf8ed
[clang][DepScan] Allow ModuleDep to be const (#132968)
This type can be exposed from C APIs, where instantiations of this type
are not expected to mutate after creation. To support this, mark the
lazy computation of build arguments mutable, as that is not intended to
otherwise mutate the state of these objects.


This was reviewed separately by @jansvoboda11
2025-03-25 13:13:58 -07:00
Zequan Wu
535b28444f
[Symbolize] Always use filename:line from debug info when debug info for the given address is available. (#128619)
To reland https://github.com/llvm/llvm-project/pull/124846, we need to
make symbolizer consistent with the case when line number is 0. Always
using filename and line from debug info even if the line number is 0
sounds like the reasonable path to go.
2025-03-25 16:09:23 -04:00
Kazu Hirata
aacc4e9a38 [modularize] Fix the build
This patch fixes:

  clang-tools-extra/modularize/ModularizeUtilities.cpp:293:15: error:
  no member named 'parseModuleMapFile' in 'clang::ModuleMap'; did you
  mean 'loadModuleMapFile'?
2025-03-25 12:41:41 -07:00
marius doerner
4067581aea
[clang] Placement new error when modifying consts (#132460)
Raise an error when placement new is used to modify a const-qualified
variable in a constexpr function.

Fixes #131432
2025-03-25 20:39:12 +01:00
Michael Spencer
57f2e76e30
[clang] Consistently use "load" to refer to populating clang::ModuleMap (#132970)
Now that we have ModuleMapFile.cpp which parses module maps, it's
confusing what ModuleMap::parseModuleMapFile actually does. HeaderSearch
already called this loading a module map, so consistently use that term
in ModuleMap too.

An upcoming patch will allow just parsing a module map without loading
the modules from it.
2025-03-25 12:32:58 -07:00
Jan Svoboda
bdbad3e432 [lldb] Fix build after #132780 2025-03-25 12:29:08 -07:00
Jan Svoboda
7a370748c0
[clang][lex] Store non-owning options ref in HeaderSearch (#132780)
This makes it so that `CompilerInvocation` can be the only entity that
manages ownership of `HeaderSearchOptions`, making it possible to
implement copy-on-write semantics.
2025-03-25 12:14:06 -07:00
Slava Zakharin
613a077b05
[flang] Generate quadmath_wrapper.h for Flang Evaluate. (#132817)
When building Flang with Clang, we need to do the same quadmath.h
wrapping as we do for flang-rt. I extracted the CMake code
into FlangCommon.cmake, and cleaned up the arguments passing
to execute_process (note that `-###` was treated as `-` in the original
code, because `#` starts a comment). I believe the Clang command
does not require the input source file, so I removed it as well.
2025-03-25 12:08:38 -07:00
Julien Villette
011a95c536
[MCA] Update of RISCV/SiFive7/instruction-tables-tests.s (#132972)
Fixing MR #130574 after merge in main branch.
Throughput has been updated in between.

Co-authored-by: Julien Villette <julien.villette@sipearl.com>
2025-03-25 11:54:04 -07:00
Anatoly Trosinenko
b6b40e9ac9
[BOLT] Gadget scanner: reformulate the state for data-flow analysis (#131898)
In preparation for implementing support for detection of non-protected
call instructions, refine the definition of state which is computed for
each register by data-flow analysis.

Explicitly marking the registers which are known to be trusted at
function entry is crucial for finding non-protected calls. In addition,
it fixes less-common false negatives for pac-ret, such as `ret x1` in
`f_nonx30_ret_non_auted` test case.
2025-03-25 21:45:02 +03:00
Jinsong Ji
f7f5aa217a
[Clang][AMDGPU] Use size_t to compare with npos (#132868)
Fix error

llvm\clang\tools\amdgpu-arch\AMDGPUArchByHIP.cpp(102,29): error: result
of comparison of constant 18446744073709551615 with expression of type
'unsigned int' is always false
[-Werror,-Wtautological-constant-out-of-range-compare]
102 | StringRef VerStr = (Pos == StringRef::npos) ? S : S.substr(Pos +
1);
2025-03-25 14:34:12 -04:00
Alex Hoppen
3bcbb47258
[clangd] Use SymbolName to represent Objective-C selectors (#82061)
This is a cleaner design than using identifier and an optional `Selector`. It also allows rename of Objective-C method names if no declaration is at hand and thus no `Selector` instance can be formed. For example, when finding the ranges to rename based on an index that’s not clangd’s built-in index.
2025-03-25 14:34:00 -04:00
Louis Dionne
b0668d859b
[libc++] Make sure that __desugars_to isn't tripped up by reference_wrapper, const and ref qualifiers (#132092)
Previously, const and ref qualification on an operation would cause
__desugars_to to report false, which would lead to unnecessary
pessimizations. The same holds for reference_wrapper.

In practice, const and ref qualifications on the operation itself are
not relevant to determining whether an operation desugars to something
else or not, so can be ignored.

We are not stripping volatile qualifiers from operations in this patch
because we feel that this requires additional discussion.

Fixes #129312
2025-03-25 14:29:06 -04:00
Joseph Huber
9243f99d17
[libc] Add support for C++20 'atomic_ref' type (#132302)
Summary:
C++20 introduced an atomic reference type, which more easily wraps
around the standard way of dealing with atomics. Instead of a dedicated
type, it allows you to treat an existing allocation as atomic.

This has no users yet, but I'm hoping to use it when I start finalizing
my GPU allocation interface, as it will need to handle atomic values
in-place that can't be done with placement new. Hopefully this is small
enough that we can just keep it in-tree until it's needed, but I'll
accept holding it here until it has a user.

I added one extension to allow implicit conversion and CTAD.
2025-03-25 13:28:49 -05:00
Louis Dionne
fc5b4d4a9d
[libc++] Rename __construct_one_at_end to __emplace_back_assume_capacity (#132276)
This makes it clear that the end of the vector is updated when calling
the function.
2025-03-25 14:27:54 -04:00
Eli Friedman
e16e93a4c7
Revert "[GlobalOpt] Handle operators separately when removing GV users" (#132971)
Reverts llvm/llvm-project#84694 .  Review was incomplete.
2025-03-25 11:20:14 -07:00
Anshil Gandhi
51dad714e8
[GlobalOpt] Handle operators separately when removing GV users (#84694)
Refactor globalopt by eliminating redundant code. Fix
https://github.com/llvm/llvm-project/issues/64680.
2025-03-25 11:14:33 -07:00
Matheus Izvekov
dfb6c761f7
[clang] ASTContex: fix getCommonSugaredType for array types (#132559)
This corrects the behaviour for getCommonSugaredType with regards to
array top level qualifiers: remove differing top level qualifiers, as
they must be redundant with element qualifiers.

Fixes https://github.com/llvm/llvm-project/issues/97005
2025-03-25 15:13:50 -03:00
Juan Manuel Martinez Caamaño
2f8d699845
[AMDGPU][SelectionDAG] Use COPY instead of S_MOV_B32 to assign values to M0 (#132957)
This is consistent with what's done on GISel. This allows the register
coalescer to remove the redundant intermediate `s_mov_b32` instructions
by using `m0` directly as the result register.
2025-03-25 19:05:43 +01:00
Michael Spencer
53fa28940e [clang] Remove unused member variable from ModuleMap
This became unused when module map parsing moved to ModuleMapFile.cpp.
2025-03-25 10:58:44 -07:00
Bruno Cardoso Lopes
74c2c049d1
[MLIR][LLVM] Add weak_odr to allowed linkage for alias (#132840)
I missed this when originally introduced the feature (note the verifier
message already contains it), this fixes a small bug.
2025-03-25 10:46:02 -07:00
Amr Hesham
357306572d
[libcxx] Put std::monostate in <utility> (#128373)
Fixes: #127874
2025-03-25 18:31:57 +01:00
Jeffrey Byrnes
25938389c0
[AMDGPU] Autogen checks for agpr-csr.ll (#132959)
Needed for a RegisterCoalescer patch
2025-03-25 10:28:35 -07:00
Eugene Epshteyn
2c8e26081f
[flang] Add HOSTNM runtime and lowering intrinsics implementation (#131910)
Implement GNU extension intrinsic HOSTNM, both function and subroutine
forms. Add HOSTNM documentation to `flang/docs/Intrinsics.md`. Add
lowering and semantic unit tests.

(This change is modeled after GETCWD implementation.)
2025-03-25 13:17:17 -04:00
Walter Lee
6ddc07163d
Disable some tests on bazel (#132951)
These tests failed at Google after #130757. Disable them in bazel for the time being.
2025-03-25 13:06:20 -04:00
vdonaldson
92e0560347
[flang] ieee_denorm (#132307)
Add support for the nonstandard ieee_denorm exception for real kinds 3,
4, 8 on x86 processors.
2025-03-25 13:02:43 -04:00
Igor Wodiany
7b3885d47b
[mlir][spirv] Add definition for GL Fract (#132921) 2025-03-25 16:59:09 +00:00
jimingham
870463519b
Fix the managing of the session dictionary when you have nested wrappers (#132846)
Since the inner wrapper call might have removed one of the entries from
the global dict that the outer wrapper ALSO was going to delete, make
sure that we check that the key is still in the global dict before
trying to act on it.
2025-03-25 09:56:58 -07:00
Pranav Kant
0919ab3cb6
[AArch64] Don't try to vectorize fixed point to fp narrowing conversion (#130665)
GCC, correctly, doesn't vectorize in this case. Absence of direct
instructions to convert larger fixed point to lower floating point
precision inadvertently causes rounding leading to subtle differences
across ISAs.

https://godbolt.org/z/ssEchMWrE

Co-authored by: @echristo
2025-03-25 09:53:27 -07:00