Skip to content

Commit b5cf661

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:7c44167daa75 into amd-gfx:294af0383f6c
Local branch amd-gfx 294af03 Merged main:84a20989c6f7 into amd-gfx:c2653d726cd0 Remote branch main 7c44167 [libc++] Updates mdspan synopsis,
2 parents 294af03 + 7c44167 commit b5cf661

File tree

12 files changed

+159
-117
lines changed

12 files changed

+159
-117
lines changed

libcxx/docs/ReleaseNotes/18.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Implemented Papers
5252
- P0020R6 - Floating Point Atomic
5353
- P2918R2 - Runtime format strings II
5454
- P2871R3 - Remove Deprecated Unicode Conversion Facets from C++26
55+
- P2870R3 - Remove basic_string::reserve()
5556

5657

5758
Improvements and New Features
@@ -75,6 +76,9 @@ Improvements and New Features
7576
- The ``_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT`` macro has been added to make
7677
the declarations in ``<codecvt>`` available.
7778

79+
- The ``_LIBCPP_ENABLE_CXX26_REMOVED_STRING_RESERVE`` macro has been added to make
80+
the function ``std::basic_string<...>::reserve()`` available.
81+
7882

7983
Deprecations and Removals
8084
-------------------------
@@ -140,7 +144,7 @@ ABI Affecting Changes
140144
---------------------
141145

142146
- The symbol of a non-visible function part of ``std::system_error`` was removed.
143-
This is not a breaking change as the private function ``__init`` was never referenced internally outside of the dylib
147+
This is not a breaking change as the private function ``__init`` was never referenced internally outside of the dylib.
144148

145149
- This release of libc++ added missing visibility annotations on some types in the library. Users compiling with
146150
``-fvisbility=hidden`` may notice that additional type infos from libc++ are being exported from their ABI. This is
@@ -155,7 +159,7 @@ ABI Affecting Changes
155159
extremely rare. Any error resulting from this change should result in a link-time error.
156160

157161
- Under the unstable ABI, the internal alignment requirements for heap allocations
158-
inside ``std::string`` has decreased from 16 to 8 This save memory since string requests fewer additional
162+
inside ``std::string`` has decreased from 16 to 8. This saves memory since string requests fewer additional
159163
bytes than it did previously. However, this also changes the return value of ``std::string::max_size``
160164
and can cause code compiled against older libc++ versions but linked at runtime to a new version
161165
to throw a different exception when attempting allocations that are too large

libcxx/docs/Status/Cxx2cPapers.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"`P2447R6 <https://wg21.link/P2447R6>`__","LWG","``std::span`` over an initializer list","Kona November 2023","","",""
3838
"`P2821R5 <https://wg21.link/P2821R5>`__","LWG","``span.at()``","Kona November 2023","","",""
3939
"`P2868R3 <https://wg21.link/P2868R3>`__","LWG","Remove Deprecated ``std::allocator`` Typedef From C++26","Kona November 2023","","",""
40-
"`P2870R3 <https://wg21.link/P2870R3>`__","LWG","Remove ``basic_string::reserve()`` From C++26","Kona November 2023","","",""
40+
"`P2870R3 <https://wg21.link/P2870R3>`__","LWG","Remove ``basic_string::reserve()`` From C++26","Kona November 2023","|Complete|","18.0",""
4141
"`P2871R3 <https://wg21.link/P2871R3>`__","LWG","Remove Deprecated Unicode Conversion Facets from C++26","Kona November 2023","|Complete|","18.0",""
4242
"`P2819R2 <https://wg21.link/P2819R2>`__","LWG","Add tuple protocol to complex","Kona November 2023","","",""
4343
"`P2937R0 <https://wg21.link/P2937R0>`__","LWG","Freestanding: Remove ``strtok``","Kona November 2023","","",""

libcxx/docs/UsingLibcxx.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,9 @@ C++26 Specific Configuration Macros
335335
**_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT**:
336336
This macro is used to re-enable all named declarations in ``<codecvt>``.
337337

338+
**_LIBCPP_ENABLE_CXX26_REMOVED_STRING_RESERVE**
339+
This macro is used to re-enable the function
340+
``std::basic_string<...>::reserve()``.
338341

339342
Libc++ Extensions
340343
=================

