[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-05 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I don't like the "ExprLValueMap" approach for array bounds checking; it's fragile and doesn't handle cases we should be able to handle. In particular, we should be able to handle arbitrary base expressions for array bounds checking, I think; there should be a constant

[clang] [AArch64] Add soft-float ABI (PR #74460)

2023-12-05 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'm a little surprised we don't need any LLVM backend changes, but I guess in soft-float mode we basically treat floats as ints anyway, so maybe things just work. I'd like to see appropriate regression tests, though (if they don't already exist).

[clang] [Clang] Emit TBAA info for enums in C (PR #73326)

2023-12-05 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The C notion of "compatibility" with regard to enums is a bit weird... clang and gcc disagree whether `enum e : int; enum e2: int; enum e x; int x; enum e2 x;` is valid because 6.2.7 doesn't actually define what's supposed to happen. Probably this should be illegal, but

[clang] fix: C++ empty record with align lead to va_list out of sync (PR #72197)

2023-12-04 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM In terms of va_list etc., we first need to make sure calls are correct (compare against gcc etc.), then we need to make sure va_list is consistent with that. https://github.com/llvm/llvm-project/pull/72197

[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

2023-11-30 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: My primary concerns here are: - It being likely these builtins will be superseded by something else once someone else tries to standardize this. Maybe this isn't a big deal... but maybe we want to choose names that are less likely to overlap with stuff anyone else is

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Eli Friedman via cfe-commits
@@ -956,42 +958,112 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -const Expr * -CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base, - const ValueDecl *CountedByVD) { +namespace { + +/// \p

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Eli Friedman via cfe-commits
@@ -956,42 +958,112 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -const Expr * -CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base, - const ValueDecl *CountedByVD) { +namespace { + +/// \p

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Eli Friedman via cfe-commits
@@ -956,42 +958,112 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -const Expr * -CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base, - const ValueDecl *CountedByVD) { +namespace { + +/// \p

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Eli Friedman via cfe-commits
@@ -956,42 +958,112 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction , return nullptr; } -const Expr * -CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base, - const ValueDecl *CountedByVD) { +namespace { + +/// \p

[clang] [clang][CodeGen] Emit annotations for function declarations. (PR #66716)

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

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I agree users probably shouldn't be doing that... but given it compiles your code should handle it gracefully. (It should just be a matter of making sure you don't recurse too deeply through the "base".) https://github.com/llvm/llvm-project/pull/73730

[clang] [clang] Avoid recalculating TBAA base type info (PR #73264)

2023-11-29 Thread Eli Friedman via cfe-commits
@@ -418,14 +418,20 @@ llvm::MDNode *CodeGenTBAA::getBaseTypeInfo(QualType QTy) { return nullptr; const Type *Ty = Context.getCanonicalType(QTy).getTypePtr(); - if (llvm::MDNode *N = BaseTypeMetadataCache[Ty]) -return N; - // Note that the following helper call

[clang] [clang] Avoid recalculating TBAA base type info (PR #73264)

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

[clang] [clang] Avoid recalculating TBAA base type info (PR #73264)

2023-11-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/73264 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] Refactor ASTContext::getDeclAlign() (NFC) (PR #72977)

2023-11-29 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM See https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements for the rules on use/don't use braces. A single multi-line statement is sort of on the edge; I tend

[clang] [clang][CodeGen] Emit atomic IR instead of libcalls for misaligned po… (PR #73176)

2023-11-29 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: As a historical note, when I first wrote the support for atomics, it was under a model where LLVM IR only modeled legal atomics, and clang lowered illegal atomics to libcalls. This was changed a few years later to generalize atomics in LLVM IR to support arbitrary atomic

[clang] [mlir] [compiler-rt] [flang] [llvm] [clang-tools-extra] [clang][CodeGen] Handle template parameter objects with explicit address spaces (PR #69266)

2023-11-29 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The concept makes sense, but I think the code should be inside CodeGenModule::GetAddrOfTemplateParamObject? I think all users of the function want a value in the correct address-space. https://github.com/llvm/llvm-project/pull/69266

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Some examples to consider: ``` // Crazy array indexing... but strictly speaking, legal. struct S { int count; int arr[] __attribute((counted_by(count))); }; int f1(int c, struct S *var) { return var[10].arr[10]; } // Double dereferenced variable. int f2(int c, struct S

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'd like to see a few tests involving multiple arrows in the same expression. (If my understanding is correct, you want to cut the recursion when you see an arrow member.) Looking at the code again, I guess FindCountedByField doesn't explicitly compute the base

[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-11-29 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: CodeGenFunction::FindCountedByField finds a field with a corresponding base expression. Currently, it throws away the base expression. And the code you've just written tries to recompute the base. Instead of doing this dance, can we just make

[llvm] [clang] [clang, SystemZ] Pass HasDef flag to getMinGlobalAlign(). (PR #73511)

2023-11-27 Thread Eli Friedman via cfe-commits
@@ -1687,7 +1687,8 @@ CharUnits ASTContext::getDeclAlign(const Decl *D, bool ForAlignof) const { if (VD->hasGlobalStorage() && !ForAlignof) { uint64_t TypeSize = !BaseT->isIncompleteType() ? getTypeSize(T.getTypePtr()) : 0; -Align =

[clang] [clang] fix emitvaarg when struct is null (PR #72624)

2023-11-27 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Please fix the pull request description to say this is aarch64-specific. Missing regression test in clang/test/CodeGen/ How does this interact with #72197? https://github.com/llvm/llvm-project/pull/72624 ___ cfe-commits mailing

[clang] [clang] Ensure minimal alignment of global vars of incomplete type. (PR #72886)

2023-11-22 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,32 @@ +// RUN: %clang --target=s390x-linux -S -emit-llvm -o - %s | FileCheck %s efriedma-quic wrote: Sorry, I missed this when reviewing. We generally only use Driver tests when we're trying to test some aspect of the driver. For arm-alignment.c,

[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

2023-11-21 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Missing change to clang/docs/LanguageExtensions.rst describing the new builtins. Are there any other projects that we might want to coordinate with here? gcc, maybe? https://github.com/llvm/llvm-project/pull/72280 ___

[clang] [llvm] [AArch64] Stack probing for dynamic allocas in SelectionDAG (PR #66525)

2023-11-21 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,363 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple aarch64-none-eabi < %s -verify-machineinstrs | FileCheck %s + +; Dynamically-sized allocation, needs a loop which can handle any size at +; runtime. The final

[clang] [clang][AArch64] Pass down stack clash protection options to LLVM/Backend (PR #68993)

2023-11-21 Thread Eli Friedman via cfe-commits
@@ -1076,6 +1076,16 @@ void CodeGenModule::Release() { "sign-return-address-with-bkey", 1); } + if (Arch == llvm::Triple::aarch64 || Arch == llvm::Triple::aarch64_be) { efriedma-quic wrote: Module-level attributes tend to

[clang] [llvm] [AArch64] Stack probing for function prologues (PR #66524)

2023-11-21 Thread Eli Friedman via cfe-commits
@@ -1076,6 +1076,16 @@ void CodeGenModule::Release() { "sign-return-address-with-bkey", 1); } + if (Arch == llvm::Triple::aarch64 || Arch == llvm::Triple::aarch64_be) { +auto *InlineAsm = llvm::MDString::get(TheModule.getContext(),

[clang] [llvm] [AArch64] Stack probing for function prologues (PR #66524)

2023-11-21 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,722 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple aarch64-none-eabi < %s -verify-machineinstrs | FileCheck %s +; RUN: llc -mtriple aarch64-none-eabi < %s -verify-machineinstrs -global-isel -global-isel-abort=2 |

[clang] [clang] Avoid memcopy for small structure with padding under -ftrivial-auto-var-init (PR #71677)

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

[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)

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

[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)

2023-11-21 Thread Eli Friedman via cfe-commits
@@ -307,7 +307,12 @@ AArch64ABIInfo::classifyArgumentType(QualType Ty, bool IsVariadic, // 0. if (IsEmpty && Size == 0) return ABIArgInfo::getIgnore(); -return ABIArgInfo::getDirect(llvm::Type::getInt8Ty(getVMContext())); +// An empty struct can have

[clang] Refactor ASTContext::getDeclAlign() (NFC) (PR #72977)

2023-11-21 Thread Eli Friedman via cfe-commits
@@ -1627,28 +1627,20 @@ const llvm::fltSemantics ::getFloatTypeSemantics(QualType T) const { CharUnits ASTContext::getDeclAlign(const Decl *D, bool ForAlignof) const { unsigned Align = Target->getCharWidth(); - bool UseAlignAttrOnly = false; - if (unsigned AlignFromAttr

[clang] [clang codegen][regression] Add dso_local/hidden/etc. markings to VTT definitions and declarations (PR #72452)

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

[clang] [clang codegen][regression] Add dso_local/hidden/etc. markings to VTT definitions and declarations (PR #72452)

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

[llvm] [clang] [clang-tools-extra] [Clang] Fix linker error for function multiversioning (PR #71706)

2023-11-21 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: @DanielKristofKiss From your response, I gather you want AArch64 to align with the other targets, but additional changes are required to make that work? In the interest of keeping things moving, how do you want to stage this? Would it make sense to land this as-is? Rhen

[llvm] [clang-tools-extra] [clang] Dont alter cold function alignment unless using Os (PR #72387)

2023-11-20 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'll try describing it a different way. There are two kinds of alignment. "ABI alignment" is required for the code to function correctly (due to things like architecture constraints, reusing the low bit for member pointers, binary patching). "Preferred alignment" is

[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)

2023-11-20 Thread Eli Friedman via cfe-commits
@@ -307,7 +307,13 @@ AArch64ABIInfo::classifyArgumentType(QualType Ty, bool IsVariadic, // 0. if (IsEmpty && Size == 0) return ABIArgInfo::getIgnore(); -return ABIArgInfo::getDirect(llvm::Type::getInt8Ty(getVMContext())); +// An empty struct can have

[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)

2023-11-20 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Good to see this works without any unexpected side-effects. Please also add a test for 32-byte alignment (since that generates different code) https://github.com/llvm/llvm-project/pull/72197 ___

[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)

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

[clang] [clang codegen][regression] Add dso_local/hidden/etc. markings to VTT definitions and declarations (PR #72452)

2023-11-20 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Okay. Please add a comment to the code briefly explaining that. Otherwise looks fine. https://github.com/llvm/llvm-project/pull/72452 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

2023-11-20 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: We're already assigning names to the different scopes; we're just doing it in the __MEMORY_SCOPE_* preprocessor macros. Replacing `_MEMORY_SCOPE_SYSTEM` in the code with `"system"` doesn't really change the nature of how we assign names to scopes. If these are supposed

[clang] [clang-tools-extra] [llvm] Dont alter cold function alignment unless using Os (PR #72387)

2023-11-20 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > Is clang aware of the target's default function alignment? No? On x86, the "default" is set by the line `setPrefFunctionAlignment(Align(16));`. Which, as the name suggests, is supposed to be a preference, not a mandatory minimum. And it's subject to change in the

[clang] [clang] Ensure minimal alignment of global vars of incomplete type. (PR #72886)

2023-11-20 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM The questions that I came up with while reviewing: - Does this affect other targets? It looks like it affects Lanai, but that difference seems fine. It looks like it doesn't affect anything else in-tree; in particular, the

[clang] [clang codegen][regression] Add dso_local/hidden/etc. markings to VTT definitions and declarations (PR #72452)

2023-11-17 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I mean, looking at the code, as far as I can tell, we always call GetAddrOfVTT immediately before EmitVTTDefinition, so setGVProperties() has already run, so running it again shouldn't do anything... unless somehow EmitVTTDefinition is overwriting the visibility, or

[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

2023-11-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > The underlying implementation is a string literal in the LLVM syncscope > argument, but the problem is that this isn't standardized at all and varies > between backends potentially We don't have to use the same set of strings as syncscope if that doesn't make sense.

[clang] [AVR] make the AVR ABI Swift compatible (PR #72298)

2023-11-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: See also #71986 https://github.com/llvm/llvm-project/pull/72298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [AVR] make the AVR ABI Swift compatible (PR #72298)

2023-11-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Can you not test this by checking an `__attribute__((swiftcall))` function works in C? https://github.com/llvm/llvm-project/pull/72298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

2023-11-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > I figured we can just treat these as clang extensions for the time being. We > already have two variants that are more or less redundant for specific > use-cases, (OpenCL and HIP), which should be able to be removed after this. I'm not sure what you mean here. If you

[clang] [Clang] Introduce scoped variants of GNU atomic functions (PR #72280)

2023-11-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'm a little wary of adding these without actually going through any sort of standardization process; if other vendors don't support the same interface, we just have more variations. (See also https://clang.llvm.org/get_involved.html#criteria ) How consistent are the

[llvm] [clang] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #67454)

2023-11-16 Thread Eli Friedman via cfe-commits
@@ -232,19 +232,19 @@ static Value *MakeBinaryAtomicValue( static Value *EmitNontemporalStore(CodeGenFunction , const CallExpr *E) { Value *Val = CGF.EmitScalarExpr(E->getArg(0)); - Value *Address = CGF.EmitScalarExpr(E->getArg(1)); + Address Addr =

[clang] [llvm] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #67454)

2023-11-16 Thread Eli Friedman via cfe-commits
@@ -395,27 +395,27 @@ namespace { void CodeGenFunction::EmitAnyExprToExn(const Expr *e, Address addr) { // Make sure the exception object is cleaned up if there's an // exception during initialization. - pushFullExprCleanup(EHCleanup, addr.getPointer()); -

[llvm] [clang] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #67454)

2023-11-16 Thread Eli Friedman via cfe-commits
@@ -80,6 +94,139 @@ class Address { return Alignment; } + /// Return address with different element type, but same pointer and + /// alignment. + RawAddress withElementType(llvm::Type *ElemTy) const { +return RawAddress(getPointer(), ElemTy, getAlignment(),

[clang] [clang codegen][regression] Add dso_local/hidden/etc. markings to VTT definitions and declarations (PR #72452)

2023-11-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'd prefer not to call setGVProperties() twice on the same variable; under what conditions is the first call not sufficient? https://github.com/llvm/llvm-project/pull/72452 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] fix: compatible C++ empty record with align UB with gcc (PR #72197)

2023-11-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The proper fix here is probably to just delete the `return ABIArgInfo::getDirect(llvm::Type::getInt8Ty(getVMContext()));` from the empty struct codepath on aarch64. Alignment shouldn't affect whether a class is empty. The issue here is just that according to aarch64

[clang] [llvm] [clang-tools-extra] Dont alter cold function alignment unless using Os (PR #72387)

2023-11-15 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: This patch appears to do two things: - Add a "default align" attribute, which instructions the backend to use some unspecified "default" alignment for the function in question. - Tells the frontend to apply this attribute specifically to "cold" functions. This is

[clang] [clang-tools-extra] [llvm] [MS-ABI] create unique vftable name for vftable defined with internal alias. (PR #71748)

2023-11-15 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Looks fine now. (You might want to change the title before merging.) https://github.com/llvm/llvm-project/pull/71748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [MS-ABI] create unique vftable name for vftable defined with internal alias. (PR #71748)

2023-11-15 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The simplest thing to do is rebase and force-push. You can alternatively try to use a merge commit, but I'm not completely sure how github would react to that. https://github.com/llvm/llvm-project/pull/71748 ___ cfe-commits

[clang] [MS-ABI] create unique vftable name for vftable defined with internal alias. (PR #71748)

2023-11-14 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. I see unrelated changes on the branch? Otherwise LGTM https://github.com/llvm/llvm-project/pull/71748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Fix linker error for function multiversioning (PR #71706)

2023-11-13 Thread Eli Friedman via cfe-commits
@@ -4098,8 +4098,26 @@ void CodeGenModule::emitMultiVersionFunctions() { } llvm::Constant *ResolverConstant = GetOrCreateMultiVersionResolver(GD); -if (auto *IFunc = dyn_cast(ResolverConstant)) +if (auto *IFunc = dyn_cast(ResolverConstant)) {

[clang] [clang][CodeGen] Ensure consistent `mustprogress` attribute emission across all paths (PR #71452)

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

[clang] [clang] Avoid memcopy for small structure with padding under -ftrivial-auto-var-init (PR #71677)

2023-11-09 Thread Eli Friedman via cfe-commits
@@ -1506,8 +1497,16 @@ TEST_CUSTOM(unmatchedreverse, unmatchedreverse, { .c = 42 }); // CHECK-O0:call void @llvm.memcpy // CHECK-NOT: !annotation // CHECK-O0:call void @{{.*}}used{{.*}}%custom) -// PATTERN-O1: store i32 -1431655894, ptr {{.*}}, align 4 -//

[clang] [clang] Avoid memcopy for small structure with padding under -ftrivial-auto-var-init (PR #71677)

2023-11-09 Thread Eli Friedman via cfe-commits
@@ -1244,29 +1244,28 @@ static void emitStoresForConstant(CodeGenModule , const VarDecl , // If the initializer is small, use a handful of stores. if (shouldSplitConstantStore(CGM, ConstantSize)) { if (auto *STy = dyn_cast(Ty)) { - // FIXME: handle the case when

[clang] [clang] Avoid memcopy for small structure with padding under -ftrivial-auto-var-init (PR #71677)

2023-11-09 Thread Eli Friedman via cfe-commits
@@ -1244,29 +1244,28 @@ static void emitStoresForConstant(CodeGenModule , const VarDecl , // If the initializer is small, use a handful of stores. if (shouldSplitConstantStore(CGM, ConstantSize)) { if (auto *STy = dyn_cast(Ty)) { - // FIXME: handle the case when

[clang] [clang] Avoid memcopy for small structure with padding under -ftrivial-auto-var-init (PR #71677)

2023-11-09 Thread Eli Friedman via cfe-commits
@@ -1244,29 +1244,28 @@ static void emitStoresForConstant(CodeGenModule , const VarDecl , // If the initializer is small, use a handful of stores. if (shouldSplitConstantStore(CGM, ConstantSize)) { if (auto *STy = dyn_cast(Ty)) { - // FIXME: handle the case when

[clang] [clang][CodeGen] Ensure consistent `mustprogress` attribute emission across all paths (PR #71452)

2023-11-09 Thread Eli Friedman via cfe-commits
@@ -1482,6 +1477,11 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, } else llvm_unreachable("no definition for emitted function"); + // This is checked after emitting the function body so we know if there + // are any permitted infinite

[clang] [MS-ABI] create unique vftable name for vftable defined with internal alias. (PR #71748)

2023-11-09 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > That seems reasonable, however, there are other QOI reasons for attempting to > generate globally unique names for lambdas Sure. But we wouldn't want to special-case vftables for that. > I think our strategy to ensure internal lambdas like this are globally unique >

[clang] [MS-ABI] create unique vftable name for vftable defined with internal alias. (PR #71748)

2023-11-08 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > Why are we creating a comdat here in the first place? I guess that's b2615aa4... but I'm pretty sure we fixed -fdata-sections so the backend automatically generates comdats. So maybe we should just revert that. > If we allow creating a comdat associated with an

[clang] [MS-ABI] create unique vftable name for vftable defined with internal alias. (PR #71748)

2023-11-08 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Why are we creating a comdat here in the first place? Creating a comdat associated with an internal symbol doesn't do anything useful: an internal symbol can't be defined in any other translation unit, so the comdat will never be discarded. If we allow creating a comdat

[clang] [llvm] [PowerPC][X86] Make cpu id builtins target independent and lower for PPC (PR #68919)

2023-11-08 Thread Eli Friedman via cfe-commits
@@ -359,6 +359,13 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public TargetInfo { bool isSPRegName(StringRef RegName) const override { return RegName.equals("r1") || RegName.equals("x1"); } + + // We support __builtin_cpu_supports/__builtin_cpu_is on targets

[clang] [clang][CodeGen] Ensure consistent `mustprogress` attribute emission across all paths (PR #71452)

2023-11-08 Thread Eli Friedman via cfe-commits
@@ -1482,6 +1477,11 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, } else llvm_unreachable("no definition for emitted function"); + // This is checked after emitting the function body so we know if there + // are any permitted infinite

[clang] [clang][CodeGen] Ensure consistent `mustprogress` attribute emission across all paths (PR #71452)

2023-11-08 Thread Eli Friedman via cfe-commits
@@ -1482,6 +1477,11 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, } else llvm_unreachable("no definition for emitted function"); + // This is checked after emitting the function body so we know if there + // are any permitted infinite

[clang] [clang][CodeGen] Ensure consistent `mustprogress` attribute emission across all paths (PR #71452)

2023-11-08 Thread Eli Friedman via cfe-commits
@@ -1482,6 +1477,11 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, } else llvm_unreachable("no definition for emitted function"); + // This is checked after emitting the function body so we know if there + // are any permitted infinite

[clang] [clang][CodeGen] Ensure consistent `mustprogress` attribute emission across all paths (PR #71452)

2023-11-08 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The C equivalent to the C++11 rule is in 6.8.5, which says "An iteration statement may be assumed by the implementation to terminate if [...]". There's no general rule that a program has to make progress if there isn't a loop involved.

[clang] [Clang] Fix linker error for function multiversioning (PR #71706)

2023-11-08 Thread Eli Friedman via cfe-commits
@@ -4098,8 +4098,26 @@ void CodeGenModule::emitMultiVersionFunctions() { } llvm::Constant *ResolverConstant = GetOrCreateMultiVersionResolver(GD); -if (auto *IFunc = dyn_cast(ResolverConstant)) +if (auto *IFunc = dyn_cast(ResolverConstant)) {

[clang] [Clang] Fix linker error for function multiversioning (PR #71706)

2023-11-08 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Added reviewers from https://reviews.llvm.org/D127812, for the AArch64 side. https://github.com/llvm/llvm-project/pull/71706 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang] Fix linker error for function multiversioning (PR #71706)

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

[clang] [Clang] Add codegen option to add passbuilder callback functions (PR #70171)

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

[llvm] [clang] [AArch64][SME] Remove immediate argument restriction for svldr and svstr (PR #68565)

2023-11-06 Thread Eli Friedman via cfe-commits
@@ -1741,6 +1742,69 @@ void AArch64DAGToDAGISel::SelectCVTIntrinsic(SDNode *N, unsigned NumVecs, CurDAG->RemoveDeadNode(N); } +void AArch64DAGToDAGISel::SelectSMELdrStrZA(SDNode *N, bool IsLoad) { + // Lower an SME LDR/STR ZA intrinsic to LDR_ZA_PSEUDO or STR_ZA. + // If

[clang] [llvm] [SystemZ][z/OS] This change adds support for the PPA2 section in zOS (PR #68926)

2023-11-01 Thread Eli Friedman via cfe-commits
@@ -976,6 +976,37 @@ void CodeGenModule::Release() { Context.getTypeSizeInChars(Context.getWideCharType()).getQuantity(); getModule().addModuleFlag(llvm::Module::Error, "wchar_size", WCharWidth); + if (getTriple().isOSzOS()) { +

[llvm] [clang] [SystemZ][z/OS] This change adds support for the PPA2 section in zOS (PR #68926)

2023-11-01 Thread Eli Friedman via cfe-commits
@@ -976,6 +976,37 @@ void CodeGenModule::Release() { Context.getTypeSizeInChars(Context.getWideCharType()).getQuantity(); getModule().addModuleFlag(llvm::Module::Error, "wchar_size", WCharWidth); + if (getTriple().isOSzOS()) { +

[clang] [llvm] [PassBuilder] Add a mechanism for adding passbuilder callbacks for static builds (PR #70171)

2023-10-31 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: It should be possible to statically link a pass plugin without modifying any LLVM/clang build files. polly uses this infrastructure. (polly is actually referenced explicitly in a couple places, but only to pull it into the build in the first place; you can do something

[clang] [clang] __is_trivially_equality_comparable for types containing lambdas (PR #68506)

2023-10-31 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Do you need to check if the lambda is templated? For example, the following doesn't compile: ``` auto GetNonCapturingLambda() { return [](){ return 42; }; } auto f() { return GetNonCapturingLambda() == GetNonCapturingLambda(); } ```

[clang] [clang][CodeGen] Emit annotations for function declarations. (PR #66716)

2023-10-31 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: (Not sure if you have commit access; let me know if you want me to merge for you.) https://github.com/llvm/llvm-project/pull/66716 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][CodeGen] Emit annotations for function declarations. (PR #66716)

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

[llvm] [clang] [PassBuilder] Add a mechanism for adding passbuilder callbacks for static builds (PR #70171)

2023-10-31 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The new option in CodeGenOptions.h seems fine. If your goal is to statically inject passes into the clang executable, I don't understand why the existing LLVM plugin infrastructure isn't sufficient for your needs. You mention "modifying Extension.def", but that file is

[llvm] [clang] [AIX][TOC] Add -mtocdata/-mno-tocdata options on AIX (PR #67999)

2023-10-31 Thread Eli Friedman via cfe-commits
@@ -622,6 +622,28 @@ static bool checkAliasedGlobal( return true; } +// Emit a warning if toc-data attribute is requested for global variables that +// have aliases and remove the toc-data attribute. +static void checkAliasForTocData(llvm::GlobalVariable *GVar, +

[llvm] [clang] [AIX][TOC] Add -mtocdata/-mno-tocdata options on AIX (PR #67999)

2023-10-31 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: What are the ABI implications here? Do all translation units have to agree on whether a variable is "tocdata"? The manual change hints there's some sort of linker fixup, but it's not clear to me how that works. Specifying the names of global

[llvm] [clang] [AIX][TOC] Add -mtocdata/-mno-tocdata options on AIX (PR #67999)

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

[clang] [llvm] [AIX][TOC] Add -mtocdata/-mno-tocdata options on AIX (PR #67999)

2023-10-31 Thread Eli Friedman via cfe-commits
@@ -265,6 +269,63 @@ bool AIXTargetCodeGenInfo::initDwarfEHRegSizeTable( return PPC_initDwarfEHRegSizeTable(CGF, Address, Is64Bit, /*IsAIX*/ true); } +void AIXTargetCodeGenInfo::setTargetAttributes( +const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule ) const {

[clang] [StackProtector] Do not emit the stack protector on GPU architectures (PR #70799)

2023-10-31 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Is there some reason stack protectors don't make sense on GPU targets? Or is the issue just that the GPU targets in question don't have the necessary runtime support? https://github.com/llvm/llvm-project/pull/70799 ___

[clang] [llvm] [AArch64][SME] Remove immediate argument restriction for svldr and svstr (PR #68565)

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

[llvm] [clang] [AArch64][SME] Remove immediate argument restriction for svldr and svstr (PR #68565)

2023-10-31 Thread Eli Friedman via cfe-commits
@@ -1741,6 +1742,69 @@ void AArch64DAGToDAGISel::SelectCVTIntrinsic(SDNode *N, unsigned NumVecs, CurDAG->RemoveDeadNode(N); } +void AArch64DAGToDAGISel::SelectSMELdrStrZA(SDNode *N, bool IsLoad) { + // Lower an SME LDR/STR ZA intrinsic to LDR_ZA_PSEUDO or STR_ZA. + // If

[clang] [llvm] [AArch64][SME] Remove immediate argument restriction for svldr and svstr (PR #68565)

2023-10-31 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: The resulting code here still isn't great quality for the case where the constant isn't folded. Maybe worth considering doing the lowering earlier (DAGCombine? Maybe even a late IR optimization?), so the lowered arithmetic can be optimized.

[clang] [clang] Better bitfield access units (PR #65742)

2023-10-27 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'm planning to take a closer look at this when I have more time. Sorry I haven't been more responsive here. One very brief note: in the comments in the code, you might want to distinguish between the semantic width of a bitfield (i.e. the C standard notion of a "memory

[clang] [AArch64][SME] Remove immediate argument restriction for svldr and svstr (PR #68565)

2023-10-27 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Also, you might want to consider marking the offset immarg, instead of trying to handle variable offsets in isel. https://github.com/llvm/llvm-project/pull/68565 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [AArch64][SME] Remove immediate argument restriction for svldr and svstr (PR #68565)

2023-10-27 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Could you briefly comment on the tradeoff of adding an argument to the intrinsic, vs. pattern-matching constant offsets to the existing intrinsic? https://github.com/llvm/llvm-project/pull/68565 ___

[clang] [AArch64][SME] Remove immediate argument restriction for svldr and svstr (PR #68565)

2023-10-27 Thread Eli Friedman via cfe-commits
@@ -292,7 +292,42 @@ define void @ldr_with_off_16mulvl(ptr %ptr) { %vscale = call i64 @llvm.vscale.i64() %mulvl = mul i64 %vscale, 256 %base = getelementptr i8, ptr %ptr, i64 %mulvl - call void @llvm.aarch64.sme.ldr(i32 16, ptr %base) + call void

[clang] [AArch64][SME] Remove immediate argument restriction for svldr and svstr (PR #68565)

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

[clang] [CGExprConstant] stop calling into ConstExprEmitter for Reference type destinations (PR #70366)

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

[clang] [CGExprConstant] stop evaluating StringLiterals for non-ConstantArrayTypes (PR #70366)

2023-10-27 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I think I'd prefer to avoid calling into ConstExprEmitter at all for cases involving reference binding. I think we've sort of discussed this before. Maybe add a check to tryEmitPrivate()? (We already have a check in tryEmitPrivateForVarInit().)

<    4   5   6   7   8   9   10   11   >