platform/upstream/llvm.git
3 weeks agoRevert "[packaging] Enable llvm build with clang" 88/309588/1 accepted/tizen_base accepted/tizen_base_asan accepted/tizen_base_toolchain accepted/tizen_base_x tizen_base accepted/tizen/base/20240415.220937 accepted/tizen/base/asan/20240422.015058 accepted/tizen/base/toolchain/20240414.003126 accepted/tizen/base/x/20240416.082010
Dongkyun Son [Fri, 12 Apr 2024 09:20:38 +0000 (18:20 +0900)]
Revert "[packaging] Enable llvm build with clang"

This reverts commit 67de5b31063d38dd7140af844dd8f15377cee02f.

Change-Id: Ia524500f7c3ff0ea3c7a19d36e587a581f982a61

3 weeks ago[packaging] build lldb for riscv64 77/309377/1 sandbox/dkson95/lldb
Dongkyun Son [Tue, 9 Apr 2024 04:53:40 +0000 (13:53 +0900)]
[packaging] build lldb for riscv64

Change-Id: I63389829a7e025748fab1a06d71b61f996823d41
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
8 weeks ago[packaging] Enable llvm build with clang 82/307082/2
Slava Barinov [Tue, 7 Dec 2021 11:39:34 +0000 (14:39 +0300)]
[packaging] Enable llvm build with clang

Change-Id: If003d29c3cfb9723b3b5896e5740c4f86c330af7
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
3 months agopackaging: add python-clang accepted/tizen_base_riscv sandbox/vbarinov/fix-check tizen_base_dev accepted/tizen/base/20240227.211311 accepted/tizen/base/riscv/20240116.145847 accepted/tizen/base/toolchain/20240116.105853
Dongkyun Son [Tue, 9 Jan 2024 07:35:48 +0000 (16:35 +0900)]
packaging: add python-clang

Python bindings to parts of the Clang library

Change-Id: I00882987dd8adfb074ae1c7887bb6ba57ff337db
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
3 months agopackaging: bump version to 17.0.6
Dongkyun Son [Thu, 4 Jan 2024 07:42:25 +0000 (16:42 +0900)]
packaging: bump version to 17.0.6

Fix error: 'CLANG_LIBDIR_SUFFIX' was not declared in this scope;

caused by commit 3adda398cef7f56d024924158e7b17d65cbc565d
Author: John Ericson <John.Ericson@Obsidian.Systems>
Date:   Sat Aug 20 11:20:12 2022 -0400

    [clang][lldb][cmake] Use new `*_INSTALL_LIBDIR_BASENAME` CPP macro

Change-Id: I0de17ab1b6658cac9954349a8dea7bf5729a3467
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
3 months agopackaging: remove -gdwarf-* on llvm_release_build
Dongkyun Son [Wed, 29 Nov 2023 05:06:35 +0000 (14:06 +0900)]
packaging: remove -gdwarf-* on llvm_release_build

Fix error: dwarf-4: linker input file not found: No such file or directory

Change-Id: If0c5e0f282aac61e4ba1b377d667ddea7f5ab885
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
(cherry picked from commit fcfb14342668bbbcbed08bbaa677e763222a3651)

3 months agoBuildIgnore build-compare
Hyunggi Lee [Fri, 21 Apr 2023 01:06:24 +0000 (10:06 +0900)]
BuildIgnore build-compare

Change-Id: I2765375e74689947392c06a4d96a27ff458a26c0
Signed-off-by: Hyunggi Lee <hyunggi.lee@samsung.com>
3 months agoLink libclang_rt.asan.so against libatomic when necessary
Łukasz Stelmach [Wed, 26 Apr 2023 10:53:28 +0000 (12:53 +0200)]
Link libclang_rt.asan.so against libatomic when necessary

To build libclang_rt.asan.so on RISC-V it is required to link it against
libatomic.

Change-Id: Iafdc20fc8ecffeeaa289e03b01267bbabdd48a9e
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
3 months ago[packaging] build llvm for riscv64
Łukasz Stelmach [Mon, 19 Sep 2022 21:26:51 +0000 (23:26 +0200)]
[packaging] build llvm for riscv64

Don't build LLDB. It doesn't support RISC-V yet.

Change-Id: I069101727569d9bddda1205bc5775912d30a632c
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
3 months agopackaging: Bump version to 15.0.7
Dongkyun Son [Wed, 8 Mar 2023 00:27:33 +0000 (09:27 +0900)]
packaging: Bump version to 15.0.7

Change-Id: I14c24a8d27c0c85107eb77d20070162744f6433a
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
3 months ago[packaging] Always build with non-asan for all architecture
Seung-Woo Kim [Fri, 12 Aug 2022 02:28:37 +0000 (11:28 +0900)]
[packaging] Always build with non-asan for all architecture

Always build with non-asan not only i586 but also all other
architectures. Otherwise, llvm build will be failed from below:
  /home/abuild/rpmbuild/BUILD/llvm-10.0.0/compiler-rt/lib/asan/asan_internal.h:24:3: error: #error "The AddressSanitizer run-time should not be"
     24 | # error "The AddressSanitizer run-time should not be"
     25 |         " instrumented by AddressSanitizer"

Change-Id: I3189246d5c6ed63760b7c2699dcfd830c5b4bce6
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 months ago[Tizen] Change libsosplugin.so path
Alexander Soldatov [Fri, 3 Jun 2022 11:32:42 +0000 (14:32 +0300)]
[Tizen] Change libsosplugin.so path

Change-Id: I9d232965b69757cceb37afe19273c28d8cb6e7f7

3 months agoFix build error for `Add search paths for libstdc++`
Hyungju Lee [Fri, 31 May 2019 05:29:09 +0000 (14:29 +0900)]
Fix build error for `Add search paths for libstdc++`

Change-Id: I2ac8cb6da767219d75166b4a03fc91200a96e538
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
3 months ago[packaging] Create clang-gcc-replace package
Slava Barinov [Thu, 9 Sep 2021 14:59:38 +0000 (17:59 +0300)]
[packaging] Create clang-gcc-replace package

The package provides symlinks %_bindir/gcc and %_bindir/g++ for clang and
clang++ respectively.

Can be used for compiler enforcement in environments which do not allow
compiler change.

Change-Id: I49660b9a705162cebe569a8b3df0714f472d86ad
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
3 months ago[packaging] Enable build in Clang environment
Slava Barinov [Fri, 6 Aug 2021 07:17:25 +0000 (10:17 +0300)]
[packaging] Enable build in Clang environment

Enforce fpu=neon for armv7l and armv7hl builds
Enable libstdc++ install paths for all platforms
Switch compilers to %__cc and %__cxx

Change-Id: Ie0f55dc36d11df398b5b397951c2b40d751506c3
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
3 months ago[llvm][clang] Add support for Tizen toolchain vendor
Slava Barinov [Thu, 2 Sep 2021 20:51:42 +0000 (23:51 +0300)]
[llvm][clang]  Add support for Tizen toolchain vendor