libcxx/include/mdspan

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace std {
2323
// [mdspan.layout], layout mapping
2424
struct layout_left;
2525
struct layout_right;
26-
struct layout_stride; // not implemented yet
26+
struct layout_stride;
2727
2828
// [mdspan.accessor.default], class template default_accessor
2929
template<class ElementType>

libcxx/include/string

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public:
173173
constexpr void resize_and_overwrite(size_type n, Operation op); // since C++23
174174
175175
void reserve(size_type res_arg); // constexpr since C++20
176-
void reserve(); // deprecated in C++20
176+
void reserve(); // deprecated in C++20, removed in C++26
177177
void shrink_to_fit(); // constexpr since C++20
178178
void clear() noexcept; // constexpr since C++20
179179
bool empty() const noexcept; // constexpr since C++20
@@ -1187,7 +1187,9 @@ public:
11871187

11881188
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __resize_default_init(size_type __n);
11891189

1190+
#if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_STRING_RESERVE)
11901191
_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve() _NOEXCEPT { shrink_to_fit(); }
1192+
#endif
11911193
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void shrink_to_fit() _NOEXCEPT;
11921194
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void clear() _NOEXCEPT;
11931195

libcxx/test/libcxx/strings/basic.string/string.capacity/PR53170.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// void reserve(); // Deprecated in C++20.
1212
// void reserve(size_type);
1313

14-
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
14+
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_STRING_RESERVE
1515

1616
// This test ensures that libc++ implements https://wg21.link/P0966R1 (reserve never shrinks)
1717
// even before C++20. This is required in order to avoid ODR violations because basic_string::reserve(size)

libcxx/test/std/strings/basic.string/string.capacity/reserve.deprecated_in_cxx20.verify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// void reserve(); // Deprecated in C++20
1212

13-
// UNSUPPORTED: c++03, c++11, c++14, c++17
13+
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++26
1414

1515
#include <string>
1616

libcxx/test/std/strings/basic.string/string.capacity/reserve.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
// <string>
1010

11-
// void reserve(); // Deprecated in C++20.
11+
// void reserve(); // Deprecated in C++20, removed in C++26.
1212

13-
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
13+
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_STRING_RESERVE
1414

1515
#include <string>
1616
#include <stdexcept>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// <string>
10+
11+
// void reserve(); // Removed in C++26
12+
13+
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
14+
15+
#include <string>
16+
17+
void f() {
18+
std::string s;
19+
s.reserve(); // expected-error {{too few arguments to function call}}
20+
}

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 481709
19+
#define LLVM_MAIN_REVISION 481714
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 98 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,8 @@ static bool ShouldUpgradeX86Intrinsic(Function *F, StringRef Name) {
486486
static bool UpgradeX86IntrinsicFunction(Function *F, StringRef Name,
487487
Function *&NewFn) {
488488
// Only handle intrinsics that start with "x86.".
489-
if (!Name.starts_with("x86."))
489+
if (!Name.consume_front("x86."))
490490
return false;
491-
// Remove "x86." prefix.
492-
Name = Name.substr(4);
493491

494492
if (ShouldUpgradeX86Intrinsic(F, Name)) {
495493
NewFn = nullptr;
@@ -507,113 +505,112 @@ static bool UpgradeX86IntrinsicFunction(Function *F, StringRef Name,
507505
return true;
508506
}
509507

508+
Intrinsic::ID ID;
509+
510510
// SSE4.1 ptest functions may have an old signature.
511-
if (Name.starts_with("sse41.ptest")) { // Added in 3.2
512-
if (Name.substr(11) == "c")
513-
return UpgradePTESTIntrinsic(F, Intrinsic::x86_sse41_ptestc, NewFn);
514-
if (Name.substr(11) == "z")
515-
return UpgradePTESTIntrinsic(F, Intrinsic::x86_sse41_ptestz, NewFn);
516-
if (Name.substr(11) == "nzc")
517-
return UpgradePTESTIntrinsic(F, Intrinsic::x86_sse41_ptestnzc, NewFn);
511+
if (Name.consume_front("sse41.ptest")) { // Added in 3.2
512+
ID = StringSwitch<Intrinsic::ID>(Name)
513+
.Case("c", Intrinsic::x86_sse41_ptestc)
514+
.Case("z", Intrinsic::x86_sse41_ptestz)
515+
.Case("nzc", Intrinsic::x86_sse41_ptestnzc)
516+
.Default(Intrinsic::not_intrinsic);
517+
if (ID != Intrinsic::not_intrinsic)
518+
return UpgradePTESTIntrinsic(F, ID, NewFn);
519+
520+
return false;
518521
}
522+
519523
// Several blend and other instructions with masks used the wrong number of
520524
// bits.
521-
if (Name == "sse41.insertps") // Added in 3.6
522-
return UpgradeX86IntrinsicsWith8BitMask(F, Intrinsic::x86_sse41_insertps,
523-
NewFn);
524-
if (Name == "sse41.dppd") // Added in 3.6
525-
return UpgradeX86IntrinsicsWith8BitMask(F, Intrinsic::x86_sse41_dppd,
526-
NewFn);
527-
if (Name == "sse41.dpps") // Added in 3.6
528-
return UpgradeX86IntrinsicsWith8BitMask(F, Intrinsic::x86_sse41_dpps,
529-
NewFn);
530-
if (Name == "sse41.mpsadbw") // Added in 3.6
531-
return UpgradeX86IntrinsicsWith8BitMask(F, Intrinsic::x86_sse41_mpsadbw,
532-
NewFn);
533-
if (Name == "avx.dp.ps.256") // Added in 3.6
534-
return UpgradeX86IntrinsicsWith8BitMask(F, Intrinsic::x86_avx_dp_ps_256,
535-
NewFn);
536-
if (Name == "avx2.mpsadbw") // Added in 3.6
537-
return UpgradeX86IntrinsicsWith8BitMask(F, Intrinsic::x86_avx2_mpsadbw,
538-
NewFn);
539-
if (Name == "avx512.mask.cmp.pd.128") // Added in 7.0
540-
return UpgradeX86MaskedFPCompare(F, Intrinsic::x86_avx512_mask_cmp_pd_128,
541-
NewFn);
542-
if (Name == "avx512.mask.cmp.pd.256") // Added in 7.0
543-
return UpgradeX86MaskedFPCompare(F, Intrinsic::x86_avx512_mask_cmp_pd_256,
544-
NewFn);
545-
if (Name == "avx512.mask.cmp.pd.512") // Added in 7.0
546-
return UpgradeX86MaskedFPCompare(F, Intrinsic::x86_avx512_mask_cmp_pd_512,
547-
NewFn);
548-
if (Name == "avx512.mask.cmp.ps.128") // Added in 7.0
549-
return UpgradeX86MaskedFPCompare(F, Intrinsic::x86_avx512_mask_cmp_ps_128,
550-
NewFn);
551-
if (Name == "avx512.mask.cmp.ps.256") // Added in 7.0
552-
return UpgradeX86MaskedFPCompare(F, Intrinsic::x86_avx512_mask_cmp_ps_256,
553-
NewFn);
554-
if (Name == "avx512.mask.cmp.ps.512") // Added in 7.0
555-
return UpgradeX86MaskedFPCompare(F, Intrinsic::x86_avx512_mask_cmp_ps_512,
556-
NewFn);
557-
if (Name == "avx512bf16.cvtne2ps2bf16.128") // Added in 9.0
558-
return UpgradeX86BF16Intrinsic(
559-
F, Intrinsic::x86_avx512bf16_cvtne2ps2bf16_128, NewFn);
560-
if (Name == "avx512bf16.cvtne2ps2bf16.256") // Added in 9.0
561-
return UpgradeX86BF16Intrinsic(
562-
F, Intrinsic::x86_avx512bf16_cvtne2ps2bf16_256, NewFn);
563-
if (Name == "avx512bf16.cvtne2ps2bf16.512") // Added in 9.0
564-
return UpgradeX86BF16Intrinsic(
565-
F, Intrinsic::x86_avx512bf16_cvtne2ps2bf16_512, NewFn);
566-
if (Name == "avx512bf16.mask.cvtneps2bf16.128") // Added in 9.0
567-
return UpgradeX86BF16Intrinsic(
568-
F, Intrinsic::x86_avx512bf16_mask_cvtneps2bf16_128, NewFn);
569-
if (Name == "avx512bf16.cvtneps2bf16.256") // Added in 9.0
570-
return UpgradeX86BF16Intrinsic(
571-
F, Intrinsic::x86_avx512bf16_cvtneps2bf16_256, NewFn);
572-
if (Name == "avx512bf16.cvtneps2bf16.512") // Added in 9.0
573-
return UpgradeX86BF16Intrinsic(
574-
F, Intrinsic::x86_avx512bf16_cvtneps2bf16_512, NewFn);
575-
if (Name == "avx512bf16.dpbf16ps.128") // Added in 9.0
576-
return UpgradeX86BF16DPIntrinsic(
577-
F, Intrinsic::x86_avx512bf16_dpbf16ps_128, NewFn);
578-
if (Name == "avx512bf16.dpbf16ps.256") // Added in 9.0
579-
return UpgradeX86BF16DPIntrinsic(
580-
F, Intrinsic::x86_avx512bf16_dpbf16ps_256, NewFn);
581-
if (Name == "avx512bf16.dpbf16ps.512") // Added in 9.0
582-
return UpgradeX86BF16DPIntrinsic(
583-
F, Intrinsic::x86_avx512bf16_dpbf16ps_512, NewFn);
584-
585-
// frcz.ss/sd may need to have an argument dropped. Added in 3.2
586-
if (Name.starts_with("xop.vfrcz.ss") && F->arg_size() == 2) {
587-
rename(F);
588-
NewFn = Intrinsic::getDeclaration(F->getParent(),
589-
Intrinsic::x86_xop_vfrcz_ss);
590-
return true;
525+
526+
// Added in 3.6
527+
ID = StringSwitch<Intrinsic::ID>(Name)
528+
.Case("sse41.insertps", Intrinsic::x86_sse41_insertps)
529+
.Case("sse41.dppd", Intrinsic::x86_sse41_dppd)
530+
.Case("sse41.dpps", Intrinsic::x86_sse41_dpps)
531+
.Case("sse41.mpsadbw", Intrinsic::x86_sse41_mpsadbw)
532+
.Case("avx.dp.ps.256", Intrinsic::x86_avx_dp_ps_256)
533+
.Case("avx2.mpsadbw", Intrinsic::x86_avx2_mpsadbw)
534+
.Default(Intrinsic::not_intrinsic);
535+
if (ID != Intrinsic::not_intrinsic)
536+
return UpgradeX86IntrinsicsWith8BitMask(F, ID, NewFn);
537+
538+
if (Name.consume_front("avx512.mask.cmp.")) {
539+
// Added in 7.0
540+
ID = StringSwitch<Intrinsic::ID>(Name)
541+
.Case("pd.128", Intrinsic::x86_avx512_mask_cmp_pd_128)
542+
.Case("pd.256", Intrinsic::x86_avx512_mask_cmp_pd_256)
543+
.Case("pd.512", Intrinsic::x86_avx512_mask_cmp_pd_512)
544+
.Case("ps.128", Intrinsic::x86_avx512_mask_cmp_ps_128)
545+
.Case("ps.256", Intrinsic::x86_avx512_mask_cmp_ps_256)
546+
.Case("ps.512", Intrinsic::x86_avx512_mask_cmp_ps_512)
547+
.Default(Intrinsic::not_intrinsic);
548+
if (ID != Intrinsic::not_intrinsic)
549+
return UpgradeX86MaskedFPCompare(F, ID, NewFn);
550+
return false; // No other 'x86.avx523.mask.cmp.*'.
591551
}
592-
if (Name.starts_with("xop.vfrcz.sd") && F->arg_size() == 2) {
593-
rename(F);
594-
NewFn = Intrinsic::getDeclaration(F->getParent(),
595-
Intrinsic::x86_xop_vfrcz_sd);
596-
return true;
552+
553+
if (Name.consume_front("avx512bf16.")) {
554+
// Added in 9.0
555+
ID = StringSwitch<Intrinsic::ID>(Name)
556+
.Case("cvtne2ps2bf16.128",
557+
Intrinsic::x86_avx512bf16_cvtne2ps2bf16_128)
558+
.Case("cvtne2ps2bf16.256",
559+
Intrinsic::x86_avx512bf16_cvtne2ps2bf16_256)
560+
.Case("cvtne2ps2bf16.512",
561+
Intrinsic::x86_avx512bf16_cvtne2ps2bf16_512)
562+
.Case("mask.cvtneps2bf16.128",
563+
Intrinsic::x86_avx512bf16_mask_cvtneps2bf16_128)
564+
.Case("cvtneps2bf16.256",
565+
Intrinsic::x86_avx512bf16_cvtneps2bf16_256)
566+
.Case("cvtneps2bf16.512",
567+
Intrinsic::x86_avx512bf16_cvtneps2bf16_512)
568+
.Default(Intrinsic::not_intrinsic);
569+
if (ID != Intrinsic::not_intrinsic)
570+
return UpgradeX86BF16Intrinsic(F, ID, NewFn);
571+
572+
// Added in 9.0
573+
ID = StringSwitch<Intrinsic::ID>(Name)
574+
.Case("dpbf16ps.128", Intrinsic::x86_avx512bf16_dpbf16ps_128)
575+
.Case("dpbf16ps.256", Intrinsic::x86_avx512bf16_dpbf16ps_256)
576+
.Case("dpbf16ps.512", Intrinsic::x86_avx512bf16_dpbf16ps_512)
577+
.Default(Intrinsic::not_intrinsic);
578+
if (ID != Intrinsic::not_intrinsic)
579+
return UpgradeX86BF16DPIntrinsic(F, ID, NewFn);
580+
return false; // No other 'x86.avx512bf16.*'.
597581
}
598-
// Upgrade any XOP PERMIL2 index operand still using a float/double vector.
599-
if (Name.starts_with("xop.vpermil2")) { // Added in 3.9
600-
auto Idx = F->getFunctionType()->getParamType(2);
601-
if (Idx->isFPOrFPVectorTy()) {
582+
583+
if (Name.consume_front("xop.")) {
584+
Intrinsic::ID ID = Intrinsic::not_intrinsic;
585+
if (Name.startswith("vpermil2")) { // Added in 3.9
586+
// Upgrade any XOP PERMIL2 index operand still using a float/double
587+
// vector.
588+
auto Idx = F->getFunctionType()->getParamType(2);
589+
if (Idx->isFPOrFPVectorTy()) {
590+
unsigned IdxSize = Idx->getPrimitiveSizeInBits();
591+
unsigned EltSize = Idx->getScalarSizeInBits();
592+
if (EltSize == 64 && IdxSize == 128)
593+
ID = Intrinsic::x86_xop_vpermil2pd;
594+
else if (EltSize == 32 && IdxSize == 128)
595+
ID = Intrinsic::x86_xop_vpermil2ps;
596+
else if (EltSize == 64 && IdxSize == 256)
597+
ID = Intrinsic::x86_xop_vpermil2pd_256;
598+
else
599+
ID = Intrinsic::x86_xop_vpermil2ps_256;
600+
}
601+
} else if (F->arg_size() == 2)
602+
// frcz.ss/sd may need to have an argument dropped. Added in 3.2
603+
ID = StringSwitch<Intrinsic::ID>(Name)
604+
.Case("vfrcz.ss", Intrinsic::x86_xop_vfrcz_ss)
605+
.Case("vfrcz.sd", Intrinsic::x86_xop_vfrcz_sd)
606+
.Default(Intrinsic::not_intrinsic);
607+
608+
if (ID != Intrinsic::not_intrinsic) {
602609
rename(F);
603-
unsigned IdxSize = Idx->getPrimitiveSizeInBits();
604-
unsigned EltSize = Idx->getScalarSizeInBits();
605-
Intrinsic::ID Permil2ID;
606-
if (EltSize == 64 && IdxSize == 128)
607-
Permil2ID = Intrinsic::x86_xop_vpermil2pd;
608-
else if (EltSize == 32 && IdxSize == 128)
609-
Permil2ID = Intrinsic::x86_xop_vpermil2ps;
610-
else if (EltSize == 64 && IdxSize == 256)
611-
Permil2ID = Intrinsic::x86_xop_vpermil2pd_256;
612-
else
613-
Permil2ID = Intrinsic::x86_xop_vpermil2ps_256;
614-
NewFn = Intrinsic::getDeclaration(F->getParent(), Permil2ID);
610+
NewFn = Intrinsic::getDeclaration(F->getParent(), ID);
615611
return true;
616612
}
613+
return false; // No other 'x86.xop.*'
617614
}
618615

619616
if (Name == "seh.recoverfp") {

0 commit comments

Comments
 (0)