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

2023-11-19 Thread John McCall via cfe-commits
rjmccall wrote: This is less about the implementation weeds of LLVM and more about the actual details of your calling convention — the decisions about how arguments and results are passed that are ultimately downstream of the choices made here. Mostly, I'm encouraging you as a platform mainta

[clang] [clang] Do not clear FP pragma stack when instantiating functions (PR #70646)

2023-10-30 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: To be clear, we're still ensuring the current pragma state during instantiation is what it was when the template is parsed, we're just not incorrectly dropping all of the saved pragma state when we're doing it? https://github.com/llvm/llvm-project/pull/70

[clang] [clang] Do not clear FP pragma stack when instantiating functions (PR #70646)

2023-10-30 Thread John McCall via cfe-commits
rjmccall wrote: That makes sense. Out of curiosity, since presumably the instantiation path is using the RAII class, and the RAII class seems to save and restore the entire stack, what actually ends up going wrong? It doesn't look like your test case has local changes to the stack within the

[clang] [clang] Do not clear FP pragma stack when instantiating functions (PR #70646)

2023-10-31 Thread John McCall via cfe-commits
rjmccall wrote: I see, that makes sense. It shouldn't really need to be saved even during late template parsing, right? Late template parsing is never at the top level, and push/pop are only allowed at the top level. https://github.com/llvm/llvm-project/pull/70646 ___

[clang] [clang] Do not clear FP pragma stack when instantiating functions (PR #70646)

2023-11-01 Thread John McCall via cfe-commits
rjmccall wrote: It's certainly possible to see push/pop pragmas in late-parsed code, but Sema should immediately emit an error and ignore them because, like I said, they're only allowed at file context, and AFAIK late-parsed code is never at file context. If there's some sneaky way to late-pa

[clang] [clang] Do not clear FP pragma stack when instantiating functions (PR #70646)

2023-11-01 Thread John McCall via cfe-commits
rjmccall wrote: > > And contrariwise, if there's some sneaky way to put push/pop pragmas in > > non-file contexts, that also seems like a serious problem, because the way > > we process them is not designed to understand local scopes, which means > > we're just doing random stuff instead of im

[clang] [clang] Do not clear FP pragma stack when instantiating functions (PR #70646)

2023-11-01 Thread John McCall via cfe-commits
rjmccall wrote: > > The upshot is that we don't (and shouldn't) ever late-parse at file > > context, which by design means we can't see stack-manipulating pragmas > > because they're all restricted to file context. In late parsing, we only > > ever observe and change the innermost state of the

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

2023-12-13 Thread John McCall via cfe-commits
@@ -232,19 +232,19 @@ static Value *MakeBinaryAtomicValue( static Value *EmitNontemporalStore(CodeGenFunction &CGF, const CallExpr *E) { Value *Val = CGF.EmitScalarExpr(E->getArg(0)); - Value *Address = CGF.EmitScalarExpr(E->getArg(1)); + Address Addr = CGF.EmitPointerWith

[clang] [HLSL] Vector standard conversions (PR #71098)

2023-12-13 Thread John McCall via cfe-commits
@@ -1422,6 +1424,9 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType, return Builder.CreateVectorSplat(NumElements, Src, "splat"); } + if (SrcType->isExtVectorType() && DstType->isExtVectorType()) +return EmitVectorElementConversion(Src

[clang] [FPEnv] Add strictfp in some C++ constructors lacking a FunctionDecl. (PR #74883)

2023-12-14 Thread John McCall via cfe-commits
@@ -5520,6 +5520,12 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, CGM.AdjustMemoryAttribute(CalleePtr->getName(), Callee.getAbstractInfo(), Attrs); } + // We may not have a FunctionDecl*, but we still need to suppo

[clang] [FPEnv] Add strictfp in some C++ constructors lacking a FunctionDecl. (PR #74883)

2023-12-14 Thread John McCall via cfe-commits
@@ -6,14 +7,80 @@ float z(); #pragma float_control(except, on) class ON { float w = 2 + y() * z(); - // CHECK-LABEL: define {{.*}} @_ZN2ONC2Ev{{.*}} - // CHECK: llvm.experimental.constrained.fmul{{.*}}tonearest{{.*}}strict }; ON on; #pragma float_control(except, off) cl

[clang] [HLSL][Docs] Add documentation for HLSL functions (PR #75397)

2023-12-14 Thread John McCall via cfe-commits
rjmccall wrote: > @rjmccall, I'm curious if you have any thoughts on the proposed > implementation approach here? > > The TL;DR for the gnarly bit is to have AST nodes representing parameters > that need temporary values, and for "output" parameters where there may be > cast sequences involve

[clang] [HLSL][Docs] Add documentation for HLSL functions (PR #75397)

2023-12-14 Thread John McCall via cfe-commits
@@ -0,0 +1,300 @@ +=== +HLSL Function Calls +=== + +.. contents:: + :local: + +Introduction + + +This document descries the design and implementation of HLSL's function call +semantics in Clang. This includes details related to argumen

[clang] [HLSL][Docs] Add documentation for HLSL functions (PR #75397)

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

[libc] [compiler-rt] [clang] [clang-tools-extra] [llvm] [flang] [libcxx] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-14 Thread John McCall via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[clang-tools-extra] [llvm] [compiler-rt] [clang] [flang] [libcxx] [libc] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-14 Thread John McCall via cfe-commits
@@ -4073,6 +4221,51 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitLValue(Array); auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOpts.has(SanitizerKind::ArrayBounds)) { + // If the array being accessed h

[compiler-rt] [libc] [clang-tools-extra] [clang] [libcxx] [llvm] [flang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

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

[llvm] [libcxx] [flang] [clang] [clang-tools-extra] [compiler-rt] [libc] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-15 Thread John McCall via cfe-commits
@@ -4073,6 +4221,51 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitLValue(Array); auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOpts.has(SanitizerKind::ArrayBounds)) { + // If the array being accessed h

[compiler-rt] [libcxx] [llvm] [clang-tools-extra] [libc] [flang] [clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

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

[libc] [libcxx] [compiler-rt] [llvm] [clang-tools-extra] [clang] [flang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-15 Thread John McCall via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[clang-tools-extra] [compiler-rt] [flang] [libcxx] [libc] [llvm] [clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-15 Thread John McCall via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[clang-tools-extra] [flang] [compiler-rt] [clang] [llvm] [libc] [libcxx] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-15 Thread John McCall via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[clang-tools-extra] [flang] [compiler-rt] [clang] [llvm] [libc] [libcxx] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-15 Thread John McCall via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[clang-tools-extra] [flang] [compiler-rt] [clang] [llvm] [libc] [libcxx] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

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

[libc] [libcxx] [llvm] [flang] [clang-tools-extra] [compiler-rt] [clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-15 Thread John McCall via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[llvm] [compiler-rt] [clang-tools-extra] [clang] [flang] [libc] [libcxx] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-15 Thread John McCall via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[clang] [CodeGen] Emit a more accurate alignment for non-temporal loads/stores (PR #75675)

2023-12-15 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/75675 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libcxx] [clang-tools-extra] [flang] [clang] [llvm] [libc] [compiler-rt] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-18 Thread John McCall via cfe-commits
@@ -8522,6 +8522,22 @@ bool Sema::CheckCountedByAttr(Scope *S, const FieldDecl *FD) { } } + // We don't support 'counted_by' on flexible array members in substructures. + const DeclContext *DC = FD->getParent(); + while (const auto *RD = dyn_cast(DC)) { +if (!RD-

[libcxx] [flang] [compiler-rt] [llvm] [clang] [libc] [clang-tools-extra] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-18 Thread John McCall via cfe-commits
@@ -8522,6 +8522,22 @@ bool Sema::CheckCountedByAttr(Scope *S, const FieldDecl *FD) { } } + // We don't support 'counted_by' on flexible array members in substructures. + const DeclContext *DC = FD->getParent(); + while (const auto *RD = dyn_cast(DC)) { +if (!RD-

[flang] [libc] [compiler-rt] [libcxx] [clang-tools-extra] [clang] [llvm] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-18 Thread John McCall via cfe-commits
@@ -3946,6 +4080,32 @@ static Address emitArraySubscriptGEP(CodeGenFunction &CGF, Address addr, return Address(eltPtr, CGF.ConvertTypeForMem(eltType), eltAlign); } +static bool GetFieldOffsetInBits(CodeGenFunction &CGF, const RecordDecl *RD, +

[flang] [libcxx] [clang] [compiler-rt] [clang-tools-extra] [libc] [llvm] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-18 Thread John McCall via cfe-commits
@@ -8522,6 +8522,22 @@ bool Sema::CheckCountedByAttr(Scope *S, const FieldDecl *FD) { } } + // We don't support 'counted_by' on flexible array members in substructures. + const DeclContext *DC = FD->getParent(); + while (const auto *RD = dyn_cast(DC)) { +if (!RD-

[flang] [libcxx] [clang] [compiler-rt] [clang-tools-extra] [libc] [llvm] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-18 Thread John McCall via cfe-commits
@@ -3946,6 +4080,32 @@ static Address emitArraySubscriptGEP(CodeGenFunction &CGF, Address addr, return Address(eltPtr, CGF.ConvertTypeForMem(eltType), eltAlign); } +static bool GetFieldOffsetInBits(CodeGenFunction &CGF, const RecordDecl *RD, +

[clang] [clang][wasm] Resolve assertion errors caused by converting ComplexTy… (PR #70496)

2023-12-19 Thread John McCall via cfe-commits
rjmccall wrote: Have you verified that this is actually the ABI you want? Is there a psABI for WASM? https://github.com/llvm/llvm-project/pull/70496 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[clang-tools-extra] [clang] [llvm] [HLSL] Vector standard conversions (PR #71098)

2023-12-19 Thread John McCall via cfe-commits
@@ -15608,11 +15608,18 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T, if (S.SourceMgr.isInSystemMacro(CC)) return; return DiagnoseImpCast(S, E, T, CC, diag::warn_impcast_vector_scalar); +} else if (S.getLangOpts().HLSL && +

[clang-tools-extra] [llvm] [clang] [HLSL] Vector standard conversions (PR #71098)

2023-12-19 Thread John McCall via cfe-commits
@@ -2466,6 +2504,14 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { case CK_IntToOCLSampler: return CGF.CGM.createOpenCLIntToSamplerConversion(E, CGF); + case CK_HLSLVectorTruncation: { +assert(DestTy->isVectorType() && "Expected dest type to be vector ty

[clang] [clang-tools-extra] [llvm] [HLSL] Vector standard conversions (PR #71098)

2023-12-19 Thread John McCall via cfe-commits
@@ -4763,6 +4763,20 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, CK_ZeroToOCLOpaqueType, From->getValueKind()).get(); break; + case ICK_HLSL_Vector_Truncation: { +// Note: HLSL vectors are Ex

[clang] [llvm] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

2023-12-19 Thread John McCall via cfe-commits
@@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -triple x86_64-linux -std=c++98 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s rjmccall wrote: This is okay as long as you're sure the optimization will be performed and you make sure your test on

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

2023-11-23 Thread John McCall 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 size

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

2023-11-25 Thread John McCall 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 size

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

2023-11-25 Thread John McCall via cfe-commits
https://github.com/rjmccall 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] Stub out gcc_struct attribute (PR #71148)

2023-12-01 Thread John McCall via cfe-commits
rjmccall wrote: It sounds like we're talking about extending the behavior of these attributes, and I'd like to make sure that whatever we do here is acceptable to GCC. That is, if we're going to start accepting these attributes on new targets which GCC doesn't currently support, we should mak

[clang] Use Address for CGBuilder's CreateAtomicRMW and CreateAtomicCmpXchg. (PR #74349)

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

[llvm] [clang] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

2023-12-20 Thread John McCall via cfe-commits
@@ -4598,8 +4602,7 @@ LValue CodeGenFunction::EmitLValueForField(LValue base, if (base.getTBAAInfo().isMayAlias() || rec->hasAttr() || FieldType->isVectorType()) { FieldTBAAInfo = TBAAAccessInfo::getMayAliasInfo(); - } else if (rec->isUnion()) { -// TODO: S

[llvm] [clang] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

2023-12-20 Thread John McCall via cfe-commits
@@ -4080,7 +4080,11 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, E->getType(), !getLangOpts().isSignedOverflowDefined(), SignedIndices, E->getExprLoc(), &arrayType, E->getBase()); EltBaseInfo = ArrayLV.getBaseInfo(); -E

[llvm] [clang] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

2023-12-20 Thread John McCall via cfe-commits
@@ -184,13 +199,24 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) { return getChar(); // Handle pointers and references. - // TODO: Implement C++'s type "similarity" and consider dis-"similar" - // pointers distinct. - if (Ty->isPointerType() || Ty->

[llvm] [clang] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

2023-12-20 Thread John McCall via cfe-commits
@@ -105,13 +105,28 @@ static bool isValidBaseType(QualType QTy) { if (RD->hasFlexibleArrayMember()) return false; // RD can be struct, union, class, interface or enum. -// For now, we only handle struct and class. -if (RD->isStruct() || RD->isClass()) +

[clang] [llvm] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

2023-12-20 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: In general, this patch needs to be clearer about what rules it's actually enforcing. You're adding new command-line options, but users have to guess what they mean! If you're going to be working on TBAA, would you mind adding a section to Clang's manual

[llvm] [clang] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

2023-12-20 Thread John McCall via cfe-commits
@@ -184,13 +199,24 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) { return getChar(); // Handle pointers and references. - // TODO: Implement C++'s type "similarity" and consider dis-"similar" - // pointers distinct. - if (Ty->isPointerType() || Ty->

[llvm] [clang] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

2023-12-20 Thread John McCall via cfe-commits
@@ -216,6 +216,9 @@ ENUM_CODEGENOPT(StructReturnConvention, StructReturnConventionKind, 2, SRCK_Defa CODEGENOPT(RelaxAll , 1, 0) ///< Relax all machine code instructions. CODEGENOPT(RelaxedAliasing , 1, 0) ///< Set when -fno-strict-aliasing is enabled. CODEGENOPT(S

[clang] [llvm] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

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

[llvm] [clang] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

2023-12-21 Thread John McCall via cfe-commits
rjmccall wrote: > From all of above, the only way void* and char* alias if they are compatible, > but they are not: Ah, you're right, I had misremembered this. 6.2.5p31 requires them to have the same representation as each other, and there's a footnote about this being meant to imply "interc

[llvm] [clang] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

2023-12-28 Thread John McCall via cfe-commits
@@ -184,13 +199,24 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) { return getChar(); // Handle pointers and references. - // TODO: Implement C++'s type "similarity" and consider dis-"similar" - // pointers distinct. - if (Ty->isPointerType() || Ty->

[llvm] [clang] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

2023-12-28 Thread John McCall via cfe-commits
@@ -105,13 +105,34 @@ static bool isValidBaseType(QualType QTy) { if (RD->hasFlexibleArrayMember()) return false; // RD can be struct, union, class, interface or enum. -// For now, we only handle struct and class. -if (RD->isStruct() || RD->isClass()) +

[clang] [llvm] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

2023-12-28 Thread John McCall via cfe-commits
@@ -184,13 +205,59 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) { return getChar(); // Handle pointers and references. - // TODO: Implement C++'s type "similarity" and consider dis-"similar" - // pointers distinct. - if (Ty->isPointerType() || Ty->

[llvm] [clang] [Clang][IR] add TBAA metadata on pointer, union and array types. (PR #75177)

2023-12-28 Thread John McCall via cfe-commits
@@ -4598,8 +4602,7 @@ LValue CodeGenFunction::EmitLValueForField(LValue base, if (base.getTBAAInfo().isMayAlias() || rec->hasAttr() || FieldType->isVectorType()) { FieldTBAAInfo = TBAAAccessInfo::getMayAliasInfo(); - } else if (rec->isUnion()) { -// TODO: S

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

2024-01-01 Thread John McCall via cfe-commits
rjmccall wrote: > That makes a lot of sense. Thank you John. I guess here are my thoughts. As I > understand it, the `SwiftABIInfo` by default does something like "if > something can be passed in 4 registers or fewer then pass by register, > otherwise pass indirectly"? I think that sweet spot

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-01-05 Thread John McCall via cfe-commits
@@ -1046,6 +1046,15 @@ CodeGenModule::getVTableLinkage(const CXXRecordDecl *RD) { if (!RD->isExternallyVisible()) return llvm::GlobalVariable::InternalLinkage; + // Previously we'll decide the linkage of the vtable by the linkage + // of the key function. But within m

[clang] [C++20] [Modules] [Itanium ABI] Generate the vtable in the module unit of dynamic classes (PR #75912)

2024-01-05 Thread John McCall via cfe-commits
@@ -1801,6 +1801,12 @@ void ItaniumCXXABI::emitVTableDefinitions(CodeGenVTables &CGVT, if (VTable->hasInitializer()) return; + // If the class are attached to a C++ named module other than the one rjmccall wrote: ```suggestion // If the class is att

[clang] [clang] Fix assertion failure when initializing union with FAM (PR #77298)

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

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

2024-01-08 Thread John McCall via cfe-commits
@@ -376,33 +377,41 @@ void CGRecordLowering::lowerUnion(bool isNoUniqueAddress) { } void CGRecordLowering::accumulateFields() { - for (RecordDecl::field_iterator Field = D->field_begin(), - FieldEnd = D->field_end(); -Field != FieldEnd;)

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

2024-01-08 Thread John McCall via cfe-commits
@@ -442,79 +455,235 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, return; } - // Check if OffsetInRecord (the size in bits of the current run) is better - // as a single field run. When OffsetInRecord has legal integer width, and - // its

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

2024-01-08 Thread John McCall via cfe-commits
@@ -442,79 +455,235 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, return; } - // Check if OffsetInRecord (the size in bits of the current run) is better - // as a single field run. When OffsetInRecord has legal integer width, and - // its

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

2024-01-08 Thread John McCall via cfe-commits
@@ -442,79 +455,235 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, return; } - // Check if OffsetInRecord (the size in bits of the current run) is better - // as a single field run. When OffsetInRecord has legal integer width, and - // its

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

2024-01-08 Thread John McCall via cfe-commits
@@ -415,12 +424,16 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, uint64_t StartBitOffset, Tail = 0; if (isDiscreteBitFieldABI()) { for (; Field != FieldEnd; ++Field) { - uint64_t BitOffset = getFieldBitOffset(*Field); + if (!Field

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

2024-01-08 Thread John McCall via cfe-commits
@@ -442,79 +455,235 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, return; } - // Check if OffsetInRecord (the size in bits of the current run) is better - // as a single field run. When OffsetInRecord has legal integer width, and - // its

[clang] [Clang] Set writable and dead_on_unwind attributes on sret arguments (PR #77116)

2024-01-10 Thread John McCall via cfe-commits
rjmccall wrote: If I understand the specification of these attributes correctly, they seem fine. `dead_on_unwind` is definitely fine — the return value must be treated as uninitialized after a call that throws. `writable` has a somewhat loose specification that scares me a bit, but as long a

[clang] [Clang] Set writable and dead_on_unwind attributes on sret arguments (PR #77116)

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

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

2024-03-13 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: Thank you, the structure looks great! Mostly style and clarity comments from here. https://github.com/llvm/llvm-project/pull/65742 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

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

2024-03-13 Thread John McCall via cfe-commits
@@ -439,82 +444,194 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

2024-03-13 Thread John McCall via cfe-commits
@@ -439,82 +444,194 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

2024-03-13 Thread John McCall via cfe-commits
@@ -439,82 +444,194 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

2024-03-13 Thread John McCall via cfe-commits
@@ -439,82 +444,194 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

2024-03-13 Thread John McCall via cfe-commits
@@ -439,82 +444,194 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

2024-03-13 Thread John McCall via cfe-commits
@@ -439,82 +444,194 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

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

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

2024-03-13 Thread John McCall via cfe-commits
@@ -439,82 +444,194 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

2024-03-13 Thread John McCall via cfe-commits
@@ -439,82 +444,194 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

2024-03-15 Thread John McCall via cfe-commits
@@ -439,82 +444,194 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

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

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

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

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

2024-03-15 Thread John McCall via cfe-commits
@@ -439,82 +444,194 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

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

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

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

[clang] [llvm] [AArch64][PAC] Support ptrauth builtins and -fptrauth-intrinsics. (PR #65996)

2024-03-15 Thread John McCall via cfe-commits
@@ -0,0 +1,265 @@ +Pointer Authentication +== + +.. contents:: + :local: + +Introduction + + +Pointer authentication is a technology which offers strong probabilistic protection against exploiting a broad class of memory bugs to take control of

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-03-18 Thread John McCall via cfe-commits
rjmccall wrote: Hmm. Is there some sort of optimization in IRGen that we need to suppress here, or is it something in LLVM code gen? Presumably normal LLVM optimization passes all just skip `optnone` functions. Mostly I'm wondering how far we're expected to go with `optnone`. https://github

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

2024-03-18 Thread John McCall via cfe-commits
rjmccall wrote: Yeah, we don't need to care about the actual bit offset of the zero-width bit-field as long as we honor the non-interference properties across it. I'll take a look at the patch, thanks. https://github.com/llvm/llvm-project/pull/65742 ___

[clang] [clang] Add `__has_extension(swiftcc)` support (PR #85347)

2024-03-18 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. Yeah, it's fine with me. https://github.com/llvm/llvm-project/pull/85347 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-03-18 Thread John McCall via cfe-commits
rjmccall wrote: > > Hmm. Is there some sort of optimization in IRGen that we need to suppress > > here, or is it something in LLVM code gen? Presumably normal LLVM > > optimization passes all just skip `optnone` functions. > > The issue #62098 demonstrates such case. Okay. So if I understand

[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)

2024-03-18 Thread John McCall via cfe-commits
@@ -3552,6 +3552,15 @@ class CastExpr : public Expr { /// function that it invokes. NamedDecl *getConversionFunction() const; + /// Path through the class hierarchy taken by a `DerivedToBase` or + /// `UncheckedDerivedToBase` cast. For each derived-to-base edge in the pa

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

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

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-03-19 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: Alright. I don't really have a problem with doing this, and this seems like basically the right approach. You're applying the attributes in the wrong place, though. https://github.com/llvm/llvm-project/pull/85605

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-03-19 Thread John McCall via cfe-commits
@@ -2508,6 +2508,10 @@ Decl *Parser::ParseFunctionStatementBody(Decl *Decl, ParseScope &BodyScope) { Sema::PragmaStackSentinelRAII PragmaStackSentinel(Actions, "InternalPragmaState", IsCXXMethod); + // Some function attributes (like OptimizeNoneAttr) affect FP options.

[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)

2024-03-19 Thread John McCall via cfe-commits
https://github.com/rjmccall approved this pull request. https://github.com/llvm/llvm-project/pull/85623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-19 Thread John McCall via cfe-commits
@@ -439,82 +444,247 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

2024-03-19 Thread John McCall via cfe-commits
https://github.com/rjmccall commented: This looks great, thanks! I have a few editorial nits, and there's an assertion that seems off, but otherwise this looks ready to go. https://github.com/llvm/llvm-project/pull/65742 ___ cfe-commits mailing list

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

2024-03-19 Thread John McCall via cfe-commits
@@ -439,82 +444,247 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

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

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

2024-03-19 Thread John McCall via cfe-commits
@@ -439,82 +444,247 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

2024-03-19 Thread John McCall via cfe-commits
@@ -439,82 +444,247 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

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

2024-03-19 Thread John McCall via cfe-commits
@@ -439,82 +444,247 @@ CGRecordLowering::accumulateBitFields(RecordDecl::field_iterator Field, Members.push_back(MemberInfo(bitsToCharUnits(StartBitOffset), MemberInfo::Field, nullptr, *Field)); } -return; +return Field;

<    1   2   3   4   5   6   7   8   9   10   >