[clang] [Headers][X86] VisitCallExpr constexpr immediate shifts (#154293) (PR #155542)

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

[clang] [WIP][Clang][bytecode] interp__builtin_elementwise_int_binop - allow RHS operand to be a scalar (PR #156017)

2025-08-29 Thread Timm Baeder via cfe-commits
@@ -2565,21 +2565,48 @@ static bool interp__builtin_elementwise_int_binop( return true; } + const auto *VT = Call->getArg(0)->getType()->castAs(); + assert(VT->getElementType()->isIntegralOrEnumerationType()); + PrimType ElemT = *S.getContext().classify(VT->getElement

[clang] [clang][bytecode] Handle negative array sizes in constexpr `new` instead of asserting (PR #155737)

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

[clang] [Clang][bytecode] interp__builtin_elementwise_int_binop - use APSInt callback instead of repeated switch statement (PR #155891)

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

[clang] [clang][bytecode] Remove split frame business (PR #155980)

2025-08-29 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155980 This was never really needed. >From 7eb6d75a1a18200ed5306470ae5897267711eff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 29 Aug 2025 08:54:48 +0200 Subject: [PATCH] [clang][bytecode

[clang] [Clang][Interp] interp__builtin_elementwise_int_binop - use APSInt callback instead of repeated switch statement (PR #155891)

2025-08-28 Thread Timm Baeder via cfe-commits
tbaederr wrote: `[clang][bytecode]` in the title please. Does this also work with the immediate shifts from https://github.com/llvm/llvm-project/pull/155542? https://github.com/llvm/llvm-project/pull/155891 ___ cfe-commits mailing list cfe-commits@li

[clang] [clang][bytecode] Handle negative array sizes in constexpr `new` instead of asserting (PR #155737)

2025-08-28 Thread Timm Baeder via cfe-commits
@@ -3490,7 +3490,15 @@ inline bool AllocN(InterpState &S, CodePtr OpPC, PrimType T, const Expr *Source, S.Stk.push(0, nullptr); return true; } - assert(NumElements.isPositive()); + if (!NumElements.isPositive()) { +if (!IsNoThrow) { + S.FFDiag(Source, diag

[clang] [clang][bytecode] Handle negative array sizes in constexpr `new` instead of asserting (PR #155737)

2025-08-28 Thread Timm Baeder via cfe-commits
@@ -1069,6 +1069,30 @@ namespace BaseCompare { static_assert(foo()); } + +namespace NegativeArraySize { + +constexpr void f() { // both-error {{constexpr function never produces a constant expression}} + int x = -1; + int *p = new int[x]; //both-note {{cannot allocate ar

[clang] [clang][bytecode] Handle negative array sizes in constexpr `new` instead of asserting (PR #155737)

2025-08-28 Thread Timm Baeder via cfe-commits
@@ -3490,7 +3490,15 @@ inline bool AllocN(InterpState &S, CodePtr OpPC, PrimType T, const Expr *Source, S.Stk.push(0, nullptr); return true; } - assert(NumElements.isPositive()); + if (!NumElements.isPositive()) { tbaederr wrote: ```suggestion i

[clang] [clang][bytecode] Lazily create DynamicAllocator (PR #155831)

2025-08-28 Thread Timm Baeder via cfe-commits
@@ -164,7 +170,7 @@ class InterpState final : public State, public SourceMapper { /// Reference to the offset-source mapping. SourceMapper *M; /// Allocator used for dynamic allocations performed via the program. - DynamicAllocator Alloc; + std::unique_ptr Alloc; -

[clang] [clang] Optimize EmbedExpr child iterator callback (PR #155803)

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

[clang] [clang][bytecode] Lazily create DynamicAllocator (PR #155831)

2025-08-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155831 Due to all the tracking via map(s) and a BumpPtrAllocator, the creating and destroying the DynamicAllocator is rather expensive. Try to do it lazily and only create it when first calling InterpState::getAlloca

[clang] [clang][bytecode] Lazily create DynamicAllocator (PR #155831)

2025-08-28 Thread Timm Baeder via cfe-commits
tbaederr wrote: https://llvm-compile-time-tracker.com/compare.php?from=3c23ae99f2f88d2a1c0f35b82a356f42e692e335&to=797559659a0d5f1c06724e174ef592319bb7ba95&stat=instructions:u https://github.com/llvm/llvm-project/pull/155831 ___ cfe-commits mailing lis

[clang] [clang] Update typechecking of builtin elementwise ternary math operators (PR #155620)

2025-08-28 Thread Timm Baeder via cfe-commits
@@ -15884,6 +15884,55 @@ static bool checkBuiltinVectorMathMixedEnums(Sema &S, Expr *LHS, Expr *RHS, return false; } +/// Check if all arguments have the same type. If the types don't match, emit an +/// error message and return true. Otherwise return false. +/// +/// For

[clang] [clang] Optimize EmbedExpr child iterator callback (PR #155803)

2025-08-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155803 Instead of querying the bitwidth and signeness of the integer literal for every iteration, get the bitwidth directly from the `APIntStorage` and assume the signeness to be `true` since we set the type of the `

[clang] [clang][bytecode][NFC] Clean up EvaluationResult (PR #155782)

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

[clang] [Headers][X86] VisitCallExpr constexpr immediate shifts (#154293) (PR #155542)

2025-08-28 Thread Timm Baeder via cfe-commits
tbaederr wrote: > I guess this is because clang/lib/AST/ExprConstant is the current interpreter > and we're not adding support to this new one. The trick is to add support for the new one as well :angel: https://github.com/llvm/llvm-project/pull/155542

[clang] [clang][bytecode] Simplify and optimize EvaluationResult (PR #155772)

2025-08-28 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155772 Remove support for saving a `Pointer` in the `EvaluationResult` since that was unused. Add `stealAPValue()` which moves the `APValue` out of the `EvaluationResult` to avoid a copy at the end of the evaluation.

[clang] [clang][bytecode] Speed up `EvaluationResult::CheckArrayInitialized()` (PR #155756)

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

[clang] [clang][bytecode][NFC] Remove FunctionPointer leftovers (PR #155761)

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

[clang] [clang][bytecode] Avoid copying APValue into EvaluationResult (PR #155757)

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

[clang] [clang][bytecode] Speed up `EvaluationResult::CheckArrayInitialized()` (PR #155756)

2025-08-27 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155756 >From bbe785eb324a33b8d43a48439a09c03401595e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 28 Aug 2025 06:02:54 +0200 Subject: [PATCH] ElementsInitialized --- clang/lib/AST/ByteCod

[clang] [clang][bytecode] Avoid copying APValue into EvaluationResult (PR #155757)

2025-08-27 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155757 Move the `APValue` into `EvaluationResult` instead. For a large primitive array (`#embed` of the sqlite3 amalgamation), this improves compile times by around 25%. >From 19bd8f5e21e06903dfec9b230f308376bd3fa82

[clang] [clang] Create PointerToBoolean casts for C casts (PR #155368)

2025-08-27 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/155368 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[clang] [clang][bytecode] Handle negative array sizes in constexpr `new` instead of asserting (PR #155737)

2025-08-27 Thread Timm Baeder via cfe-commits
@@ -0,0 +1,15 @@ +// RUN: not %clang_cc1 -std=c++20 -fsyntax-only %s 2>&1 \ +// RUN: | FileCheck %s --implicit-check-not='Assertion `NumElements.isPositive()` failed' + tbaederr wrote: Oh and the test should go into `test/AST/ByteCode/` https://github.com/llv

[clang] [clang][bytecode] Handle negative array sizes in constexpr `new` instead of asserting (PR #155737)

2025-08-27 Thread Timm Baeder via cfe-commits
@@ -0,0 +1,15 @@ +// RUN: not %clang_cc1 -std=c++20 -fsyntax-only %s 2>&1 \ +// RUN: | FileCheck %s --implicit-check-not='Assertion `NumElements.isPositive()` failed' + tbaederr wrote: You don't use `FileCheck` for these kinds of tests, use `-verify`. https:/

[clang] [clang] Update typechecking of builtin elementwise ternary math operators (PR #155620)

2025-08-27 Thread Timm Baeder via cfe-commits
@@ -15884,6 +15884,58 @@ static bool checkBuiltinVectorMathMixedEnums(Sema &S, Expr *LHS, Expr *RHS, return false; } +/// Check if all arguments have the same type. If the types don't match, emit an +/// error message and return true. Otherwise return false. +/// +/// For

[clang] [clang] Update typechecking of builtin elementwise ternary math operators (PR #155620)

2025-08-27 Thread Timm Baeder via cfe-commits
@@ -15884,6 +15884,58 @@ static bool checkBuiltinVectorMathMixedEnums(Sema &S, Expr *LHS, Expr *RHS, return false; } +/// Check if all arguments have the same type. If the types don't match, emit an +/// error message and return true. Otherwise return false. +/// +/// For

[clang] [clang] Update typechecking of builtin elementwise ternary math operators (PR #155620)

2025-08-27 Thread Timm Baeder via cfe-commits
@@ -15884,6 +15884,58 @@ static bool checkBuiltinVectorMathMixedEnums(Sema &S, Expr *LHS, Expr *RHS, return false; } +/// Check if all arguments have the same type. If the types don't match, emit an +/// error message and return true. Otherwise return false. +/// +/// For

[clang] [clang][bytecode] Reject vectors with non-primitive element types (PR #155597)

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

[clang] [clang] Create PointerToBoolean casts for C casts (PR #155368)

2025-08-27 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155368 >From c6f68c64eae649055070200431485f4fc421b0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Aug 2025 09:

[clang] [clang][bytecode] Reject vectors with non-primitive element types (PR #155597)

2025-08-27 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155597 This happens for e.g. arm's float8 types. >From 6d8f645682cfc888d083b8b19cc30fa80c27b209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 27 Aug 2025 13:27:37 +0200 Subject: [PATCH] [cla

[clang] [clang] Make sure EvalInfo pointer isn't null (PR #155563)

2025-08-27 Thread Timm Baeder via cfe-commits
tbaederr wrote: /cherry-pick 60cdc3ddeacd1310e8a014b076572c27e4886015 https://github.com/llvm/llvm-project/pull/155563 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Make sure EvalInfo pointer isn't null (PR #155563)

2025-08-27 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr milestoned https://github.com/llvm/llvm-project/pull/155563 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Make sure EvalInfo pointer isn't null (PR #155563)

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

[clang] [clang][bytecode] Reject dependent RequiresExprs (PR #155230)

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

[clang] [clang][bytecode] Handle vector assignments (PR #155573)

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

[clang] [clang] Make sure EvalInfo pointer isn't null (PR #155563)

2025-08-27 Thread Timm Baeder via cfe-commits
@@ -391,3 +391,10 @@ void ghissue109095() { _Static_assert(i == c[0]); // expected-error {{static assertion expression is not an integral constant expression}}\ // expected-note {{initializer of 'i' is not a constant expression}} } + +typedef bo

[clang] [clang][bytecode] Handle vector assignments (PR #155573)

2025-08-27 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155573 >From d39fd952f001650ae503b122ca3e7d2adf8c0601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 27 Aug 2025 10:29:40 +0200 Subject: [PATCH] [clang][bytecode] Handle vector assignments --

[clang] [clang][bytecode] Handle vector assignments (PR #155573)

2025-08-27 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155573 None >From 1ad4ccd8e3cba0e894cdfc5a012147360516a112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 27 Aug 2025 10:29:40 +0200 Subject: [PATCH] [clang][bytecode] Handle vector assignmen

[clang] [clang] Post-commit review for #150028 (PR #155351)

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

[clang] [clang] Post-commit review for #150028 (PR #155351)

2025-08-26 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155351 >From df9f96c18433d509abba6b7b3a8128b5510fe824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Aug 2025 05:57:47 +0200 Subject: [PATCH] [clang] Post-commit review for #150028 1) Ret

[clang] [clang] Create PointerToBoolean casts for C casts (PR #155368)

2025-08-26 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155368 >From cfe28648d256469e871e79fe44bad7eb1819aaa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Aug 2025 09:

[clang] [clang] Make sure EvalInfo pointer isn't null (PR #155563)

2025-08-26 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155563 It can be null, when called via CheckICE(). Accidentally introduced via #119366 Fixes #155507 >From c9fea1a7b715623f6e50aa5341232208cd441de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date:

[clang] [clang][bytecode] Cleanup primitive descriptor ctor/dtor handling (PR #155401)

2025-08-26 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155401 Use switches instead of if statements and COMPOSITE_TYPE_SWITCH and remove some leftover move functions. >From b98a518955edd40f3377c9bda74ca84a73e55d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4de

[clang] [clang][bytecode] Try to avoid dtor functions in Record descriptors (PR #155396)

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

[clang] [clang][bytecode] Support remaining add_sat like X86 builtins (PR #155358)

2025-08-26 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr closed https://github.com/llvm/llvm-project/pull/155358 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Try to avoid dtor functions in Record descriptors (PR #155396)

2025-08-26 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155396 We don't need to call the dtor fn of a record where all bases, fields and virtual bases have no dtor fn either. >From fed0d542cce4c67e35bc8700a3a203ee536a7dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=

[clang] [clang][bytecode][NFC] Check hasTrivialDtor() in RunDestructors (PR #155381)

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

[clang] [clang][bytecode][NFC] Use Pointer::initializeAllElements() in Program (PR #155391)

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

[clang] [clang][bytecode][NFC] Check InitializingBlocks in _within_lifetime (PR #155378)

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

[clang] [clang][bytecode][NFC] Check hasTrivialDtor() in RunDestructors (PR #155381)

2025-08-26 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155381 >From a9b63626a9eccf36f632585866cd68a425fb30ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Aug 2025 11:07:35 +0200 Subject: [PATCH] [clang][bytecode][NFC] Check hasTrivialDtor() i

[clang] [clang][bytecode][NFC] Check hasTrivialDtor() in RunDestructors (PR #155381)

2025-08-26 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155381 We do this when calling Free() on dynamically allocated memory. >From 2e16dde1cefb26576eff27f9337a8b2135e35bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Aug 2025 11:07:35 +0200

[clang] [clang][bytecode][NFC] Check InitializingBlocks in _within_lifetime (PR #155378)

2025-08-26 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155378 This kind of check is exactly why InterpState::InitializingBlocks exists. >From 58fd33edddc61e7b394740694fde9ec577b71cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Aug 2025 11:0

[clang] [clang][test] Add a RUN line for the bytecode interpreter (PR #155363)

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

[clang] [clang] Create PointerToBoolean casts for C casts (PR #155368)

2025-08-26 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155368 Don't create CK_BitCast casts from `nullptr_t` to `bool`. Fixes #155126 >From 65031365f138e1ab8d3668ce902b441922ef5ff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Aug 2025 09:38

[clang] [Clang] Support generic bit counting builtins on fixed boolean vectors (PR #154203)

2025-08-26 Thread Timm Baeder via cfe-commits
tbaederr wrote: The bytecode parts LGTM https://github.com/llvm/llvm-project/pull/154203 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Support remaining add_sat like X86 builtins (PR #155358)

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

[clang] [clang][bytecode] Support remaining add_sat like X86 builtins (PR #155358)

2025-08-26 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155358 >From 21769a22bbbf39b736eba7a61c31a36aeb88afc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Aug 2025 07:56:46 +0200 Subject: [PATCH] [clang][bytecode] Support remaining add_sat lik

[clang] [clang][bytecode] Support remaining add_sat like X86 builtins (PR #155358)

2025-08-26 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155358 >From f351b23841d0917a4b578d97b1117684b059c3d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Aug 2025 07:56:46 +0200 Subject: [PATCH] [clang][bytecode] Support remaining add_sat lik

[clang] [clang][bytecode] Support remaining add_sat like X86 builtins (PR #155358)

2025-08-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155358 Checking CI with the RUN lines. They won't be pushed though because of a signed integer overflow reported by ubsan that seems to happen on unsigned types. >From 182c16a85d3a0d7961696fa5a2e387bf85a32e20 Mon Sep

[clang] [clang][bytecode] Don't call getIndex() on one-past-end pointers (PR #155173)

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

[clang] [clang][bytecode] Error if calls have fewer arguments than parameters (PR #155151)

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

[clang] [clang][bytecode] Don't call getIndex() on one-past-end pointers (PR #155173)

2025-08-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155173 >From 448ee9a9b416b3c78d6134bc649f6a4b2e4b2391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 24 Aug 2025 16:47:01 +0200 Subject: [PATCH] [clang][bytecode] Don't call getIndex() on one-

[clang] [clang][bytecode] Simplify Pointer (PR #155170)

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

[clang] [clang] Post-commit review for #150028 (PR #155351)

2025-08-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155351 1) Return `std::nullopt` instead of `{}`. 2) Rename the new function to evaluate*, it's not a simple getter. >From dfee9351513fae7272b9aafd8ebd5d717bd07d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3

[clang] [clang][bytecode] Error if calls have fewer arguments than parameters (PR #155151)

2025-08-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155151 >From 6e9e9659ce2014d56780de5ed67697753ee6ad70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 26 Aug 2025 05:53:58 +0200 Subject: [PATCH] Fixup --- clang/lib/AST/ByteCode/Compiler.cpp

[clang] [clang][bytecode] Simplify Pointer (PR #155170)

2025-08-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155170 >From a4f94a5792aa3108e160f691c49dbfc161a78b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 24 Aug 2025 16:36:17 +0200 Subject: [PATCH] [clang][bytecode] Simplify Pointer Now that we

[clang] Reapply "[clang][bytecode] Fix incorrect offset in elem() (#155157)" (PR #155276)

2025-08-25 Thread Timm Baeder via cfe-commits
tbaederr wrote: I tested this on a big-endian host, but even the previous attempt worked just fine. It seems to be a problem with 32-bit hosts? I can't test that easily though, I'll merge this and try. https://github.com/llvm/llvm-project/pull/155276 ___

[clang] Reapply "[clang][bytecode] Fix incorrect offset in elem() (#155157)" (PR #155276)

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

[clang] [Clang] Enable constexpr handling for builtin elementwise fshl/fshr (PR #153572)

2025-08-25 Thread Timm Baeder via cfe-commits
@@ -2817,6 +2817,81 @@ static bool interp__builtin_select(InterpState &S, CodePtr OpPC, return true; } +static bool interp__builtin_elementwise_fsh(InterpState &S, CodePtr OpPC, +const CallExpr *Call, +

[clang] [Clang] Enable constexpr handling for builtin elementwise fshl/fshr (PR #153572)

2025-08-25 Thread Timm Baeder via cfe-commits
@@ -2817,6 +2817,81 @@ static bool interp__builtin_select(InterpState &S, CodePtr OpPC, return true; } +static bool interp__builtin_elementwise_fsh(InterpState &S, CodePtr OpPC, +const CallExpr *Call, +

[clang] [clang][bytecode] Reject dependent RequiresExprs (PR #155230)

2025-08-25 Thread Timm Baeder via cfe-commits
tbaederr wrote: > Do you know which clause causes clang to choose to reject this, looks like we > are the only one: https://godbolt.org/z/KhfeP5W6d > > CC @hokein looks like came in w/ > [bd4662c](https://github.com/llvm/llvm-project/commit/bd4662cd3f3743e08699e6bab976d9e7b163ece0) No clue. T

[clang] [Clang] Enable constexpr handling for builtin elementwise fshl/fshr (PR #153572)

2025-08-25 Thread Timm Baeder via cfe-commits
@@ -2817,6 +2817,82 @@ static bool interp__builtin_select(InterpState &S, CodePtr OpPC, return true; } +static bool interp__builtin_elementwise_fsh(InterpState &S, CodePtr OpPC, +const CallExpr *Call, +

[clang] [Clang] Enable constexpr handling for builtin elementwise fshl/fshr (PR #153572)

2025-08-25 Thread Timm Baeder via cfe-commits
@@ -2817,6 +2817,82 @@ static bool interp__builtin_select(InterpState &S, CodePtr OpPC, return true; } +static bool interp__builtin_elementwise_fsh(InterpState &S, CodePtr OpPC, +const CallExpr *Call, +

[clang] [Clang] Enable constexpr handling for builtin elementwise fshl/fshr (PR #153572)

2025-08-25 Thread Timm Baeder via cfe-commits
@@ -2817,6 +2817,82 @@ static bool interp__builtin_select(InterpState &S, CodePtr OpPC, return true; } +static bool interp__builtin_elementwise_fsh(InterpState &S, CodePtr OpPC, +const CallExpr *Call, +

[clang] [Clang] Enable constexpr handling for builtin elementwise fshl/fshr (PR #153572)

2025-08-25 Thread Timm Baeder via cfe-commits
@@ -11941,6 +11941,42 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) { } return Success(APValue(ResultElements.data(), ResultElements.size()), E); } + + case Builtin::BI__builtin_elementwise_fshl: + case Builtin::BI__builtin_elementwise_fshr: { +

[clang] [Clang] Enable constexpr handling for builtin elementwise fshl/fshr (PR #153572)

2025-08-25 Thread Timm Baeder via cfe-commits
@@ -2817,6 +2817,82 @@ static bool interp__builtin_select(InterpState &S, CodePtr OpPC, return true; } +static bool interp__builtin_elementwise_fsh(InterpState &S, CodePtr OpPC, +const CallExpr *Call, +

[clang] [Clang] Enable constexpr handling for builtin elementwise fshl/fshr (PR #153572)

2025-08-25 Thread Timm Baeder via cfe-commits
@@ -2817,6 +2817,82 @@ static bool interp__builtin_select(InterpState &S, CodePtr OpPC, return true; } +static bool interp__builtin_elementwise_fsh(InterpState &S, CodePtr OpPC, +const CallExpr *Call, +

[clang] [Clang] Enable constexpr handling for builtin elementwise fshl/fshr (PR #153572)

2025-08-25 Thread Timm Baeder via cfe-commits
@@ -2817,6 +2817,82 @@ static bool interp__builtin_select(InterpState &S, CodePtr OpPC, return true; } +static bool interp__builtin_elementwise_fsh(InterpState &S, CodePtr OpPC, +const CallExpr *Call, +

[clang] [clang][bytecode] Reject dependent RequiresExprs (PR #155230)

2025-08-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155230 >From fa6fbec9dbe7d09ca3f9256f8c72e3223f4e4249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 25 Aug 2025 12:22:20 +0200 Subject: [PATCH] [clang][bytecode] Reject dependent RequiresExpr

[clang] [clang][bytecode] Don't call getIndex() on one-past-end pointers (PR #155173)

2025-08-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155173 >From 2f9a85e20284807bad73c0553f9277aaa8668c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 24 Aug 2025 16:47:01 +0200 Subject: [PATCH] [clang][bytecode] Don't call getIndex() on one-

[clang] [clang][bytecode] Check that a ltor cast to a complex value is possible (PR #155152)

2025-08-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155152 >From d87d467cc62edb7bdb20a3893209da781b18c15b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 24 Aug 2025 11:09:51 +0200 Subject: [PATCH] [clang][bytecode] Check that a ltor cast to a c

[clang] [clang][bytecode] Error if calls have fewer arguments than parameters (PR #155151)

2025-08-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155151 >From 8110e1f0b9059ed08fd005fe6d537520e72dc03f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 24 Aug 2025 11:09:51 +0200 Subject: [PATCH] [clang][bytecode] Check that a ltor cast to a c

[clang] Reapply "[clang][bytecode] Fix incorrect offset in elem() (#155157)" (PR #155276)

2025-08-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155276 This reverts commit 9642aadf7064192164d1687378d28d6bda1978c9. Since elem() only works on primitive arrays anyway, we don't have to do the isArrayRoot() check at all. >From ad39593f874733149daf4a27f87e285ac9d2

[clang] [clang][bytecode] Simplify Pointer (PR #155170)

2025-08-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155170 >From 6accebd531bf512f1f281522922eb568e6920d25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 24 Aug 2025 16:36:17 +0200 Subject: [PATCH] [clang][bytecode] Simplify Pointer Now that we

[clang] [clang][bytecode] Simplify Pointer (PR #155170)

2025-08-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155170 >From bcfb4231a2d995c51e6b33ba6986d16e4850b289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 24 Aug 2025 16:36:17 +0200 Subject: [PATCH] [clang][bytecode] Simplify Pointer Now that we

[clang] [clang][bytecode] Fix incorrect offset in elem() (PR #155157)

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

[clang] [clang][bytecode] Fix OptionScope initializer (PR #155149)

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

[clang] [clang][bytecode][NFC] Remove double initializer (PR #155150)

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

[clang] [clang][bytecode] Reject dependent RequiresExprs (PR #155230)

2025-08-25 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155230 Fixes #152899 >From 6acbe858dba0195b8b0ecbe3b4a69c6fc07f5f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Mon, 25 Aug 2025 12:22:20 +0200 Subject: [PATCH] [clang][bytecode] Reject depende

[clang] [clang][bytecode] Don't call getIndex() on one-past-end pointers (PR #155173)

2025-08-24 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/155173 >From 450ebd35245d908d067175757ef5b2a40dbea0d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 24 Aug 2025 16:47:01 +0200 Subject: [PATCH] [clang][bytecode] Don't call getIndex() on one-

[clang] [clang][bytecode] Guard strcmp against differing element types (PR #154777)

2025-08-24 Thread Timm Baeder via cfe-commits
@@ -338,3 +338,12 @@ static void *FooTable[1] = { } }; +int strcmp(const char *, const char *); // all-note {{passing argument to parameter here}} +#define S "\x01\x02\x03\x04\x05\x06\x07\x08" +const char _str[] = {S[0], S[1], S[2], S[3], S[4], S[5], S[6], S[7]}; +const u

[clang] [clang][bytecode] Don't call getIndex() on one-past-end pointers (PR #155173)

2025-08-24 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155173 That doesn't work. Fixes #152903 >From dd0d243e9799f8fbdfcabafbfb5f11ebff124a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 24 Aug 2025 16:47:01 +0200 Subject: [PATCH] [clang][byte

[clang] [clang][bytecode] Simplify Pointer (PR #155170)

2025-08-24 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155170 Now that we don't have the PointeeStorage pointer anymore, it's simpler to access the members of the anonymous union directly instead of using asBlockPointer(), etc. >From 4d1a84bd4897114609a90b008ae78876e03d

[clang] [clang][bytecode] Fix incorrect offset in elem() (PR #155157)

2025-08-24 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155157 We need to use the base offset in both cases. Also, add additional assertions to make sure we don't miss this case again. Fixes #155132 >From c466589f26780f35a317a6743ea675e89ea73764 Mon Sep 17 00:00:00 2001 F

[clang] [clang][bytecode] Check that a ltor cast to a complex value is possible (PR #155152)

2025-08-24 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155152 When we get to this point, the pointer might _not_ be backed by a primitive array, so the later code will fail. Fixes #155144 >From 8a31c1128ee4f2afe69afedd87024dc3ac76ca78 Mon Sep 17 00:00:00 2001 From: =?UT

[clang] [clang][bytecode] Error if calls have fewer arguments than parameters (PR #155151)

2025-08-24 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155151 Shouldn't happen, but does. Fixes #155147 >From a48107184367e99e173875e34f1bc063f2114006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 24 Aug 2025 10:56:05 +0200 Subject: [PATCH] [c

[clang] [clang][bytecode] Improve __builtin_{,dynamic_}object_size implementation (PR #153601)

2025-08-24 Thread Timm Baeder via cfe-commits
@@ -2170,29 +2170,32 @@ static bool interp__builtin_memchr(InterpState &S, CodePtr OpPC, return true; } -static unsigned computeFullDescSize(const ASTContext &ASTCtx, -const Descriptor *Desc) { - +static std::optional computeFullDescSize(

[clang] [clang][bytecode][NFC] Remove double initializer (PR #155150)

2025-08-24 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155150 As pointed out in https://github.com/llvm/llvm-project/pull/154405#discussion_r2296441643 >From 72b59df75ec3b66243b20dc0957b6b9a92cf07f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun,

  1   2   3   4   5   6   7   8   9   10   >