[clang] [llvm] [clang][CodeGen][AA] Add `!llvm.errno.tbaa` gathering int-compatible TBAA nodes (PR #125258)

2025-05-28 Thread John McCall via cfe-commits
rjmccall wrote: > Oh, sorry for not providing context earlier. The reasoning behind is to allow > certain optimizations involving errno-writing libcalls (marked as > `memory(errnomem: write)`) to occur, if we are able to prove the involved > memory location does not alias errno (e.g., because

[clang] [llvm] [clang][CodeGen][AA] Add `!llvm.errno.tbaa` gathering int-compatible TBAA nodes (PR #125258)

2025-05-27 Thread John McCall via cfe-commits
rjmccall wrote: Sorry, can you back up and explain the root problem you're trying to solve? You have a platform where we're emitting accesses to `errno` as if it weren't an `int`? What does it look like in source? https://github.com/llvm/llvm-project/pull/125258 ___

[clang] [Clang][OpenCL][AMDGPU] Allow a kernel to call another kernel (PR #115821)

2025-05-27 Thread John McCall via cfe-commits
rjmccall wrote: It's not actually clang's responsibility to not break your transformation. We don't want to break it gratuitously, but if clang is generating correct code, your transformation needs to be flexible enough to handle it. If there's something easy we can do to help your transformat

[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-05-22 Thread John McCall via cfe-commits
rjmccall wrote: Okay, it sounds like this is where we've left off: - The standard is using an odd formulation in [[class.cdtor]p2](https://eel.is/c++draft/class.cdtor) that we're not sure how to interpret. It's possible that it's formally slightly weaker than `restrict` might be, which would m

[clang] [CodeGen] Add TBAA struct path info for array members (PR #137719)

2025-05-20 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/137719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Add TBAA struct path info for array members (PR #137719)

2025-05-19 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: Thanks, those seem like good reasons. https://github.com/llvm/llvm-project/pull/137719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Add TBAA struct path info for array members (PR #137719)

2025-05-19 Thread John McCall via cfe-commits
@@ -4503,7 +4503,29 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, E->getType(), !getLangOpts().PointerOverflowDefined, SignedIndices, E->getExprLoc(), &arrayType, E->getBase()); EltBaseInfo = ArrayLV.getBaseInfo(); -EltT

[clang] [CodeGen] Add TBAA struct path info for array members (PR #137719)

2025-05-19 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/137719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

2025-05-16 Thread John McCall via cfe-commits
rjmccall wrote: The AMDGPU `TargetInfo` is responsible for ensuring that the choices it makes match the ABI. It is inconceivable that just dropping in the converted struct type that Clang IRGen uses as a direct parameter or result type would be a correct way to implement this; even if by chanc

[clang] [CodeGen] Add TBAA struct path info for array members (PR #137719)

2025-05-15 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: I'm surprised we need all this. Since we don't distinguish arrays from their elements in TBAA, is it not sufficient to just make sure that array subscript expressions produce an l-value with the same TBAA metadata as their base l-value? https://github.co

[clang] clang: Remove dest LangAS argument from performAddrSpaceCast (PR #138866)

2025-05-09 Thread John McCall via cfe-commits
rjmccall wrote: Merging this was fine because it was just removing the redundant LangAS argument, not removing the abstract handling of address-space conversions in IRGen. I just wanted to note my opposition to the idea of taking that second step, since it had come up in the review. https://g

[clang] [ItaniumMangle] Make sure class types are added to the dictionary of substitution candidates when compiling for older ABIs (PR #138947)

2025-05-07 Thread John McCall via cfe-commits
rjmccall wrote: Can you confirm that the intent here is to restore mangler behavior to what it was prior to #132401, making the pair of PRs ABI-neutral? https://github.com/llvm/llvm-project/pull/138947 ___ cfe-commits mailing list cfe-commits@lists.ll

[clang] [C] Diagnose use of C++ keywords in C (PR #137234)

2025-05-01 Thread John McCall via cfe-commits
rjmccall wrote: > For what it's worth, the existing "keyword from language you're not using" > warnings [already fire for analogous Objective-C++ > cases](https://godbolt.org/z/3K6835PPK)... which in those cases is correct, > since Clang does _not_ accept C++11-onwards keywords as selector nam

[clang] [C] Diagnose use of C++ keywords in C (PR #137234)

2025-04-30 Thread John McCall via cfe-commits
rjmccall wrote: Yeah, triggering this at the preprocessor level is not going to let you do in properly in Objective-C, where keywords are effectively context-sensitive. If that's the only reasonable way to implement it, you should just turn it off in Objective-C completely. https://github.com

[clang] [C] Diagnose use of C++ keywords in C (PR #137234)

2025-04-30 Thread John McCall via cfe-commits
rjmccall wrote: > > Similarly, ObjC selector components exist outside of the normal keyword > > rules, and the warning should never kick in on them. > > I don't know about selectors all that much; can you give me a test case that > you think I should handle? In general: look at `ParseObjCSele

[clang] [clang][headers][Apple] Don't include_next float.h to avoid an unnecessary module dependency (PR #137432)

2025-04-29 Thread John McCall via cfe-commits
rjmccall wrote: Messing around with `#include_next` is scary, but the problems are always thorny reasons that only come up in intense testing; I don't see anything obviously wrong, and I trust @ian-twilightcoder to have done the investigation properly. LGTM. https://github.com/llvm/llvm-proje

[clang] [C] Diagnose use of C++ keywords in C (PR #137234)

2025-04-29 Thread John McCall via cfe-commits
rjmccall wrote: The ObjC `@` is essentially an escape into a completely different grammar, and it doesn't matter whether the following identifier is a keyword or not in the base language. This warning should never kick in on that identifier. Similarly, ObjC selector components exist outside of

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/137364 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread John McCall via cfe-commits
@@ -121,6 +121,7 @@ CAST_OPERATION(FunctionToPointerDecay) /// CK_NullToPointer - Null pointer constant to pointer, ObjC /// pointer, or block pointer. /// (void*) 0 +/// (void*) nullptr rjmccall wrote: I think Eli is asking for you to note in the text tha

[clang] [CodeGen] Fix handling of nullptr in initializers (PR #137364)

2025-04-25 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/137364 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Emit fake uses before musttail calls (PR #136867)

2025-04-25 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/136867 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Emit fake uses before musttail calls (PR #136867)

2025-04-25 Thread John McCall via cfe-commits
@@ -6001,8 +6001,18 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, for (auto it = EHStack.find(CurrentCleanupScopeDepth); it != EHStack.end(); ++it) { EHCleanupScope *Cleanup = dyn_cast(&*it); - if (!(Cleanup && Cleanup->getCleanup(

[clang] [Clang][CodeGen] Emit fake uses before musttail calls (PR #136867)

2025-04-25 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: Functionality seems fine. A couple minor requests, then LGTM. https://github.com/llvm/llvm-project/pull/136867 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [Clang][CodeGen] Emit fake uses before musttail calls (PR #136867)

2025-04-25 Thread John McCall via cfe-commits
@@ -0,0 +1,56 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -emit-llvm -fextend-variable-liveness -o - %s | FileCheck %s + +/// Tests that when we have fake uses in a function ending in a musttail call,

[clang] [Clang] Make the result type of sizeof/pointer subtraction/size_t lit… (PR #136542)

2025-04-23 Thread John McCall via cfe-commits
rjmccall wrote: That is not possible, and this is exactly what I'm worried about with all this discussion about making `size_t` more "built-in". `size_t` is specified to be a typedef of a (platform-dependent) standard integer type, and it needs to continue to behave that way; we cannot actuall

[clang] [Clang] Make the result type of sizeof/pointer subtraction/size_t lit… (PR #136542)

2025-04-23 Thread John McCall via cfe-commits
rjmccall wrote: > > At least, it must ensure that `__size_t` is equivalent to `size_t` and > > generates the same mangled name. > > Is that possible? @rjmccall If `size_t` is a different type from `__size_t`, then `void foo(size_t);` declares a different entity from `void foo(__size_t);`. The

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-22 Thread John McCall via cfe-commits
rjmccall wrote: That's fine with me, yeah. https://github.com/llvm/llvm-project/pull/136038 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Make the result type of sizeof/pointer subtraction/size_t lit… (PR #136542)

2025-04-21 Thread John McCall via cfe-commits
rjmccall wrote: It's fine to make these operators look up and use the `size_t` / `ptrdiff_t` typedefs if they're available and have the right type. We would need to apply an allowlist to the attributes on the typedef, too — it would be quite abusive, but someone could use an `aligned` attribut

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-17 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. Thanks, that addresses my testing concern. https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread John McCall via cfe-commits
@@ -8623,6 +8624,13 @@ inline bool Type::isIntegralOrEnumerationType() const { inline bool Type::isBooleanType() const { if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() == BuiltinType::Bool; + if (const EnumType *ET = dyn_cast(CanonicalType)) { +//

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread John McCall via cfe-commits
@@ -8623,6 +8624,13 @@ inline bool Type::isIntegralOrEnumerationType() const { inline bool Type::isBooleanType() const { if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() == BuiltinType::Bool; + if (const EnumType *ET = dyn_cast(CanonicalType)) { +//

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread John McCall via cfe-commits
@@ -5238,6 +5238,14 @@ inline bool IsEnumDeclScoped(EnumDecl *ED) { return ED->isScoped(); } +/// Return the integer type corresponding to the given decl. +/// +/// We use this function to break a cycle between the inline definitions in +/// Type.h and Decl.h. +inline QualTy

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread John McCall via cfe-commits
@@ -2336,16 +2336,9 @@ bool Type::isArithmeticType() const { } bool Type::hasBooleanRepresentation() const { - if (isBooleanType()) -return true; - - if (const EnumType *ET = getAs()) -return ET->getDecl()->getIntegerType()->isBooleanType(); - - if (const AtomicType

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread John McCall via cfe-commits
@@ -2774,7 +2774,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { bool hasFloatingRepresentation() const; /// Determine whether this type has a boolean representation - /// of some sort. + /// of some sort, e.g., it is a boolean type or a vector

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread John McCall via cfe-commits
@@ -8623,6 +8624,13 @@ inline bool Type::isIntegralOrEnumerationType() const { inline bool Type::isBooleanType() const { if (const auto *BT = dyn_cast(CanonicalType)) return BT->getKind() == BuiltinType::Bool; + if (const EnumType *ET = dyn_cast(CanonicalType)) { +//

[clang] [clang] Rework `hasBooleanRepresentation`. (PR #136038)

2025-04-17 Thread John McCall via cfe-commits
@@ -2336,16 +2336,9 @@ bool Type::isArithmeticType() const { } bool Type::hasBooleanRepresentation() const { - if (isBooleanType()) -return true; - - if (const EnumType *ET = getAs()) -return ET->getDecl()->getIntegerType()->isBooleanType(); - - if (const AtomicType

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-15 Thread John McCall via cfe-commits
@@ -1302,6 +1302,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) { setSize(std::max(getSize(), Offset + Layout.getSize())); // Remember max struct/class alignment. + UnadjustedAlignment = std::max(UnadjustedAlignment, PreferredBaseAlign); ---

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-15 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
@@ -1302,6 +1302,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) { setSize(std::max(getSize(), Offset + Layout.getSize())); // Remember max struct/class alignment. + UnadjustedAlignment = std::max(UnadjustedAlignment, PreferredBaseAlign); ---

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
@@ -1302,6 +1302,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) { setSize(std::max(getSize(), Offset + Layout.getSize())); // Remember max struct/class alignment. + UnadjustedAlignment = std::max(UnadjustedAlignment, PreferredBaseAlign); ---

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
https://github.com/rjmccall requested changes to this pull request. Flagging as changes requested to at least verify that this doesn't change ABI for Darwin. https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lis

[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

2025-04-14 Thread John McCall via cfe-commits
@@ -1302,6 +1302,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) { setSize(std::max(getSize(), Offset + Layout.getSize())); // Remember max struct/class alignment. + UnadjustedAlignment = std::max(UnadjustedAlignment, PreferredBaseAlign); ---

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

2025-04-11 Thread John McCall via cfe-commits
@@ -0,0 +1,142 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++11 -fptrauth-calls -fptrauth-intrinsics -verify -fsyntax-only %s +// RUN: %clang_cc1 -triple aarch64-linux-gnu -std=c++11 -fptrauth-calls -fptrauth-intrinsics -verify -fsyntax-only %s + +#define AQ __ptrauth

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

2025-04-09 Thread John McCall via cfe-commits
@@ -0,0 +1,142 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++11 -fptrauth-calls -fptrauth-intrinsics -verify -fsyntax-only %s +// RUN: %clang_cc1 -triple aarch64-linux-gnu -std=c++11 -fptrauth-calls -fptrauth-intrinsics -verify -fsyntax-only %s + +#define AQ __ptrauth

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

2025-04-09 Thread John McCall via cfe-commits
@@ -0,0 +1,142 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++11 -fptrauth-calls -fptrauth-intrinsics -verify -fsyntax-only %s +// RUN: %clang_cc1 -triple aarch64-linux-gnu -std=c++11 -fptrauth-calls -fptrauth-intrinsics -verify -fsyntax-only %s + +#define AQ __ptrauth

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

2025-04-03 Thread John McCall via cfe-commits
@@ -0,0 +1,142 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++11 -fptrauth-calls -fptrauth-intrinsics -verify -fsyntax-only %s +// RUN: %clang_cc1 -triple aarch64-linux-gnu -std=c++11 -fptrauth-calls -fptrauth-intrinsics -verify -fsyntax-only %s + +#define AQ __ptrauth

[clang] [clang] Add value_type attr, use it to add noalias when pass-by-value. (PR #95004)

2025-03-18 Thread John McCall via cfe-commits
@@ -9242,3 +9242,15 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def ValueTypeDocs : Documentation { + let Category = DocCatDecl; + let Content = [{ +The ``value_type`` attribute can be u

[clang] [clang] Add value_type attr, use it to add noalias when pass-by-value. (PR #95004)

2025-03-18 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/95004 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add value_type attr, use it to add noalias when pass-by-value. (PR #95004)

2025-03-18 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/95004 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add value_type attr, use it to add noalias when pass-by-value. (PR #95004)

2025-03-17 Thread John McCall via cfe-commits
@@ -9242,3 +9242,15 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def ValueTypeDocs : Documentation { + let Category = DocCatDecl; + let Content = [{ +The ``value_type`` attribute can be u

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

2025-03-11 Thread John McCall via cfe-commits
@@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify -fptrauth-intrinsics -std=c++11 %s +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify -fptrauth-intrinsics -std=c++11 %s + +template struct G { + T __ptrauth(0,0,1234) test; +

[clang] Allow direct dispatch for the ObjFW runtime (PR #126382)

2025-03-06 Thread John McCall via cfe-commits
@@ -,6 +,96 @@ class CGObjCObjFW: public CGObjCGNU { return ClassSymbol; } + void GenerateDirectMethodPrologue( + CodeGenFunction &CGF, llvm::Function *Fn, const ObjCMethodDecl *OMD, + const ObjCContainerDecl *CD) override { +auto &Builder = CGF.Bu

[clang] Allow direct dispatch for the ObjFW runtime (PR #126382)

2025-03-06 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/126382 ___ 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)

2025-03-05 Thread John McCall via cfe-commits
@@ -73,7 +73,7 @@ namespace { // value of the expression to the unqualified, non-atomic version of // the named type. if (!S.Context.getLangOpts().ObjC && !DestType->isRecordType() && - !DestType->isArrayType()) { + !DestType->isArrayType

[clang] [clang][Sema] Fix type of an statement expression ending with an atomic type (PR #119711)

2025-02-17 Thread John McCall via cfe-commits
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?= Message-ID:

[clang] [clang][Sema] Fix type of an statement expression ending with an atomic type (PR #119711)

2025-02-12 Thread John McCall via cfe-commits
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?= Message-ID: In-Reply-To: @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +

[clang] [clang][Sema] Fix type of an statement expression ending with an atomic type (PR #119711)

2025-02-12 Thread John McCall via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -163,6 +163,7 @@ Bug Fixes to C++ Support Bug Fixes to AST Handling ^ +- F

[clang] [clang] run clang-format on some CGObjC files (PR #126644)

2025-02-12 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. Thank you; LGTM. https://github.com/llvm/llvm-project/pull/126644 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] run clang-format on some CGObjC files (PR #126644)

2025-02-11 Thread John McCall via cfe-commits
@@ -3397,53 +3309,53 @@ void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) { enum FragileClassFlags { /// Apparently: is not a meta-class. - FragileABI_Class_Factory = 0x1, + FragileABI_Class_Factory = 0x1, rjmccall

[clang] [TBAA] Refine pointer-tbaa for void pointers by pointer depth (PR #126047)

2025-02-11 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. Thanks, the new comment looks great. LGTM. https://github.com/llvm/llvm-project/pull/126047 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

[clang] [TBAA] Refine pointer-tbaa for void pointers by pointer depth (PR #126047)

2025-02-10 Thread John McCall via cfe-commits
@@ -80,6 +80,28 @@ llvm::MDNode *CodeGenTBAA::getChar() { return Char; } +llvm::MDNode *CodeGenTBAA::getAnyPtr(unsigned PtrDepth) { + assert(PtrDepth >= 1 && "Pointer must have some depth"); + + // Populate at least PtrDepth elements in AnyPtrs. These are the type nodes +

[clang] [TBAA] Refine pointer-tbaa for void pointers by pointer depth (PR #126047)

2025-02-10 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/126047 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [TBAA] Refine pointer-tbaa for void pointers by pointer depth (PR #126047)

2025-02-10 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: Functionality LGTM; just some suggested tweaks to the comments. https://github.com/llvm/llvm-project/pull/126047 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [TBAA] Refine pointer-tbaa for void pointers by pointer depth (PR #126047)

2025-02-07 Thread John McCall via cfe-commits
@@ -256,7 +277,7 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) { // similar-types rule. const auto *RT = Ty->getAs(); if (!RT) -return AnyPtr; +return getAnyPtr(); rjmccall wrote: This and the site below sho

[clang] [clang][Sema] Fix type of an statement expression ending with an atomic type (PR #119711)

2025-02-04 Thread John McCall via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -15919,10 +15919,17 @@ ExprResult Sema::ActOnStmtExprResult(ExprResult ER) { if (Cast && Cast->getCastKind() == CK_ARCConsumeObject)

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-02-04 Thread John McCall via cfe-commits
rjmccall wrote: We're documenting a weaker guarantee than we implement, yes. https://github.com/llvm/llvm-project/pull/122116 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Fix type of an statement expression ending with an atomic type (PR #119711)

2025-02-03 Thread John McCall via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/119711 ___ cfe-commits mailing list cf

[clang] [clang][Sema] Fix type of an statement expression ending with an atomic type (PR #119711)

2025-02-03 Thread John McCall via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -15919,10 +15919,17 @@ ExprResult Sema::ActOnStmtExprResult(ExprResult ER) { if (Cast && Cast->getCastKind() == CK_ARCConsumeObject)

[clang] [Clang] Add GCC's __builtin_stack_address() to Clang. (PR #121332)

2025-01-30 Thread John McCall via cfe-commits
rjmccall wrote: I agree with Nikita. I have no problem with supporting this builtin, but it feels like something that should be expressed portably as an IR intrinsic and then get lowered in the backend rather than needing frontend work for every target. https://github.com/llvm/llvm-project/pu

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-30 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/122116 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-30 Thread John McCall via cfe-commits
@@ -2489,6 +2489,81 @@ are listed below. $ clang -fuse-ld=lld -Oz -Wl,--icf=safe -fcodegen-data-use code.cc +Strict Aliasing +--- + +The C and C++ standards require accesses to objects in memory to use l-values of +an appropriate type for the object. This is

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-29 Thread John McCall via cfe-commits
@@ -2489,6 +2489,81 @@ are listed below. $ clang -fuse-ld=lld -Oz -Wl,--icf=safe -fcodegen-data-use code.cc +Strict Aliasing +--- + +The C and C++ standards require accesses to objects in memory to use l-values of +an appropriate type for the object. This is

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-29 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: Last minute re-read caught a couple slip-ups, and yeah, as mentioned, please feel free to augment this with other relevant information for users. Also, I'm definitely not sure the separate clang-cl section is worth keeping; it's pretty short, and any extr

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-29 Thread John McCall via cfe-commits
@@ -2489,6 +2489,81 @@ are listed below. $ clang -fuse-ld=lld -Oz -Wl,--icf=safe -fcodegen-data-use code.cc +Strict Aliasing +--- + +The C and C++ standards require accesses to objects in memory to use l-values of +an appropriate type for the object. This is

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-29 Thread John McCall via cfe-commits
@@ -2489,6 +2489,81 @@ are listed below. $ clang -fuse-ld=lld -Oz -Wl,--icf=safe -fcodegen-data-use code.cc +Strict Aliasing +--- + +The C and C++ standards require accesses to objects in memory to use l-values of +an appropriate type for the object. This is

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-29 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/122116 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [flang] [llvm] [Clang] Remove ARCMigrate (PR #119269)

2025-01-29 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. This looks right to me, but let me tag in @akyrtzi just to make his own pass over this. https://github.com/llvm/llvm-project/pull/119269 ___ cfe-commits mailing list cfe-commits@lists.llvm.org ht

[clang] [Clang] Fix __{add, remove}_pointer in Objective-C++ (PR #123678)

2025-01-24 Thread John McCall via cfe-commits
rjmccall wrote: It's probably right that these should match the behavior of adding or removing a `*` (the latter of which can happen via template argument deduction), which does mean they need to handle ObjC pointer types correctly. https://github.com/llvm/llvm-project/pull/123678

[clang] [Clang][OpenCL][AMDGPU] Allow a kernel to call another kernel (PR #115821)

2025-01-24 Thread John McCall via cfe-commits
@@ -5692,7 +5692,10 @@ CGCallee CodeGenFunction::EmitCallee(const Expr *E) { // Resolve direct calls. } else if (auto DRE = dyn_cast(E)) { if (auto FD = dyn_cast(DRE->getDecl())) { - return EmitDirectCallee(*this, FD); + auto CalleeDecl = FD->hasAttr() +

[clang] [PAC] Ignore noexcept on function type when computing discriminator of member function pointers (PR #109056)

2025-01-16 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/109056 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PAC] Ignore noexcept on function type when computing discriminator of member function pointers (PR #109056)

2025-01-16 Thread John McCall via cfe-commits
@@ -3442,6 +3442,35 @@ uint16_t ASTContext::getPointerAuthTypeDiscriminator(QualType T) { encodeTypeForFunctionPointerAuth(*this, Out, T); } else { T = T.getUnqualifiedType(); +// Drop exception specification from member function pointer type. rj

[clang] [PAC] Ignore noexcept on function type when computing discriminator of member function pointers (PR #109056)

2025-01-16 Thread John McCall via cfe-commits
@@ -3442,6 +3442,13 @@ uint16_t ASTContext::getPointerAuthTypeDiscriminator(QualType T) { encodeTypeForFunctionPointerAuth(*this, Out, T); } else { T = T.getUnqualifiedType(); +// Drop exception specification from member function pointer type. +if (auto *MPT

[clang] [PAC] Ignore noexcept on function type when computing discriminator of member function pointers (PR #109056)

2025-01-16 Thread John McCall via cfe-commits
@@ -3442,6 +3442,13 @@ uint16_t ASTContext::getPointerAuthTypeDiscriminator(QualType T) { encodeTypeForFunctionPointerAuth(*this, Out, T); } else { T = T.getUnqualifiedType(); +// Drop exception specification from member function pointer type. rj

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-09 Thread John McCall via cfe-commits
rjmccall wrote: Okay, so if the ultimate pointee type is `void`, we're basically treating that as a generic pointer, no matter what the pointer depth is? I guess that makes sense. > What would be a good place to document this? Hmm, I was hoping that we would have a section in the manual alre

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-09 Thread John McCall via cfe-commits
rjmccall wrote: I agree that allowing `void*` l-values to alias arbitrary pointer objects is probably the right pragmatic choice. We should document it, though. @pinskia, does GCC apply this recursively — e.g. are `void**` l-values treated specially in any way, or are they basically just `char

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

2025-01-01 Thread John McCall via cfe-commits
@@ -0,0 +1,37 @@ +// RUN: split-file %s %t +// RUN: python %t/gen.py %t/switch-overflow.c %t/tmp.c && %clang_cc1 -emit-llvm %t/tmp.c -o - | FileCheck %t/tmp.c + +//--- gen.py rjmccall wrote: If you don't mind working on the representation issue, I think that wou

[clang] [clang][NFC] Increase NumStmtBits by 2 as we are approaching the limit (PR #120341)

2024-12-20 Thread John McCall via cfe-commits
rjmccall wrote: > FYI it looks like this has a fairly large impact on compile-time, esp at `O0` > with a clang host compiler > (https://llvm-compile-time-tracker.com/compare.php?from=1fcb6a9754a8db057e18f629cb90011b638901e7&to=4797437463e63ee289a1ff1904cfb7b2fe6cb4c2&stat=instructions%3Au). >

[clang] [clang][NFC] Increase NumStmtBits by 2 as we are approaching the limit (PR #120341)

2024-12-18 Thread John McCall via cfe-commits
rjmccall wrote: > > > Let's just increase to 9 bits. > > > Have you checked whether the size of `Stmt` or `Expr` changes when you do > > > this? > > > > > > @rjmccall I've changed it to 9 bits and checked that `Stmt` and `Expr` are > > still 8 bytes and 16 bytes resp.. > > I think checking j

[clang] [clang][NFC] Increase NumStmtBits by 2 as we are approaching the limit (PR #120341)

2024-12-17 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: Let's just increase to 9 bits. Have you checked whether the size of `Stmt` or `Expr` changes when you do this? https://github.com/llvm/llvm-project/pull/120341 ___ cfe-commits mailing list cfe-commits@lists.llvm.

[clang] [clang][CodeGen] `sret` args should always point to the `alloca` AS, so use that (PR #114062)

2024-12-12 Thread John McCall via cfe-commits
@@ -225,7 +225,9 @@ ABIArgInfo AMDGPUABIInfo::classifyArgumentType(QualType Ty, bool Variadic, // Records with non-trivial destructors/copy-constructors should not be // passed by value. if (auto RAA = getRecordArgABI(Ty, getCXXABI())) - return getNaturalAlign

[clang] [clang][CodeGen] `sret` args should always point to the `alloca` AS, so use that (PR #114062)

2024-12-12 Thread John McCall via cfe-commits
@@ -800,7 +800,9 @@ static ABIArgInfo classifyExpandedType(SwiftAggLowering &lowering, if (lowering.empty()) { return ABIArgInfo::getIgnore(); } else if (lowering.shouldPassIndirectly(forReturn)) { -return ABIArgInfo::getIndirect(alignmentForIndirect, /*byval*/ fal

[clang] [clang][CodeGen] `sret` args should always point to the `alloca` AS, so use that (PR #114062)

2024-12-10 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/114062 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CodeGen] `sret` args should always point to the `alloca` AS, so use that (PR #114062)

2024-12-10 Thread John McCall via cfe-commits
@@ -225,7 +225,9 @@ ABIArgInfo AMDGPUABIInfo::classifyArgumentType(QualType Ty, bool Variadic, // Records with non-trivial destructors/copy-constructors should not be // passed by value. if (auto RAA = getRecordArgABI(Ty, getCXXABI())) - return getNaturalAlign

[clang] [clang][CodeGen] `sret` args should always point to the `alloca` AS, so use that (PR #114062)

2024-12-10 Thread John McCall via cfe-commits
https://github.com/rjmccall requested changes to this pull request. I'm fine with how you're handling the address spaces for now. I'd like to talk about the rule you're implementing, though. It looks like it's supposed to be: - return values always use the alloca AS - arguments always use the

[clang] [clang][CodeGen] `sret` args should always point to the `alloca` AS, so use that (PR #114062)

2024-12-10 Thread John McCall via cfe-commits
https://github.com/rjmccall edited https://github.com/llvm/llvm-project/pull/114062 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CodeGen] `sret` args should always point to the `alloca` AS, so use that (PR #114062)

2024-12-10 Thread John McCall via cfe-commits
@@ -800,7 +800,9 @@ static ABIArgInfo classifyExpandedType(SwiftAggLowering &lowering, if (lowering.empty()) { return ABIArgInfo::getIgnore(); } else if (lowering.shouldPassIndirectly(forReturn)) { -return ABIArgInfo::getIndirect(alignmentForIndirect, /*byval*/ fal

  1   2   3   4   5   6   7   8   9   10   >