[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

[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" && +

[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 , 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 want

[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] [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] [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] [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" && +

[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

[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() && -

[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 ) { 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] [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] [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 , return ABIArgInfo::getDirect(); return ABIArgInfo::getExpand(); } -return getIndirectResult(Ty, /*ByVal=*/false, State); +return getIndirectResult(Ty,

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

2024-05-10 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,14 @@ +// REQUIRES: arm-registered-target +// RUN: %clang_cc1 -triple aarch64-none-elf \ +// RUN: -O2 \ +// RUN: -emit-llvm -fexperimental-max-bitint-width=1024 -o - %s | FileCheck %s efriedma-quic wrote: Digging a bit into the history, I found

[clang] [Sema] Fix handling of fields with initializers in nested anonymous unions. (PR #91692)

2024-05-09 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/91692 Make sure we count the anonymous union as an initialized field, so we properly construct the AST. Included bonus testcase Test3, which shows a remaining gap: an anonymous union can contain a partially

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

2024-05-09 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,14 @@ +// REQUIRES: arm-registered-target +// RUN: %clang_cc1 -triple aarch64-none-elf \ +// RUN: -O2 \ +// RUN: -emit-llvm -fexperimental-max-bitint-width=1024 -o - %s | FileCheck %s efriedma-quic wrote: Can we integrate this into some existing

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

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

[clang] [Clang][AArch64] Fixed incorrect _BitInt alignment (PR #90602)

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

[clang] [clang] Lower _BitInt(129+) to a different type in LLVM IR (PR #91364)

2024-05-07 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: You're suggesting we should fork ConvertTypeForMem into two functions? So there's actually three types: the "register" type, the "load/store" type, and the "in-memory" type. I guess that makes sense from a theoretical perspective, but... as a practical matter, I'm not

[clang] [llvm] [clang][hlsl] Add tan intrinsic part 1 (PR #90276)

2024-05-07 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. Okay. I mostly just want to make sure the plan isn't "land all the intrinsics from the RFC, then eventually investigate the constrained intrinsics". LGTM https://github.com/llvm/llvm-project/pull/90276

[clang] [llvm] [clang][hlsl] Add tan intrinsic part 1 (PR #90276)

2024-05-07 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > I didn't want the current set of changes to go stale. How many changes are we talking about here? If it's just the tan() ones, that's fine; it probably makes sense to land constrained-tan separately anyway. https://github.com/llvm/llvm-project/pull/90276

[clang] [SystemZ][z/OS] Implement z/OS XPLINK ABI (PR #91384)

2024-05-07 Thread Eli Friedman via cfe-commits
@@ -529,9 +529,325 @@ bool SystemZTargetCodeGenInfo::isVectorTypeBased(const Type *Ty, return false; } +//===--===// +// z/OS XPLINK ABI Implementation

[clang] [SystemZ][z/OS] Implement z/OS XPLINK ABI (PR #91384)

2024-05-07 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: At first glance, making a separate ABI seemed weird, but I guess it's pretty different from the normal SystemZ ABI. https://github.com/llvm/llvm-project/pull/91384 ___ cfe-commits mailing list

[clang] [SystemZ][z/OS] Implement z/OS XPLINK ABI (PR #91384)

2024-05-07 Thread Eli Friedman via cfe-commits
@@ -529,9 +529,325 @@ bool SystemZTargetCodeGenInfo::isVectorTypeBased(const Type *Ty, return false; } +//===--===// +// z/OS XPLINK ABI Implementation

[clang] [SystemZ][z/OS] Implement z/OS XPLINK ABI (PR #91384)

2024-05-07 Thread Eli Friedman via cfe-commits
@@ -529,9 +529,325 @@ bool SystemZTargetCodeGenInfo::isVectorTypeBased(const Type *Ty, return false; } +//===--===// +// z/OS XPLINK ABI Implementation

[clang] [SystemZ][z/OS] Implement z/OS XPLINK ABI (PR #91384)

2024-05-07 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/91384 ___ 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-07 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/91310 ___ 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-07 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Is it possible you could put this code into CompleteExternalDeclaration(), instead of writing it out in every place that can refer to the address of a function? https://github.com/llvm/llvm-project/pull/91310

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

2024-05-07 Thread Eli Friedman via cfe-commits
@@ -1950,8 +1950,22 @@ ConstantLValueEmitter::tryEmitBase(const APValue::LValueBase ) { 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] Lower _BitInt(129+) to a different type in LLVM IR (PR #91364)

2024-05-07 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I don't think FPGA folks will run into any practical issue with this; this only impacts the in-memory types, and backends shouldn't really be using in-memory types for anything anyways. https://github.com/llvm/llvm-project/pull/91364

[clang] [clang] Lower _BitInt(129+) to a different type in LLVM IR (PR #91364)

2024-05-07 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > It seems to me this is a case where we're trying to work -around an llvm bug? > Should we just be fixing that instead? You mean, revert https://reviews.llvm.org/D86310 ? Making any changes in LLVM here is painful; I'd rather not revisit that. CC @hvdijk @rnk

[clang] [clang] Lower _BitInt(129+) to a different type in LLVM IR (PR #91364)

2024-05-07 Thread Eli Friedman via cfe-commits
@@ -5348,6 +5348,13 @@ Value *ScalarExprEmitter::VisitVAArgExpr(VAArgExpr *VE) { return llvm::UndefValue::get(ArgTy); } + if (const auto *BIT = Ty->getAs()) { +if (BIT->getNumBits() > 128) { efriedma-quic wrote: This seems a little fragile;

[clang] [clang] Lower _BitInt(129+) to a different type in LLVM IR (PR #91364)

2024-05-07 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Maybe add a helper somewhere to check "is this type a bitint wider than 128 bits"? https://github.com/llvm/llvm-project/pull/91364 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang] Lower _BitInt(129+) to a different type in LLVM IR (PR #91364)

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

[clang] [clang] Lower _BitInt(129+) to a different type in LLVM IR (PR #91364)

2024-05-07 Thread Eli Friedman via cfe-commits
@@ -1774,6 +1774,18 @@ llvm::Constant *ConstantEmitter::emitForMemory(CodeGenModule , return Res; } + if (const auto *BIT = destType->getAs()) { +if (BIT->getNumBits() > 128) { + // Long _BitInt has array of bytes as in-memory type. +

[clang] [Clang][AArch64] Fixed incorrect _BitInt alignment (PR #90602)

2024-05-07 Thread Eli Friedman via cfe-commits
@@ -518,6 +518,16 @@ class TargetInfo : public TransferrableTargetInfo, /// getInt128Align() - Returns the alignment of Int128. unsigned getInt128Align() const { return Int128Align; } + /// getBitIntAlign/Width - Return aligned size of '_BitInt' and + /// 'unsigned

[clang] [Arm64EC] Fix compilation of arm_acle.h (PR #91281)

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

[clang] [Arm64EC] Fix compilation of arm_acle.h (PR #91281)

2024-05-06 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/91281 None >From 5a5512aa5a84e2c89efd9e9ade043061d73d25fb Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Fri, 3 May 2024 21:13:32 -0700 Subject: [PATCH] [Arm64EC] Fix compilation of arm_acle.h ---

[clang] [llvm] [ARM] Save floating point registers and status registers with save_fp function attribute (PR #89654)

2024-05-06 Thread Eli Friedman via cfe-commits
@@ -2239,6 +2239,20 @@ The semantics are as follows: }]; } +def ARMInterruptSaveFPDocs : Documentation { +let Category = DocCatFunction; + let Heading = "interrupt_save_fp (ARM)"; + let Content = [{ +Clang supports the GNU style

[clang] [llvm] [clang][hlsl] Add tan intrinsic part 1 (PR #90276)

2024-05-05 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'm worried if we add a whole new series of math intrinsics without adding the corresponding constrained intrinsics, it's going to be confusing for anyone trying to understand how math intrinsics work. Why does tan exist, but not constrained tan? `tan` is defined

[clang] [llvm] [clang backend] In AArch64's DataLayout, specify a minimum function alignment of 4. (PR #90702)

2024-05-05 Thread Eli Friedman via cfe-commits
@@ -1480,11 +1480,11 @@ AArch64leTargetInfo::AArch64leTargetInfo(const llvm::Triple , void AArch64leTargetInfo::setDataLayout() { if (getTriple().isOSBinFormatMachO()) { if(getTriple().isArch32Bit()) - resetDataLayout("e-m:o-p:32:32-i64:64-i128:128-n32:64-S128",

[clang] [llvm] [clang backend] In AArch64's DataLayout, specify a minimum function alignment of 4. (PR #90702)

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

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

2024-05-05 Thread Eli Friedman via cfe-commits
@@ -221,6 +224,15 @@ def : Pat<(AArch64_smstop (i32 svcr_op:$pstate), (i64 /*AArch64SME::Always*/0)), (MSRpstatesvcrImm1 svcr_op:$pstate, 0b0)>; +// Pseudo to insert cfi_offset/cfi_restore instructions. Used to save or restore +// the streaming value of VG around

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

2024-05-05 Thread Eli Friedman via cfe-commits
@@ -3730,6 +3730,12 @@ def warn_gnu_inline_cplusplus_without_extern : Warning< "'gnu_inline' attribute without 'extern' in C++ treated as externally" " available, this changed in Clang 10">, InGroup>; +def warn_sme_streaming_mode_change_no_sve : Warning< + "function

[clang] [llvm] [clang backend] In AArch64's DataLayout, specify a minimum function alignment of 4. (PR #90702)

2024-05-05 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Which email address do you want the commit associated with? The GitHub "squash and merge" button wants to attribute it to your "sonosphere.com" address, but it looks like the commits themselves are using an "apple.com" address.

[clang] [llvm] [clang backend] In AArch64's DataLayout, specify a minimum function alignment of 4. (PR #90702)

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

[clang] [Clang][AArch64] Fixed incorrect _BitInt alignment (PR #90602)

2024-05-05 Thread Eli Friedman via cfe-commits
@@ -1674,4 +1679,4 @@ void RenderScript64TargetInfo::getTargetDefines(const LangOptions , MacroBuilder ) const { Builder.defineMacro("__RENDERSCRIPT__"); AArch64leTargetInfo::getTargetDefines(Opts, Builder); -} +}

[clang] [Clang][AArch64] Fixed incorrect _BitInt alignment (PR #90602)

2024-05-05 Thread Eli Friedman via cfe-commits
@@ -518,6 +518,16 @@ class TargetInfo : public TransferrableTargetInfo, /// getInt128Align() - Returns the alignment of Int128. unsigned getInt128Align() const { return Int128Align; } + /// getBitIntAlign/Width - Return aligned size of '_BitInt' and + /// 'unsigned

[clang] [Clang][AArch64] Fixed incorrect _BitInt alignment (PR #90602)

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

[clang] [Clang][AArch64] Fixed incorrect _BitInt alignment (PR #90602)

2024-05-05 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic edited https://github.com/llvm/llvm-project/pull/90602 ___ 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-05 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm < %s efriedma-quic wrote: Have you seen https://llvm.org/docs/TestingGuide.html#regression-test-structure ? If you have any ideas for improving the documentation, please let me know (or better, propose a patch;

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-05-05 Thread Eli Friedman via cfe-commits
@@ -908,6 +908,69 @@ void CodeGenFunction::EmitIfStmt(const IfStmt ) { incrementProfileCounter(); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool HasEmptyBody) { + if

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-05-04 Thread Eli Friedman via cfe-commits
@@ -908,6 +908,69 @@ void CodeGenFunction::EmitIfStmt(const IfStmt ) { incrementProfileCounter(); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool HasEmptyBody) { + if

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-05-03 Thread Eli Friedman via cfe-commits
@@ -908,6 +908,69 @@ void CodeGenFunction::EmitIfStmt(const IfStmt ) { incrementProfileCounter(); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool HasEmptyBody) { + if

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-05-03 Thread Eli Friedman via cfe-commits
@@ -908,6 +908,69 @@ void CodeGenFunction::EmitIfStmt(const IfStmt ) { incrementProfileCounter(); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool HasEmptyBody) { + if

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

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

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-05-03 Thread Eli Friedman via cfe-commits
@@ -908,6 +908,69 @@ void CodeGenFunction::EmitIfStmt(const IfStmt ) { incrementProfileCounter(); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool HasEmptyBody) { + if

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-05-03 Thread Eli Friedman via cfe-commits
@@ -908,6 +908,69 @@ void CodeGenFunction::EmitIfStmt(const IfStmt ) { incrementProfileCounter(); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool HasEmptyBody) { + if

[clang] [clang][CodeGen] Fix MSVC ABI for classes with a deleted copy assignment operator (PR #90547)

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

[clang] [clang][CodeGen] Fix MSVC ABI for classes with a deleted copy assignment operator (PR #90547)

2024-05-03 Thread Eli Friedman via cfe-commits
@@ -1131,13 +1132,18 @@ static bool isTrivialForMSVC(const CXXRecordDecl *RD, QualType Ty, return false; if (RD->hasNonTrivialCopyAssignment()) return false; + if (RD->needsImplicitCopyAssignment() && !RD->hasSimpleCopyAssignment()) efriedma-quic

[clang] [AArch64] Diagnose more functions when FP not enabled (PR #90832)

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

[clang] [FMV][AArch64] Don't optimize backward compatible features in resolver. (PR #90928)

2024-05-03 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Burying this check in the middle of CodeGen seems error-prone: when we add new features in the future, someone is going to have to dig up this code. Can we put this in on of the target feature tables, like in AArch64TargetParser.h? If I'm understanding correctly, the

[clang] [llvm] [mlir] [Clang][CodeGen] Start migrating away from assuming the Default AS is 0 (PR #88182)

2024-05-02 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. Please fix the commit message before you merge; otherwise LGTM https://github.com/llvm/llvm-project/pull/88182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

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

[clang] [AArch64] Diagnose more functions when FP not enabled (PR #90832)

2024-05-02 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: I'm a little unhappy with the duplicated logic between checkFunctionCallABI and checkFunctionABI; is there some way we can unify? Even if it doesn't actually reduce the code duplication very much, it would be helpful to clarify that both paths are

[clang] [clang][CodeGen] Fix in codegen for __builtin_popcountg/ctzg/clzg (PR #90845)

2024-05-02 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. Please fix clang-format warnings. Otherwise LGTM https://github.com/llvm/llvm-project/pull/90845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-05-02 Thread Eli Friedman via cfe-commits
@@ -908,6 +908,72 @@ void CodeGenFunction::EmitIfStmt(const IfStmt ) { incrementProfileCounter(); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool HasEmptyBody) { + if

[clang] [clang][CodeGen] Fix in codegen for __builtin_popcountg/ctzg/clzg (PR #90845)

2024-05-02 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Please add a testcase for i1/i2 (which are the only cases where this actually matters). https://github.com/llvm/llvm-project/pull/90845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-05-02 Thread Eli Friedman via cfe-commits
@@ -5702,13 +5702,16 @@ CodeGenModule::getLLVMLinkageVarDefinition(const VarDecl *VD) { static void replaceUsesOfNonProtoConstant(llvm::Constant *old, llvm::Function *newFn) { // Fast path. - if (old->use_empty()) return; + if

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

2024-05-02 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm < %s efriedma-quic wrote: Can you integrate this test into some existing file that's testing something similar? Please leave the bug number in a comment: something like `//GH88917`. Please use FileCheck CHECK

[clang] [llvm] [clang backend] In AArch64's DataLayout, specify a minimum function alignment of 4. (PR #90702)

2024-04-30 Thread Eli Friedman via cfe-commits
@@ -5387,6 +5387,14 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) { return Res; } + // AArch64 data layout upgrades. + if (T.isAArch64()) { +// Add "-Fn32" +if (!DL.contains("-Fn32")) + Res.append("-Fn32");

[clang] [llvm] [clang backend] In AArch64's DataLayout, specify a minimum function alignment of 4. (PR #90702)

2024-04-30 Thread Eli Friedman via cfe-commits
@@ -5387,6 +5387,14 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) { return Res; } + // AArch64 data layout upgrades. + if (T.isAArch64()) { +// Add "-Fn32" +if (!DL.contains("-Fn32")) + Res.append("-Fn32");

[clang] [llvm] [clang backend] In AArch64's DataLayout, specify a minimum function alignment of 4. (PR #90702)

2024-04-30 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: This looks correct. I'd expect regression tests for the autoupgrade, and a test that clang isn't generating the alignment markings anymore. https://github.com/llvm/llvm-project/pull/90702 ___ cfe-commits

[clang] [llvm] [clang backend] In AArch64's DataLayout, specify a minimum function alignment of 4. (PR #90702)

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

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-04-30 Thread Eli Friedman via cfe-commits
@@ -908,6 +908,74 @@ void CodeGenFunction::EmitIfStmt(const IfStmt ) { incrementProfileCounter(); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool IsTrivialCXXLoop) { + if

[clang] [clang][CodeGen] Fix MSVC ABI for classes with non static data members of reference type (PR #90547)

2024-04-30 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Maybe we should just be testing if the copy-assignment operator is deleted? For reference, MSVC also returns the following indirectly: ``` struct Test { int x; Test& operator=(const Test&) = delete; }; Test foo(); Test test(Test x) {

[clang] [clang][CodeGen] Fix MSVC ABI for classes with non static data members of reference type (PR #90547)

2024-04-30 Thread Eli Friedman via cfe-commits
@@ -1144,11 +1167,13 @@ bool MicrosoftCXXABI::classifyReturnType(CGFunctionInfo ) const { if (!RD) return false; - bool isTrivialForABI = RD->canPassInRegisters() && - isTrivialForMSVC(RD, FI.getReturnType(), CGM); - // MSVC always returns

[clang] [clang][CodeGen] Fix MSVC ABI for classes with non static data members of reference type (PR #90547)

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

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

2024-04-30 Thread Eli Friedman via cfe-commits
@@ -3122,9 +3122,25 @@ Address X86_64ABIInfo::EmitVAArg(CodeGenFunction , Address VAListAddr, CGF.Builder.CreateStore(V, CGF.Builder.CreateStructGEP(Tmp, 1)); RegAddr = Tmp.withElementType(LTy); - } else if (neededInt) { -RegAddr =

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

2024-04-30 Thread Eli Friedman via cfe-commits
@@ -3133,15 +3149,13 @@ Address X86_64ABIInfo::EmitVAArg(CodeGenFunction , Address VAListAddr, // Copy into a temporary if the type is more aligned than the // register save area. -if (TyAlign.getQuantity() > 8) { - Address Tmp = CGF.CreateMemTemp(Ty); +

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-04-30 Thread Eli Friedman via cfe-commits
@@ -908,6 +908,74 @@ void CodeGenFunction::EmitIfStmt(const IfStmt ) { incrementProfileCounter(); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool IsTrivialCXXLoop) { + if

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

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

[clang] [llvm] [CodeGen][i386] Move -mregparm storage earlier and fix Runtime calls (PR #89707)

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

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

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

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

2024-04-29 Thread Eli Friedman via cfe-commits
@@ -3123,8 +3123,22 @@ Address X86_64ABIInfo::EmitVAArg(CodeGenFunction , Address VAListAddr, RegAddr = Tmp.withElementType(LTy); } else if (neededInt) { -RegAddr = Address(CGF.Builder.CreateGEP(CGF.Int8Ty, RegSaveArea, gp_offset), - LTy,

[clang] [clang codegen] Fix MS ABI detection of user-provided constructors. (PR #90151)

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

[clang] [llvm] [clang][hlsl] Add tan intrinsic part 1 (PR #90276)

2024-04-29 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Are you intentionally skipping implementing changes to __builtin_tan()? https://github.com/llvm/llvm-project/pull/90276 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Implement P2809: Trivial infinite loops are not Undefined Behavior (PR #90066)

2024-04-29 Thread Eli Friedman via cfe-commits
@@ -908,6 +908,73 @@ void CodeGenFunction::EmitIfStmt(const IfStmt ) { incrementProfileCounter(); } +bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression, + bool IsTrivialCXXLoop) { + if

[clang] [Clang] Add support for scalable vectors in __builtin_reduce_* functions (PR #87750)

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

[clang] [clang codegen] Delete unnecessary GEP cleanup code. (PR #90303)

2024-04-26 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/90303 There's some code in AggExprEmitter::VisitCXXParenListOrInitListExpr to try to do early cleanup for GEPs for fields that aren't accessed. But it's unlikely to actually save significant compile-time, and

[clang] [llvm] [CodeGen][i386] Move -mregparm storage earlier and fix Runtime calls (PR #89707)

2024-04-26 Thread Eli Friedman via cfe-commits
@@ -4781,6 +4782,7 @@ CodeGenModule::CreateRuntimeFunction(llvm::FunctionType *FTy, StringRef Name, } } setDSOLocal(F); + markRegisterParameterAttributes(F); efriedma-quic wrote: Suggested text on the clang change: FIXME: We should

[clang] [llvm] [CodeGen][i386] Move -mregparm storage earlier and fix Runtime calls (PR #89707)

2024-04-26 Thread Eli Friedman via cfe-commits
@@ -62,6 +62,13 @@ namespace llvm { LibFunc TheLibFunc, AttributeList AttributeList, FunctionType *Invalid, ArgsTy... Args) = delete; + // Handle -mregparm for the given function. + // FIXME: This should likely be implemented in +

[clang] [clang codegen] Fix MS ABI detection of user-provided constructors. (PR #90151)

2024-04-26 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Added release note. https://github.com/llvm/llvm-project/pull/90151 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang codegen] Fix MS ABI detection of user-provided constructors. (PR #90151)

2024-04-26 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/90151 >From 9adeffc9ee780c84a525ce0535a84508105e05ae Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 25 Apr 2024 17:06:40 -0700 Subject: [PATCH 1/2] [clang codegen] Fix MS ABI detection of user-provided

[clang] Don't wrap immediate invocations in ConstantExprs within constexpr initializers (PR #89565)

2024-04-26 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The approach makes sense. I'll defer to someone who's more familiar with this code for the full review. https://github.com/llvm/llvm-project/pull/89565 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-04-26 Thread Eli Friedman via cfe-commits
@@ -536,6 +536,8 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr, llvm::ArrayType *AType, CodeGen::CodeGenModule = CGF.CGM; ConstantEmitter Emitter(CGF); LangAS AS = ArrayQTy.getAddressSpace(); +if (CGF.getLangOpts().OpenCL) + AS =

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

2024-04-26 Thread Eli Friedman via cfe-commits
@@ -536,6 +536,8 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr, llvm::ArrayType *AType, CodeGen::CodeGenModule = CGF.CGM; ConstantEmitter Emitter(CGF); LangAS AS = ArrayQTy.getAddressSpace(); +if (CGF.getLangOpts().OpenCL) + AS =

[clang] Re-apply "Emit missing cleanups for stmt-expr" and other commits (PR #89154)

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

[clang] [clang codegen] Fix MS ABI detection of user-provided constructors. (PR #90151)

2024-04-25 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/90151 In the context of determining whether a class counts as an "aggregate", a constructor template counts as a user-provided constructor. Fixes #86384 >From 9adeffc9ee780c84a525ce0535a84508105e05ae Mon Sep

<    1   2   3   4   5   6   7   8   9   >