[clang] [clang] Use a Worklist for some CodeGenFunctions (PR #115395)

2024-11-20 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: In general, it's hard to avoid recursion: an AST is fundamentally a tree, and the most natural way to walk a tree is recursive, which is why we have issues in the first place. This usually isn't an issue because people don't write deeply nested code

[clang] [Clang/AMDGPU] Zero sized arrays not allowed in HIP device code. (PR #113470)

2024-11-20 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/113470 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add support for `__declspec(no_init_all)` (PR #116847)

2024-11-20 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/116847 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang/AMDGPU] Zero sized arrays not allowed in HIP device code. (PR #113470)

2024-11-20 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/113470 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang/AMDGPU] Zero sized arrays not allowed in HIP device code. (PR #113470)

2024-11-20 Thread Eli Friedman via cfe-commits
@@ -8714,6 +8714,21 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) { } } + // zero sized static arrays are not allowed in HIP device functions + if (LangOpts.CUDAIsDevice && LangOpts.HIP) { +if (FunctionDecl *FD = getCurFunctionDecl(); +FD && +

[clang] [clang] Add support for `__declspec(no_init_all)` (PR #116847)

2024-11-20 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/116847 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Use a Worklist for some CodeGenFunctions (PR #115395)

2024-11-20 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,37 @@ +// RUN: split-file %s %t +// RUN: python %t/gen.py %t/switch-overflow.c %t/tmp.c && %clang_cc1 -emit-llvm %t/tmp.c -o - | FileCheck %t/tmp.c + +//--- gen.py efriedma-quic wrote: I guess 32000 is small enough that a test won't be that expensive,

[clang] [clang] Use a Worklist for some CodeGenFunctions (PR #115395)

2024-11-20 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/115395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][SME] Ignore flatten for callees with mismatched streaming attributes (PR #116391)

2024-11-20 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. Oh, right, we have isInlineViable(), but attributes aren't part of it for... reasons. (I haven't tried to dig into https://discourse.llvm.org/t/rfc-avoid-inlining-alwaysinline-functions-when-they-cannot-be-inlined ; I'll believe you

[clang] [clang] Fix a crash issue that caused by handling of fields with initializers in nested anonymous unions (PR #113049)

2024-11-20 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: We could maybe look at setting hadError less aggressively in InitListChecker, for cases where the error is unlikely to impact the overall parse. If a member has a RecoveryExpr as its initializer, it's probably reasonable to continue producing error messages. That said, I

[clang] [Clang][AST] Fix MS Mangle concept uneval context template instantiation crash (PR #117845)

2024-11-27 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -std=c++20 -fms-compatibility -fms-compatibility-version=19.33 -emit-llvm %s -o - -triple=x86_64-windows-msvc | FileCheck %s + +template +concept C = requires +{ +{ T::test([](){}) }; +}; + +template +struct Widget {}; + +template +stru

[clang] [clang] Fix a crash issue that caused by handling of fields with initializers in nested anonymous unions (PR #113049)

2024-11-18 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: On my end, still waiting for review comments to be addressed. https://github.com/llvm/llvm-project/pull/113049 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [aarch64][clang][llvm] Allow AArch64 TLB maintenance instructions to be enabled via -march (PR #116707)

2024-11-18 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/116707 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [aarch64][clang][llvm] Allow AArch64 TLB maintenance instructions to be enabled via -march (PR #116707)

2024-11-18 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: __ARM_FEATURE_* defines are, as far as I know, supposed to be defined in the ACLE. So there needs to be an issue/PR for the ACLE spec. Once Arm reviews that, we can merge the corresponding patches here. https://github.com/llvm/llvm-project/pull/116

[clang] [clang] Implement -fstrict-bool (PR #116732)

2024-11-19 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: If we're going to document that values other than 0 and 1 are "allowed", I think the documentation needs to explicitly state how values other than 0 and 1 are handled. https://github.com/llvm/llvm-project/pull/116732 ___ cfe-comm

[clang] [llvm] [aarch64][clang][llvm] Allow AArch64 TLB maintenance instructions to be enabled via -march (PR #116707)

2024-11-19 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: In assembly, you can override the current architecture with a `.arch` directive. https://github.com/llvm/llvm-project/pull/116707 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[clang] [clang] Add support for `__declspec(no_init_all)` (PR #116847)

2024-11-19 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: If we're going to treat `/d1initall` as an alias for `-ftrivial-auto-var-init`, can we just treat `__declspec(no_init_all)` as an alias for `__attribute__((uninitialized))`? https://github.com/llvm/llvm-project/pull/116847 ___ cf

[clang] [llvm] [aarch64][clang][llvm] Allow AArch64 TLB maintenance instructions to be enabled via -march (PR #116707)

2024-11-19 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > Ah, interesting, any objection to not adding the detection macros? For the feature names, I think we also try to coordinate with Arm to define the names. (Maybe also in the ACLE? Not sure.) So I don't object to splitting the patch, but I'm not sure that really helps.

[clang] [llvm] [SystemZ] Add support for __builtin_setjmp and __builtin_longjmp (PR #116642)

2024-11-19 Thread Eli Friedman via cfe-commits
@@ -4619,6 +4619,12 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // Buffer is a void**. Address Buf = EmitPointerWithAlignment(E->getArg(0)); +if (getTarget().getTriple().getArch() == llvm::Triple::systemz) { + // Call L

[clang] [llvm] [SystemZ] Add support for __builtin_setjmp and __builtin_longjmp (PR #116642)

2024-11-20 Thread Eli Friedman via cfe-commits
@@ -4619,6 +4619,12 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // Buffer is a void**. Address Buf = EmitPointerWithAlignment(E->getArg(0)); +if (getTarget().getTriple().getArch() == llvm::Triple::systemz) { + // Call L

[clang] [clang][SME] Ignore flatten for callees with mismatched streaming attributes (PR #116391)

2024-11-19 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Do we really need to do this in the frontend? The inliner itself should be doing safety checks. https://github.com/llvm/llvm-project/pull/116391 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[clang] [clang] Add support for `__declspec(no_init_all)` (PR #116847)

2024-11-19 Thread Eli Friedman via cfe-commits
@@ -8719,6 +8719,18 @@ Attribute used by `clspv`_ (OpenCL-C to Vulkan SPIR-V compiler) to identify func }]; } +def NoTrivialAutoVarInitDocs : Documentation { + let Category = DocCatDecl; + let Content = [{ +The ``__declspec(no_init_all)`` attribute disables the automatic i

[clang] [llvm] [SystemZ] Add support for __builtin_setjmp and __builtin_longjmp (PR #116642)

2024-11-19 Thread Eli Friedman via cfe-commits
@@ -4619,6 +4619,12 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // Buffer is a void**. Address Buf = EmitPointerWithAlignment(E->getArg(0)); +if (getTarget().getTriple().getArch() == llvm::Triple::systemz) { + // Call L

[clang] [CodeGen] Do not emit call site attributes for LLVM intrinsics. (PR #116881)

2024-11-19 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Accessing intrinsics using `asm` is not a documented feature; it's an unintended result of the name clash between functions and LLVM intrinsics. And I'm a little hesitant about making it a real feature; there are other calling convention issues, and IR changes can very ea

[clang] [clang] Add support for `__declspec(no_init_all)` (PR #116847)

2024-11-19 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I see. I agree we don't need to add non-__declspec syntax here. We're adding this for MSVC compat, so we need to match MSVC semantics anyway, so there's not really any other way to implement this. We can always adjust the code later if we end up implementing an overlapp

[clang] [Clang][Parser] Make 'T...[N]' within a function parameter a valid pack expansion prior to C++2c (PR #116332)

2024-11-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: We basically have the following options here: 1. Use C++23 semantics in C++23 mode, with a warning. 2. Use C++2c semantics in C++23 mode, with a warning. 3. Reject the construct with a hard error in C++23 mode. (2) and (3) are basically removing the pack expansion parse fro

[clang] [Clang][Parser] Make 'T...[N]' within a function parameter a valid pack expansion prior to C++2c (PR #116332)

2024-11-15 Thread Eli Friedman via cfe-commits
@@ -58,8 +58,9 @@ void b(T[] ...); template void c(T ... []); // expected-error {{expected expression}} \ efriedma-quic wrote: To be clear, it's not a "pack-index-specifier" even in C++26: it doesn't match the grammar because there's no constant-expression,

[clang] [clang codegen] Add CreateRuntimeFunction overload that takes a clang type. (PR #113506)

2024-11-13 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/113506 >From 7f259d75f18422fff05ac11526b5a0a1b73312fd Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Wed, 23 Oct 2024 16:12:27 -0700 Subject: [PATCH] [clang codegen] Add CreateRuntimeFunction overload that tak

[clang] [MS] Add /Zc:tlsGuards option to control tls guard emission (PR #113830)

2024-11-13 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/113830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang/AMDGPU] Zero sized arrays not allowed in HIP device code. (PR #113470)

2024-11-13 Thread Eli Friedman via cfe-commits
@@ -8732,6 +8732,18 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) { } } + // zero sized static arrays are not allowed in HIP device functions + if (getLangOpts().HIP && + DeclAttrsMatchCUDAMode(getLangOpts(), getCurFunctionDecl())) {

[clang] [Clang/AMDGPU] Zero sized arrays not allowed in HIP device code. (PR #113470)

2024-11-13 Thread Eli Friedman via cfe-commits
@@ -8732,6 +8732,18 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) { } } + // zero sized static arrays are not allowed in HIP device functions + if (getLangOpts().HIP && + DeclAttrsMatchCUDAMode(getLangOpts(), getCurFunctionDecl())) {

[clang] [clang codegen] Add CreateRuntimeFunction overload that takes a clang type. (PR #113506)

2024-11-14 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic closed https://github.com/llvm/llvm-project/pull/113506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Handle trivial_abi attribute for Microsoft ABI. (PR #88857)

2024-11-14 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The original patch just changed the calling convention for structs explicitly marked trivial_abi. @rnk wanted to instead introduce the notion of a "trivial-abi-aware" type, i.e. a type that is either trivial_abi, or contains a trivial-abi-aware field/base. The patch was

[clang] [Clang/AMDGPU] Zero sized arrays not allowed in HIP device code. (PR #113470)

2024-11-14 Thread Eli Friedman via cfe-commits
@@ -8732,6 +8732,18 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) { } } + // zero sized static arrays are not allowed in HIP device functions + if (getLangOpts().HIP && + DeclAttrsMatchCUDAMode(getLangOpts(), getCurFunctionDecl())) {

[clang] [AArch64] Add support for the __{inc|add}x18{byte|word|dword|qword intrinsics (PR #117752)

2024-11-26 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/117752 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [AArch64] Add support for the __{inc|add}x18{byte|word|dword|qword intrinsics (PR #117752)

2024-11-26 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic requested changes to this pull request. Sorry, just spotted an issue: I don't think you're emitting the operations in the correct order. You need to emit both arguments before you read the register or load the value. If you have some non-trivial operation like

[clang] [PowerPC] Fix incorrect store alignment for __builtin_vsx_build_pair() (PR #108606)

2024-09-17 Thread Eli Friedman via cfe-commits
@@ -18197,7 +18197,7 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, CallOps.push_back(Ops[i]); llvm::Function *F = CGM.getIntrinsic(ID); Value *Call = Builder.CreateCall(F, CallOps); -return Builder.CreateAlignedStore(Call, Ops[0], MaybeAli

[clang] [Clang] Emit error for duplicate mangled names within a lambda (PR #107581)

2024-09-17 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: In the example in https://github.com/llvm/llvm-project/pull/107581#issuecomment-2343651051 , there are four relevant calls to GetOrCreateLLVMFunction: one for each function with IsInDefinition false, and one for each function with IsInDefinition true. The last of those c

[clang] [PowerPC] Fix incorrect store alignment for __builtin_vsx_build_pair() (PR #108606)

2024-09-17 Thread Eli Friedman via cfe-commits
@@ -18197,7 +18197,7 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, CallOps.push_back(Ops[i]); llvm::Function *F = CGM.getIntrinsic(ID); Value *Call = Builder.CreateCall(F, CallOps); -return Builder.CreateAlignedStore(Call, Ops[0], MaybeAli

[clang] [llvm] [SelectionDAG][PowerPC] Add an intrinsic for memcmp. (PR #118178)

2024-12-02 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: We already have handling in the backend; see llvm/lib/CodeGen/ExpandMemCmp.cpp . https://github.com/llvm/llvm-project/pull/118178 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[clang] [Clang][AST] Fix MS Mangle concept uneval context template instantiation crash (PR #117845)

2024-12-02 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -std=c++20 -fms-compatibility -fms-compatibility-version=19.33 -emit-llvm %s -o - -triple=x86_64-windows-msvc | FileCheck %s + +template +concept C = requires +{ +{ T::test([](){}) }; +}; + +template +struct Widget {}; + +template +stru

[clang] [MS] Add /Zc:tlsGuards option to control tls guard emission (PR #113830)

2024-11-13 Thread Eli Friedman via cfe-commits
@@ -4063,6 +4063,11 @@ defm threadsafe_statics : BoolFOption<"threadsafe-statics", NegFlag, PosFlag>; +defm tls_guards : BoolFOption<"tls-guards", + LangOpts<"TlsGuards">, DefaultTrue, efriedma-quic wrote: My understanding is that if a tls variable is def

[clang] [Clang][Parser] Make 'T...[N]' within a function parameter a valid pack expansion prior to C++2c (PR #116332)

2024-11-16 Thread Eli Friedman via cfe-commits
@@ -58,8 +58,9 @@ void b(T[] ...); template void c(T ... []); // expected-error {{expected expression}} \ efriedma-quic wrote: Consider: ``` templatevoid c(T ... []); ``` Earlier versions of clang consider this valid: it's a function that takes pointers to

[clang] [AArch64][SME] Fix bug on SMELd1St1 (PR #118109)

2024-12-04 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > I thought that this fix will automatically pull from main to other branch at > some tiime main is the basis for all future release branches (20.x and later), but we don't automatically pull fixes into release branches that are already created (19.x). See https://llvm.o

[clang] [clang] Fix a crash issue that caused by handling of fields with initializers in nested anonymous unions (PR #113049)

2024-12-04 Thread Eli Friedman via cfe-commits
@@ -750,6 +750,19 @@ void InitListChecker::FillInEmptyInitForField(unsigned Init, FieldDecl *Field, if (Field->hasInClassInitializer()) { if (VerifyOnly) return; + + // We do not want to aggressively set the hadError flag and cutoff + // parsing. Tr

[clang] [aarch64][arm] Add support for the _Interlocked[Compare]ExchangePointer_{acq|nf|rel} MS intrinsics (PR #117645)

2024-12-04 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/117645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Revert "[HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (#114148)" (PR #117448)

2024-12-04 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: In the future, when you revert a commit, please put a note in the commit message explaining why you're reverting, so other people can understand what you're doing. https://github.com/llvm/llvm-project/pull/117448 ___ cfe-commits

[clang] [llvm] [RISCV][VLS] Support RISCV VLS calling convention (PR #100346)

2024-12-04 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Is there discussion somewhere of why you need a command-line flag? ABI-modifying flags tend to be dangerous to work with. It's hard to ensure that all code is compiled with the same flags, and if the user messes up, the compiler silently generates broken code. https://gi

[clang] [llvm] [SystemZ] Add support for __builtin_setjmp and __builtin_longjmp (PR #116642)

2024-12-04 Thread Eli Friedman via cfe-commits
@@ -4619,6 +4619,31 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // Buffer is a void**. Address Buf = EmitPointerWithAlignment(E->getArg(0)); +if (getTarget().getTriple().getArch() == llvm::Triple::systemz) { + // Call L

[clang] [aarch64] Add support for the __{inc|add}x18{byte|word|dword|qword intrinsics (PR #117752)

2024-12-03 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/117752 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Reimplement constrained 'trunc' using operand bundles (PR #118253)

2024-12-05 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: llvm.trunc is currently marked IntrNoMem in Intrinsics.td; you'll need to update that if you want it to read/modify FP state. (Trying to override the default by sticking attributes on top doesn't work properly, as far as I know.) https://github.com/llvm/llvm-project/pull/

[clang] [Clang][AArch64] Allow FP8 Neon vector types to be used by __builtin_shufflevector (PR #119031)

2024-12-09 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Given the mfloat8 scalar type exists, why does mfloat8x16 need to be a BuiltinType, as opposed to a VectorType? https://github.com/llvm/llvm-project/pull/119031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists

[clang] [llvm] [RISCV][VLS] Support RISCV VLS calling convention (PR #100346)

2024-12-09 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Is there a downside if we just recommend people `__attribute__((riscv_vls_cc(MY_LIBRARY_VLEN)))`, then put `-DMY_LIBRARY_VLEN=128` on the command-line? It's about the same complexity as -mriscv-abi-vlen, and it's much more obvious that what you're doing is fragile. https

[clang] [RISCV] Merging RISCVToolChain and BareMetal toolchains (PR #118809)

2024-12-09 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > I think this change could be made a lot smaller by doing a clean up first, > bringing the BareMetal driver closer to other drivers, before attempting to > merge the RISCVToolChain driver into it. Could you describe in a bit more detail which bits you think need to be cle

[clang] [clang] Fix crashes when passing VLA to va_arg (PR #119563)

2025-01-06 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/119563 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang/python] Add python bindings for PrintingPolicy (PR #120494)

2025-01-06 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: @DeinAlptraum any idea why the Python tests are failing? https://github.com/llvm/llvm-project/pull/120494 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libclang] Add API to query more information about base classes. (PR #120300)

2025-01-06 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I think the relevant code that prevents visiting template instantiations is CursorVisitor::VisitClassTemplateSpecializationDecl. It intentionally skips implicit template instantiations, I guess because of the origin of the API, which was focused around code written by the

[clang] [libclang/python] Add python bindings for PrintingPolicy (PR #120494)

2025-01-06 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120494 >From 13a9c0b88afae7a5f48a66e86357f7284fdace95 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 17 Dec 2024 15:25:00 -0800 Subject: [PATCH] [libclang/python] Add python bindings for PrintingPolicy T

[clang] [libclang/python] Add python binding for clang_Cursor_isAnonymousRecordDecl (PR #120483)

2025-01-06 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic closed https://github.com/llvm/llvm-project/pull/120483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Restrict use of scalar types in vector builtins (PR #119423)

2025-01-06 Thread Eli Friedman via cfe-commits
@@ -14585,11 +14585,18 @@ void Sema::CheckAddressOfPackedMember(Expr *rhs) { _2, _3, _4)); } +static ExprResult UsualUnaryConversionsNoPromoteInt(Sema &S, Expr *E) { + // Don't promote integer types + if (QualType Ty = E->getType(); S.getASTContext().is

[clang] [clang] Emit @llvm.assume when we know the streaming mode of the function (PR #121917)

2025-01-07 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I really don't see why we'd want to implement the optimization this way; can't we just add an instcombine for calls to `llvm.aarch64.sme.in.streaming.mode`? https://github.com/llvm/llvm-project/pull/121917 ___ cfe-commits mailing

[clang] [Clang][counted_by] Don't treat a __bdos argument as an array if it isn't (PR #125298)

2025-02-03 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Sorry I didn't get around to re-reviewing #122198 earlier... it looks like this is the with lvalue-to-rvalue conversions I mentioned on the review. You do not want to look through lvalue-to-rvalue conversions; the StructFieldAccess visitor should bail out if it sees one.

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-03 Thread Eli Friedman via cfe-commits
@@ -1984,6 +1984,15 @@ llvm::Constant *ConstantEmitter::emitForMemory(CodeGenModule &CGM, return Res; } + // In HLSL bool vectors are stored in memory as a vector of i32 + if (destType->isExtVectorBoolType() && CGM.getContext().getLangOpts().HLSL) { +llvm::Type *b

[clang] [HLSL] Make memory representation of boolean vectors in HLSL, vectors of i32. Add support for boolean swizzling. (PR #123977)

2025-02-03 Thread Eli Friedman via cfe-commits
@@ -2016,8 +2016,9 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const { case Type::Vector: { const auto *VT = cast(T); TypeInfo EltInfo = getTypeInfo(VT->getElementType()); -Width = VT->isExtVectorBoolType() ? VT->getNumElements() -

[clang] [Win/X86] Make _m_prefetch[w] builtins to avoid winnt.h conflicts (PR #115099)

2025-02-03 Thread Eli Friedman via cfe-commits
@@ -146,8 +146,13 @@ let Attributes = [Const, NoThrow, RequiredVectorWidth<256>], Features = "avx" in // current formulation is based on what was easiest to recognize from the // pre-TableGen version. -let Features = "mmx", Attributes = [NoThrow, Const] in { - def _mm_prefet

[clang] CodeGen: support static linking for libclosure (PR #125384)

2025-02-03 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Do you anticipate the clang driver ever adding the libclosure runtime to the link line automatically? If we do, would this flag control the behavior of that? https://github.com/llvm/llvm-project/pull/125384 ___ cfe-commits maili

[clang] CodeGen: support static linking for libclosure (PR #125384)

2025-02-03 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I thought the Windows linker actually can handle statically linking dllimported symbols this (maybe with a warning?). The other options you mention (`-static-libgcc` etc.) affect the link line; it looks like this patch doesn't change the way linking works? Is that expecte

[clang] [Clang] allow restrict qualifier for array types with pointer types as element types (PR #120896)

2025-02-03 Thread Eli Friedman via cfe-commits
@@ -1596,12 +1596,14 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc, QualType ProblemTy; if (T->isAnyPointerType() || T->isReferenceType() || -T->isMemberPointerType()) { +T->isMemberPointerType() || T->isArrayType()) { Qual

[clang] [Win/X86] Make _m_prefetch[w] builtins to avoid winnt.h conflicts (PR #115099)

2025-02-03 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/115099 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][counted-by] Bail out of visitor for LValueToRValue cast (PR #125571)

2025-02-03 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: My expectation was that this would affect the tests from #125298, because the MemberExpr there is a child of an LValueToRValue conversion. I could be missing something, though? https://github.com/llvm/llvm-project/pull/125571 __

[clang] [Win/X86] Make _m_prefetch[w] builtins to avoid winnt.h conflicts (PR #115099)

2025-01-30 Thread Eli Friedman via cfe-commits
@@ -2225,9 +2221,10 @@ _mm_storer_ps(float *__p, __m128 __a) ///be generated. \n ///_MM_HINT_T2: Move data using the T2 hint. The PREFETCHT2 instruction will ///be generated. -#define _mm_prefetch(a, sel) (__builtin_prefetch((const void *)(a), \ -

[clang] [Clang] allow restrict qualifier for array types with pointer types as element types (PR #120896)

2025-02-04 Thread Eli Friedman via cfe-commits
@@ -1593,34 +1593,31 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc, // object or incomplete types shall not be restrict-qualified." if (Qs.hasRestrict()) { unsigned DiagID = 0; -QualType ProblemTy; - -if (T->isAnyPointerType() || T->isRefe

[clang] [Clang] allow restrict qualifier for array types with pointer types as element types (PR #120896)

2025-02-04 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -std=c2y -fsyntax-only -verify -pedantic %s + +typedef int (*T1)[2]; +restrict T1 t1; +static_assert(_Generic(typeof (t1), int (*restrict)[2] : 1, default : 0)); + +typedef int *T2[2]; +restrict T2 t2; +static_assert(_Generic(typeof (t2), int *

[clang] [llvm] [mlir] [IR][ModRef] Introduce `errno` memory location (PR #120783)

2025-02-04 Thread Eli Friedman via cfe-commits
@@ -82,7 +82,7 @@ define void @test_store(ptr %p) { @G = external global ptr define i8 @test_store_capture(ptr %p) { -; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: read, inaccessiblemem: none) +; FNATTRS: Functio

[clang] [llvm] [aarch64][x86][win] Add compiler support for MSVC's /funcoverride flag (Windows kernel loader replaceable functions) (PR #125320)

2025-02-04 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -loader-replaceable-function=override_me -emit-llvm -std=c11 -o - %s | FileCheck %s + +// CHECK: define dso_local void @override_me() #0 +void override_me() {} + +// CHECK: define dso_local void @dont_override_me() #1 +void dont_override_me()

[clang] [llvm] [aarch64][x86][win] Add compiler support for MSVC's /funcoverride flag (Windows kernel loader replaceable functions) (PR #125320)

2025-02-04 Thread Eli Friedman via cfe-commits
@@ -4661,3 +4661,110 @@ AsmPrinter::getCodeViewJumpTableInfo(int JTI, const MachineInstr *BranchInstr, return std::make_tuple(Base, 0, BranchLabel, codeview::JumpTableEntrySize::Int32); } + +void AsmPrinter::emitCOFFReplaceableFunctionData(Module &M)

[clang] [llvm] [aarch64][x86][win] Add compiler support for MSVC's /funcoverride flag (Windows kernel loader replaceable functions) (PR #125320)

2025-02-04 Thread Eli Friedman via cfe-commits
@@ -4661,3 +4661,110 @@ AsmPrinter::getCodeViewJumpTableInfo(int JTI, const MachineInstr *BranchInstr, return std::make_tuple(Base, 0, BranchLabel, codeview::JumpTableEntrySize::Int32); } + +void AsmPrinter::emitCOFFReplaceableFunctionData(Module &M)

[clang] [llvm] [aarch64][x86][win] Add compiler support for MSVC's /funcoverride flag (Windows kernel loader replaceable functions) (PR #125320)

2025-02-04 Thread Eli Friedman via cfe-commits
@@ -561,6 +564,16 @@ class CodeGenOptions : public CodeGenOptionsBase { /// Reset all of the options that are not considered when building a /// module. void resetNonModularOptions(StringRef ModuleFormat); + + // Is the given function name one of the functions that can b

[clang] [clang] Support member function poiners in Decl::getFunctionType() (PR #125077)

2025-01-31 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. https://github.com/llvm/llvm-project/pull/125077 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [mlir] [InferAttrs] Mark errnomem-setting libcalls as such (PR #124742)

2025-01-31 Thread Eli Friedman via cfe-commits
@@ -672,13 +703,15 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F, Changed |= setDoesNotThrow(F); Changed |= setDoesNotCapture(F, 0); Changed |= setOnlyReadsMemory(F, 0); +Changed |= setOnlyAccessesErrnoMemory(F); efriedma-quic wrote:

[clang] [Clang] allow restrict qualifier for array types with pointer types as element types (PR #120896)

2025-01-31 Thread Eli Friedman via cfe-commits
@@ -1596,12 +1596,14 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc, QualType ProblemTy; if (T->isAnyPointerType() || T->isReferenceType() || -T->isMemberPointerType()) { +T->isMemberPointerType() || T->isArrayType()) { ---

[clang] [Clang][counted-by] Bail out of visitor for LValueToRValue cast (PR #125571)

2025-02-04 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/125571 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] CodeGen: support static linking for libclosure (PR #125384)

2025-02-04 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Please add HelpText for the new option. Maybe mention in that text that it currently doesn't affect linking. Please add a release note. Otherwise looks fine. https://github.com/llvm/llvm-project/pull/125384 __

[clang] [sanitizer] [clang] Introduce fsanitize-bounds-strict-flex-arrays (PR #126163)

2025-02-07 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: What else even uses the level? __builtin_object_size codegen? Can you add a DocBrief to the flag explaining when you'd want to use it? https://github.com/llvm/llvm-project/pull/126163 ___ cfe-commits mailing list cfe-commits@lis

[clang] [Clang] allow restrict qualifier for array types with pointer types as element types (PR #120896)

2025-02-07 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic requested changes to this pull request. Oh, just thought of one more thing: we probably want a c23_compat warning for this (assuming the language is new in c23). https://github.com/llvm/llvm-project/pull/120896 ___ cfe

[clang] [llvm] [clang] Add support for the c2000 architecture (PR #125663)

2025-02-07 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: If you wanted to do things "properly", you'd probably define `__interrupt` and `__cregister` as attributes in clang/include/clang/Basic/Attr.td . But at first glance, using macros to ignore `__interrupt` and `__cregister` behaves basically correctly, if you're not actuall

[clang] [llvm] [clang] Add support for the c2000 architecture (PR #125663)

2025-02-07 Thread Eli Friedman via cfe-commits
@@ -9111,3 +9118,50 @@ def wasm_opt : Flag<["--"], "wasm-opt">, Group, HelpText<"Enable the wasm-opt optimizer (default)">, MarshallingInfoNegativeFlag>; + + + +//===--===// +// cl2000 Options +//===-

[clang] [Clang] allow restrict qualifier for array types with pointer types as element types (PR #120896)

2025-02-07 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/120896 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [mlir] [IR][ModRef] Introduce `errno` memory location (PR #120783)

2025-02-05 Thread Eli Friedman via cfe-commits
@@ -82,7 +82,7 @@ define void @test_store(ptr %p) { @G = external global ptr define i8 @test_store_capture(ptr %p) { -; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: read, inaccessiblemem: none) +; FNATTRS: Functio

[clang] [libclang] Always Dup in createRef(StringRef) (PR #125020)

2025-02-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: If `CXString createRef(StringRef)` is essentially equivalent to `CXString createDup(StringRef)`, should we just get rid of `CXString createRef(StringRef)`? https://github.com/llvm/llvm-project/pull/125020 _

[clang] [llvm] Add support for flag output operand "=@cc" for SystemZ. (PR #125970)

2025-02-10 Thread Eli Friedman via cfe-commits
@@ -2563,9 +2563,15 @@ EmitAsmStores(CodeGenFunction &CGF, const AsmStmt &S, if ((i < ResultRegIsFlagReg.size()) && ResultRegIsFlagReg[i]) { // Target must guarantee the Value `Tmp` here is lowered to a boolean // value. - llvm::Constant *Two = llvm::Consta

[clang] [llvm] [llvm:ir] Add support for constant data exceeding 4GiB (PR #126481)

2025-02-10 Thread Eli Friedman via cfe-commits
@@ -1583,7 +1583,7 @@ static void printConstant(const Constant *COp, unsigned BitWidth, bool IsInteger = EltTy->isIntegerTy(); bool IsFP = EltTy->isHalfTy() || EltTy->isFloatTy() || EltTy->isDoubleTy(); unsigned EltBits = EltTy->getPrimitiveSizeInBits(); -unsig

[clang] [llvm] [llvm:ir] Add support for constant data exceeding 4GiB (PR #126481)

2025-02-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/126481 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [llvm:ir] Add support for constant data exceeding 4GiB (PR #126481)

2025-02-10 Thread Eli Friedman via cfe-commits
@@ -364,13 +364,13 @@ bool ConstantAggregateBuilder::split(size_t Index, CharUnits Hint) { // FIXME: If possible, split into two ConstantDataSequentials at Hint. CharUnits ElemSize = getSize(CDS->getElementType()); replace(Elems, Index, Index + 1, -llvm

[clang] [llvm] [llvm:ir] Add support for constant data exceeding 4GiB (PR #126481)

2025-02-10 Thread Eli Friedman via cfe-commits
@@ -644,7 +644,7 @@ class ConstantDataSequential : public ConstantData { Type *getElementType() const; /// Return the number of elements in the array or vector. - unsigned getNumElements() const; + uint64_t getNumElements() const; efriedma-quic wrote: D

[clang] [llvm] [llvm:ir] Add support for constant data exceeding 4GiB (PR #126481)

2025-02-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Did you test that the result actually has the correct contents, in addition to the correct size? It looks like it might still wrap... https://github.com/llvm/llvm-project/pull/126481 ___ cfe-commits mailing

[clang] [Clang] allow restrict qualifier for array types with pointer types as element types (PR #120896)

2025-02-11 Thread Eli Friedman via cfe-commits
@@ -1593,35 +1593,38 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc, // object or incomplete types shall not be restrict-qualified." if (Qs.hasRestrict()) { unsigned DiagID = 0; -QualType ProblemTy; - -if (T->isAnyPointerType() || T->isRefe

[clang] [libclang] Always Dup in createRef(StringRef) (PR #125020)

2025-02-11 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The public libclang interface needs to be stable, yes... but in this context, that's just the interfaces declared in clang/include/clang-c/CXString.h. We can do whatever we want with the internal interface in clang/tools/libclang/CXString.h. https://github.com/llvm/llvm-p

[clang] [Win/X86] Make _m_prefetch[w] builtins to avoid winnt.h conflicts (PR #115099)

2025-01-30 Thread Eli Friedman via cfe-commits
@@ -146,8 +146,13 @@ let Attributes = [Const, NoThrow, RequiredVectorWidth<256>], Features = "avx" in // current formulation is based on what was easiest to recognize from the // pre-TableGen version. -let Features = "mmx", Attributes = [NoThrow, Const] in { - def _mm_prefet

[clang] [Win/X86] Make _m_prefetch[w] builtins to avoid winnt.h conflicts (PR #115099)

2025-01-30 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/115099 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    9   10   11   12   13   14   15   16   17   18   >