506403 Commits

Author SHA1 Message Date
Mariya Podchishchaeva
062adaf7d2
[clang] Reject if constexpr in C (#112685)
Fixes https://github.com/llvm/llvm-project/issues/112587
2024-10-29 09:59:53 +01:00
Chen Zheng
6ee49080e4
[NFC] fix build failure (#100993)
Fix the build failure caused by
https://github.com/llvm/llvm-project/pull/94944

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

(cherry picked from commit 40b4fd7a3e81d32b29364a1b15337bcf817659c0)
2024-10-29 09:58:55 +01:00
Nikita Popov
6e006e11f3
[WebAssembly] Fix feature coalescing (#110647)
This fixes a problem introduced in #80094. That PR copied negative
features from the TargetMachine to the end of the feature string. This
is not correct, because even if we have a baseline TM of say `-simd128`,
but a function with `+simd128`, the coalesced feature string should have
`+simd128`, not `-simd128`.

To address the original motivation of that PR, we should instead
explicitly materialize the negative features in the target feature
string, so that explicitly disabled default features are honored.

Unfortunately, there doesn't seem to be any way to actually test this
using llc, because `-mattr` appends the specified features to the end of
the `"target-features"` attribute. I've tested this locally by making it
prepend the features instead.

(cherry picked from commit 5a7b79c93e2e0c71aec016973f5f13d3bb2e7a62)
2024-10-29 09:58:06 +01:00
Tobias Hieta
17365dfd21
Bump version to 19.1.3 2024-10-29 09:57:40 +01:00
Michał Górny
21ed37e3e7
[LLVM] [Clang] Backport "Support for Gentoo *t64 triples (64-bit time_t ABIs)"
This is a backport of 387b37af1aabf325e9be844361564dfad8d45c75 for 19.x,
adjusted to add new Triple::EnvironmentType members at the end to avoid
breaking backwards ABI compatibility.

Gentoo is planning to introduce a `*t64` suffix for triples that will be
used by 32-bit platforms that use 64-bit `time_t`. Add support for
parsing and accepting these triples, and while at it make clang
automatically enable the necessary glibc feature macros when this suffix
is used.
2024-10-29 09:53:58 +01:00
Younan Zhang
19c571a631
[Clang] Instantiate Typedefs referenced by type alias deduction guides (#111804)
TypedefNameDecl referenced by a synthesized CTAD guide for type aliases
was not transformed previously, resulting in a substitution failure in
BuildDeductionGuideForTypeAlias() when substituting into the
right-hand-side deduction guide.

This patch fixes it in the way we have been doing since
https://reviews.llvm.org/D80743. We transform all the function
parameters, parenting referenced TypedefNameDecls with the
CXXDeductionGuideDecl. Then we instantiate these declarations in
FindInstantiatedDecl() as we build up the eventual deduction guide,
using the mechanism introduced in D80743

Fixes #111508

(cherry picked from commit 0bc02b999a9686ba240b7a68d3f1cbbf037d2170)
2024-10-29 09:52:13 +01:00
goldsteinn
74b2743bd5
[Inliner] Don't propagate access attr to byval params (#112256)
- **[Inliner] Add tests for bad propagationg of access attr for `byval`
param; NFC**
- **[Inliner] Don't propagate access attr to `byval` params**

We previously only handled the case where the `byval` attr was in the
callbase's param attr list. This PR also handles the case if the
`ByVal` was a param attr on the function's param attr list.

(cherry picked from commit 3c777f04f065dda5f0c80eaaef2a7f623ccc20ed)
2024-10-29 09:48:10 +01:00
Thomas Petazzoni
d8752671e8 Undef _TIME_BITS along with _FILE_OFFSET_BITS
This change is identical to
26800a2c7e7996dc773b4e990dd5cca41c45e1a9 ("[sanitizer] Undef
_TIME_BITS along with _FILE_OFFSET_BITS on Linux"), but for
sanitizer_procmaps_solaris.cpp.

Indeed, even though sanitizer_procmaps_solaris.cpp is Solaris
specific, it also gets built on Linux platforms. It also includes
sanitizer_platform.h, which also ends up including features-time64.h,
causing a build failure on 32-bit Linux platforms on which 64-bit
time_t is enabled by setting _TIME_BITS=64.

To fix this, we do the same change: undefine _TIME_BITS, which anyway
will cause no harm as the rest of this file is inside a
SANITIZER_SOLARIS compile-time conditional.

Fixes:

In file included from /home/thomas/buildroot/buildroot/output/host/i686-buildroot-linux-gnu/sysroot/usr/include/features.h:394,
                 from ../../../../libsanitizer/sanitizer_common/sanitizer_platform.h:25,
                 from ../../../../libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp:14:
/home/thomas/buildroot/buildroot/output/host/i686-buildroot-linux-gnu/sysroot/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is al
lowed only with _FILE_OFFSET_BITS=64"
   26 | #   error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
      |     ^~~~~

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Closes: https://github.com/llvm/llvm-project/pull/99699
(cherry picked from commit a1217020da219386b29c1a5a4a217904ecf07d7d)
2024-10-28 08:40:43 +01:00
Vassil Vassilev
7ba7d8e2f7 [clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138)
In incremental compilation clang works with multiple `llvm::Module`s.
Our current approach is to create a CodeGenModule entity for every new
module request (via StartModule). However, some of the state such as the
mangle context needs to be preserved to keep the original semantics in
the ever-growing TU.

Fixes: llvm/llvm-project#95581.

cc: @jeaye
(cherry picked from commit 6c62ad446b2441b78ae524d9e700e351d5a76394)
2024-10-15 10:17:37 +02:00
Max Winkler
689282743d [Headers] [ARM64EC] Fix extra tokens inside intrin0.h preprocessor directive (#112066)
Fixes https://github.com/llvm/llvm-project/pull/87717.

(cherry picked from commit 9bf68c2400e8966511332dfbf5c0f05e8a3300fa)
2024-10-15 08:57:17 +02:00
Brian Cain
f8cf339563 [lld][Hexagon] Support predicated-add GOT_16_X mask lookup (#111896)
When encountering an instruction like `if (p0) r0 = add(r0,##bar@GOT)`,
lld would fail with:
```
ld.lld: error: unrecognized instruction for 16_X type: 0x7400C000
```

This issue was encountered while building libreadline with clang 19.1.0.

Fixes: #111876
(cherry picked from commit 77aa8257acbd773c0c430cd962da1bcfbd5ee94b)
2024-10-15 08:56:21 +02:00
Yingwei Zheng
35bd5ff4ca [InstCombine] Drop range attributes in foldIsPowerOf2 (#111946)
Fixes https://github.com/llvm/llvm-project/issues/111934.
2024-10-15 08:55:36 +02:00
Owen Pan
96839b6f16 [clang-format] Handle template closer followed by braces (#110971)
Fixes #110968.

(cherry picked from commit e5b05a51b8151cc7788bbdea4d491e5ccfceedea)
2024-10-15 08:55:16 +02:00
David CARLIER
16c2aae4f6 [compiler-rt] Remove SHA2 interceptions for NetBSD/FreeBSD. (#110246)
To Fix #110215

Interceptors introduced with 18a7ebda99044473fdbce6376993714ff54e6690

(cherry picked from commit d0b9c2c5647656738cda3fb670aa5d3b3a69d784)
2024-10-15 08:54:46 +02:00
David Green
04199538e3 Update test since trunk 2024-10-15 08:53:11 +02:00
David Green
8cb7d8a70d [VectorCombine] Do not try to operate on OperandBundles. (#111635)
This bails out if we see an intrinsic with an operand bundle on it, to
make sure we don't process the bundles incorrectly.

Fixes #110382.

(cherry picked from commit c136d3237a3c6230cfe1ab3f0f6790f903c54a27)
2024-10-15 08:53:11 +02:00
cor3ntin
dedbdfb70d [Clang] Improve type traits recognition in __has_builtin (#111516)
`__has_builtin` was relying on reversible identifiers and string
matching to recognize builtin-type traits, leading to some newer type
traits not being recognized.

Fixes #111477
2024-10-15 08:52:34 +02:00
Simon Pilgrim
92f4a2bf0a [x86] combineMUL - when looking for a vector multiply by splat constant, ensure we're only accepting ConstantInt splat scalars.
Fixes #111170

(cherry picked from commit 9459d729d22b7bfedad9d3a4237162077c6984a4)
2024-10-15 08:51:57 +02:00
Matt Arsenault
139d737ae0 Move out of line 2024-10-15 08:50:50 +02:00
Matt Arsenault
f12830aac9 FastISel: Fix incorrectly using getPointerTy (#110465)
This was using the default address space instead of the
correct one.

Fixes #56055

Keep old method around for ABI compatibility on the release branch.

(cherry picked from commit 81ba95cefe1b5a12f0a7d8e6a383bcce9e95b785)
2024-10-15 08:50:50 +02:00
Louis Dionne
c36d7fd568 [libc++] Avoid re-exporting a few specific symbols from libc++abi (#109054)
In 6a884a9aef39, I synchronized the export list of libc++abi to the
export list of libc++. From the linker's perspective, this caused these
symbols to be taken from libc++.dylib instead of libc++abi.dylib.

However, that can be problematic when back-deploying. Indeed, this means
that the linker will encode an undefined reference to be fullfilled by
libc++.dylib, but when backdeploying against an older system, that
symbol might only be available in libc++abi.dylib.

Most of the symbols that started being re-exported after 6a884a9aef39
turn out to be implementation details of libc++abi, so nobody really
depends on them and this back-deployment issue is inconsequential.

However, we ran into issues with a few of these symbols while testing
LLVM 19, which led to this patch. This slipped between the cracks and
that is why the patch is coming so long after the original patch landed.

In the future, a follow-up cleanup would be to stop exporting most of
the _cxxabiv1_foo_type_infoE symbols from both libc++abi and libc++
since they are implementation details that nobody should be relying on.

rdar://131984512
(cherry picked from commit 677e8cd6ff51e178bcb4669104763f71a2de106c)
2024-10-15 08:50:13 +02:00
Louis Dionne
1360969b81 [libc++] Adjust the version of __cpp_lib_ranges in C++20 mode
This is a (very partial) cherry-pick of #101715 to fix this oversight
in the LLVM 19 release.
2024-10-11 15:30:47 +08:00
Bill Wendling
6c1fd539e4 [Clang] Check that we have the correct RecordDecl
Ensure we have the correct RecordDecl before returning the Expr we're
looking for.
2024-10-11 08:04:20 +02:00
Jan Hendrik Farr
b42a74febe [Clang] Fix 'counted_by' for nested struct pointers (#110497)
Fix counted_by attribute for cases where the flexible array member is
accessed through struct pointer inside another struct:

```
struct variable {
        int a;
        int b;
        int length;
        short array[] __attribute__((counted_by(length)));
};

struct bucket {
        int a;
        struct variable *growable;
        int b;
};
```

__builtin_dynamic_object_size(p->growable->array, 0);

This commit makes sure that if the StructBase is both a MemberExpr and a
pointer, it is treated as a pointer. Otherwise clang will generate to
code to access the address of p->growable intead of loading the value of
p->growable->length.

Fixes #110385
2024-10-11 08:04:20 +02:00
Ulrich Weigand
149884a146 [SystemZ] Fix codegen for _[u]128 intrinsics
PR #74625 introduced a regression in the code generated for the
following set of intrinsic:
  vec_add_u128, vec_addc_u128, vec_adde_u128, vec_addec_u128
  vec_sub_u128, vec_subc_u128, vec_sube_u128, vec_subec_u128
  vec_sum_u128, vec_msum_u128
  vec_gfmsum_128, vec_gfmsum_accum_128

This is because the new code incorrectly assumed that a cast
from "unsigned __int128" to "vector unsigned char" would simply
be a bitcast re-interpretation; instead, this cast actually
truncates the __int128 to char and splats the result.

Fixed by adding an intermediate cast via a single-element
128-bit integer vector.

Fixes: https://github.com/llvm/llvm-project/issues/109113
(cherry picked from commit baf9b7da81025c1e3b0704d7ecf667e06f95642b)
2024-10-11 08:03:12 +02:00
Younan Zhang
f3f49528c4 [Clang] Remove the special-casing for RequiresExprBodyDecl in BuildResolvedCallExpr() after fd87d765c0 (#111277)
The special-casing for RequiresExprBodyDecl caused a regression, as
reported in #110785.

The original fix for #84020 has been superseded by fd87d765c0, which
establishes a `DependentScopeDeclRefExpr` instead of a
`CXXDependentScopeMemberExpr` for the case in issue. So the spurious
diagnostic in #84020 would no longer occur.

This also merges the test for #84020 together with that for #110785 into
clang/test/SemaTemplate/instantiate-requires-expr.cpp.

No release note because I think this merits a backport.

Fixes #110785

(cherry picked from commit 8c1547055eaf65003f3e6fd024195f4926ff2356)
2024-10-11 08:02:12 +02:00
Nathan Ridge
33a5c88572 [clang-tidy] Avoid capturing a local variable in a static lambda in UseRangesCheck (#111282)
Fixes https://github.com/llvm/llvm-project/issues/109367

(cherry picked from commit acf92a47c0ece8562fd745215c478fe2d4ab5896)
2024-10-11 08:01:40 +02:00
Owen Pan
1515e63864 [clang-format] Handle template closer followed by empty paretheses (#110408)
Fixes #109925.
2024-10-11 08:01:09 +02:00
Farzon Lotfi
3e6207eb81 [x86][Windows] Fix chromium build break
Windows does not support float C89 math functions like:
- acosf
- asinf
- atanf
- coshf
- sinhf
- tanhf
These 6 libfuncs need to be type promoted.

This PR fixes the bug introduced by https://github.com/llvm/llvm-project/pull/98949
2024-10-11 08:00:33 +02:00
Keith Smiley
7b591d7fce workflows/release-binaries: Use static ZSTD on macOS
On macOS the shared zstd library points to a homebrew install that isn't
very stable for users.

(cherry picked from commit 748f5404ccdf28d4beef37efdaeba7a1701ab425)
2024-10-11 07:59:58 +02:00
Louis Dionne
b0b36c00f5 [libc++] Fix name of is_always_lock_free test which was never being run (#106077)
(cherry picked from commit b45661953e6974782b0ccada6f0784db04bc693f)
2024-10-11 07:59:25 +02:00
Tom Stellard
c3c1b047ed workflows/release-documentation: Submit a pull request with changes (#108247)
This is instead of pushing directly. Creating a pull request is slightly
more work for the release manager, but it is more secure as we no longer
need a secret with write access to the www-releases repo.

(cherry picked from commit 9cd289fa4a7355e1bfd3129ba9c755f979fd0a72)
2024-10-11 07:58:23 +02:00
Tom Stellard
7b2756484b workflow/release-binaries: Checkout sources before downloading artifacts (#109349)
The actions/checkout step will clear the current directory, so we need
to checkout the sources first so that the downloaded artifacts won't be
deleted.

(cherry picked from commit 8f2aa9dbad7c1400f66e1ee1c43b071a1905f3e6)
2024-10-11 07:57:49 +02:00
Zentrik
bfa99ebbc3 Fix libFuzzer not building with pthreads on Windows (#109525)
Fixes https://github.com/llvm/llvm-project/issues/106871

(cherry picked from commit b4130bee6bfd34d8045f02fc9f951bcb5db9d85c)
2024-10-11 07:56:48 +02:00
Jakub Mazurkiewicz
4f844b265d
[libc++] Follow-up to "Poison Pills are Too Toxic"
* Update release notes and `Cxx23.html`
* Update `__cpp_lib_ranges` feature test macro
2024-10-11 07:54:27 +02:00
Tobias Hieta
d5498c39fe
Bump version to 19.1.2 2024-10-01 16:04:00 +02:00
Phoebe Wang
d401987fe3 [X86][APX] Do not emit {evex} prefix for memory variant (#109759)
This was mistakely changed by #109579, which doesn't match with other
EVEX decoding.

(cherry picked from commit 70529b24a30943d46e361d2990268499921e28a2)
2024-10-01 14:08:12 +02:00
Phoebe Wang
edd018ead7 [X86][APX] Fix wrong encoding of promoted KMOV instructions due to missing NoCD8 (#109579)
Promoted KMOV* was encoded with CD8 incorrectly, see
https://godbolt.org/z/cax513hG1

(cherry picked from commit 0d334d83a4c7ce16fa1bc0e5e56bbdeaf01c2b2d)
2024-10-01 14:08:12 +02:00
Joe Faulls
1f681b5913 [CodeGen] Clear InitUndef pass new register cache between pass runs (#90967)
Multiple invocations of the pass could interfere with eachother,
preventing some undefs being initialised.

I found it very difficult to create a unit test for this due to it being
dependent on particular allocations of a previous function. However, the
bug can be observed here: https://godbolt.org/z/7xnMo41Gv with the
creation of the illegal instruction `vnsrl.wi v9, v8, 0`
2024-10-01 13:49:40 +02:00
David Spickett
23eadbda36 [libcxx][test] Use smaller time range for 32 bit time_t (#104762)
This fixes the test on Arm 32 bit Ubuntu Jammy where time_t is 32 bit.

(cherry picked from commit cdd608b8f0ce090b3568238387df368751bdbb5d)
2024-10-01 09:03:25 +02:00
David Spickett
4dbe72f91a [lldb][test] Mark sys_info zdump test unsupported on 32 bit Arm Linux
Until https://github.com/llvm/llvm-project/pull/103056 lands
or another more appropriate check can be found.

This test fails on Ubuntu Focal where zdump is built with 32 bit time_t
but passes on Ubuntu Jammy where zdump is built with 64 bit time_t.

Marking it unsupported means Linaro can upgrade its bots to Ubuntu
Jammy without getting an unexpected pass.

(cherry picked from commit 6f6422f4a2b8647a59936c131e50a79906d89510)
2024-10-01 09:03:25 +02:00
Tobias Hieta
fae11d419d
Bump version to 19.1.1 2024-10-01 09:02:07 +02:00
Petar Avramovic
962edd3f71 AMDGPU: Fix inst-selection of large scratch offsets with sgpr base (#110256)
Use i32 for offset instead of i16, this way it does not get interpreted
as negative 16 bit offset.

(cherry picked from commit 83fe85115da9dc25fa270d2ea8140113c8d49670)
2024-10-01 08:56:50 +02:00
Petar Avramovic
03d133728a AMDGPU: Add test for 16 bit unsigned scratch offsets (#110255)
Large scratch offset with one on highest bit selected as negative,
negative offset has same binary representation in 16 bits as large
unsigned offset.

(cherry picked from commit e9d12a6b451bd403d95105aa976a011dc821f126)
2024-10-01 08:56:50 +02:00
Louis Dionne
53010fcf66 [libc++] Fix AppleClang version number when checking for __builtin_verbose_trap support (#110161)
We should have been checking against 1700, not 17000, which was a typo.

(cherry picked from commit 1eba87904b0cbaaee82cfdb835528b85d99320ef)
2024-10-01 08:56:18 +02:00
Timothy Pearson
8679d1b51b [SDAG] Honor signed arguments in floating point libcalls (#109134)
In ExpandFPLibCall, an assumption is made that all floating point
libcalls that take integer arguments use unsigned integers. In the case
of ldexp and frexp, this assumption is incorrect, leading to
miscompilation and subsequent target-dependent incorrect operation.

Indicate that ldexp and frexp utilize signed arguments in
ExpandFPLibCall.

Fixes #108904

Signed-off-by: Timothy Pearson <tpearson@solidsilicon.com>
(cherry picked from commit 90c14748638f1e10e31173b145fdbb5c4529c922)
2024-10-01 08:55:02 +02:00
Weining Lu
b3734d9f93 [LoongArch] Fix the assertion for atomic store with 'ptr' type
(cherry picked from commit 63267ca9016aa334b329aa408716456b4e3799c8)
2024-10-01 08:53:44 +02:00
Martin Storsjö
997b66e566 [clang-scan-deps] Don't inspect Args[0] as an option (#109050)
Since a26ec542371652e1d774696e90016fd5b0b1c191, we expand the executable
name to an absolute path, if it isn't already one, if found in path.

This broke a couple tests in some environments; when the clang workdir
resides in a path under e.g. /opt. Tests that only use a tool name like
"clang-cl" would get expanded to the absolute path in the build tree.
The loop for finding the last "-o" like option for clang-cl command
lines would inspect all arguments, including Args[0] which is the
executable name itself. As an /opt path matches Arg.starts_with("/o"),
this would get detected as an object file output name in cases where
there was no other explicit output argument.

Thus, this fixes those tests in workdirs under e.g. /opt.

(cherry picked from commit cead9044a995910306e2e64b426fcc8042d7e0ef)
2024-10-01 08:53:03 +02:00
Martin Storsjö
2b6c23303f [clang-scan-deps] Infer the tool locations from PATH (#108539)
This allows the clang driver to know which tool is meant to be executed,
which allows the clang driver to load the right clang config files, and
allows clang to find colocated sysroots.

This makes sure that doing `clang-scan-deps -- <tool> ...` looks up
things in the same way as if one just would execute `<tool> ...`, when
`<tool>` isn't an absolute or relative path.

(cherry picked from commit a26ec542371652e1d774696e90016fd5b0b1c191)
2024-10-01 08:53:03 +02:00
Martin Storsjö
a0fc8a2b2b [clang-scan-deps] Fix builds with BUILD_SHARED_LIBS=ON
This fixes building in this configuration after
87e1104cf0e2de0d04bee2944893fa7897277b2f.

(cherry picked from commit aa3465793a250faa5426ac626989375465256658)
2024-10-01 08:53:03 +02:00