[clang] [X86][vectorcall] Pass built types byval when xmm0~6 exhausted (PR #91846)

2024-05-11 Thread Eli Friedman via cfe-commits
@@ -792,7 +792,7 @@ ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty, CCState &State, return ABIArgInfo::getDirect(); return ABIArgInfo::getExpand(); } -return getIndirectResult(Ty, /*ByVal=*/false, State); +return getIndirectResult(Ty, IsVe

[clang] [X86][vectorcall] Pass built types byval when xmm0~6 exhausted (PR #91846)

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

[clang] [llvm] [BPF] Fix linking issues in static map initializers (PR #91310)

2024-05-12 Thread Eli Friedman via cfe-commits
@@ -1950,8 +1950,22 @@ ConstantLValueEmitter::tryEmitBase(const APValue::LValueBase &base) { if (D->hasAttr()) return CGM.GetWeakRefReference(D).getPointer(); -if (auto FD = dyn_cast(D)) - return CGM.GetAddrOfFunction(FD); +if (auto FD = dyn_cast(D)) {

[clang] [Clang][AArch64][SVE] Allow write to SVE vector elements using the subscript operator (PR #91965)

2024-05-13 Thread Eli Friedman via cfe-commits
@@ -4180,8 +4180,10 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, // If the base is a vector type, then we are forming a vector element lvalue // with this subscript. - if (E->getBase()->getType()->isVectorType() && - !isa(E->getBase

[clang] [Clang][AArch64][SVE] Allow write to SVE vector elements using the subscript operator (PR #91965)

2024-05-13 Thread Eli Friedman via cfe-commits
@@ -88,3 +88,13 @@ float subscript_float32(svfloat32_t a, size_t b) { double subscript_float64(svfloat64_t a, size_t b) { return a[b]; } + +// CHECK-LABEL: @subscript_write_float32( +// CHECK-NEXT: entry: +// CHECK-NEXT:[[VECINS:%.*]] = insertelement [[A:%.*]], float 1

[clang] [llvm] [clang][SPIR-V] Add support for AMDGCN flavoured SPIRV (PR #89796)

2024-05-14 Thread Eli Friedman via cfe-commits
@@ -6088,6 +6088,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, StringRef Prefix = llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch()); if (!Prefix.empty()) { +if (Prefix == "spv" && +getTarget().getTr

[clang] [Clang] Fix incorrect passing of _BitInt args (PR #90741)

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

[clang] [Clang][objectsize] Generate object size calculation for sub-objects (PR #86858)

2024-05-14 Thread Eli Friedman via cfe-commits
@@ -1052,6 +1053,165 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +class ObjectSizeVisitor +: public ConstStmtVisitor { + bool SkipASE; + +

[clang] [Clang][objectsize] Generate object size calculation for sub-objects (PR #86858)

2024-05-14 Thread Eli Friedman via cfe-commits
@@ -1052,6 +1053,165 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +class ObjectSizeVisitor +: public ConstStmtVisitor { + bool SkipASE; + +

[clang] [Clang][objectsize] Generate object size calculation for sub-objects (PR #86858)

2024-05-14 Thread Eli Friedman via cfe-commits
@@ -1052,6 +1053,165 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +class ObjectSizeVisitor +: public ConstStmtVisitor { + bool SkipASE; + +

[clang] [llvm] [AArch64][SME] Save VG for unwind info when changing streaming-mode (PR #83301)

2024-05-15 Thread Eli Friedman via cfe-commits
@@ -3768,6 +3768,12 @@ def err_conflicting_attributes_arm_state : Error< "conflicting attributes for state '%0'">; def err_sme_streaming_cannot_be_multiversioned : Error< "streaming function cannot be multi-versioned">; +def err_sme_streaming_mode_change_no_sve : Error< +

[clang] [llvm] [AArch64][SME] Save VG for unwind info when changing streaming-mode (PR #83301)

2024-05-15 Thread Eli Friedman via cfe-commits
@@ -8287,6 +8289,13 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI, SDValue InGlue; if (RequiresSMChange) { + +if (Subtarget->hasSVE()) { efriedma-quic wrote: I'm not sure I follow what the issue is... I think we discussed before that we w

[clang] [llvm] [clang][SPIR-V] Add support for AMDGCN flavoured SPIRV (PR #89796)

2024-05-15 Thread Eli Friedman via cfe-commits
@@ -6088,6 +6088,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, StringRef Prefix = llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch()); if (!Prefix.empty()) { +if (Prefix == "spv" && +getTarget().getTr

[clang] [Clang] Emit lifetime markers for non-aggregate temporary allocas (PR #90849)

2024-05-15 Thread Eli Friedman via cfe-commits
@@ -1,13 +1,15 @@ -// RUN: %clang_cc1 -emit-llvm -triple arm64-- -o - %s -O0 | FileCheck %s --check-prefix=CHECK-O0 -// RUN: %clang_cc1 -emit-llvm -disable-llvm-optzns -triple arm64-- -o - %s -O3 | FileCheck %s --check-prefix=CHECK-O3 +// NOTE: Assertions have been autogenerated

[clang] [Coverage] Handle array decomposition correctly (PR #88881)

2024-05-15 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM. I'm not completely convinced by your argument here... but let's try to move forward and land this and #88898 so we can do the refactor to use isUnique(). Then we can revisit later if necessary. https://github.com/llvm/llvm-pr

[clang] [Coverage] Handle `CoroutineSuspendExpr` correctly (PR #88898)

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

[clang] [Coverage] Handle `CoroutineSuspendExpr` correctly (PR #88898)

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

[clang] [Coverage] Handle array decomposition correctly (PR #88881)

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

[clang] [Clang] Add __builtin_selectvector and use it for AVX512 intrinsics (PR #91306)

2024-05-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: clang already supports `?:` with a vector condition; does this add anything new on top of that? https://github.com/llvm/llvm-project/pull/91306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [Clang][AArch64] Use __clang_arm_builtin_alias for overloaded svreinterpret's (PR #92427)

2024-05-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: However we choose to emit this particular builtin, should we provide a way to write a function like this? Like, the caller has to either support sve, or have streaming enabled. Maybe call it __arm_streaming_compatible_requires_sve. https://github.com/llvm/llvm-project/pu

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > The data layout will insert 4-bytes of padding between the float and the > vector because the vector needs to be properly aligned. You can use `type <{ float, <2 x float>}>` if you need the tightly-packed layout. https://github.com/llvm/llvm-project/pull/91999 _

[clang] [Clang] Fix P2564 handling of variable initializers (PR #89565)

2024-05-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: clang already generates certain diagnostics from ExprConstant; expanding the set of diagnostics could be reasonable. Alternatively, we could try to add some sort of cooperation between DiagRuntimeBehavior and constant evaluation, to try to avoid having to diagnose everyth

[clang] [Clang][AArch64] Use __clang_arm_builtin_alias for overloaded svreinterpret's (PR #92427)

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

[clang] [Clang][AArch64] Use __clang_arm_builtin_alias for overloaded svreinterpret's (PR #92427)

2024-05-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The key here is that `__arm_streaming_compatible` is the only way to write code that runs in both streaming and non-streaming mode; outside of `__arm_streaming_compatible`, there generally isn't an issue. If you know you're not in streaming mode, you can just check direct

[clang] [Clang][AArch64] Use __clang_arm_builtin_alias for overloaded svreinterpret's (PR #92427)

2024-05-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > Thinking about it a bit more, maybe we can just do some magic to make things > work? Say, if you specify `__attribute__((target("sve"))) > __arm_streaming_compatible`, and the caller is in streaming mode, allow the > call even if the caller doesn't have SVE proper. Thin

[clang] [OpenCL] Put constant initializer globals into constant addrspace (PR #90048)

2024-05-16 Thread Eli Friedman via cfe-commits
@@ -535,20 +535,23 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr, llvm::ArrayType *AType, elementType.isTriviallyCopyableType(CGF.getContext())) { CodeGen::CodeGenModule &CGM = CGF.CGM; ConstantEmitter Emitter(CGF); -LangAS AS = ArrayQTy.getAddressSpa

[clang] [CodeGen] Support arrays with initializers of 64-bit size (PR #92473)

2024-05-16 Thread Eli Friedman via cfe-commits
@@ -949,11 +949,11 @@ tryEmitGlobalCompoundLiteral(ConstantEmitter &emitter, static llvm::Constant * EmitArrayConstant(CodeGenModule &CGM, llvm::ArrayType *DesiredType, - llvm::Type *CommonElementType, unsigned ArrayBound, + llvm::Type *Common

[clang] [Clang][AArch64] Use __clang_arm_builtin_alias for overloaded svreinterpret's (PR #92427)

2024-05-17 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: clang specifically diagnoses always_inline functions. So for example, say you want to write something like: ``` #include __attribute__((always_inline, target("+sve"))) static inline void f(void* p) __arm_streaming_compatible { *(svuint32_t*)p = svmul_m(svptrue_b32(), *(

[clang] [CodeGen] Support arrays with initializers of 64-bit size (PR #92473)

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

[clang] [clang] add unnamed_addr function attribute (PR #92499)

2024-05-17 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: If we're going to do this, it should probably also work for constants. Also, I think I'd prefer to sort out the situation with the C++ standard's rules for constant merging before we start extending those rules. See #63628. https://github.com/llvm/llvm-project/pull/92499 _

[clang] [Clang][AArch64][SVE] Allow write to SVE vector elements using the subscript operator (PR #91965)

2024-05-17 Thread Eli Friedman via cfe-commits
@@ -4180,8 +4180,10 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, // If the base is a vector type, then we are forming a vector element lvalue // with this subscript. - if (E->getBase()->getType()->isVectorType() && - !isa(E->getBase

[clang] [OpenCL] Fix an infinite loop in builidng AddrSpaceQualType (PR #92612)

2024-05-17 Thread Eli Friedman via cfe-commits
@@ -537,8 +537,9 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr, llvm::ArrayType *AType, elementType.isTriviallyCopyableType(CGF.getContext())) { CodeGen::CodeGenModule &CGM = CGF.CGM; ConstantEmitter Emitter(CGF); +Qualifiers Quals; QualType GVAr

[clang] [OpenCL] Fix an infinite loop in builidng AddrSpaceQualType (PR #92612)

2024-05-17 Thread Eli Friedman via cfe-commits
@@ -537,8 +537,9 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr, llvm::ArrayType *AType, elementType.isTriviallyCopyableType(CGF.getContext())) { CodeGen::CodeGenModule &CGM = CGF.CGM; ConstantEmitter Emitter(CGF); +Qualifiers Quals; QualType GVAr

[clang] [OpenCL] Fix an infinite loop in builidng AddrSpaceQualType (PR #92612)

2024-05-18 Thread Eli Friedman via cfe-commits
@@ -3054,6 +3054,13 @@ QualType ASTContext::removeAddrSpaceQualType(QualType T) const { if (!T.hasAddressSpace()) return T; + // For arrays, strip the qualifier off the element type, then reconstruct the + // array type + if (T.getTypePtr()->isArrayType()) { +Qua

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-19 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,55 @@ +// RUN: %clang_cc1 -emit-llvm -triple i386-linux -Wno-unknown-pragmas %s -o - | FileCheck %s efriedma-quic wrote: Since this is a preprocessor testcase, can you just use -E? https://github.com/llvm/llvm-project/pull/92699 _

[clang] [Clang][Sema] Refactor handling of vector subscript expressions (NFC) (PR #92778)

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

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-20 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,55 @@ +// RUN: %clang_cc1 -emit-llvm -triple i386-linux -Wno-unknown-pragmas %s -o - | FileCheck %s efriedma-quic wrote: Is there some reason the preprocessor can't parse FENV_ROUND? Breaking code with -save-temps etc. seems bad. https://github.com

[clang] [Clang] Emit lifetime markers for non-aggregate temporary allocas (PR #90849)

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

[clang] [llvm] [BPF] Fix linking issues in static map initializers (PR #91310)

2024-05-20 Thread Eli Friedman via cfe-commits
@@ -1950,8 +1950,22 @@ ConstantLValueEmitter::tryEmitBase(const APValue::LValueBase &base) { if (D->hasAttr()) return CGM.GetWeakRefReference(D).getPointer(); -if (auto FD = dyn_cast(D)) - return CGM.GetAddrOfFunction(FD); +if (auto FD = dyn_cast(D)) {

[clang] [OpenCL] Fix an infinite loop in builidng AddrSpaceQualType (PR #92612)

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

[clang] [clang] solve crash due to function overloading. (PR #90255)

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

[clang] [clang] solve crash due to function overloading. (PR #90255)

2024-05-20 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Bot is unreliable, so copy-pasting: > ⚠️ We detected that you are using a GitHub private e-mail address to > contribute to the repo. Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account. See [LLVM Discourse](https:/

[clang] [llvm] [CodeGen][AArch64] Added -mno-va-float to skip FP save in variadic functions (PR #92827)

2024-05-20 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: This patch, as proposed, doesn't seem like a good idea: it's very likely to miscompile user code without any diagnostic. Are you sure you don't want one of the following? - A soft-float ABI (-mabi=aapcs-soft) - Completely forbidding the use of floating-point values (-mgene

[clang] [AArch64][NFC] Use ptrmask for vaarg stack alignment (PR #92836)

2024-05-20 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. Please don't use "NFC" markings for patches that change the emitted IR, even if it doesn't significantly impact the resulting assembly in most cases. That said, LGTM https://github.com/llvm/llvm-project/pull/92836 ___

[clang] [clang] add unnamed_addr function attribute (PR #92499)

2024-05-21 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I think the underlying functionality is pretty clearly useful: identical code folding gives significant codesize reductions. In fact, on Windows, the linker does this kind of folding automatically by default (despite the fact that it isn't standards-compliant). I imagine

[clang] [Clang][AArch64][SVE] Allow write to SVE vector elements using the subscript operator (PR #91965)

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

[clang] [llvm] [IR] Avoid creating icmp/fcmp constant expressions (PR #92885)

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

[clang] [clang] Fix PS "selective" DLL import/export of vtable & typeinfo (PR #92579)

2024-05-21 Thread Eli Friedman via cfe-commits
@@ -1793,6 +1793,37 @@ void ItaniumCXXABI::EmitDestructorCall(CodeGenFunction &CGF, ThisTy, VTT, VTTTy, nullptr); } +// Check if any non-inline method has the specified attribute. +template +static bool CXXRecordNonInlineHasAttr(const CXXRecordDec

[clang] [clang] solve crash due to function overloading. (PR #90255)

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

[clang] [clang] Fix PS "selective" DLL import/export of vtable & typeinfo (PR #92579)

2024-05-21 Thread Eli Friedman via cfe-commits
@@ -1793,6 +1793,37 @@ void ItaniumCXXABI::EmitDestructorCall(CodeGenFunction &CGF, ThisTy, VTT, VTTTy, nullptr); } +// Check if any non-inline method has the specified attribute. +template +static bool CXXRecordNonInlineHasAttr(const CXXRecordDec

[clang] [clang] Fix PS "selective" DLL import/export of vtable & typeinfo (PR #92579)

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

[clang] [Clang] Remove parameter that shouldn't be there (PR #93086)

2024-05-22 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Looks fine. https://github.com/llvm/llvm-project/pull/93086 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][FMV] Allow declaration of function versions in namespaces. (PR #93044)

2024-05-22 Thread Eli Friedman via cfe-commits
@@ -11868,8 +11868,10 @@ static bool CheckMultiVersionFunction(Sema &S, FunctionDecl *NewFD, return false; if (!OldDecl || !OldDecl->getAsFunction() || - OldDecl->getDeclContext()->getRedeclContext() != - NewFD->getDeclContext()->getRedeclContext()) { +

[clang] [clang] Fix PS "selective" DLL import/export of vtable & typeinfo (PR #92579)

2024-05-22 Thread Eli Friedman via cfe-commits
@@ -1793,6 +1793,37 @@ void ItaniumCXXABI::EmitDestructorCall(CodeGenFunction &CGF, ThisTy, VTT, VTTTy, nullptr); } +// Check if any non-inline method has the specified attribute. +template +static bool CXXRecordNonInlineHasAttr(const CXXRecordDec

[clang] Fix codegen of consteval functions returning an empty class. (PR #93115)

2024-05-22 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/93115 If a class is empty, don't store it to memory: the store might overwrite useful data. (See also d60c3d08.) Fixes #93040. >From bdfcc729c309fc5b1092b67d7c3c803c852ae251 Mon Sep 17 00:00:00 2001 From: Eli

[clang] Fix codegen of consteval functions returning an empty class. (PR #93115)

2024-05-22 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I didn't think so at first glance... but yes, we do, in certain obscure cases: ``` #include struct A { char c; A(); }; struct __attribute((packed)) S { char a; int x; __attribute((aligned(2))) char y; consteval S() : x(1), a(3), y(2) {} }; struct S2 { [[no_unique_address]

[clang] Fix codegen of consteval functions returning an empty class. (PR #93115)

2024-05-23 Thread Eli Friedman via cfe-commits
@@ -135,6 +135,17 @@ class AggExprEmitter : public StmtVisitor { EnsureDest(E->getType()); if (llvm::Value *Result = ConstantEmitter(CGF).tryEmitConstantExpr(E)) { + // An empty record can overlap other data (if declared with + // no_unique_address); omit the

[clang] [Clang][objectsize] Generate object size calculation for sub-objects (PR #86858)

2024-05-23 Thread Eli Friedman via cfe-commits
@@ -1062,6 +1063,159 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +class ObjectSizeVisitor +: public ConstStmtVisitor { + bool SkipASE; + +

[clang] [Clang][objectsize] Generate object size calculation for sub-objects (PR #86858)

2024-05-23 Thread Eli Friedman via cfe-commits
@@ -1062,6 +1063,159 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +class ObjectSizeVisitor +: public ConstStmtVisitor { + bool SkipASE; + +

[clang] [Clang][objectsize] Generate object size calculation for sub-objects (PR #86858)

2024-05-23 Thread Eli Friedman via cfe-commits
@@ -1052,6 +1053,165 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +class ObjectSizeVisitor +: public ConstStmtVisitor { + bool SkipASE; + +

[clang] [Clang][objectsize] Generate object size calculation for sub-objects (PR #86858)

2024-05-23 Thread Eli Friedman via cfe-commits
@@ -1062,6 +1063,159 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +class ObjectSizeVisitor +: public ConstStmtVisitor { + bool SkipASE; + +

[clang] Fix codegen of consteval functions returning an empty class. (PR #93115)

2024-05-23 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/93115 >From 19f3b677d92ed88b825b455d738055da05f91e0d Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 23 May 2024 18:38:04 -0700 Subject: [PATCH] Fix codegen of consteval functions returning an empty class,

[clang] Fix codegen of consteval functions returning an empty class, and related issues (PR #93115)

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

[clang] Fix codegen of consteval functions returning an empty class, and related issues (PR #93115)

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

[clang] Fix codegen of consteval functions returning an empty class, and related issues (PR #93115)

2024-05-23 Thread Eli Friedman via cfe-commits
@@ -177,7 +179,12 @@ kernel void KernelTwoMember(struct StructTwoMember u) { // AMDGCN-LABEL: define{{.*}} amdgpu_kernel void @KernelLargeTwoMember // AMDGCN-SAME: (%struct.LargeStructTwoMember %[[u_coerce:.*]]) // AMDGCN: %[[u:.*]] = alloca %struct.LargeStructTwoMember, alig

[clang] Fix codegen of consteval functions returning an empty class, and related issues (PR #93115)

2024-05-23 Thread Eli Friedman via cfe-commits
@@ -46,9 +46,9 @@ int mane() { char1 f1{1}; char1 f2{1}; -// CHECK: [[TMP:%.+]] = alloca i16 efriedma-quic wrote: The revised version of casting integers is a bit more aggressive; it's hard to make it precisely match the old code while still preservi

[clang] Fix codegen of consteval functions returning an empty class, and related issues (PR #93115)

2024-05-23 Thread Eli Friedman via cfe-commits
@@ -44,20 +44,20 @@ struct S1 f1(struct S1 s1) { return s1; } // CHECK-SOFT: define{{.*}} void @_Z2f22S2(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.S2) align 8 %agg.result, [4 x i32] %s2.coerce) // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc [2 x <2 x

[clang] Fix codegen of consteval functions returning an empty class, and related issues (PR #93115)

2024-05-23 Thread Eli Friedman via cfe-commits
@@ -48,10 +48,13 @@ uint8x16x4_t test_vld4q_u8(const uint8_t *addr) // CHECK-LABEL: @test_vst2q_u32( // CHECK-NEXT: entry: -// CHECK-NEXT:[[VALUE_COERCE_FCA_0_0_EXTRACT:%.*]] = extractvalue [[STRUCT_UINT32X4X2_T:%.*]] [[VALUE_COERCE:%.*]], 0, 0 -// CHECK-NEXT:[[VALUE

[clang] [clang] Macro for constant rounding mode (PR #92699)

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

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-24 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: This approach seems much better. https://github.com/llvm/llvm-project/pull/92699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-24 Thread Eli Friedman via cfe-commits
@@ -965,6 +965,16 @@ void Preprocessor::Lex(Token &Result) { LastTokenWasAt = Result.is(tok::at); --LexLevel; + if (Result.is(tok::l_brace)) { +CurlyBraceLevel++; + } else if (Result.is(tok::r_brace)) { +if (!RoundingPragmas.empty() && efriedma-q

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-24 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM, but maybe wait a few days to merge in case someone else has comments. https://github.com/llvm/llvm-project/pull/92699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang] [clang][c++20] Fix code coverage mapping crash with generalized NTTPs (PR #85837)

2024-05-24 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM (In the future, please leave a note on the pull request when you push an update; as far as I can tell, GitHub doesn't generate a notification when you force-push to the branch.) https://github.com/llvm/llvm-project/pull/85837

[clang] [clang][c++20] Fix code coverage mapping crash with generalized NTTPs (PR #85837)

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

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-27 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Oh, I somehow thought the macro was part of the spec; reading again, I guess it isn't, it's just an attempt to implement the spec. We probably want some feedback from libc implementers to check if this is what they want. I don't really want to end up in a situation where

[clang] [clang] fix classification of a string literal expression used as initializer (PR #101447)

2024-07-31 Thread Eli Friedman via cfe-commits
@@ -119,8 +119,6 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { // First come the expressions that are always lvalues, unconditionally. case Expr::ObjCIsaExprClass: -// C++ [expr.prim.general]p1: A string literal is an lvalue. - case Expr::S

[clang] [clang] fix classification of a string literal expression used as initializer (PR #101447)

2024-07-31 Thread Eli Friedman via cfe-commits
@@ -150,6 +148,12 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { case Expr::OMPIteratorExprClass: return Cl::CL_LValue; +// C++ [expr.prim.general]p1: A string literal is an lvalue. +// Except we special case them as prvalues when they ar

[clang] [clang] fix classification of a string literal expression used as initializer (PR #101447)

2024-07-31 Thread Eli Friedman via cfe-commits
@@ -119,8 +119,6 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { // First come the expressions that are always lvalues, unconditionally. case Expr::ObjCIsaExprClass: -// C++ [expr.prim.general]p1: A string literal is an lvalue. - case Expr::S

[clang] [clang][CUDA] Add 'noconvergent' function and statement attribute (PR #100637)

2024-07-31 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: A revert isn't necessary just for the missing release note; a followup PR is fine. https://github.com/llvm/llvm-project/pull/100637 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang] [X86_32][C++] fix 0 sized struct case in vaarg. (PR #86388)

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

[clang] [clang] fix classification of a string literal expression used as initializer (PR #101447)

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

[clang] [Clang] Improve generation of GEP and RecordDecl loop (PR #101434)

2024-08-01 Thread Eli Friedman via cfe-commits
@@ -1136,15 +1135,15 @@ llvm::Value *CodeGenFunction::EmitCountedByFieldExpr( return nullptr; } - llvm::Value *Zero = Builder.getInt32(0); RecIndicesTy Indices; - getGEPIndicesToField(*this, RD, CountDecl, Indices); + if (Indices.empty()) +return nullptr; -

[clang] [Clang] Improve generation of GEP and RecordDecl loop (PR #101434)

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

[clang] [Clang] Improve generation of GEP and RecordDecl loop (PR #101434)

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

[clang] [llvm] [BPF] introduce `__attribute__((bpf_fastcall))` (PR #101228)

2024-08-01 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Is there some reason this is an attribute, and not a calling convention, at the IR level? https://github.com/llvm/llvm-project/pull/101228 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] Fix codegen of consteval functions returning an empty class, and related issues (PR #93115)

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

[clang] [llvm] [PowerPC] Fix codegen for transparent_union function params (PR #101738)

2024-08-05 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: transparent_union generally means that the value is passed using the convention of the first member of the union. Why do you need to check for whether the value was originally a transparent union? Shouldn't the resulting convention be the same either way? https://github

[clang] Fix codegen of consteval functions returning an empty class, and related issues (PR #93115)

2024-08-05 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: /cherry-pick 1762e01cca0186f1862db561cfd9019164b8c654 https://github.com/llvm/llvm-project/pull/93115 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-05 Thread Eli Friedman via cfe-commits
@@ -104,6 +104,7 @@ FEATURE(thread_sanitizer, LangOpts.Sanitize.has(SanitizerKind::Thread)) FEATURE(dataflow_sanitizer, LangOpts.Sanitize.has(SanitizerKind::DataFlow)) FEATURE(scudo, LangOpts.Sanitize.hasOneOf(SanitizerKind::Scudo)) FEATURE(ptrauth_intrinsics, LangOpts.Pointer

[clang] [llvm] [PowerPC] Fix codegen for transparent_union function params (PR #101738)

2024-08-05 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Would it do any harm to just unconditionally compute the type and pass it into getExtend()? https://github.com/llvm/llvm-project/pull/101738 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-06 Thread Eli Friedman via cfe-commits
@@ -104,6 +104,7 @@ FEATURE(thread_sanitizer, LangOpts.Sanitize.has(SanitizerKind::Thread)) FEATURE(dataflow_sanitizer, LangOpts.Sanitize.has(SanitizerKind::DataFlow)) FEATURE(scudo, LangOpts.Sanitize.hasOneOf(SanitizerKind::Scudo)) FEATURE(ptrauth_intrinsics, LangOpts.Pointer

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-08-07 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: #100452 only fixed the "ignoring the in-class initializer of the static data member" issue. I don't think we did anything to allow downgrading overflow errors to warnings. https://github.com/llvm/llvm-project/pull/70307 ___ cfe-

[clang] Add flag to suppress overflow errors in C++ constant expressions. (PR #102390)

2024-08-07 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/102390 Recent Android NDK headers are broken on 32-bit because they contain an invalid shift, and older versions of clang didn't catch this. Demote the error to a default-error with a flag so it can be suppresse

[clang] [clang] Emit bad shift warnings (PR #70307)

2024-08-07 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: #102390 "fixes" the Android NDK issue. https://github.com/llvm/llvm-project/pull/70307 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add flag to suppress overflow errors in C++ constant expressions. (PR #102390)

2024-08-08 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I targeted all overflows with this fix because we were missing diagnostics for all overflows. For example, "enum{x=99*99};" only produces a pedantic warning on clang 18. So if we need the extra flexibility, we should just add it for everything. I think a default

[clang] [X86_64] Fix empty field error in vaarg of C++. (PR #101639)

2024-08-08 Thread Eli Friedman via cfe-commits
@@ -3124,26 +3124,40 @@ RValue X86_64ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, CGF.Builder.CreateStore(V, CGF.Builder.CreateStructGEP(Tmp, 1)); RegAddr = Tmp.withElementType(LTy); - } else if (neededInt) { -RegAddr = Address(CGF.Builder.CreateG

[clang] [llvm] [PAC] Fix address discrimination for type info vtable pointers (PR #102199)

2024-08-08 Thread Eli Friedman via cfe-commits
@@ -1056,12 +1056,18 @@ class ConstantPtrAuth final : public Constant { return !getAddrDiscriminator()->isNullValue(); } - /// A constant value for the address discriminator which has special - /// significance to ctors/dtors lowering. Regular address discrimination c

[clang] dc1ab59 - [Sema] Fold VLA types in compound literals to constant arrays.

2021-04-14 Thread Eli Friedman via cfe-commits
Author: Eli Friedman Date: 2021-04-14T17:09:59-07:00 New Revision: dc1ab590a0527533815aeed0100de54a5f4a4829 URL: https://github.com/llvm/llvm-project/commit/dc1ab590a0527533815aeed0100de54a5f4a4829 DIFF: https://github.com/llvm/llvm-project/commit/dc1ab590a0527533815aeed0100de54a5f4a4829.diff

[clang] [llvm] [PowerPC] Fix codegen for transparent_union function params (PR #101738)

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

[clang] [clang] fix divide by zero in ComplexExprEvaluator (PR #104666)

2024-08-18 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Opened #104738 as a followup. https://github.com/llvm/llvm-project/pull/104666 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    6   7   8   9   10   11   12   13   14   15   >