[clang] [clang][bytecode] Fix two-pointer-style std::initializer_lists (PR #107682)

2024-09-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/107682 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Fix two-pointer-style std::initializer_lists (PR #107682)

2024-09-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/107682 The first pointer needs to point to the first element of the underlying array. This requires some changes to how we handle array expansion >From 4067ab666b9fbfb05b6a22c14de1eededebcb16f Mon Sep 17 00:00:00 200

[clang] [clang][bytecode] Implement using operator new/operator delete (PR #107679)

2024-09-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/107679 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Remove an incorrect assertion in ConstantFoldAttrs (PR #105789)

2024-09-07 Thread Timm Baeder via cfe-commits
tbaederr wrote: CC @AaronBallman for an opinion about the AST represenation https://github.com/llvm/llvm-project/pull/105789 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Implement logical operators for vector type (PR #107678)

2024-09-07 Thread Timm Baeder via cfe-commits
@@ -15,6 +15,7 @@ #include "PrimType.h" #include "Program.h" #include "clang/AST/Attr.h" +#include "clang/AST/OperationKinds.h" tbaederr wrote: What is this needed for? A call to `isLogicalOp()` was already in the file before. https://github.com/llvm/llvm-pr

[clang] [clang][bytecode] Implement logical operators for vector type (PR #107678)

2024-09-07 Thread Timm Baeder via cfe-commits
@@ -1300,6 +1309,16 @@ bool Compiler::VisitVectorBinOp(const BinaryOperator *E) { if (!this->emitGT(ElemT, E)) return false; break; +case BO_LAnd: + // a && b is equivalent to a!=0 & b!=0 tbaederr wrote: I was trying to prove this

[clang] [clang][bytecode] Implement logical operators for vector type (PR #107678)

2024-09-07 Thread Timm Baeder via cfe-commits
@@ -1267,7 +1268,15 @@ bool Compiler::VisitVectorBinOp(const BinaryOperator *E) { auto getElem = [=](unsigned Offset, unsigned Index) { if (!this->emitGetLocal(PT_Ptr, Offset, E)) return false; -return this->emitArrayElemPop(ElemT, Index, E); +if (!this->em

[clang] [clang][bytecode] Implement using operator new/operator delete (PR #107679)

2024-09-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/107679 Reuse the __builtin_operator_{new,delete} implementations. >From 654bc52d1e947d52942878a6a50c73053814d565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sat, 7 Sep 2024 10:52:40 +0200 Subje

[clang] [clang][bytecode] Implement __builtin_operator{new,delete} (PR #107672)

2024-09-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/107672 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Allow continuing when discarded MemberExpr Base fails (PR #107231)

2024-09-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/107231 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Implement __builtin_operator{new,delete} (PR #107672)

2024-09-07 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/107672 None >From fbdde33e018a721bab026dcffb4af22987cc7366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sat, 7 Sep 2024 09:10:00 +0200 Subject: [PATCH] [clang][bytecode] Implement __builtin_oper

[clang] [clang][bytecode] Only visit local variables if they have constant init (PR #107576)

2024-09-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/107576 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Only visit local variables if they have constant init (PR #107576)

2024-09-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr edited https://github.com/llvm/llvm-project/pull/107576 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Fix reinterpret casts of two non-primitive types (PR #107564)

2024-09-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/107564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ExprConst] Allow comparisons with string literals (PR #106733)

2024-09-06 Thread Timm Baeder via cfe-commits
tbaederr wrote: Ping https://github.com/llvm/llvm-project/pull/106733 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Only visit local variables if they have constant init (PR #107576)

2024-09-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/107576 See the comment I added for why this is weird. We might want to have a different mechanism for this in the future. >From 7149533c281d2e7c9a3e669336645776bf03c9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=2

[clang] [clang][bytecode] Implement placement-new (PR #107033)

2024-09-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/107033 >From 19abb83b47cbbdfac84dd5a30ff01e3f55e2d4d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 3 Sep 2024 02:52:35 +0200 Subject: [PATCH] [clang][bytecode] Implement placement-new ---

[clang] [clang][ExprConst] Allow comparisons with string literals (PR #106733)

2024-09-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/106733 >From 7dbb01805663a6671c61330c5abc04c44146cc24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 30 Aug 2024 15:52:48 +0200 Subject: [PATCH] [clang][ExprConst] Allow comparisons with strin

[clang] [clang][ExprConst] Allow comparisons with string literals (PR #106733)

2024-09-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/106733 >From 73af678c4c405cff16d5baf668e78e736bb1d228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 30 Aug 2024 15:52:48 +0200 Subject: [PATCH] [clang][ExprConst] Allow comparisons with strin

[clang] [clang][bytecode] Allow continuing when discarded MemberExpr Base fails (PR #107231)

2024-09-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/107231 >From 44b14f24196f4ff407dfa020f441690b1203f847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 4 Sep 2024 14:32:32 +0200 Subject: [PATCH] [clang][bytecode] Allow continuing when discarde

[clang] [clang][bytecode] Allow continuing when discarded MemberExpr Base fails (PR #107231)

2024-09-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/107231 >From 6bfbb1b280490a18d817d9ef0be0491925a0a9ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 4 Sep 2024 14:32:32 +0200 Subject: [PATCH] [clang][bytecode] Allow continuing when discarde

[clang] [clang][bytecode] Implement comparsion operators for vector type (PR #107258)

2024-09-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr approved this pull request. https://github.com/llvm/llvm-project/pull/107258 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Fix two-pointer-style std::initializer_lists (PR #107565)

2024-09-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/107565 The first pointer needs to point to the first element of the underlying array. This requires some changes to how we handle array expansion >From 8968151c4773910e6f85d9273899432556376300 Mon Sep 17 00:00:00 200

[clang] [clang][bytecode] Fix reinterpret casts of two non-primitive types (PR #107564)

2024-09-06 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/107564 We don't want to allow e.g. cast from a record to an array or the other way arround. >From dda02f67ba68beba4564bae52374849724fd19ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 5 Se

[clang] [clang][bytecode] Implement comparsion operators for vector type (PR #107258)

2024-09-05 Thread Timm Baeder via cfe-commits
@@ -1222,6 +1224,105 @@ bool Compiler::VisitComplexBinOp(const BinaryOperator *E) { return true; } +template +bool Compiler::VisitVectorBinOp(const BinaryOperator *E) { + assert(E->getType()->isVectorType()); + assert(E->getLHS()->getType()->isVectorType()); + assert(E-

[clang] [clang][bytecode] Implement comparsion operators for vector type (PR #107258)

2024-09-05 Thread Timm Baeder via cfe-commits
@@ -1222,6 +1224,117 @@ bool Compiler::VisitComplexBinOp(const BinaryOperator *E) { return true; } +template +bool Compiler::VisitVectorBinOp(const BinaryOperator *E) { + assert(E->getType()->isVectorType()); tbaederr wrote: Add an assertion that both LH

[clang] [clang][bytecode] Implement comparsion operators for vector type (PR #107258)

2024-09-05 Thread Timm Baeder via cfe-commits
@@ -1222,6 +1224,117 @@ bool Compiler::VisitComplexBinOp(const BinaryOperator *E) { return true; } +template +bool Compiler::VisitVectorBinOp(const BinaryOperator *E) { + assert(E->getType()->isVectorType()); + + // FIXME: Current only support comparison binary operator,

[clang] [clang][bytecode] Implement comparsion operators for vector type (PR #107258)

2024-09-05 Thread Timm Baeder via cfe-commits
@@ -1222,6 +1224,117 @@ bool Compiler::VisitComplexBinOp(const BinaryOperator *E) { return true; } +template +bool Compiler::VisitVectorBinOp(const BinaryOperator *E) { + assert(E->getType()->isVectorType()); + + // FIXME: Current only support comparison binary operator,

[clang] [Clang] Implement P2280R4 Using unknown pointers and references in constant expressions (PR #95474)

2024-09-04 Thread Timm Baeder via cfe-commits
@@ -0,0 +1,118 @@ +// RUN: %clang_cc1 -std=c++23 -verify %s + +using size_t = decltype(sizeof(0)); + +namespace std { +struct type_info { + const char* name() const noexcept(true); +}; +} + +template +constexpr size_t array_size(T (&)[N]) { + return N; +} + +void use_array(int

[clang] [clang][bytecode] Allow continuing when discarded MemberExpr Base fails (PR #107231)

2024-09-04 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/107231 We don't need the value in this case, since we're discarding it anyway. Allow continuing the interpretation but note the side effect. >From 696b77b7c85f79fddb2b88f04c78933acd769d12 Mon Sep 17 00:00:00 2001 Fro

[clang] [clang][bytecode][NFC] Simplify builtin-functions.cpp (PR #107118)

2024-09-03 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/107118 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode][NFC] Simplify builtin-functions.cpp (PR #107118)

2024-09-03 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/107118 The effect is the same, but this version doesn't take as long to evaluate. >From b203f7fe81a98258690ebb8d6385a9384a1b7ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 3 Sep 2024 16:5

[clang] [clang][bytecode][NFC] Move Call ops into Interp.cpp (PR #107104)

2024-09-03 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/107104 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode][NFC] Move Call ops into Interp.cpp (PR #107104)

2024-09-03 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/107104 They are quite long and not templated. >From f395bdadb094477b757a2c0789f902d56eb14df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 3 Sep 2024 15:11:57 +0200 Subject: [PATCH] [clang][

[clang] [clang][bytecode] Pass FPOptions to floating point ops (PR #107063)

2024-09-03 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/107063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Implement placement-new (PR #107033)

2024-09-03 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/107033 >From 5286c57c1664bf64dae570c13de6956dbb762ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 3 Sep 2024 02:52:35 +0200 Subject: [PATCH] [clang][bytecode] Implement placement-new ---

[clang] [clang][bytecode] Implement placement-new (PR #107033)

2024-09-03 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/107033 >From 4f6db8a9c37c2fd5df32e3611c3630b5d7581a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 3 Sep 2024 02:52:35 +0200 Subject: [PATCH] [clang][bytecode] Implement placement-new ---

[clang] [clang][bytecode] Pass FPOptions to floating point ops (PR #107063)

2024-09-03 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/107063 >From f8b31c957fc281bf4c73f3b032099e2de4f58193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 3 Sep 2024 10:59:22 +0200 Subject: [PATCH] [clang][bytecode] Pass FPOptions to floating poi

[clang] [clang][bytecode] Print Pointers via APValue (PR #107056)

2024-09-03 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/107056 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Pass FPOptions to floating point ops (PR #107063)

2024-09-03 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/107063 So we don't have to retrieve them from the InterpFrame, which is slow. >From 32b28da07f4115b46fe4fd51e05e60264d194558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 3 Sep 2024 10:59:22

[clang] [clang][bytecode] Print Pointers via APValue (PR #107056)

2024-09-03 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/107056 Instead of doing this ourselves, just rely on printing the APValue. >From 05f15c5c7c867cdb37f45c51e7d33fdcc527463e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 3 Sep 2024 09:58:06 +0

[clang] [clang][bytecode] Implement placement-new (PR #107033)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/107033 >From be9096f14454cf1450915bd044aef1c037c3e935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 3 Sep 2024 02:52:35 +0200 Subject: [PATCH] [clang][bytecode] Implement placement-new ---

[clang] [clang][bytecode] Implement placement-new (PR #107033)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/107033 >From 903663240c79db28a3153e2d7154bb40c214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 3 Sep 2024 02:52:35 +0200 Subject: [PATCH] [clang][bytecode] Implement placement-new ---

[clang] [clang][bytecode] Implement placement-new (PR #107033)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/107033 >From cfdf24d7e50c13b4741336303dfe1e5abae3ed81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 3 Sep 2024 02:52:35 +0200 Subject: [PATCH] [clang][bytecode] Implement placement-new ---

[clang] [clang][bytecode] Implement placement-new (PR #107033)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/107033 >From 6c722173d8a08f4c0bb75916ac88f2e37170c742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 3 Sep 2024 02:52:35 +0200 Subject: [PATCH] [clang][bytecode] Implement placement-new ---

[clang] [clang][bytecode] Implement placement-new (PR #107033)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/107033 If we have a placement-new destination already, use that instead of allocating a new one. Tests are partially based on `test/SemaCXX/cxx2c-constexpr-placement-new.cpp`. >From 588703b329b186c3e85291abd63c8cf18f

[clang] [clang][AST][NFC] Make ASTContext::UnwrapSimilar{Array, }Types const (PR #106992)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/106992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][AST][NFC] Make ASTContext::UnwrapSimilar{Array, }Types const (PR #106992)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr edited https://github.com/llvm/llvm-project/pull/106992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][AST] Make ASTContext::UnwrapSimilar{Array,}Types const (PR #106992)

2024-09-02 Thread Timm Baeder via cfe-commits
tbaederr wrote: ... and `hasSimilarType`. https://github.com/llvm/llvm-project/pull/106992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][AST] Make ASTContext::UnwrapSimilar{Array,}Types const (PR #106992)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/106992 >From b886f4aa5e6cab7e0105c2d415b21dfe614b5010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 2 Sep 2024 15:50:56 +0200 Subject: [PATCH] [clang][AST] Make ASTContext::UnwrapSimilar{Arra

[clang] [clang][AST] Make ASTContext::UnwrapSimilar{Array,}Types const (PR #106992)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106992 They don't mutate the context at all, so mark them const. >From 152d50f0f842f058cb68b7dfed563fd6f55b32a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 2 Sep 2024 15:50:56 +0200 Subjec

[clang] [clang][bytecode] Fix zero-init of first union member (PR #106962)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/106962 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Implement __noop (PR #106714)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/106714 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Implement __noop (PR #106714)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/106714 >From f78ac3974423d2cd01bc73ed0de854ce4d6f50cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 30 Aug 2024 13:45:37 +0200 Subject: [PATCH] [clang][bytecode] Implement __noop This does n

[clang] [clang][bytecode] Fix zero-init of first union member (PR #106962)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106962 ... if done via a ImplicitValueInitExpr. We were already doing this later in visitZeroRecordInitializer(). >From 3ca8c6c3408d78163c01d5ff95796fdc310b9b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4d

[clang] [clang] The ms-extension __noop should return zero in a constexpr context. (PR #106849)

2024-09-02 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/106849 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] The ms-extension __noop should return zero in a constexpr context. (PR #106849)

2024-09-01 Thread Timm Baeder via cfe-commits
@@ -12720,8 +12720,8 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E, } case Builtin::BI__noop: - // __noop always evaluates successfully -return true; +// __noop always evaluates successfully +return ZeroInitialization(E); t

[clang] [clang][bytecode] Fix diagnosing reads from temporaries (PR #106868)

2024-08-31 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/106868 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Fix diagnosing reads from temporaries (PR #106868)

2024-08-31 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr edited https://github.com/llvm/llvm-project/pull/106868 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Fix diagnosting reads from temporaries (PR #106868)

2024-08-31 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106868 Fix the DeclID not being set in global temporaries and use the same strategy for deciding if a temporary is readable as the current interpreter. >From 21f0a354dad22ac9fa540413cd859a5d6bd0904c Mon Sep 17 00:00:

[clang] [clang][bytecode][NFC] Check for custom typechecking in call cleanup (PR #106826)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/106826 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode][NFC] Check for custom typechecking in call cleanup (PR #106826)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106826 The comment already explains that this is only true for _some_ builtin functions. This also brings the time it takes me to run the builtin-functions.cpp test locally from 50s down to 47s. >From e38266cd0fa28e

[clang] [clang][bytecode][NFC] Implement MemberPointer::toDiagnosticString() (PR #106825)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/106825 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode][NFC] Implement MemberPointer::toDiagnosticString() (PR #106825)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/106825 >From fd47ce2d92865a5c9e5307478a10dd2c8b91ac44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sat, 31 Aug 2024 02:56:46 +0200 Subject: [PATCH] [clang][bytecode][NFC] Implement MemberPointer

[clang] [clang][bytecode][NFC] Implement MemberPointer::toDiagnosticString() (PR #106825)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106825 None >From 7d3a2ba57c5eefe47c2ccc57584881efdef41262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sat, 31 Aug 2024 02:56:46 +0200 Subject: [PATCH] [clang][bytecode][NFC] Implement MemberP

[clang] [clang][bytecode] Diagnose comparisons with literals (PR #106734)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/106734 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix crash in code with StmtExpr and atomic char load in Expr::EvaluateAsRValue. (PR #106751)

2024-08-30 Thread Timm Baeder via cfe-commits
tbaederr wrote: Of course not! The reason that `AtomicToNonAtomic` is handled but `NonAtomicToAtomic` isn't, is that this is in `IntExprEvaluator`, meaning the result must be a (non-atomic) integer. If it was atomic, it'd be in `AtomicExprEvaluator`. This AST for the LHS of the binary operato

[clang] [clang][bytecode] Diagnose comparisons with literals (PR #106734)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/106734 >From af84a7c4effc0372386b598bf323783d0e7fd132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 30 Aug 2024 15:51:17 +0200 Subject: [PATCH] [clang][bytecode] Diagnose comparisons with lit

[clang] [clang][bytecode] Diagnose comparisons with literals (PR #106734)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/106734 >From 0786e92abfceb279ad79b3da3c33b3c645aa8754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 30 Aug 2024 15:51:17 +0200 Subject: [PATCH] [clang][bytecode] Diagnose comparisons with lit

[clang] [clang][bytecode] Diagnose comparisons with literals (PR #106734)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/106734 >From bbf8b0f42845ada6ddb3935d975b06f9044b3c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 30 Aug 2024 15:51:17 +0200 Subject: [PATCH] [clang][bytecode] Diagnose comparisons with lit

[clang] [clang][bytecode] Implement __noop (PR #106714)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/106714 >From b04dc6d69039eeabe177cc5d109970734e0c29ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 30 Aug 2024 13:45:37 +0200 Subject: [PATCH] [clang][bytecode] Implement __noop This does n

[clang] [clang][bytecode][NFC] Cache the BuiltinID in Function (PR #106745)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/106745 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Implement __noop (PR #106714)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/106714 >From 0423c99a3b539e20c807ae4a773521a5ad5063c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 30 Aug 2024 13:45:37 +0200 Subject: [PATCH] [clang][bytecode] Implement __noop This does n

[clang] [clang][bytecode] Diagnose comparisons with literals (PR #106734)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/106734 >From 099ae16b3e41392f8fde9d4c92b4af48486bd027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 30 Aug 2024 15:51:17 +0200 Subject: [PATCH] [clang][bytecode] Diagnose comparisons with lit

[clang] [clang][bytecode][NFC] Cache the BuiltinID in Function (PR #106745)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106745 FunctionDecl::getBuiltinID() is surprisingly slow and we tend to call it quite a bit, especially when interpreting builtin functions. Caching the BuiltinID here reduces the time I need to compile the floating_

[clang] [clang][bytecode] Diagnose comparisons with literals (PR #106734)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106734 This requires adding a new opcode for PointerToBoolean casts, since we otherwise emit too many diagnostics. But that fixes an older problem when casting weak pointers to bool. >From 0517f11ddbe4fda0f71692e800

[clang] [clang][ExprConst] Allow comparisons with string literals (PR #106733)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106733 Don't diagnose them, but literals still have distinct addresses. Fixes https://github.com/llvm/llvm-project/issues/58754 >From b77e5f928ff6acd2c44bfc27c178aa4121a24228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?

[clang] [clang][bytecode] Implement __noop (PR #106714)

2024-08-30 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106714 This does nothing and returns 0. >From 45d97a71f5e76091234d0d919db4cb605d2d1949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 30 Aug 2024 13:45:37 +0200 Subject: [PATCH] [clang][bytec

[clang] [clang][bytecode] Add InitLinkScope for temporary variables (PR #106552)

2024-08-30 Thread Timm Baeder via cfe-commits
tbaederr wrote: @AaronBallman Can you confirm whether the following behavior is correct? When a `CXXDefaultInitExpr` is the child node of an `InitListExpr`, all `CXXThisExpr` found within that `CXXDefaultInitExpr` point to the `InitListExpr` and not to the actual instance pointer of the curren

[clang] [clang][bytecode] Fix the handling of address of a vector (PR #106558)

2024-08-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr approved this pull request. https://github.com/llvm/llvm-project/pull/106558 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Diagnose member calls on deleted blocks (PR #106529)

2024-08-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/106529 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Add InitLinkScope for temporary variables (PR #106552)

2024-08-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106552 None >From 5d313ed583f9ca8209fbdc04ecb0fd8174e74239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 29 Aug 2024 13:46:18 +0200 Subject: [PATCH] [clang][bytecode] Add InitLinkScope for t

[clang] [clang][bytecode] Properly diagnose non-const reads (PR #106514)

2024-08-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/106514 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Diagnose member calls on deleted blocks (PR #106529)

2024-08-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106529 This requires a bit of restructuring of ctor calls when checking for a potential constant expression. >From 86f776e9de9ddee4bb5c35f6f6cd7959795bea8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?=

[clang] [clang][bytecode] Properly diagnose non-const reads (PR #106514)

2024-08-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/106514 >From a8eaf58bcae529a3629dbd1b84df58e9557dde5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 29 Aug 2024 10:21:54 +0200 Subject: [PATCH] [clang][bytecode] Properly diagnose non-const r

[clang] [clang][bytecode] Properly diagnose non-const reads (PR #106514)

2024-08-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106514 If the global variable is constant (but not constexpr), we need to diagnose, but keep evaluating. >From e9e4774a38975de976793d7941b6eae68dde7711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Da

[clang] `__noop` not marked as constexpr #102064 (PR #105983)

2024-08-29 Thread Timm Baeder via cfe-commits
tbaederr wrote: You have to resolve the conflict in `ReleaseNotes.rst` firsrt https://github.com/llvm/llvm-project/pull/105983 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Fix #55390 here as well (PR #106395)

2024-08-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/106395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Implement constexpr vector unary operators +, -, ~, ! (PR #105996)

2024-08-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr edited https://github.com/llvm/llvm-project/pull/105996 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Interp] Implement constexpr vector unary operators +, -, ~, ! (PR #105996)

2024-08-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr approved this pull request. If CI comes back, the rest looks good to me, thanks! https://github.com/llvm/llvm-project/pull/105996 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] [Clang][Interp] Implement constexpr vector unary operators +, -, ~, ! (PR #105996)

2024-08-28 Thread Timm Baeder via cfe-commits
@@ -0,0 +1,90 @@ +// RUN: %clang_cc1 %s -triple x86_64-linux-gnu -Wno-uninitialized -std=c++14 -fsyntax-only -verify +// RUN: %clang_cc1 %s -triple x86_64-linux-gnu -fexperimental-new-constant-interpreter -Wno-uninitialized -std=c++14 -fsyntax-only -verify tbae

[clang] [clang][bytecode] Fix #55390 here as well (PR #106395)

2024-08-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106395 Ignore the multiplication overflow but report the 0 denominator. >From 7b1cfea20ae76a7b04ae63bf6d6082488c17b2e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 28 Aug 2024 15:50:10 +020

[clang] [Clang][Interp] Implement constexpr vector unary operators +, -, ~, ! (PR #105996)

2024-08-28 Thread Timm Baeder via cfe-commits
@@ -5312,6 +5314,120 @@ bool Compiler::VisitComplexUnaryOperator(const UnaryOperator *E) { return true; } +template +bool Compiler::VisitVectorUnaryOperator(const UnaryOperator *E) { + const Expr *SubExpr = E->getSubExpr(); + assert(SubExpr->getType()->isVectorType()); +

[clang] [clang][bytecode] Diagnose array-to-pointer decays of dummy pointers (PR #106366)

2024-08-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106366 We have type information for them now, so we can do this. >From 670598d602949cee9bc8cbfe563563aa699d8505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 28 Aug 2024 12:58:29 +0200 Subje

[clang] [Clang][Interp] Implement constexpr vector unary operators +, -, ~, ! (PR #105996)

2024-08-28 Thread Timm Baeder via cfe-commits
@@ -5312,6 +5314,120 @@ bool Compiler::VisitComplexUnaryOperator(const UnaryOperator *E) { return true; } +template +bool Compiler::VisitVectorUnaryOperator(const UnaryOperator *E) { + const Expr *SubExpr = E->getSubExpr(); + assert(SubExpr->getType()->isVectorType()); +

[clang] [Clang][Interp] Implement constexpr vector unary operators +, -, ~, ! (PR #105996)

2024-08-28 Thread Timm Baeder via cfe-commits
@@ -5312,6 +5314,120 @@ bool Compiler::VisitComplexUnaryOperator(const UnaryOperator *E) { return true; } +template +bool Compiler::VisitVectorUnaryOperator(const UnaryOperator *E) { + const Expr *SubExpr = E->getSubExpr(); + assert(SubExpr->getType()->isVectorType()); +

[clang] [Clang][Interp] Implement constexpr vector unary operators +, -, ~, ! (PR #105996)

2024-08-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr edited https://github.com/llvm/llvm-project/pull/105996 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Interp] Implement constexpr vector unary operators +, -, ~, ! (PR #105996)

2024-08-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr commented: Are these the only unary operators supported on vectors or are more to come? Since all (except for `+`, which doesn't do anything) cases call `prepareResult()` and `createTemp()` unconditionally, it would probably be cleaner to reject the unhandled cases

[clang] [NFC] Comment fix: "does specify state that" -> "does specify that" (PR #106338)

2024-08-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/106338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Interp] Implement constexpr vector unary operators +, -, ~, ! (PR #105996)

2024-08-27 Thread Timm Baeder via cfe-commits
@@ -5312,6 +5314,147 @@ bool Compiler::VisitComplexUnaryOperator(const UnaryOperator *E) { return true; } +template +bool Compiler::VisitVectorUnaryOperator(const UnaryOperator *E) { + const Expr *SubExpr = E->getSubExpr(); + assert(SubExpr->getType()->isVectorType()); +

<    1   2   3   4   5   6   7   8   9   10   >