[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-12 Thread Thiago Macieira via cfe-commits
@@ -857,8 +881,13 @@ void CXXRecordDecl::addedMember(Decl *D) { data().HasDeclaredCopyAssignmentWithConstParam = true; } -if (Method->isMoveAssignmentOperator()) +if (Method->isMoveAssignmentOperator()) { SMKind |= SMF_MoveAssignment; +} + +i

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-15 Thread Krystian Stasiowski via cfe-commits
@@ -826,6 +842,14 @@ void CXXRecordDecl::addedMember(Decl *D) { ? !Constructor->isImplicit() : (Constructor->isUserProvided() || Constructor->isExplicit())) data().Aggregate = false; + + // A trivially relocatable class is a class: +

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-15 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian commented: Minor nit, but otherwise looks good. https://github.com/llvm/llvm-project/pull/84621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-15 Thread Alan de Freitas via cfe-commits
alandefreitas wrote: My Boost libraries would benefit a lot from this change. 🙂 https://github.com/llvm/llvm-project/pull/84621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-16 Thread Giuseppe D'Angelo via cfe-commits
@@ -857,8 +881,13 @@ void CXXRecordDecl::addedMember(Decl *D) { data().HasDeclaredCopyAssignmentWithConstParam = true; } -if (Method->isMoveAssignmentOperator()) +if (Method->isMoveAssignmentOperator()) { SMKind |= SMF_MoveAssignment; +} + +i

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-17 Thread Amirreza Ashouri via cfe-commits
https://github.com/AMP999 updated https://github.com/llvm/llvm-project/pull/84621 >From 6e127e5794efafaabf82b6c3d5e0634ddcfee977 Mon Sep 17 00:00:00 2001 From: Amirreza Ashouri Date: Sat, 2 Mar 2024 15:37:33 +0330 Subject: [PATCH 1/4] [clang][Sema] Track trivial-relocatability as a type trait

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-17 Thread Amirreza Ashouri via cfe-commits
@@ -857,8 +881,13 @@ void CXXRecordDecl::addedMember(Decl *D) { data().HasDeclaredCopyAssignmentWithConstParam = true; } -if (Method->isMoveAssignmentOperator()) +if (Method->isMoveAssignmentOperator()) { SMKind |= SMF_MoveAssignment; +}

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-17 Thread Amirreza Ashouri via cfe-commits
https://github.com/AMP999 edited https://github.com/llvm/llvm-project/pull/84621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-17 Thread Amirreza Ashouri via cfe-commits
@@ -826,6 +842,14 @@ void CXXRecordDecl::addedMember(Decl *D) { ? !Constructor->isImplicit() : (Constructor->isUserProvided() || Constructor->isExplicit())) data().Aggregate = false; + + // A trivially relocatable class is a class: +

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-17 Thread Timm Baeder via cfe-commits
@@ -2680,8 +2680,8 @@ bool QualType::isTriviallyRelocatableType(const ASTContext &Context) const { return false; } else if (!BaseElementType->isObjectType()) { return false; - } else if (const auto *RD = BaseElementType->getAsRecordDecl()) { -return RD->canPassI

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-17 Thread Amirreza Ashouri via cfe-commits
https://github.com/AMP999 updated https://github.com/llvm/llvm-project/pull/84621 >From 6e127e5794efafaabf82b6c3d5e0634ddcfee977 Mon Sep 17 00:00:00 2001 From: Amirreza Ashouri Date: Sat, 2 Mar 2024 15:37:33 +0330 Subject: [PATCH 1/5] [clang][Sema] Track trivial-relocatability as a type trait

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-18 Thread Daniel Anderson via cfe-commits
DanielLiamAnderson wrote: This would be really useful for [ParlayLib](https://github.com/cmuparlay/parlaylib). We implement our own is_trivially_relocatable which is not nearly as reliable as having the compiler do it. I support this PR's semantics; types with non-defaulted assignment operato

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-18 Thread via cfe-commits
sjanel wrote: The [amc](https://github.com/AmadeusITGroup/amc) library defining drop-in replacement for vector-like containers handling trivially relocatability optimizations would love to see this kind of improvement, as currently the users need to manually tell the compiler which types are O

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-20 Thread via cfe-commits
isidorostsa wrote: Currently, [HPX](https://github.com/STEllAR-GROUP/hpx) implements the P1144 interface. We have our own implementation of the is_trivially_relocatable trait, but it cannot recursively figure out if a type is relocatable based on its components. It would be great for us to let

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-22 Thread Dana Jansens via cfe-commits
danakj wrote: The subspace library also provides mechanisms [for querying](https://suslib.cc/sus-mem-TriviallyRelocatable.html) and marking types trivially relocatable, and relies on the compiler's `__is_trivially_relocatable` as a signal as well. It then optimizes containers and operations i

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-27 Thread Artur Bać via cfe-commits
arturbac wrote: My small_vectors are waiting for that feature for a long time, already have trait defined but cant implement and TODO in code. https://github.com/llvm/llvm-project/pull/84621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-05 Thread Barry Revzin via cfe-commits
@@ -857,8 +881,13 @@ void CXXRecordDecl::addedMember(Decl *D) { data().HasDeclaredCopyAssignmentWithConstParam = true; } -if (Method->isMoveAssignmentOperator()) +if (Method->isMoveAssignmentOperator()) { SMKind |= SMF_MoveAssignment; +} + +i

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-05 Thread via cfe-commits
https://github.com/cor3ntin edited https://github.com/llvm/llvm-project/pull/84621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-05 Thread via cfe-commits
cor3ntin wrote: > The semantics in this PR are the semantics relied upon by the libraries whose > maintainers have commented in support of this PR. These semantics have been > codified into P1144; that's the paper I'm quoting in the code comments. > @cor3ntin could you clarify what you mean by

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-05 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: Based on the poll results from Tokyo, P2786 is the direction EWG has taken for this functionality, so we should be focusing our efforts on supporting that direction. If WG21 changes direction again, we can shift again, (this builtin exists to support the standard's type tra

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-05 Thread via cfe-commits
@@ -826,6 +842,14 @@ void CXXRecordDecl::addedMember(Decl *D) { ? !Constructor->isImplicit() : (Constructor->isUserProvided() || Constructor->isExplicit())) data().Aggregate = false; + + // A trivially relocatable class is a class: +

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-06 Thread Giuseppe D'Angelo via cfe-commits
dangelog wrote: I perfectly understand that Clang wants to implement the semantics that are being adopted by standard C++, so it wants to reserve `__is_trivially_relocatable` to match those semantics. The amount of comments in this PR is however a strong signal that standard C++ is going dire

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-06 Thread via cfe-commits
cor3ntin wrote: > But this isn't useful at all; every library has already invented its own > constraints and type traits. The point of having a language-based solution is > that the "is TR" property gets automatically propagated when you compose > types. No library solution can achieve that, e

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-06 Thread via cfe-commits
cor3ntin wrote: > Do you mean that you would reject a proposal that adds Clang-specific trait > (with another name) that implements P1144's semantics? A proposal that explores trivial swapability for example, with the understanding it would be a subset of trivially relocatable types might be

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-08 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Do you mean that you would reject a proposal that adds Clang-specific trait > (with another name) that implements P1144's semantics? So long as it checks all the boxes in our usual [criteria](https://clang.llvm.org/get_involved.html#criteria) for extensions, I'd see no r

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-09 Thread Amirreza Ashouri via cfe-commits
https://github.com/AMP999 created https://github.com/llvm/llvm-project/pull/84621 To resolve llvm#69394, this patch separates trivial-relocatability's logic from `canPassInRegisters` to decide if a type is trivial-relocatable. A type passed in registers doesn't necessarily mean trivial-relocat

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-09 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Amirreza Ashouri (AMP999) Changes To resolve llvm#69394, this patch separates trivial-relocatability's logic from `canPassInRegisters` to decide if a type is trivial-relocatable. A type passed in registers doesn't necessarily mean trivial

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-09 Thread Amirreza Ashouri via cfe-commits
https://github.com/AMP999 updated https://github.com/llvm/llvm-project/pull/84621 >From 71502300d47f3d5492e6073a3959fe32b0c9cf65 Mon Sep 17 00:00:00 2001 From: Amirreza Ashouri Date: Sat, 2 Mar 2024 15:37:33 +0330 Subject: [PATCH] [clang][Sema] Track trivial-relocatability as a type trait To r

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-09 Thread Amirreza Ashouri via cfe-commits
https://github.com/AMP999 updated https://github.com/llvm/llvm-project/pull/84621 >From 2603e170c127aa614d499e5d527db8503a55c651 Mon Sep 17 00:00:00 2001 From: Amirreza Ashouri Date: Sat, 2 Mar 2024 15:37:33 +0330 Subject: [PATCH] [clang][Sema] Track trivial-relocatability as a type trait To r

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-09 Thread Amirreza Ashouri via cfe-commits
https://github.com/AMP999 updated https://github.com/llvm/llvm-project/pull/84621 >From 2603e170c127aa614d499e5d527db8503a55c651 Mon Sep 17 00:00:00 2001 From: Amirreza Ashouri Date: Sat, 2 Mar 2024 15:37:33 +0330 Subject: [PATCH] [clang][Sema] Track trivial-relocatability as a type trait To r

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-12 Thread Amirreza Ashouri via cfe-commits
https://github.com/AMP999 updated https://github.com/llvm/llvm-project/pull/84621 >From 6e127e5794efafaabf82b6c3d5e0634ddcfee977 Mon Sep 17 00:00:00 2001 From: Amirreza Ashouri Date: Sat, 2 Mar 2024 15:37:33 +0330 Subject: [PATCH 1/2] [clang][Sema] Track trivial-relocatability as a type trait

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-12 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 3358838446428976a41390fde98fe5b04b08a132 a7ff71da99cd158e9bc608b43577cb854dfc7fae --

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-12 Thread Amirreza Ashouri via cfe-commits
https://github.com/AMP999 updated https://github.com/llvm/llvm-project/pull/84621 >From 6e127e5794efafaabf82b6c3d5e0634ddcfee977 Mon Sep 17 00:00:00 2001 From: Amirreza Ashouri Date: Sat, 2 Mar 2024 15:37:33 +0330 Subject: [PATCH 1/3] [clang][Sema] Track trivial-relocatability as a type trait

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-12 Thread Amirreza Ashouri via cfe-commits
https://github.com/AMP999 updated https://github.com/llvm/llvm-project/pull/84621 >From 6e127e5794efafaabf82b6c3d5e0634ddcfee977 Mon Sep 17 00:00:00 2001 From: Amirreza Ashouri Date: Sat, 2 Mar 2024 15:37:33 +0330 Subject: [PATCH 1/3] [clang][Sema] Track trivial-relocatability as a type trait

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-12 Thread via cfe-commits
@@ -857,8 +881,13 @@ void CXXRecordDecl::addedMember(Decl *D) { data().HasDeclaredCopyAssignmentWithConstParam = true; } -if (Method->isMoveAssignmentOperator()) +if (Method->isMoveAssignmentOperator()) { SMKind |= SMF_MoveAssignment; +} + +i

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-12 Thread via cfe-commits
@@ -189,6 +189,11 @@ FIELD(DeclaredNonTrivialSpecialMembers, 6, MERGE_OR) /// SMF_MoveConstructor, and SMF_Destructor are meaningful here. FIELD(DeclaredNonTrivialSpecialMembersForCall, 6, MERGE_OR) +/// True when this class's bases and fields are all trivially relocatable +//

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-12 Thread via cfe-commits
@@ -826,6 +842,14 @@ void CXXRecordDecl::addedMember(Decl *D) { ? !Constructor->isImplicit() : (Constructor->isUserProvided() || Constructor->isExplicit())) data().Aggregate = false; + + // A trivially relocatable class is a class: +

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-03-12 Thread via cfe-commits
@@ -857,8 +881,13 @@ void CXXRecordDecl::addedMember(Decl *D) { data().HasDeclaredCopyAssignmentWithConstParam = true; } -if (Method->isMoveAssignmentOperator()) +if (Method->isMoveAssignmentOperator()) { SMKind |= SMF_MoveAssignment; +}

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-16 Thread Reid Kleckner via cfe-commits
rnk wrote: So, I was completely unaware that trivial relocatability had been picked up at all by WG21. Since the beginning of `trivial_abi`, I we were solidly in the vendor-extension space trying to build non-standard but practical solutions to real world problems, like the fact that we couldn

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-16 Thread via cfe-commits
@@ -826,6 +842,14 @@ void CXXRecordDecl::addedMember(Decl *D) { ? !Constructor->isImplicit() : (Constructor->isUserProvided() || Constructor->isExplicit())) data().Aggregate = false; + + // A trivially relocatable class is a class: +

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > So, I was completely unaware that trivial relocatability had been picked up > at all by WG21. Since the beginning of `trivial_abi`, I we were solidly in > the vendor-extension space trying to build non-standard but practical > solutions to real world problems, like the fa

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-16 Thread Marcin Kowalczyk via cfe-commits
QrczakMK wrote: I think that if Clang chooses to support both variants of the type trait, it should provide both variants of `[[clang::trivial_abi]]`, so that a type like `std::unique_ptr` is trivially relocatable including assignment (and can be annotated as such), while a type like `std::tup

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-16 Thread Amirreza Ashouri via cfe-commits
AMP999 wrote: > We (users & implementers) have all collectively identified trivial > relocatability as an important optimization for vector-like containers, and > we're all looking for a solution to that. It feels like this attempt to > standardize this type trait is getting in the way of our

[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

2024-04-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > We (users & implementers) have all collectively identified trivial > > relocatability as an important optimization for vector-like containers, and > > we're all looking for a solution to that. It feels like this attempt to > > standardize this type trait is getting in t