[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-16 Thread Hans Wennborg via Phabricator via cfe-commits
hans added inline comments. Comment at: clang/lib/CodeGen/CGExprAgg.cpp:535 CGM.getModule(), C->getType(), - CGM.isTypeConstant(ArrayQTy, /* ExcludeCtorDtor= */ true), + CGM.isTypeConstant(ArrayQTy, /* ExcludeCtor= */ true, +

[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-16 Thread Hans Wennborg via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. hans marked an inline comment as done. Closed by commit rG7a85aa918ccd: Emit const globals with constexpr destructor as constant LLVM values (authored by hans). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTI

[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-15 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision. efriedma added a comment. This revision is now accepted and ready to land. LGTM Comment at: clang/lib/CodeGen/CGExprAgg.cpp:535 CGM.getModule(), C->getType(), - CGM.isTypeConstant(ArrayQTy, /* ExcludeCtorDtor= */ true), +

[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-15 Thread Hans Wennborg via Phabricator via cfe-commits
hans updated this revision to Diff 505466. hans marked an inline comment as done. hans added a comment. Passing a `ExcludeDtor` param. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145369/new/ https://reviews.llvm.org/D145369 Files: clang/lib/CodeGen/CGDecl.cpp clang/lib/CodeGen/CG

[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-15 Thread Hans Wennborg via Phabricator via cfe-commits
hans marked an inline comment as done. hans added inline comments. Comment at: clang/lib/CodeGen/CodeGenModule.cpp:4344 + (Record->hasTrivialDestructor() || + Record->hasConstexprDestructor()); } efriedma wrote: > For the purposes of C

[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-14 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments. Comment at: clang/lib/CodeGen/CodeGenModule.cpp:4344 + (Record->hasTrivialDestructor() || + Record->hasConstexprDestructor()); } For the purposes of CodeGen, checking `Record->hasConstexprDestructor()` i

[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-14 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments. Comment at: clang/test/CodeGenCXX/static-init.cpp:181 +#if __cplusplus >= 202002L +// A const object with constexpr destructor can be emitted as a constant. +namespace test5 { I don't see how this works. For a static local variabl

[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-14 Thread Hans Wennborg via Phabricator via cfe-commits
hans updated this revision to Diff 505127. hans added a comment. Thanks for the review! Added tests to cover other calls that change behavior due to this. Please take another look. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145369/new/ https://reviews.llvm.org/D145369 Files: cla

[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-13 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. There appear to be 8 different places that call `isTypeConstant(Ty, true)`; I'd like to see testcases for all of them if it's relevant. (I agree with your assessment for global variables, but not sure about the other places.) Repository: rG LLVM Github Monorepo CH

[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-10 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added reviewers: rjmccall, efriedma. aaron.ballman added a comment. This seems reasonable to me, but adding the codegen code owners in case they disagree. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145369/new/ https://reviews.llvm

[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-09 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment. In D145369#4181296 , @ilya-biryukov wrote: > I don't have a lot of experience in codegen, so will let Aaron and Richard do > the review. Thanks for checking! I don't have a lot of experience here either, so any review is much app

[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-09 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. I don't have a lot of experience in codegen, so will let Aaron and Richard do the review. However, still wanted to share one observation. The actual check that avoids emitting the destructors for variables seems more involved than just checking if the destructor

[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-08 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a reviewer: aaron.ballman. hans added a comment. +aaron.ballman Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145369/new/ https://reviews.llvm.org/D145369 ___ cfe-commits mailing list cfe-comm

[PATCH] D145369: Emit const globals with constexpr destructor as constant LLVM values

2023-03-06 Thread Hans Wennborg via Phabricator via cfe-commits
hans created this revision. hans added reviewers: rsmith, ilya-biryukov. Herald added a project: All. hans requested review of this revision. Herald added a project: clang. This follows 2b4fa53 which made Clang not emit destructor calls for such objects. However, they would still not get emitted