Port of
ebf1682d714e4b6c1487ea0e136cf7c1ec30f46d
8845ba7f79513b7e362fed80bb57b708352ddbbd

Signed-off-by: Slava Barinov <v.barinov@samsung.com>
3 months ago[packaging] Add packaging
Slava Barinov [Fri, 30 Jul 2021 11:15:23 +0000 (14:15 +0300)]
[packaging] Add packaging

Change-Id: Ia0f97e3b5d3901fe5183e51faad7b01bd3af6cd8
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
5 months agoRevert "[runtimes] Add missing test dependencies to check-all (#72955)" upstream/17.0.6
Tobias Hieta [Tue, 28 Nov 2023 08:52:28 +0000 (09:52 +0100)]
Revert "[runtimes] Add missing test dependencies to check-all (#72955)"

This reverts commit e957e6dcb29d94e4e1678da9829b77009be88926.

The commit was reverted on main because of issues. We will not carry
this in the release branch for 17.x

5 months ago[Driver] Enable __float128 support on X86 on FreeBSD / NetBSD (#72788)
Brad Smith [Sun, 19 Nov 2023 08:00:05 +0000 (03:00 -0500)]
[Driver] Enable __float128 support on X86 on FreeBSD / NetBSD (#72788)

(cherry picked from commit 23c47eba879769a29772c999be2991201c2fe399)

5 months agoeliminate python SyntaxWarnings from check-all output.
Georgios Eleftheriou [Thu, 16 Nov 2023 16:53:40 +0000 (17:53 +0100)]
eliminate python SyntaxWarnings from check-all output.

```
src_dir/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py:28: SyntaxWarning: invalid escape sequence '\*'    self.implementationContent += """
src_dir/llvm/utils/lit/lit/TestRunner.py:205: SyntaxWarning: invalid escape sequence '\c'                      """
src_dir/llvm/utils/lit/lit/TestRunner.py:1561: SyntaxWarning: invalid escape sequence '\s'                     match = _caching_re_compile("^\s*%else\s*(%{)?").search(ln)
src_dir/libcxx/utils/libcxx/test/format.py:64: SyntaxWarning: invalid escape sequence '\s'                     for output in re.split('[$]\s*":"\s*"RUN: at line \d+"', fullOutput):
src_dir/libcxx/utils/libcxx/test/params.py:121: SyntaxWarning: invalid escape sequence '\+'                    AddSubstitution("%{cxx_std}", re.sub("\+", "x", std)),
src_dir/libcxx/utils/libcxx/test/params.py:214: SyntaxWarning: invalid escape sequence '\+'                    AddFeature("stdlib=libc++") if re.match(".+-libc\+\+", stdlib) else None,
src_dir/compiler-rt/test/lit.common.cfg.py:800: SyntaxWarning: invalid escape sequence '\$'                    "-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec"
src_dir/compiler-rt/test/lit.common.cfg.py:809: SyntaxWarning: invalid escape sequence '\$'                    "-Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix,
src_dir/compiler-rt/test/lit.common.cfg.py:817: SyntaxWarning: invalid escape sequence '\$'                    "-Wl,-R\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix,
src_dir/llvm/test/lit.cfg.py:275: SyntaxWarning: invalid escape sequence '\d'                                  match = re.search("release (\d+)\.(\d+)", ptxas_out)
```

5 months ago[clang-format] Fix crashes in AlignArrayOfStructures (#72520)
Owen Pan [Fri, 17 Nov 2023 22:35:30 +0000 (14:35 -0800)]
[clang-format] Fix crashes in AlignArrayOfStructures (#72520)

Fixed #54815.
Fixed #55269.
Fixed #55493.
Fixed #68431.

5 months ago[clang] Fix sorting module headers (#73146)
Tulio Magno Quites Machado Filho [Fri, 24 Nov 2023 12:17:21 +0000 (09:17 -0300)]
[clang] Fix sorting module headers (#73146)

Struct Module::Header is not a POD type. As such, qsort() and
llvm::array_pod_sort() must not be used to sort it. This became an issue
with the new implementation of qsort() in glibc 2.39 that is not
guaranteed to be a stable sort, causing Headers to be re-ordered and
corrupted.

Replace the usage of llvm::array_pod_sort() with std::stable_sort() in
order to fix this issue. The signature of compareModuleHeaders() has to
be modified.

Fixes #73145.

(cherry picked from commit cf1bde33423da5eb9b7dc95daac4aada3167de3c)

5 months ago[JITLink][aarch32] Change writeRegister's return type to void.
Lang Hames [Fri, 4 Aug 2023 17:16:25 +0000 (10:16 -0700)]
[JITLink][aarch32] Change writeRegister's return type to void.

This function does not return a value.

https://github.com/llvm/llvm-project/issues/64418
(cherry picked from commit dce179396e7e547fe6b42f0f9625b49212e6ec0b)

5 months ago[CMake] Support building shared library for NetBSD
Brad Smith [Wed, 22 Nov 2023 23:42:56 +0000 (18:42 -0500)]
[CMake] Support building shared library for NetBSD

(cherry picked from commit 51c5d74940c3a6682ccd44491cb40c7e26fb83e5)

5 months agoworkflows/release-binaries: Do a preliminary build to fill ccache (#72576)
Tom Stellard [Tue, 21 Nov 2023 20:29:20 +0000 (12:29 -0800)]
workflows/release-binaries: Do a preliminary build to fill ccache (#72576)

Build clang with the host compiler and ccache enabled in order to speed
up the phase 1 builds. This helps reduce the amount of time spent
running on the non-free builders.

(cherry picked from commit e746b56c98f6180cffd4cad9ebdd249bdaa17283)

5 months agoAdd RV64 constraint to SRLIW (#69416)
Shao-Ce SUN [Wed, 18 Oct 2023 07:01:17 +0000 (15:01 +0800)]
Add RV64 constraint to SRLIW (#69416)

Fixes #69408

(cherry picked from commit f48dab523784252448dbd42e72f0048ee0463368)

5 months ago[runtimes] Add missing test dependencies to check-all (#72955)
Tom Stellard [Wed, 22 Nov 2023 21:57:48 +0000 (13:57 -0800)]
[runtimes] Add missing test dependencies to check-all (#72955)

The test-depends target contained all the dependencies needed to run the
runtimes tests, but it was never added as a dependency of check-all.
This caused some of the tsan tests to fail, since the custom libcxx
build the tests were looking for was never built. Besides the tsan
failures, this fixes all the other test failures I was seeing with:
cmake -G Ninja -B release-build -S llvm \
        -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
        -DCMAKE_BUILD_TYPE=Release \
        -DLLVM_ENABLE_ASSERTIONS=OFF \
        -DLLVM_ENABLE_PROJECTS="clang;lld" \
        -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt"

This is the same configuration the test-release.sh script uses, so I'm
hoping this will also fix all the test failures we've been seeing when
building the releases.

Fixes #58680

(cherry picked from commit 7f215b1380da49dccbf57da3040a40d25ed898f4)

5 months ago[clang-format] Fix a bug in aligning comments above PPDirective (#72791)
Owen Pan [Sun, 19 Nov 2023 22:59:53 +0000 (14:59 -0800)]
[clang-format] Fix a bug in aligning comments above PPDirective (#72791)

Fixed #72785.

(cherry picked from commit 5860d248a780aaef860db3d54184b49fc758c3c1)

5 months ago[clangd] Avoid null result in FindRecordTypeAt()
Nathan Ridge [Fri, 25 Aug 2023 15:16:04 +0000 (11:16 -0400)]
[clangd] Avoid null result in FindRecordTypeAt()

Fixes https://github.com/clangd/clangd/issues/1743

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

(cherry picked from commit 1994e1173b64b61c07f8acf107f29c2c015575b4)

5 months agoBump version to 17.0.6
Tobias Hieta [Mon, 20 Nov 2023 08:56:48 +0000 (09:56 +0100)]
Bump version to 17.0.6

5 months agoremove tests from bad merge
Utkarsh Saxena [Wed, 15 Nov 2023 12:21:09 +0000 (13:21 +0100)]
remove tests from bad merge

5 months agoUse the correct namespace for looking up matching operator!= (#68922)
Utkarsh Saxena [Mon, 23 Oct 2023 12:10:06 +0000 (14:10 +0200)]
Use the correct namespace for looking up matching operator!= (#68922)

`S.getScopeForContext` determins the **active** scope associated with
the given `declContext`.
This fails to find the matching `operator!=` if candidate `operator==`
was found via ADL since that scope is not active.

Instead, just directly lookup using the namespace decl of `operator==`

Fixes #68901

(cherry picked from commit 9330261143ccbe947ef0687fd20747ba47f26879)

5 months ago[libc++] Use correct size for deallocation of arrays in shared_ptr (#68233)
Ilya Biryukov [Thu, 5 Oct 2023 13:27:58 +0000 (15:27 +0200)]
[libc++] Use correct size for deallocation of arrays in shared_ptr (#68233)

Fixes #68051.

Current implementation passes the number of `_AlignedStorage` objects
when it calls to `allocate` and the number of **bytes** on `deallocate`.
This only applies to allocations that allocate control block and the
storage together, i.e. `make_shared` and `allocate_shared`.

Found by ASan under Clang combined with `-fsized-deallocation`.

(cherry picked from commit f722db02d359e29ca001b78197ee1a275f8c3d7c)

5 months agoRevert "Reland [clang] Canonicalize system headers in dependency file when -canonical...
Arthur Eubanks [Wed, 8 Nov 2023 19:43:35 +0000 (11:43 -0800)]
Revert "Reland [clang] Canonicalize system headers in dependency file when -canonical-prefixes" (#71697)

This reverts commit 578a4716f549167165a2ec3bac89c86706136d4e.

This causes multiple issues. Compile time slowdown due to more path
canonicalization, and weird behavior on Windows.

Will reland under a separate flag `-f[no-]canonical-system-headers` to
match gcc in the future and further limit when it's passed by default.

Fixes #70011.

5 months ago[clang][WebAssembly] Link crt1 even in case of -shared
YAMAMOTO Takashi [Mon, 14 Aug 2023 16:18:34 +0000 (09:18 -0700)]
[clang][WebAssembly] Link crt1 even in case of -shared

This allows -mexec-model=reactor -shared produces a library module
with _initialize entrypoint, which is preferrable over __wasm_call_ctors.

This partially reverts https://reviews.llvm.org/D153293

Discussion: https://github.com/dicej/component-linking-demo/issues/3

Reviewed By: sbc100

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

(cherry picked from commit 989ce069a4638fd561bebc95f478ca9e45154fec)

5 months ago[BranchFolding] Remove dubious assert from operator< (#71639)
Nikita Popov [Thu, 9 Nov 2023 09:23:10 +0000 (10:23 +0100)]
[BranchFolding] Remove dubious assert from operator< (#71639)

`MergePotentialElts::operator<` asserts that the two elements being
compared are not equal. However, sorting functions are allowed to invoke
the comparison function with equal arguments (though they usually don't
for efficiency reasons).

There is an existing special-case that disables the assert if
_GLIBCXX_DEBUG is used, which may invoke the comparator with equal args
to verify strict weak ordering. I believe libc++ also has strict weak
ordering checks under some options nowadays.

Recently, #71312 was reported, where a change to glibc's qsort_r
implementation can also result in comparison between equal elements.
From what I understood, this is an inefficiency that will be fixed on
the glibc side as well, but I think at this point we should just remove
this assertion.

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

(cherry picked from commit 74a76a288562c486f377121855ef7db0386e0e43)

5 months ago[GlobalOpt] Cache whether CC is changeable (#71381)
Nikita Popov [Tue, 7 Nov 2023 09:36:45 +0000 (10:36 +0100)]
[GlobalOpt] Cache whether CC is changeable (#71381)

The hasAddressTaken() call in hasOnlyColdCalls() has quadratic
complexity if there are many cold calls to a function: We're going to
visit each call of the function, and then for each of them iterate all
the users of the function.

We've recently encountered a case where GlobalOpt spends more than an
hour in these hasAddressTaken() checks when full LTO is used.

Avoid this by moving the hasAddressTaken() check into hasChangeableCC()
and caching its result, so it is only computed once per function.

(cherry picked from commit e360a16fee2dc3cb632ace556fb715832f488a90)

5 months ago[libc++] Fix UB in <expected> related to "has value" flag (#68552) (#68733)
Jan Kokemüller [Mon, 30 Oct 2023 18:56:03 +0000 (19:56 +0100)]
[libc++] Fix UB in <expected> related to "has value" flag (#68552) (#68733)

The calls to std::construct_at might overwrite the previously set
__has_value_ flag in the case where the flag is overlapping with
the actual value or error being stored (since we use [[no_unique_address]]).
To fix this issue, this patch ensures that we initialize the
__has_value_ flag after we call std::construct_at.

Fixes #68552

(cherry picked from commit 134c91595568ea1335b22e559f20c1a488ea270e)

5 months ago[clang] fix test PR69717.cpp (#72134)
antoine moynault [Mon, 13 Nov 2023 17:39:25 +0000 (18:39 +0100)]
[clang] fix test PR69717.cpp (#72134)

Test still fail on ARM machine (no float_control support)

(cherry picked from commit 5fdb70be7b0a1340a7ebdeb94ab073e466fc4aa6)

5 months ago[clang] Run test on x86 only
Serge Pavlov [Mon, 13 Nov 2023 12:16:29 +0000 (19:16 +0700)]
[clang] Run test on x86 only

The test Sema/PR69717.cpp fails on platforms that do not support
pragma float_control. So run this test on x86 only.

(cherry picked from commit 93ae26331592f41bf2b1d10b048743d80c468385)

5 months ago[clang] Do not clear FP pragma stack when instantiating functions (#70646)
Serge Pavlov [Mon, 13 Nov 2023 10:24:46 +0000 (17:24 +0700)]
[clang] Do not clear FP pragma stack when instantiating functions (#70646)

When instantiation function, a call to Sema::resetFPOption was used to
set the FP options associated with AST node. However this function also
cleared FP pragma stack, and it is incorrect. Template instantiation
takes place on AST representation and semantic information like the FP
pragma stack should not affect it. This was a reason for miscompilation
in some cases.

To make the Sema interface more consistent, now `resetFPOptions` does
not clear FP pragma stack anymore. It is cleared in
`FpPragmaStackSaveRAII`, which is used in parsing only.

This change must fix https://github.com/llvm/llvm-project/issues/69717
(Problems with float_control pragma stack in Clang 17.x).

(cherry picked from commit f6f625f4c6c3cbeb8cf6b889cdafc848dd4cb117)

5 months ago[SLP]Fix PR70004: Do not change insert point for reduction gather nodes.
Alexey Bataev [Tue, 24 Oct 2023 15:58:50 +0000 (08:58 -0700)]
[SLP]Fix PR70004: Do not change insert point for reduction gather nodes.

No need to change the insert point for reduction gather node, we can use
the ReductionRoot as insert point instead to avoid possible crashes.

(cherry picked from commit d79051f894129428ec36dedc6bbfdfdcc1bd0c17)

5 months ago[DAG] WidenVectorOperand - add basic handling for *_EXTEND_VECTOR_INREG nodes
Simon Pilgrim [Wed, 25 Oct 2023 15:52:00 +0000 (16:52 +0100)]
[DAG] WidenVectorOperand - add basic handling for *_EXTEND_VECTOR_INREG nodes

Fixes Issue #70208

(cherry picked from commit c9c9bf0f20fd820b86fac35113bbd8049ff4e72a)

5 months ago[Mips] In LowerShift*Parts, xor with bits-1 instead of -1. (#71149)
Craig Topper [Fri, 3 Nov 2023 17:08:00 +0000 (10:08 -0700)]
[Mips] In LowerShift*Parts, xor with bits-1 instead of -1. (#71149)

If we start with an i128 shift, the initial shift amount would usually
have zeros in bit 8 and above. xoring the shift amount with -1 will set
those upper bits to 1. If DAGCombiner is able to prove those bits are
now 1, then the shift that uses the xor will be replaced with undef.
Which we don't want.

Reduce the xor constant to VT.bits-1 where VT is half the size of the
larger shift type. This avoids toggling the upper bits. The hardware
shift instruction only uses the lower bits of the shift amount. I assume
the code used NOT because the hardware doesn't use the upper bits, but
that isn't compatible with the LLVM poison semantics.

Fixes #71142.

(cherry picked from commit 8d24d3900ec3f28902b2fad4a2c2c2b789257424)

5 months ago[clang-format] Correctly annotate keyword operator function name (#66904)
Owen Pan [Wed, 27 Sep 2023 20:12:55 +0000 (13:12 -0700)]
[clang-format] Correctly annotate keyword operator function name (#66904)

Fixes #66890.

(cherry picked from commit 67b99fa8ba638edddd5ce38b4d379eab8e339e4a)

5 months agoBump version to 17.0.5
Tobias Hieta [Mon, 13 Nov 2023 07:29:19 +0000 (08:29 +0100)]
Bump version to 17.0.5

5 months ago[Driver] Fix linking with -lm on Solaris (#65632)
Rainer Orth [Thu, 7 Sep 2023 17:14:55 +0000 (19:14 +0200)]
[Driver] Fix linking with -lm on Solaris (#65632)

As noticed in D158846, the Solaris driver deviates from other targets in
that it links every executable with `-lm`, but doesn't for shared
objects. For C code, this is unnecessary, while for C++ `libm` is always
needed, even for shared objects.

This patch fixes this by following the `Gnu.cpp` precedent. It adjusts
the `solaris-ld.c` test accordingly, adding some more tests.

Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and
`x86_64-pc-linux-gnu`.

(cherry picked from commit 1e6b0df3503567488e7df2d574c90f8f31a001a2)

5 months ago[clang-repl] Fix BUILD_SHARED_LIBS symbols from libclangInterpreter on MinGW (#71393)
Martin Storsjö [Tue, 7 Nov 2023 09:48:12 +0000 (11:48 +0200)]
[clang-repl] Fix BUILD_SHARED_LIBS symbols from libclangInterpreter on MinGW (#71393)

A few symbols within libclangInterpreter have got explicit dllexport
attributes, in order to make them exported (and thus visible at runtime)
in any build, not only when they are part of e.g. a DLL libclang-cpp,
but also when they are part of a plain .exe.

Due to the explicit dllexports, these symbols would sidestep the regular
MinGW logic of exporting all symbols if there are no dllexports.
Therefore, for libclang-cpp, a separate fix was made in
592e935e115ffb451eb9b782376711dab6558fe0, to pass --export-all-symbols
to the build of libclang-cpp.

If building with BUILD_SHARED_LIBS enabled, then the same issue appears
in libclangInterpreter; pass the same flag --export-all-symbols there as
well, to make sure all symbols are visible, not only the ones that are
explicitly marked as dllexport.

(cherry picked from commit 0d3eeac8c0f45410398a87f72ae38ea6ae1c3073)

5 months ago[CGExprConstant] stop calling into ConstExprEmitter for Reference type destinations...
Nick Desaulniers [Mon, 30 Oct 2023 15:48:31 +0000 (08:48 -0700)]
[CGExprConstant] stop calling into ConstExprEmitter for Reference type destinations (#70366)

Fixes a bug introduced by
commit b54294e2c959 ("[clang][ConstantEmitter] have
tryEmitPrivate[ForVarInit] try ConstExprEmitter fast-path first")

In the added test case, the QualType is a LValueReferenceType.

    LValueReferenceType 0x558412998d90 'const char (&)[41]'
    `-ParenType 0x558412998d30 'const char[41]' sugar
      `-ConstantArrayType 0x558412998cf0 'const char[41]' 41
        `-QualType 0x55841294c271 'const char' const
          `-BuiltinType 0x55841294c270 'char'

Fixes: #69979
(cherry picked from commit d9b15b068d19089f72fc0d7dc59ed1d6d77125dc)

6 months ago[AArch64][GlobalISel] Fix incorrect ABI when tail call not supported (#70215)
Nikita Popov [Mon, 30 Oct 2023 14:01:01 +0000 (15:01 +0100)]
[AArch64][GlobalISel] Fix incorrect ABI when tail call not supported (#70215)

The check for whether a tail call is supported calls
determineAssignments(), which may modify argument flags. As such, even
though the check fails and a non-tail call will be emitted, it will not
have a different (incorrect) ABI.

Fix this by operating on a separate copy of the arguments.

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

(cherry picked from commit 292f34b0d3cb2a04be5ebb85aaeb838b29f71323)

6 months ago[AArch64] Add test for #70207 (NFC)
Nikita Popov [Wed, 25 Oct 2023 13:43:02 +0000 (15:43 +0200)]
[AArch64] Add test for #70207 (NFC)

(cherry picked from commit d9cfb82207035fc7382ad02ec827c0dbed96565c)

6 months ago[GVN] Fix use-after-free in load PRE with select available value (#69314)
Nikita Popov [Thu, 19 Oct 2023 07:08:59 +0000 (09:08 +0200)]
[GVN] Fix use-after-free in load PRE with select available value (#69314)

replaceValuesPerBlockEntry() only handled simple and coerced load
values, however the load may also be referenced by a select value.

Additionally, I suspect that the previous code might have been incorrect
if a load had an offset, as it always constructed the AvailableValue
from scratch.

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

(cherry picked from commit 7f1733a252cbbad74445bd54dc95aeec52bb3199)

6 months ago[clang-tidy] Fix crash in modernize-use-trailing-return-type (#70709)
Piotr Zegar [Tue, 31 Oct 2023 05:52:40 +0000 (06:52 +0100)]
[clang-tidy] Fix crash in modernize-use-trailing-return-type (#70709)

Resolved the crash that occurred during the use of a user-defined
C-style string literal. The fix entails checking whether the identifier
is non-empty before attempting to read its name.

(cherry picked from commit a396fb247e0719f56a830a9e4aab0449be7f843a)

6 months ago[OpenMP] Fix building for 32-bit DragonFly, NetBSD, OpenBSD (#70527)
Brad Smith [Sat, 28 Oct 2023 02:53:24 +0000 (22:53 -0400)]
[OpenMP] Fix building for 32-bit DragonFly, NetBSD, OpenBSD (#70527)

Fixing ```#error "Unknown or unsupported OS"```

(cherry picked from commit 223852aecf3f01cea21c40ea128a26f6a194345d)

6 months ago[OpenMP] record-replay use static-cast (#70516)
Konstantinos Parasyris [Fri, 27 Oct 2023 23:46:34 +0000 (16:46 -0700)]
[OpenMP] record-replay use static-cast  (#70516)

[OpenMP] Fixes #69905

(cherry picked from commit 01828c4323172db5901ac3e959d52553b2bd74e5)

6 months ago[flang] Add comdats to functions with linkonce linkage (#66516)
David Truby [Tue, 19 Sep 2023 14:00:04 +0000 (15:00 +0100)]
[flang] Add comdats to functions with linkonce linkage (#66516)

This fixes a bug where functions generated by the MLIR Math dialect, for
example ipowi, would fail to link with link.exe on Windows due to having
linkonce linkage but no associated comdat. Adding the comdat on ELF also
allows linkers to perform better garbage collection in the binary.

Simply adding comdats to all functions with this linkage type should
also cover future cases where linkonce or linkonce_odr functions might
be necessary.

(cherry picked from commit 5f476b80e3d472f672f5f6a719eebe2c0aadf52c)

6 months ago[mlir] Add pass to add comdat to all linkonce functions (#65270)
David Truby [Wed, 13 Sep 2023 12:05:05 +0000 (13:05 +0100)]
[mlir] Add pass to add comdat to all linkonce functions (#65270)

This adds a new pass to add an Any comdat to each linkonce
and linkonce_odr function in the LLVM dialect. These comdats are
necessary on Windows
to allow the default system linker to link binaries containing these
functions.

(cherry picked from commit a6857156df9a73720fbd9633067d1a61c32dd74e)

6 months agoUpdate release note for the fix
Takuya Shimizu [Fri, 27 Oct 2023 09:15:47 +0000 (18:15 +0900)]
Update release note for the fix

6 months ago[clang][ExprConst] Fix crash on uninitialized array subobject (#67817)
Takuya Shimizu [Fri, 27 Oct 2023 05:11:27 +0000 (14:11 +0900)]
[clang][ExprConst] Fix crash on uninitialized array subobject (#67817)

https://reviews.llvm.org/D146358 was assuming that all subobjects have
their own name (`SubobjectDecl`), but it was not true for array
elements.

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

6 months ago[RISCV] Correct copyPhysReg for GPRPF64. (#70419)
Craig Topper [Fri, 27 Oct 2023 06:54:46 +0000 (23:54 -0700)]
[RISCV] Correct copyPhysReg for GPRPF64. (#70419)

GPRF64 represents a pair of registers. We were only copying the even
part. We need to copy the odd part too.

6 months ago[SVE] Fix incorrect offset calculation when rewriting an instruction's frame index...
Paul Walker [Fri, 27 Oct 2023 15:53:30 +0000 (16:53 +0100)]
[SVE] Fix incorrect offset calculation when rewriting an instruction's frame index. (#70315)

When partially packing an offset into an SVE load/store instruction we
are incorrectly calculating the remainder.

(cherry picked from commit 7c90be2857fc4c6a2e67f203ca289ed7773fae03)

6 months ago[MemCpyOpt] Combine alias metadatas when replacing byval arguments (#70580)
DianQK [Sun, 29 Oct 2023 08:07:55 +0000 (16:07 +0800)]
[MemCpyOpt] Combine alias metadatas when replacing byval arguments (#70580)

Fixes #70578.

(cherry picked from commit 0c4f326d8bc97a2fdb0533a68dbe1a7164da3911)

6 months ago[OpenMP] Use the more appropriate function to retrieve the thread id on OpenBSD ...
Brad Smith [Fri, 8 Sep 2023 01:05:25 +0000 (21:05 -0400)]
[OpenMP] Use the more appropriate function to retrieve the thread id on OpenBSD (#65553)

Use the getthrid() function instead of a syscall.

(cherry picked from commit 7e31b45d6a2571ff17426930dcbb784473a965b4)

6 months ago[libc++] Encode additional ODR-affecting properties in the ABI tag (#69669)
Louis Dionne [Thu, 26 Oct 2023 13:05:16 +0000 (09:05 -0400)]
[libc++] Encode additional ODR-affecting properties in the ABI tag (#69669)

As explained in `__config`, we have an ABI tag that we use to ensure
that we don't run into ODR issues when mixing different versions of
libc++ in multiple TUs. However, the reasoning behind that extends not
only to different versions of libc++, but also to different
configurations of the same version of libc++. In fact, we've been aware
of this for a while but never really bothered to make the change because
ODR issues are often thought to be benign.

Well, it turns out that I just spent over an hour banging my head
against an issue that boils down to our lack of encoding of some ODR
properties in the ABI tag, so here's the patch we should have done a
long time ago.

For now, the ODR properties we encode in the ABI tag are:
- library version
- exceptions vs no-exceptions
- hardening mode

Those are all things that we support different values for on a per-TU
basis and they definitely affect ODR in a meaningful way. We can add
more properties later as we see fit.

(cherry picked from commit bc792a284362696c91599f9ab01f74eda4b9108f)

6 months ago[AArch64] Prevent argument promotion of vector with size > 128 bits (#70034)
KAWASHIMA Takahiro [Thu, 26 Oct 2023 05:51:20 +0000 (14:51 +0900)]
[AArch64] Prevent argument promotion of vector with size > 128 bits (#70034)

This patch prevents argument promotion from promoting pointers to
fixed-length vector types larger than 128 bits like `<8 x float>` into
the values of the pointees.

Such vector types are used for SVE VLS but there is no ABI for SVE VLS
arguments and the backend cannot lower such value arguments.

Fixes #69147

(cherry picked from commit 926173c614784149889b2c975adccf52bcece75b)

6 months ago[LoongArch] Implement COPY instruction between CFRs (#69300)
wanglei [Thu, 19 Oct 2023 01:20:27 +0000 (09:20 +0800)]
[LoongArch] Implement COPY instruction between CFRs (#69300)

With this patch, all CFRs can be used for register allocation.

(cherry picked from commit 271087e3a0875672b26c185a28b3552d5600d2fb)

6 months agoRevert "[clang-format] Fix align consecutive declarations over function pointers"
Owen Pan [Tue, 24 Oct 2023 09:13:14 +0000 (02:13 -0700)]
Revert "[clang-format] Fix align consecutive declarations over function pointers"

This reverts commit a84e0b4bdc9999872adbdaafbade8164b197784b.

Fixes #68079.

(cherry picked from commit 7bc1031c474ebb2216a5432273dafe4d1490fbce)

6 months agoFix tests for c23 <-> c2x
Aaron Ballman [Wed, 25 Oct 2023 15:57:17 +0000 (11:57 -0400)]
Fix tests for c23 <-> c2x

6 months agoFix a c23 -> c2x think-o
Aaron Ballman [Wed, 25 Oct 2023 13:10:34 +0000 (09:10 -0400)]
Fix a c23 -> c2x think-o

6 months ago[C23] Use thread_local semantics (#70107)
Aaron Ballman [Wed, 25 Oct 2023 11:51:28 +0000 (07:51 -0400)]
[C23] Use thread_local semantics (#70107)

When implementing thread_local as a keyword in C23, we accidentally
started using C++11 thread_local semantics when using that keyword
instead of using C11 _Thread_local semantics.

This oversight is fixed by pretending the user wrote _Thread_local
instead. This doesn't have the best behavior in terms of diagnostics,
but it does correct the semantic behavior.

Fixes https://github.com/llvm/llvm-project/issues/70068
Fixes https://github.com/llvm/llvm-project/issues/69167

6 months ago[clangd] Disable crashy unchecked-optional-access tidy check (#69427)
kadir çetinkaya [Thu, 19 Oct 2023 07:24:22 +0000 (09:24 +0200)]
[clangd] Disable crashy unchecked-optional-access tidy check (#69427)

Fixes https://github.com/llvm/llvm-project/issues/69369.
Fixes https://github.com/clangd/clangd/issues/1700.

(cherry picked from commit e63ab13c82e78f65baca48d5b5e4f6ea8d55dbc7)

6 months ago[ConstraintElim] Don't decompose values wider than 64 bits (#68803)
Nikita Popov [Mon, 16 Oct 2023 10:03:49 +0000 (12:03 +0200)]
[ConstraintElim] Don't decompose values wider than 64 bits (#68803)

Our coefficients are 64-bits, so adding/multiplying them can wrap in
64-bits even if there would be no wrapping the full bit width.

The alternative would be to check for overflows during all adds/muls in
decomposition. I assume that we don't particularly care about handling
wide integers here, so I've opted to bail out.

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

(cherry picked from commit 1d43096e16ff7288c7feac1ae81fd4f745ce10bb)

6 months ago[ConstraintElim] Add test for #68751 (NFC)
Nikita Popov [Wed, 11 Oct 2023 13:52:18 +0000 (15:52 +0200)]
[ConstraintElim] Add test for #68751 (NFC)

(cherry picked from commit 2b74db6c9bff757ce016d62a7086617e2b9e43b3)

6 months ago[mlir] Avoid including <alloca.h> on DragonFly
Brad Smith [Sat, 21 Oct 2023 05:18:36 +0000 (01:18 -0400)]
[mlir] Avoid including <alloca.h> on DragonFly

(cherry picked from commit a157a82b1e7a8d4be34cc862db4b42fa9db363d0)

6 months ago[LVI][CVP] Treat undef like a full range on abs(x, false) (#68711)
DianQK [Sun, 15 Oct 2023 22:25:23 +0000 (06:25 +0800)]
[LVI][CVP] Treat undef like a full range on abs(x, false) (#68711)

Fixes #68682.

(cherry picked from commit 2ad9a658005e6a4204d7ee617c3949632a707aa5)

6 months ago[libcxx] [test] Add a test parameter for disabling memory intensive tests (#68214)
Martin Storsjö [Tue, 17 Oct 2023 19:49:52 +0000 (22:49 +0300)]
[libcxx] [test] Add a test parameter for disabling memory intensive tests (#68214)

Specifically, the test std/input.output/string.streams/stringstream/stringstream.members/gcount.pass.cpp
allocates a std::string with INT_MAX-1 elements, and then writes this to
a std::stringstream. On Linux, running this test consumes around 5.0 GB
of memory; on Windows, it ends up using up to 6.8 GB of memory.

This limits whether such tests can run on e.g. GitHub Actions runners,
where the free runners are limited to 8 GB of memory.

This is somewhat similar to, but still notably different, from the
existing test parameter long_tests.

(cherry picked from commit 122064a6303eb9c06e0af231f5a4ce145d9a2e67)

6 months agoworkflows/release-tasks: Fix release note artifact upload (#69522)
Tom Stellard [Thu, 19 Oct 2023 21:02:23 +0000 (14:02 -0700)]
workflows/release-tasks: Fix release note artifact upload (#69522)

(cherry picked from commit afdad4fd402d1e8917375960df7104bc16f4cba9)

6 months agoBump version to 17.0.4
Tobias Hieta [Mon, 23 Oct 2023 07:39:40 +0000 (09:39 +0200)]
Bump version to 17.0.4

6 months agoworkflows/release-lit: Pass correct build directory to pypa/gh-action-pypi-publish...
Tom Stellard [Wed, 18 Oct 2023 21:02:05 +0000 (14:02 -0700)]
workflows/release-lit: Pass correct build directory to pypa/gh-action-pypi-publish (#69438)

(cherry picked from commit 1db8abf21a7c025d850624b487b5b792c562094e)

6 months agoworkflows/release-lit: Fix dev suffix removal (#69397)
Tom Stellard [Wed, 18 Oct 2023 21:01:53 +0000 (14:01 -0700)]
workflows/release-lit: Fix dev suffix removal (#69397)

This was broken by b71edfaa4ec3c998aadb35255ce2f60bba2940b0.

(cherry picked from commit 6a7f0b9d9fb533abeb14a7b5af03205688b3786a)

6 months ago[asan] Ensure __asan_register_elf_globals is called in COMDAT asan.module_ctor (...
Fangrui Song [Wed, 11 Oct 2023 16:23:56 +0000 (09:23 -0700)]
[asan] Ensure __asan_register_elf_globals is called in COMDAT asan.module_ctor (#67745)

On ELF platforms, when there is no global variable and the unique module ID is
non-empty, COMDAT asan.module_ctor is created with no
`__asan_register_elf_globals` calls. If this COMDAT is the prevailing copy
selected by the linker, the linkage unit will have no
`__asan_register_elf_globals` call: the redzone will not be poisoned and ODR
violation checker will not work (#67677).

This behavior is benign for -fno-sanitize-address-globals-dead-stripping because
asan.module_ctor functions that call `__asan_register_globals`
(`InstrumentGlobalsWithMetadataArray`) do not use COMDAT.

To fix #67677:

* Use COMDAT for -fsanitize-address-globals-dead-stripping on ELF platforms.
* Call `__asan_register_elf_globals` even if there is no global variable.
* If the unique module ID is empty, don't call SetComdatForGlobalMetadata:
  placing `@.str` in a COMDAT would incorrectly discard internal COMDAT `@.str`
  in other compile units.

Alternatively, when there is no global variable, asan.module_ctor is not COMDAT
and does not call `__asan_register_elf_globals`. However, the asan.module_ctor
function cannot be eliminated by the linker.

Tested the following script. Only ELF -fsanitize-address-globals-dead-stripping has changed behaviors.
```
echo > a.cc  # no global variable, empty uniqueModuleId
echo 'void f() {}' > b.cc  # with global variable, with uniqueModuleId
echo 'int g;' > c.cc  # with global variable
for t in x86_64-linux-gnu arm64-apple-macosx x86_64-windows-msvc; do
  for gc in -f{,no-}sanitize-address-globals-dead-stripping; do
    for f in a.cc b.cc c.cc; do
      echo /tmp/Rel/bin/clang -S --target=$t -fsanitize=address $gc $f -o -
      /tmp/Rel/bin/clang -S --target=$t -fsanitize=address $gc $f -o - | sed -n '/asan.module_ctor/,/ret/p'
    done
  done
done
```

---

Identical to commit 16eed8c906875e748c3cb610f3dc4b875f3882aa.
6420d3301cd4f0793adcf11f59e8398db73737d8 is an incorrect revert for genuine
purely internal issues.

6 months ago[clang-format][doc] Update the Linux kernel coding style URL
Owen Pan [Thu, 5 Oct 2023 08:12:27 +0000 (01:12 -0700)]
[clang-format][doc] Update the Linux kernel coding style URL

(cherry picked from commit 8902f12e61aa2d3053ad4d536e36569fc8bc9512)

6 months ago[clang-format] Fix a serious bug in git-clang-format (#65723)
Owen Pan [Fri, 8 Sep 2023 22:05:22 +0000 (15:05 -0700)]
[clang-format] Fix a serious bug in git-clang-format (#65723)

When applying format changes to staged files, git-clang-format
erroneously checks out all files in the index and thus may overwrite
unstaged changes.

Fixes #65643.

(cherry picked from commit 743659be87daff4cc8861c525d4a6229d787ef14)

6 months ago[LSan] Mark create_thread_leak.cpp as UNSUPPORTED: darwin.
Artem Dergachev [Thu, 31 Aug 2023 23:36:38 +0000 (16:36 -0700)]
[LSan] Mark create_thread_leak.cpp as UNSUPPORTED: darwin.

It started to fail in a flaky manner a few days ago on GreenDragon buildbots
(i.e. x86_64-darwin). I didn't track down the root cause but LSan isn't
actually supported on darwin anyway, so UNSUPPORTED seems appropriate.

Prior art: 3ff080b5.

(cherry picked from commit 0a3519d5a27b9400250b5f6656b50148021e7496)

6 months ago[PowerPC] Use zext instead of anyext in custom and combine (#68784)
Nikita Popov [Thu, 12 Oct 2023 07:32:17 +0000 (09:32 +0200)]
[PowerPC] Use zext instead of anyext in custom and combine (#68784)

This custom combine currently converts `and(anyext(x),c)` into
`anyext(and(x,c))`. This is not correct, because the original expression
guaranteed that the high bits are zero, while the new one sets them to
undef.

Emit `zext(and(x,c))` instead.

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

(cherry picked from commit 127ed9ae266ead58aa525f74f4c86841f6674793)

6 months ago[PowerPC] Add test for #68783 (NFC)
Nikita Popov [Wed, 11 Oct 2023 10:14:31 +0000 (12:14 +0200)]
[PowerPC] Add test for #68783 (NFC)

(cherry picked from commit 0ead1faef0bfaea499c3b2d13ab417f6bf3f67e1)

6 months ago[clang-format] Fix a bug in RemoveParentheses: ReturnStatement (#67911)
Owen Pan [Mon, 2 Oct 2023 07:15:49 +0000 (00:15 -0700)]
[clang-format] Fix a bug in RemoveParentheses: ReturnStatement (#67911)

Don't remove the outermost parentheses surrounding a return statement
expression when inside a function/lambda that has the decltype(auto)
return type.

Fixed #67892.

(cherry picked from commit 75441a684273268ce91036aa2c770e669d39f501)

6 months ago[X86] Fix logic for optimizing movmsk(bitcast(shuffle(x))); PR67287
Noah Goldstein [Sun, 8 Oct 2023 16:40:15 +0000 (11:40 -0500)]
[X86] Fix logic for optimizing movmsk(bitcast(shuffle(x))); PR67287

Prior logic would remove the shuffle iff all of the elements in `x`
where used. This is incorrect.

The issue is `movmsk` only cares about the highbits, so if the width
of the elements in `x` is smaller than the width of the elements
for the `movmsk`, then the shuffle, even if it preserves all the elements,
may change which ones are used by the highbits.

For example:
`movmsk64(bitcast(shuffle32(x, (1,0,3,2))))`

Even though the shuffle mask `(1,0,3,2)` preserves all the elements, it
flips which will be relevant to the `movmsk64` (x[1] and x[3]
before and x[0] and x[2] after).

The fix here, is to ensure that the shuffle mask can be scaled to the
element width of the `movmsk` instruction. This ensure that the
"high" elements stay "high". This is overly conservative as it
misses cases like `(1,1,3,3)` where the "high" elements stay
intact despite not be scalable, but for an relatively edge-case
optimization that should generally be handled during
simplifyDemandedBits, it seems okay.

(cherry picked from commit 1684c65bc997a8ce0ecf96a493784fe39def75de)

6 months ago[X86] Add tests for incorrectly optimizing out shuffle used in `movmsk`; PR67287
Noah Goldstein [Fri, 6 Oct 2023 00:54:57 +0000 (19:54 -0500)]
[X86] Add tests for incorrectly optimizing out shuffle used in `movmsk`; PR67287

(cherry picked from commit 65a576e27be814bd23f39b31a8074e9850b0fe26)

6 months ago[clang] [MinGW] Explicitly always pass the -fno-use-init-array (#68571)
Martin Storsjö [Tue, 10 Oct 2023 06:55:56 +0000 (09:55 +0300)]
[clang] [MinGW] Explicitly always pass the -fno-use-init-array (#68571)

On MinGW targets, the .ctors section is always used for constructors.

When using the .ctors section, the constructors need to be emitted in
reverse order to get them execute in the right order. (Constructors with
a specific priority are sorted separately by the linker later.) In LLVM,
in CodeGen/AsmPrinter/AsmPrinter.cpp, there's code that reverses them
before writing them out, executed when using the .ctors section. This
logic is done whenever TM.Options.UseInitArray is set to false. Thus,
make sure to set UseInitArray to false for this target.

This fixes https://github.com/llvm/llvm-project/issues/55938.

(cherry picked from commit a2b8c49c1839076b540c542c024fcfe2361a3e47)

6 months ago[LVI][CVP] Treat undef like a full range (#68190)
DianQK [Tue, 10 Oct 2023 08:03:24 +0000 (16:03 +0800)]
[LVI][CVP] Treat undef like a full range (#68190)

When converting to ConstantRange, we should treat undef like a full range.
Fixes #68381.

(cherry picked from commit 81857940f278e21f7957a2833d4b6ec72819e79f)

6 months ago[X86] combineConcatVectorOps - only concatenate single-use subops
Simon Pilgrim [Sun, 1 Oct 2023 13:27:55 +0000 (14:27 +0100)]
[X86] combineConcatVectorOps - only concatenate single-use subops

We could maybe extend this by allowing the lowest subop to have multiple uses and extract the lowest subvector result of the concatenated op, but let's just get the fix in first.

Fixes #67333

6 months agoBump version to 17.0.3
Tobias Hieta [Tue, 10 Oct 2023 06:47:40 +0000 (08:47 +0200)]
Bump version to 17.0.3

6 months ago[clang] Correct behavior of `LLVM_UNREACHABLE_OPTIMIZE=OFF` for `Release` builds...
Arvind Mukund [Thu, 5 Oct 2023 19:01:56 +0000 (12:01 -0700)]
[clang] Correct behavior of `LLVM_UNREACHABLE_OPTIMIZE=OFF` for `Release` builds (#68284)

```c++
AArch64SVEPcsAttr *AArch64SVEPcsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
  AttributeCommonInfo I(Range, NoSemaHandlerAttribute, (
    S == GNU_aarch64_sve_pcs ? AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/} :
    S == CXX11_clang_aarch64_sve_pcs ? AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/} :
    S == C23_clang_aarch64_sve_pcs ? AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/} :
    (llvm_unreachable("Unknown attribute spelling!"),  AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/})));
  return CreateImplicit(Ctx, I);
}
```

```c++
AArch64SVEPcsAttr *AArch64SVEPcsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) {
  AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() {
    switch (S) {
    case GNU_aarch64_sve_pcs:
      return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
    case CXX11_clang_aarch64_sve_pcs:
      return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
    case C23_clang_aarch64_sve_pcs:
      return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
    default:
      llvm_unreachable("Unknown attribute spelling!");
      return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/};
    }
  }());
  return CreateImplicit(Ctx, I);
}
```

Fixes https://github.com/llvm/llvm-project/issues/68237
Conflicts:
clang/docs/ReleaseNotes.rst

6 months ago[LLD] [COFF] Fix handling of comdat .drectve sections (#68116)
Martin Storsjö [Wed, 4 Oct 2023 07:54:50 +0000 (10:54 +0300)]
[LLD] [COFF] Fix handling of comdat .drectve sections (#68116)

This can happen when manually emitting strings into .drectve sections
with `__attribute__((section(".drectve")))`, which is a way to emulate
`#pragma comment(linker, "...")` for mingw compilers, without requiring
building with -fms-extensions.

Normally, this doesn't generate any comdat, but if compiled with
-fsanitize=address, this section does get turned into a comdat section.

This fixes #67261. This issue can be seen as a regression; a change in
the "lli" tool in 17.x triggers this case, if compiled with ASAN
enabled, triggering this unsupported corner case in LLD. With this
change, LLD can handle it.

(cherry picked from commit 503bc5f66111f7e4fc79972bb9bfec8bb5606bab)

6 months agoworkflows/release-binaries: Use more cores to avoid the 6 hour timeout (#67874)
Tom Stellard [Tue, 3 Oct 2023 18:40:41 +0000 (11:40 -0700)]
workflows/release-binaries: Use more cores to avoid the 6 hour timeout (#67874)

(cherry picked from commit 95b2c6b3d6dc5f8b6ee5eb4f8dbc96dea0f50cac)

6 months ago[AArch64] Disable loop alignment for Windows targets (#67894)
Martin Storsjö [Mon, 2 Oct 2023 20:55:23 +0000 (23:55 +0300)]
[AArch64] Disable loop alignment for Windows targets (#67894)

This should fix #66912. When emitting SEH unwind info, we need to be
able to calculate the exact length of functions before alignments are
fixed. Until that limitation is overcome, just disable all loop
alignment on Windows targets.

(cherry picked from commit 6ae36c012728a274a78a771e4506681732f85a6d)

6 months ago[Sema] Use underlying type of scoped enum for -Wformat diagnostics (#67378)
Shoaib Meenai [Mon, 2 Oct 2023 18:32:54 +0000 (11:32 -0700)]
[Sema] Use underlying type of scoped enum for -Wformat diagnostics (#67378)

Right now, `-Wformat` for a scoped enum will suggest a cast based on the
format specifier being used. This can lead to incorrect results, e.g.
attempting to format a scoped enum with `%s` would suggest casting to
`char *` instead of fixing the specifier. Change the logic to treat the
scoped enum's underlying type as the intended type to be printed, and
suggest format specifier changes and casts based on that.

(cherry picked from commit 0b07b06effe5fdf779b75bb5ac6cf15e477cb0be)

7 months agoFix release/export.sh to export runtimes tarball, too (#67404)
René Rebe [Thu, 28 Sep 2023 14:37:24 +0000 (16:37 +0200)]
Fix release/export.sh to export runtimes tarball, too (#67404)

This addresses missing cmake files needed to build some sub-projects
like libstdcxx.

Co-authored-by: René Rebe <rene@exactcode.de>
7 months ago[libc++] Fix `std::pair`'s pair-like constructor's incorrect assumption (#66585)
Hui [Mon, 18 Sep 2023 18:01:19 +0000 (19:01 +0100)]
[libc++] Fix `std::pair`'s  pair-like constructor's incorrect assumption (#66585)

The helper function `__pair_like_explicit_wknd` is only SFINAE-ed with
`tuple_size<remove_cvref_t<_PairLike>>::value == 2`, but its function
body assumes `std::get` being valid.

Fixes #65620

(cherry picked from commit 054f9c55c6b4520d3feb8b4354b9b942026b5124)