[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-12 Thread Timm Baeder via cfe-commits
@@ -478,6 +480,43 @@ template class SourceLocScope final { bool Enabled = false; }; +template class StoredOpaqueValueScope final { +public: + StoredOpaqueValueScope(ByteCodeExprGen *Ctx) : Ctx(Ctx) {} + + bool VisitAndStoreOpaqueValue(const OpaqueValueExpr *Ove) { +a

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-12 Thread Timm Baeder via cfe-commits
@@ -478,6 +480,43 @@ template class SourceLocScope final { bool Enabled = false; }; +template class StoredOpaqueValueScope final { +public: + StoredOpaqueValueScope(ByteCodeExprGen *Ctx) : Ctx(Ctx) {} + + bool VisitAndStoreOpaqueValue(const OpaqueValueExpr *Ove) { +a

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-15 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/68039 >From baf0fc082f2cfa86346a93b22c39b92e9e7e261b Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Mon, 2 Oct 2023 22:29:14 +0200 Subject: [PATCH 1/5] impl --- clang/li

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-15 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/68039 >From baf0fc082f2cfa86346a93b22c39b92e9e7e261b Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Mon, 2 Oct 2023 22:29:14 +0200 Subject: [PATCH 1/5] impl --- clang/li

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-15 Thread via cfe-commits
@@ -478,6 +480,43 @@ template class SourceLocScope final { bool Enabled = false; }; +template class StoredOpaqueValueScope final { +public: + StoredOpaqueValueScope(ByteCodeExprGen *Ctx) : Ctx(Ctx) {} + + bool VisitAndStoreOpaqueValue(const OpaqueValueExpr *Ove) { +a

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-15 Thread via cfe-commits
@@ -478,6 +480,43 @@ template class SourceLocScope final { bool Enabled = false; }; +template class StoredOpaqueValueScope final { +public: + StoredOpaqueValueScope(ByteCodeExprGen *Ctx) : Ctx(Ctx) {} + + bool VisitAndStoreOpaqueValue(const OpaqueValueExpr *Ove) { +a

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-15 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/68039 >From 6748bd2171cca24c46ade12d57b57e97c3312501 Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Mon, 2 Oct 2023 22:29:14 +0200 Subject: [PATCH 1/5] impl --- clang/li

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-18 Thread Timm Baeder via cfe-commits
@@ -847,7 +845,33 @@ template bool ByteCodeExprGen::VisitOpaqueValueExpr(const OpaqueValueExpr *E) { if (Initializing) return this->visitInitializer(E->getSourceExpr()); - return this->visit(E->getSourceExpr()); + + PrimType CacheVariableTy = classify(E).value_or(PT_Pt

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-18 Thread Timm Baeder via cfe-commits
@@ -847,7 +845,33 @@ template bool ByteCodeExprGen::VisitOpaqueValueExpr(const OpaqueValueExpr *E) { if (Initializing) return this->visitInitializer(E->getSourceExpr()); - return this->visit(E->getSourceExpr()); + + PrimType CacheVariableTy = classify(E).value_or(PT_Pt

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-18 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr requested changes to this pull request. https://github.com/llvm/llvm-project/pull/68039 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-18 Thread Timm Baeder via cfe-commits
@@ -847,7 +845,33 @@ template bool ByteCodeExprGen::VisitOpaqueValueExpr(const OpaqueValueExpr *E) { if (Initializing) return this->visitInitializer(E->getSourceExpr()); - return this->visit(E->getSourceExpr()); + + PrimType CacheVariableTy = classify(E).value_or(PT_Pt

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-18 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr edited https://github.com/llvm/llvm-project/pull/68039 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-18 Thread Timm Baeder via cfe-commits
@@ -810,9 +810,7 @@ bool ByteCodeExprGen::VisitArrayInitLoopExpr( const ArrayInitLoopExpr *E) { assert(Initializing); assert(!DiscardResult); - // TODO: This compiles to quite a lot of bytecode if the array is larger. - // Investigate compiling this to a loop, or at

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-18 Thread Timm Baeder via cfe-commits
@@ -847,7 +845,33 @@ template bool ByteCodeExprGen::VisitOpaqueValueExpr(const OpaqueValueExpr *E) { if (Initializing) return this->visitInitializer(E->getSourceExpr()); - return this->visit(E->getSourceExpr()); + + PrimType CacheVariableTy = classify(E).value_or(PT_Pt

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-22 Thread via cfe-commits
@@ -847,7 +845,33 @@ template bool ByteCodeExprGen::VisitOpaqueValueExpr(const OpaqueValueExpr *E) { if (Initializing) return this->visitInitializer(E->getSourceExpr()); - return this->visit(E->getSourceExpr()); + + PrimType CacheVariableTy = classify(E).value_or(PT_Pt

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-22 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/68039 >From 6748bd2171cca24c46ade12d57b57e97c3312501 Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Mon, 2 Oct 2023 22:29:14 +0200 Subject: [PATCH 1/6] impl --- clang/li

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-23 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr approved this pull request. https://github.com/llvm/llvm-project/pull/68039 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-23 Thread via cfe-commits
https://github.com/isuckatcs closed https://github.com/llvm/llvm-project/pull/68039 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-02 Thread via cfe-commits
https://github.com/isuckatcs created https://github.com/llvm/llvm-project/pull/68039 At the moment in `Interp` the source array initialization (`getCommonExpr()`) of an `ArrayInitLoopExpr` is evaluated during every iteration, when it should only be evaluated once. The initializer is always wr

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-02 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/68039 >From baf0fc082f2cfa86346a93b22c39b92e9e7e261b Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Mon, 2 Oct 2023 22:29:14 +0200 Subject: [PATCH 1/3] impl --- clang/li

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-02 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Changes At the moment in `Interp` the source array initialization (`getCommonExpr()`) of an `ArrayInitLoopExpr` is evaluated during every iteration, when it should only be evaluated once. The initializer is always wrapped inside an `OpaqueValueEx

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-02 Thread via cfe-commits
https://github.com/isuckatcs updated https://github.com/llvm/llvm-project/pull/68039 >From baf0fc082f2cfa86346a93b22c39b92e9e7e261b Mon Sep 17 00:00:00 2001 From: isuckatcs <65320245+isucka...@users.noreply.github.com> Date: Mon, 2 Oct 2023 22:29:14 +0200 Subject: [PATCH 1/4] impl --- clang/li

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-02 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 55d8f0cd31311ed3ebc85bef2c9b5cfca1579076 3724f695e7699840998d8af16a60f02f90f64b95 --

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-10 Thread via cfe-commits
isuckatcs wrote: ping @tbaederr https://github.com/llvm/llvm-project/pull/68039 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-12 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr requested changes to this pull request. https://github.com/llvm/llvm-project/pull/68039 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-12 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr edited https://github.com/llvm/llvm-project/pull/68039 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-12 Thread Timm Baeder via cfe-commits
@@ -478,6 +480,43 @@ template class SourceLocScope final { bool Enabled = false; }; +template class StoredOpaqueValueScope final { +public: + StoredOpaqueValueScope(ByteCodeExprGen *Ctx) : Ctx(Ctx) {} + + bool VisitAndStoreOpaqueValue(const OpaqueValueExpr *Ove) { +a

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-12 Thread Timm Baeder via cfe-commits
@@ -478,6 +480,43 @@ template class SourceLocScope final { bool Enabled = false; }; +template class StoredOpaqueValueScope final { +public: + StoredOpaqueValueScope(ByteCodeExprGen *Ctx) : Ctx(Ctx) {} + + bool VisitAndStoreOpaqueValue(const OpaqueValueExpr *Ove) { +a

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-12 Thread Timm Baeder via cfe-commits
@@ -366,8 +363,7 @@ namespace ArrayInitLoop { auto [a, b, c] = f(n).arr; return a + b + c; } - static_assert(g() == 6); // expected-error {{failed}} \ - // expected-note {{15 == 6}} + static_assert(g() == 6); tbaederr w

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-12 Thread Timm Baeder via cfe-commits
@@ -827,6 +829,9 @@ bool ByteCodeExprGen::VisitArrayInitLoopExpr( template bool ByteCodeExprGen::VisitOpaqueValueExpr(const OpaqueValueExpr *E) { + if (OpaqueExprs.contains(E)) +return this->emitGetLocal(*classify(E), OpaqueExprs[E], E); tbaederr wrote:

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-12 Thread via cfe-commits
@@ -478,6 +480,43 @@ template class SourceLocScope final { bool Enabled = false; }; +template class StoredOpaqueValueScope final { +public: + StoredOpaqueValueScope(ByteCodeExprGen *Ctx) : Ctx(Ctx) {} + + bool VisitAndStoreOpaqueValue(const OpaqueValueExpr *Ove) { +a

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-12 Thread via cfe-commits
@@ -478,6 +480,43 @@ template class SourceLocScope final { bool Enabled = false; }; +template class StoredOpaqueValueScope final { +public: + StoredOpaqueValueScope(ByteCodeExprGen *Ctx) : Ctx(Ctx) {} + + bool VisitAndStoreOpaqueValue(const OpaqueValueExpr *Ove) { +a

[clang] [clang][Interp] Only evaluate the source array initialization of an `ArrayInitLoopExpr` once (PR #68039)

2023-10-12 Thread via cfe-commits
@@ -827,6 +829,9 @@ bool ByteCodeExprGen::VisitArrayInitLoopExpr( template bool ByteCodeExprGen::VisitOpaqueValueExpr(const OpaqueValueExpr *E) { + if (OpaqueExprs.contains(E)) +return this->emitGetLocal(*classify(E), OpaqueExprs[E], E); isuckatcs wrote: