[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] [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] [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] [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
@@ -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] [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
@@ -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] 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] [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-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] [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-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] [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] [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] 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][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] [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()) { Qual

[clang] [SveEmitter] Explicitly merge with `poison` instead of `undef` (PR #124596)

2025-01-31 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The architecture manual isn't really helpful here... the instruction set doesn't really have any notion of undefined values in this context; the operations in question are always "merging". The intrinsic allows omitting the destination register for convenience, in which c

[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] [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] [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] [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] [llvm] [mlir] [IR][ModRef] Introduce `errno` memory location (PR #120783)

2025-01-30 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] [mlir] [InferAttrs] Mark errnomem-setting libcalls as such (PR #124742)

2025-01-30 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/124742 ___ 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-30 Thread Eli Friedman via cfe-commits
@@ -703,13 +737,15 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F, Changed |= setDoesNotCapture(F, 1); Changed |= setOnlyReadsMemory(F, 0); Changed |= setOnlyReadsMemory(F, 1); +Changed |= setOnlyAccessesErrnoMemory(F); efriedma-quic wr

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

2025-01-30 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Please take a second look at your markings: in particular, syscalls with side-effects should be treated as modifying inaccessible memory. https://github.com/llvm/llvm-project/pull/124742 ___ cfe-commits mail

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

2025-01-30 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] [llvm] [mlir] [InferAttrs] Mark errnomem-setting libcalls as such (PR #124742)

2025-01-30 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); break; case LibFunc_ctermid:

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

2025-01-30 Thread Eli Friedman via cfe-commits
@@ -703,13 +737,15 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F, Changed |= setDoesNotCapture(F, 1); Changed |= setOnlyReadsMemory(F, 0); Changed |= setOnlyReadsMemory(F, 1); +Changed |= setOnlyAccessesErrnoMemory(F); break; case LibFunc_fdope

[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

[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] [Clang][NFC] Add special handling of mfloat8 in initializer lists (PR #125097)

2025-01-30 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Please don't mark this "NFC"; I'd consider this a functional change, even if it doesn't have any obvious effect on non-asserts builds. https://github.com/llvm/llvm-project/pull/125097 ___ cfe-commits mailing list cfe-commits@lists

[clang] [clang] Return larger CXX records in memory (PR #120670)

2025-01-30 Thread Eli Friedman via cfe-commits
@@ -1334,6 +1334,16 @@ class X86_64ABIInfo : public ABIInfo { return T.isOSLinux() || T.isOSNetBSD(); } + bool returnCXXRecordGreaterThan128InMem() const { +// Clang <= 20.0 did not do this. +if (getContext().getLangOpts().getClangABICompat() <= +LangOpt

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

2025-01-30 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM... but I have a couple comments on things you mentioned in the commit message. > ``` > /// Looks through the Decl's underlying type to extract a FunctionType > /// when possible. Will return null if the type underlying the Decl d

[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)

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/124762 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Return larger CXX records in memory (PR #120670)

2025-01-29 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: You can cherry-pick this to the 20.x branch if you want; we can still land fixes like this for a few weeks after the branch is created. https://github.com/llvm/llvm-project/pull/120670 ___ cfe-commits mailing list cfe-commits@list

[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)

2025-01-29 Thread Eli Friedman via cfe-commits
@@ -1144,6 +1144,12 @@ Arm and AArch64 Support * FUJITSU-MONAKA (fujitsu-monaka) +- The AArch64 calling convention for empty structs in C++ mode was changed to efriedma-quic wrote: I assume this is supposed to mention AArch32/AAPCS32? https://github.com/l

[clang] [llvm] [clang][llvm][aarch64][win] Add a clang flag and module attribute for import call optimization, and remove LLVM flag (PR #122831)

2025-01-29 Thread Eli Friedman via cfe-commits
@@ -945,7 +944,7 @@ void AArch64AsmPrinter::emitEndOfAsmFile(Module &M) { // If import call optimization is enabled, emit the appropriate section. // We do this whether or not we recorded any import calls. - if (EnableImportCallOptimization && TT.isOSBinFormatCOFF()) { +

[clang] [llvm] [clang][llvm][aarch64][win] Add a clang flag and module attribute for import call optimization, and remove LLVM flag (PR #122831)

2025-01-29 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM with one minor comment. https://github.com/llvm/llvm-project/pull/122831 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [llvm] [clang][llvm][aarch64][win] Add a clang flag and module attribute for import call optimization, and remove LLVM flag (PR #122831)

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

[clang] [clang][SME] Account for C++ lambdas in SME builtin diagnostics (PR #124750)

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

[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)

2025-01-29 Thread Eli Friedman via cfe-commits
@@ -1144,6 +1144,12 @@ Arm and AArch64 Support * FUJITSU-MONAKA (fujitsu-monaka) +- The AArch64 calling convention for empty structs in C++ mode was changed to + pass them as if they have a size of 1 byte, matching the AAPCS64 + specification and GCC's implementation. The

[clang] [AArch64] Match GCC behaviour for zero-size structs (PR #124760)

2025-01-28 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The likelihood of anyone actually tripping over this outside a synthetic testcase is very low; you need a combination of unusual constructs to hit this. So I'm not really worried about documentation/ABI compat flags. https://github.com/llvm/llvm-project/pull/124760 __

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

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

[clang] [clang][SME] Account for C++ lambdas in SME builtin diagnostics (PR #124750)

2025-01-28 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Please add some tests for lambdas with streaming attributes, for example: ``` void f() { auto x = []__arm_locally_streaming {}; x(); } ``` https://github.com/llvm/llvm-project/pull/124750 ___ cfe-commits mailing list cfe-commits@l

[clang] [AArch64] Match GCC behaviour for zero-size structs (PR #124760)

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

[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)

2025-01-28 Thread Eli Friedman via cfe-commits
@@ -366,9 +387,15 @@ ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, bool isVariadic, return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); } - // Ignore empty records. - if (isEmptyRecord(getContext(), Ty, true)) -return ABIArgInfo::ge

[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)

2025-01-28 Thread Eli Friedman via cfe-commits
@@ -588,7 +615,8 @@ ABIArgInfo ARMABIInfo::classifyReturnType(QualType RetTy, bool isVariadic, // Otherwise this is an AAPCS variant. - if (isEmptyRecord(getContext(), RetTy, true)) + if (isEmptyRecord(getContext(), RetTy, true) || + getContext().getTypeSize(RetTy)

[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)

2025-01-28 Thread Eli Friedman via cfe-commits
@@ -752,10 +780,13 @@ RValue ARMABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, CharUnits SlotSize = CharUnits::fromQuantity(4); // Empty records are ignored for parameter passing purposes. - if (isEmptyRecord(getContext(), Ty, true)) + uint64_t Size = getC

[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)

2025-01-28 Thread Eli Friedman via cfe-commits
@@ -366,9 +387,15 @@ ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, bool isVariadic, return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); } - // Ignore empty records. - if (isEmptyRecord(getContext(), Ty, true)) -return ABIArgInfo::ge

[clang] [clang][SME] Emit error for OpenMP captured regions in SME functions (PR #124590)

2025-01-27 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM In theory, handling streaming mode doesn't seem too challenging here: you mark the outlined functions locally_streaming, and you're done, I think. That said, I'm not sure how you define the semantics for ZA, so maybe better to

[clang] [Clang] Skip past code generation for unevaluated lambdas (PR #124572)

2025-01-27 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Looking a bit more, I'm not sure I buy the premise that we don't need to mangle lambdas written in unevaluated contexts. Consider the following related example: ``` template using simd_vector = Tp; template using simd_vector_underlying_type_t = decltype([](simd_vecto

[clang] [SveEmitter] Explicitly merge with `poison` instead of `undef` (PR #124596)

2025-01-27 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Does the Arm spec actually allow us to do this? It says "the inactive elements of the result have arbitrary, undefined values." That seems very different from "your program has undefined behavior if you use the inactive elements of the result". For comparison, the x86 `

[clang] [Clang] Skip past code generation for unevaluated lambdas (PR #124572)

2025-01-27 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: See also discussion on #117845. I think it makes some sense to add a way for CodeGen to query whether a given declaration is impossible to emit. I suggested in that discussion that it could be a kind of linkage. I'd prefer not to mess with the way DeferredDecls works for

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Eli Friedman via cfe-commits
@@ -4311,14 +4311,14 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, // GEP indexes are signed, and scaling an index isn't permitted to // signed-overflow, so we use the same semantics for our explicit // multiply. We suppress this i

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Eli Friedman via cfe-commits
@@ -4311,14 +4311,14 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, // GEP indexes are signed, and scaling an index isn't permitted to // signed-overflow, so we use the same semantics for our explicit // multiply. We suppress this i

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

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

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-24 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: CC @llvm/clang-vendors : this changes the behavior of -fwrapv. Internally, I expect it's going to be a bit painful to communicate to all our internal teams that they need to change their -fwrapv usage to -fno-strict-overflow, but if we think it's imp

[clang] [NFC] Avoid potential nullptr deref by using castAs<> (PR #123395)

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

[clang] [llvm] [clang] Implement pragma clang section on COFF targets (PR #112714)

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

[clang] [llvm] [clang] Implement pragma clang section on COFF targets (PR #112714)

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

[clang] [llvm] [clang] Implement pragma clang section on COFF targets (PR #112714)

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

[clang] [clang] Emit @llvm.assume before streaming_compatible functions when the streaming mode is known (PR #121917)

2025-01-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The two issues are sort of tied together: if the intrinsic isn't IntrNoMem, I suspect the assumption cache stops cooperating. But anyway, I guess the question is really whether we want these constructs represented explicitly in IR, to try to leverage the AssumptionCache, o

[clang] [Clang][counted_by] Refactor __builtin_dynamic_object_size on FAMs (PR #122198)

2025-01-15 Thread Eli Friedman via cfe-commits
@@ -1060,236 +1061,358 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type, return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true); } -const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset( -ASTContext &Ctx, const

[clang] [Clang][counted_by] Refactor __builtin_dynamic_object_size on FAMs (PR #122198)

2025-01-15 Thread Eli Friedman via cfe-commits
@@ -1060,236 +1061,358 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type, return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true); } -const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberFieldAndOffset( -ASTContext &Ctx, const

[clang] [llvm] [IR] Don't set strictfp on irrelevant calls (PR #122735)

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

[clang] [llvm] [IR] Don't set strictfp on irrelevant calls (PR #122735)

2025-01-15 Thread Eli Friedman via cfe-commits
@@ -86,6 +86,35 @@ IRBuilderBase::createCallHelper(Function *Callee, ArrayRef Ops, return CI; } +CallInst *IRBuilderBase::CreateCall(FunctionType *FTy, Value *Callee, +ArrayRef Args, +ArrayRef OpBundles

[clang] [llvm] [IR] Don't set strictfp on irrelevant calls (PR #122735)

2025-01-15 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: LGTM with one minor comment https://github.com/llvm/llvm-project/pull/122735 ___ 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-14 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The 32-bit Arm failures are fixed by 7aec7caca30f800811b76ba94291645494788a4f . The other failures appear to be unrelated. https://github.com/llvm/llvm-project/pull/120300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang] 7aec7ca - Add explicit triple to test_type.py.

2025-01-14 Thread Eli Friedman via cfe-commits
Author: Eli Friedman Date: 2025-01-14T14:49:45-08:00 New Revision: 7aec7caca30f800811b76ba94291645494788a4f URL: https://github.com/llvm/llvm-project/commit/7aec7caca30f800811b76ba94291645494788a4f DIFF: https://github.com/llvm/llvm-project/commit/7aec7caca30f800811b76ba94291645494788a4f.diff

[clang] [llvm] [clang] Implement pragma clang section on COFF targets (PR #112714)

2025-01-14 Thread Eli Friedman via cfe-commits
@@ -1,4 +1,5 @@ ;RUN: llc -mtriple=armv7-eabi %s -o - | FileCheck %s +;RUN: llc -mtriple=armv7-msvc %s -o - | FileCheck %s efriedma-quic wrote: That's fine. But the CHECK lines in the new test don't look right (`nobits` etc. are ELF-specific). https://github.

[clang] [llvm] [IR] Don't set strictfp on irrelevant calls (PR #122735)

2025-01-14 Thread Eli Friedman via cfe-commits
@@ -66,6 +66,12 @@ bool IntrinsicInst::mayLowerToFunctionCall(Intrinsic::ID IID) { } } +bool IntrinsicInst::canAccessFPEnvironment(LLVMContext &C, Intrinsic::ID IID) { + AttributeList Attrs = Intrinsic::getAttributes(C, IID); + MemoryEffects ME = Attrs.getMemoryEffects();

[clang] [clang] Implement gcc_struct attribute on Itanium targets (PR #71148)

2025-01-13 Thread Eli Friedman via cfe-commits
@@ -997,6 +997,9 @@ def warn_npot_ms_struct : Warning< "data types with sizes that aren't a power of two">, DefaultError, InGroup; +def err_itanium_layout_unimplemented : Error< + "Itanium-compatible layout for the Microsoft C++ ABI is not yet supported">; ---

[clang] [clang] Implement gcc_struct attribute on Itanium targets (PR #71148)

2025-01-13 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-pc-linux-gnu %s +// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-pc-linux-gnu -fms-layout-compatibility=microsoft %s +// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-pc-windows-gnu %s +// RUN: %clang_cc1 -emi

[clang] [llvm] [IR] Don't set strictfp on irrelevant calls (PR #122735)

2025-01-13 Thread Eli Friedman via cfe-commits
@@ -66,6 +66,17 @@ bool IntrinsicInst::mayLowerToFunctionCall(Intrinsic::ID IID) { } } +bool IntrinsicInst::canAccessFPEnvironment(Intrinsic::ID IID) { + switch (IID) { +#define DAG_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) \ +case Intrinsic::INTR

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-10 Thread Eli Friedman via cfe-commits
@@ -137,6 +137,10 @@ llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, Alloca = new llvm::AllocaInst(Ty, CGM.getDataLayout().getAllocaAddrSpace(), ArraySize, Name, AllocaInsertPt->getIterator()); + if (Alloca->getName

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

2025-01-10 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] [mlir] [IR][ModRef] Introduce `errno` memory location (PR #120783)

2025-01-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/120783 ___ 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-01-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: This seems like roughly what I expected from the proposal. https://github.com/llvm/llvm-project/pull/120783 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

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

2025-01-10 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Addressed review comments https://github.com/llvm/llvm-project/pull/120300 ___ 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-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120300 >From 12ad982b984a4e533db4220332f6edbf4b4903a2 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 10 Dec 2024 15:23:55 -0800 Subject: [PATCH] [cindex] Add API to query more information about base clas

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

2025-01-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120300 >From ff0f4b551de077ee07331ed30410b102abb06c09 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 10 Dec 2024 15:23:55 -0800 Subject: [PATCH] [cindex] Add API to query more information about base clas

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

2025-01-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120300 >From 0d4bcf69c57457ba79af9069ae60c6de8ee45498 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 10 Dec 2024 15:23:55 -0800 Subject: [PATCH] [cindex] Add API to query more information about base clas

[clang] [libclang] Allow using PrintingPolicy with types (PR #122386)

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

[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

2025-01-10 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'm tempted to say we should just treat -fwrapv/-fwrapv-pointer/-fno-strict-overflow as aliases for each other. I don't think anyone using -fwrapv is going to be happy that we're turning on overflow optimizations. https://github.com/llvm/llvm-project/pull/122486

[clang] [libclang] Allow using PrintingPolicy with types (PR #122386)

2025-01-10 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/122386 >From 2f6e9acc324802854132ff1b48693a47a8466fa4 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 17 Dec 2024 17:46:09 -0800 Subject: [PATCH] [libclang] Allow using PrintingPolicy with types This allo

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

2025-01-10 Thread Eli Friedman via cfe-commits
@@ -3771,6 +3771,12 @@ CINDEX_LINKAGE enum CXRefQualifierKind clang_Type_getCXXRefQualifier(CXType T); */ CINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor); +/** + * Returns the offset in bits of a CX_CXXBaseSpecifier relative to the parent + * class. + */ +CINDEX_LINKAG

[clang] [AArch64][Clang] Add support for __arm_agnostic("sme_za_state") (PR #121788)

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

[clang] [libclang] Allow using PrintingPolicy with types (PR #122386)

2025-01-09 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/122386 >From 0557238b725ecf3554f91ef264d710ff841fd1e1 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 17 Dec 2024 17:46:09 -0800 Subject: [PATCH] [libclang] Allow using PrintingPolicy with types This allo

[clang] [libclang] Allow using PrintingPolicy with types (PR #122386)

2025-01-09 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/122386 This allows controlling pretty-printing of types the same way it works with cursors. >From a96fbe38f697f77c12c712f5573c2158072a8d2f Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 17 Dec 2024 17:4

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

2025-01-09 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/120300 >From 448537876f4377686847120a923dd9d443f7d556 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 10 Dec 2024 15:23:55 -0800 Subject: [PATCH] [cindex] Add API to query more information about base clas

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

2025-01-09 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic closed 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/python] Add python bindings for PrintingPolicy (PR #120494)

2025-01-09 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Oh, looks like that fixed it, thanks. 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] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

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

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-09 Thread Eli Friedman via cfe-commits
@@ -137,6 +137,10 @@ llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, Alloca = new llvm::AllocaInst(Ty, CGM.getDataLayout().getAllocaAddrSpace(), ArraySize, Name, AllocaInsertPt->getIterator()); + if (Alloca->getName

[clang] [clang-tools-extra] Remove `StringLiteral` in favor of `StringRef` (PR #122366)

2025-01-09 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: For reference, when it was added, the important thing about StringLiteral was that it had a constexpr constructor. The StringRef constructor became constexpr with 57effbdadc0b382db4ef86addcfd03a64c9eda0a, a few years after StringLiteral was added. https://github.com/llvm

[clang] Remove the `CustomEntry` escape hatch from builtin TableGen (PR #120861)

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

  1   2   3   4   5   6   7   8   9   10   >