[clang] Mark CXX module initializer with PACBTI attributes (PR #133716)

2025-03-31 Thread Eli Friedman via cfe-commits
@@ -818,6 +818,12 @@ void CodeGenModule::EmitCXXModuleInitFunc(Module *Primary) { Fn->addFnAttr("device-init"); } + if (getTarget().isBranchProtectionSupportedArch( + getTarget().getTargetOpts().CPU)) { +TargetInfo::BranchProtectionInfo BPI(getLangOpts());

[clang] [C11] Implement WG14 N1285 (temporary lifetimes) (PR #133472)

2025-03-28 Thread Eli Friedman via cfe-commits
@@ -741,10 +741,11 @@ ExprResult Sema::ImpCastExprToType(Expr *E, QualType Ty, if (Kind == CK_ArrayToPointerDecay) { // C++1z [conv.array]: The temporary materialization conversion is applied. // We also use this to fuel C++ DR1213, which applies to C++11 onwards. -

[clang] [C11] Implement WG14 N1285 (temporary lifetimes) (PR #133472)

2025-03-28 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,212 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -std=c99 -Wno-dangling -emit-llvm -o - %s | FileCheck %s --check-prefix=C99 +// RUN: %clang_cc1 -std=c11 -Wno-dangling -emit-llvm -o - %s |

[clang] [clang] fix constexpr-unknown handling of self-references. (PR #132990)

2025-03-28 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/132990 >From 2873bb1aee5470ecd7fa66c1f255bfe8b26dbc68 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Mon, 17 Mar 2025 11:20:21 -0700 Subject: [PATCH 1/3] [clang] fix constexpr-unknown handling of self-referen

[clang] [clang] fix constexpr-unknown handling of self-references. (PR #132990)

2025-03-28 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Addressed review comments. We now reject g3() and g5(), the cases that involved using a local variable in a constexpr function in its own initializer. https://github.com/llvm/llvm-project/pull/132990 ___ cf

[clang] [llvm] Remove Native Client support (PR #133661)

2025-03-31 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > CodeGen/Thumb2/pacbti-m-outliner-1.ll ``` diff --git a/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-1.ll b/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-1.ll index 23924b2..dc06c26 100644 --- a/llvm/test/CodeGen/Thumb2/pacbti-m-outliner-1.ll +++ b/llvm/test/CodeGen/Thumb2/pacb

[clang] [clang] Fix handling of explicit-`this` functions as template arguments (PR #133748)

2025-03-31 Thread Eli Friedman via cfe-commits
@@ -7558,6 +7558,18 @@ ExprResult Sema::BuildExpressionFromDeclTemplateArgument( } else { assert(ParamType->isReferenceType() && "unexpected type for decl template argument"); + +if (auto *Method = dyn_cast(VD); +Method && Method->isExplicitObjectMe

[clang] [C11] Implement WG14 N1285 (temporary lifetimes) (PR #133472)

2025-03-31 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,212 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -std=c99 -Wno-dangling -emit-llvm -o - %s | FileCheck %s --check-prefix=C99 +// RUN: %clang_cc1 -std=c11 -Wno-dangling -emit-llvm -o - %s |

[clang] [clang][test] Don't require specific alignment in test case (PR #130589)

2025-03-15 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Thanks for taking care of this for me. https://github.com/llvm/llvm-project/pull/130589 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] disable unary, vector mask (PR #130400)

2025-03-17 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I have no idea how much the two-argument version of __builtin_shufflevector is used in practice. I wouldn't want to remove it without a better idea of that... I vaguely recall it might be relevant for some GPU languages. It should be possible to fix the crash by just reje

[clang] [clang] Fix array types comparison in getCommonSugaredType (PR #131649)

2025-03-17 Thread Eli Friedman via cfe-commits
@@ -14171,6 +14171,15 @@ static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X, static auto unwrapSugar(SplitQualType &T, Qualifiers &QTotal) { SmallVector R; while (true) { +if (const auto *ATy = dyn_cast(T.Ty)) { + // C++ 9.3.3.4p3: Any type of t

[clang] [libclang/python] Add python bindings for PrintingPolicy (PR #120494)

2025-04-08 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The PrintingPolicy constants just reflect the names from clang/include/clang/AST/PrettyPrinter.h. For FullyQualifiedName specifically: > /// When true, print the fully qualified name of function declarations. > /// This is the opposite of SuppressScope and thus overrules

[clang] [clang][bytecode] Fix emitting dtors of zero-sized arrays (PR #134672)

2025-04-08 Thread Eli Friedman via cfe-commits
@@ -6818,15 +6818,17 @@ bool Compiler::emitDestruction(const Descriptor *Desc, return true; } -for (ssize_t I = Desc->getNumElems() - 1; I >= 0; --I) { - if (!this->emitConstUint64(I, Loc)) -return false; - if (!this->emitArrayElemPtrUint64(L

[clang] [Clang][CodeGen][X86] don't coerce int128 into `{i64,i64}` for SysV-like ABIs (PR #135230)

2025-04-11 Thread Eli Friedman via cfe-commits
@@ -2595,6 +2595,14 @@ GetX86_64ByValArgumentPair(llvm::Type *Lo, llvm::Type *Hi, ABIArgInfo X86_64ABIInfo:: classifyReturnType(QualType RetTy) const { + // return int128 as i128 + if (const BuiltinType *BT = RetTy->getAs()) { +BuiltinType::Kind k = BT->getKind(); +

[clang] [clang][CodeGen] Add range metadata for atomic load of boolean type. #131476 (PR #133546)

2025-04-11 Thread Eli Friedman via cfe-commits
Jan =?utf-8?q?G=C3=B3rski?= , Jan =?utf-8?q?G=C3=B3rski?= , Jan =?utf-8?q?G=C3=B3rski?= , Jan =?utf-8?q?G=C3=B3rski?= , Jan =?utf-8?q?G=C3=B3rski?= , Jan =?utf-8?q?G=C3=B3rski?= , Jan =?utf-8?q?G=C3=B3rski?= , Jan =?utf-8?q?G=C3=B3rski?= Message-ID: In-Reply-To: https://github.com/efriedma-quic

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-11 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: If we're going to do this, I think we need better diagnostics. Just straight disabling this is going to give very confusing diagnostics to anyone actually using dollar-signs in identifiers. Some ideas: - We can give a warning if we see a "$" adjac

[clang] [HLSL] Desugar ConstantArrayType when calculating cbuffer field layout (PR #134683)

2025-04-07 Thread Eli Friedman via cfe-commits
@@ -195,7 +195,8 @@ bool HLSLBufferLayoutBuilder::layoutField(const FieldDecl *FD, // Unwrap array to find the element type and get combined array size. QualType Ty = FieldTy; while (Ty->isConstantArrayType()) { - const ConstantArrayType *ArrayTy = cast(Ty); +

[clang] [CLANG-CL] ignores Wpadded (PR #134426)

2025-04-14 Thread Eli Friedman via cfe-commits
=?utf-8?q?Théo?= De Magalhaes , =?utf-8?q?Théo?= De Magalhaes , =?utf-8?q?Théo?= De Magalhaes , =?utf-8?q?Théo?= De Magalhaes , =?utf-8?q?Théo?= De Magalhaes , =?utf-8?q?Théo?= De Magalhaes , =?utf-8?q?Théo?= De Magalhaes , =?utf-8?q?Théo?= De Magalhaes ,Theo de Magalhaes , =?utf-8?q?Théo?= De Mag

[clang] [AArch64] Change the coercion type of structs with pointer members. (PR #135064)

2025-04-14 Thread Eli Friedman via cfe-commits
@@ -485,6 +485,39 @@ ABIArgInfo AArch64ABIInfo::classifyArgumentType(QualType Ty, bool IsVariadicFn, } Size = llvm::alignTo(Size, Alignment); +// If the Aggregate is made up of pointers, use an array of pointers for the +// coerced type. This prevents having

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

2025-04-14 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic 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 Eli Friedman 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 Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM with the PreferredBaseAlign thing fixed. https://github.com/llvm/llvm-project/pull/135564 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [clang][CodeGen] Add range metadata for atomic load of boolean type. #131476 (PR #133546)

2025-04-14 Thread Eli Friedman via cfe-commits
Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= Message-ID: In-Reply-To: efriedma-quic wrote: Not sure why automation didn't catch this, but: >

[clang] [Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #135135)

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

[clang] [CLANG-CL] ignores Wpadded (PR #134426)

2025-04-14 Thread Eli Friedman via cfe-commits
=?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes ,Theo

[clang] [clang][CodeGen] Add range metadata for atomic load of boolean type. #131476 (PR #133546)

2025-04-14 Thread Eli Friedman via cfe-commits
Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= Message-ID: In-Reply-To: https://github.com/efriedma-quic closed https://github.com/llvm/llvm-pr

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

2025-04-14 Thread Eli Friedman 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] [CLANG][MS-STRUCT] bitfield padding warning presents padding to exact bit count (PR #136062)

2025-04-18 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: If I'm following correctly, this also affects non-ms_struct definitions? Can you also add test coverage for that? I'm not sure people will be happy to see "padding struct 'Foo' with 1 bit to align 'xx'", but I guess we can see how it goes. Looks like gcc's -Wpadded does

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

2025-04-18 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Is this still waiting for something from me? https://github.com/llvm/llvm-project/pull/89654 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][PowerPC] Add flag to enable compatibility with GNU for complex arguments (PR #77732)

2025-04-18 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Being incompatible with the platform compiler is the wrong default; we should be compatible by default. And the platform compiler is gcc for almost actively developed ppc32 targets, so we should just switch the default. Having a flag in addition to

[clang] [clang][PowerPC] Add flag to enable compatibility with GNU for complex arguments (PR #77732)

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

[clang] [clang][PowerPC] Add flag to enable compatibility with GNU for complex arguments (PR #77732)

2025-04-18 Thread Eli Friedman via cfe-commits
@@ -78,6 +78,13 @@ class CodeGenOptions : public CodeGenOptionsBase { SRCK_InRegs// Small structs in registers (-freg-struct-return). }; + enum ComplexArgumentConventionKind { +CMPLX_Default, +CMPLX_OnStack, efriedma-quic wrote: I don't thi

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

2025-04-28 Thread Eli Friedman via cfe-commits
@@ -6107,6 +6109,43 @@ static bool isFromSystemHeader(SourceManager &SM, const Decl *D) { SM.isInSystemMacro(D->getLocation()); } +constexpr unsigned countCPlusPlusKeywords() { + unsigned Ret = 0; +#define MODULES_KEYWORD(NAME) +#define KEYWORD(NAME, FLAGS) ++Ret; +

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

2025-04-23 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: This isn't really the right place to add this code; we should be doing it alongside all the other attributes on function definitions... That said: - I'm not sure this matches the requirements for C++ semantics; noalias is very aggressive, so we might end up with undefined

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `emitPointerArithmetic` (PR #137849)

2025-04-30 Thread Eli Friedman via cfe-commits
@@ -4238,7 +4238,8 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, else elemTy = CGF.ConvertTypeForMem(elementType); - if (CGF.getLangOpts().PointerOverflowDefined) + if (CGF.getLangOpts().PointerOverflowDefined || + CGF.isUnderlyingBasePointerConstan

[clang] [Clang][CodeGen] Add workaround for old glibc `__PTR_ALIGN` macro (PR #137851)

2025-04-30 Thread Eli Friedman via cfe-commits
@@ -4820,6 +4820,15 @@ bool CodeGenFunction::isUnderlyingBasePointerConstantNull(const Expr *E) { const Expr *UnderlyingBaseExpr = E->IgnoreParens(); while (auto *BaseMemberExpr = dyn_cast(UnderlyingBaseExpr)) UnderlyingBaseExpr = BaseMemberExpr->getBase()->IgnoreParen

[clang] [Clang][AArch64] Add pessimistic vscale_range when sve is in target-f… (PR #137624)

2025-04-30 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Those tests are already generating that warning; I assume the "new" warning is a duplicate? That seems like a bug in the x86 handling for target features: it should generate a warning at most once per function, and the warning should point to the function in question. (C

[clang] [C] Add -Wjump-bypasses-init (PR #138009)

2025-04-30 Thread Eli Friedman via cfe-commits
@@ -560,13 +560,14 @@ LABEL3:{} // #GOTOLBL3 void IndirectGoto3_Loop() { void* ptr; #pragma acc parallel loop// #GOTOPAR_LOOP3 - for (unsigned i = 0; i < 5; ++i) { + for (unsigned i = 0; i < 5; ++i) { // #INIT LABEL3:{} // #GOTOLBL3_2 ptr = &&LABEL3; } -// expected

[clang] [llvm] [mlir] [IR] Do not store Function inside BlockAddress (PR #137958)

2025-04-30 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I think at some point we were discussing changing what happens when you have a dead blockaddress, which might involve a kind of blockaddress that doesn't refer to a specific basic block. (The value of "1" has bad interactions if you compute the difference between two bloc

[libunwind] [libunwind] [SEH] Implement parsing of aarch64 pdata/xdata (PR #137949)

2025-04-30 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The parsing itself looks fine. I don't have any context for how this code is supposed to work, though. https://github.com/llvm/llvm-project/pull/137949 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang] [clang][test][NFC] Use -fdriver-only over /dev/null (PR #135255)

2025-04-10 Thread Eli Friedman via cfe-commits
@@ -1,6 +1,6 @@ -// RUN: %clang -fopenacc -S %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=ERROR -// RUN: %clang -fclangir -fopenacc -S %s -o /dev/null 2>&1 | FileCheck %s --allow-empty -check-prefix=NOERROR -// RUN: %clang -fopenacc -fclangir -S %s -o /dev/null 2>&1 | FileC

[clang] [Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #135135)

2025-04-10 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > Looking at the issue description from > https://github.com/llvm/llvm-project/pull/130990, the problem is that the > code is passing argmem: read, but then passes a "pointer" as an i32. Which is > against the rules: argmem is specifically pointer arguments. So either need

[clang] [clang][CodeGen] Add range metadata for atomic load of boolean type. #131476 (PR #133546)

2025-04-10 Thread Eli Friedman via cfe-commits
Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= Message-ID: In-Reply-To: @@ -590,6 +590,16 @@ static void EmitAtomicOp(CodeGenFunction &CGF, AtomicExpr

[clang] [clang][CodeGen] Add range metadata for atomic load of boolean type. #131476 (PR #133546)

2025-04-10 Thread Eli Friedman via cfe-commits
Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= , Jan =?utf-8?q?Górski?= Message-ID: In-Reply-To: efriedma-quic wrote: Oh, hmm, we have range metadata, but it gets killed by mem2reg. So instcombine could do the transform, but it runs too late

[clang] [Clang][CodeGen] Do not set inbounds flag in `EmitMemberDataPointerAddress` when the base pointer is null (PR #130952)

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

[clang] [Clang][CodeGen] Do not set inbounds flag in `EmitMemberDataPointerAddress` when the base pointer is null (PR #130952)

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

[clang] [Clang][CodeGen] Do not set inbounds flag in `EmitMemberDataPointerAddress` when the base pointer is null (PR #130952)

2025-04-10 Thread Eli Friedman via cfe-commits
@@ -660,8 +660,8 @@ EmitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *M) { case SubobjectAdjustment::MemberPointerAdjustment: { llvm::Value *Ptr = EmitScalarExpr(Adjustment.Ptr.RHS); - Object = EmitCXXMemberDataPointerAddress(E, Object, Ptr, -

[clang] [Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (PR #130734)

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

[clang] [Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #135135)

2025-04-10 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Looking at the issue description from #130990, the problem is that the code is passing `argmem: read`, but then passes a "pointer" as an i32. Which is against the rules: argmem is specifically pointer arguments. So either needs to just be marked "read", or you need to f

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

2025-04-14 Thread Eli Friedman 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] [clang] [CodeGen] fix crash when Ty isDependentType in CodeGenFunction::EmitAutoVarAlloca (PR #135643)

2025-04-14 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic requested changes to this pull request. Even if this fixes the crash, the resulting code likely won't work; we need to compute the type to emit correct code. The underlying issue is probably an issue with template instantiation (clang/lib/Sema). When a template

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: We should disable the warning if we're preprocessing asm, which should mostly solve the issue with warnings. For the Linux kernel, does anything break other than the warnings? https://github.com/llvm/llvm-project/pull/135407 ___

[clang] [Clang][CodeGen][X86] don't coerce int128 into `{i64,i64}` for SysV-like ABIs (PR #135230)

2025-04-16 Thread Eli Friedman via cfe-commits
@@ -2595,6 +2595,14 @@ GetX86_64ByValArgumentPair(llvm::Type *Lo, llvm::Type *Hi, ABIArgInfo X86_64ABIInfo:: classifyReturnType(QualType RetTy) const { + // return int128 as i128 + if (const BuiltinType *BT = RetTy->getAs()) { +BuiltinType::Kind k = BT->getKind(); +

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-16 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > Effectively checking for `LangOpts.DollarIdents || LangOpts.AsmPreprocessor`? > Or do you think `DollarIdents` should be true if `AsmPreprocessor` is true? Neither. DollarIdents is already off by default in AsmPreprocessor mode. We should just preserve the existing beh

[clang] [clang][NFC] Fix some clang-format mistakes (PR #138036)

2025-05-02 Thread Eli Friedman via cfe-commits
@@ -3997,7 +3996,7 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI, RV = SI->getValueOperand(); SI->eraseFromParent(); -// Otherwise, we have to do a simple load. + // Otherwise, we have to do a simple load. e

[clang] [clang] Function type attribute to prevent CFI instrumentation (PR #135836)

2025-05-02 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'm confident making this part of the FunctionType is the right approach. We don't implicitly drop the bits from the FunctionType bitfields, for bits that are part of the canonical type. Any cast is explicitly represented in the AST, and we have warnings for mismatches (s

[clang] [C] Add -Wjump-bypasses-init (PR #138009)

2025-05-01 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. Please add a test for the new indirect goto diagnostic. Otherwise LGTM https://github.com/llvm/llvm-project/pull/138009 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] [Clang][AArch64] Add pessimistic vscale_range when sve is in target-f… (PR #137624)

2025-05-01 Thread Eli Friedman via cfe-commits
@@ -794,12 +794,14 @@ AArch64TargetInfo::getTargetBuiltins() const { std::optional> AArch64TargetInfo::getVScaleRange(const LangOptions &LangOpts, - bool IsArmStreamingFunction) const { + bool IsArmStreamingFunc

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `emitPointerArithmetic` (PR #137849)

2025-05-01 Thread Eli Friedman via cfe-commits
@@ -4238,7 +4238,8 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, else elemTy = CGF.ConvertTypeForMem(elementType); - if (CGF.getLangOpts().PointerOverflowDefined) + if (CGF.getLangOpts().PointerOverflowDefined || + CGF.isUnderlyingBasePointerConstan

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `isNullPointerArithmeticExtension` (PR #137849)

2025-05-05 Thread Eli Friedman via cfe-commits
@@ -4169,11 +4169,16 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, // The index is not pointer-sized. // The pointer type is not byte-sized. // - if (BinaryOperator::isNullPointerArithmeticExtension(CGF.getContext(), -

[clang] [Clang][CodeGen] Add workaround for old glibc `__PTR_ALIGN` macro (PR #137851)

2025-05-06 Thread Eli Friedman via cfe-commits
@@ -2247,6 +2247,15 @@ bool BinaryOperator::isNullPointerArithmeticExtension(ASTContext &Ctx, return false; } + // Workaround for old glibc's __PTR_ALIGN macro + if (auto *Select = dyn_cast(PExp->IgnoreParenCasts())) { efriedma-quic wrote: IgnorePare

[clang] [clang][NFC] Fix some more incorrectly formatted comments (PR #138342)

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

[clang] [clang][NFC] Fix some more incorrectly formatted comments (PR #138342)

2025-05-06 Thread Eli Friedman via cfe-commits
@@ -4911,8 +4911,8 @@ std::optional Type::getNullability() const { bool Type::canHaveNullability(bool ResultIfUnknown) const { QualType type = getCanonicalTypeInternal(); + // We'll only see canonical types here. efriedma-quic wrote: Actually, maybe move

[clang] [llvm] [HLSL] Run finalize linkage pass for all targets (PR #134260)

2025-04-23 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The idea that a symbol should be externally visible before linking, and not externally visible afterwards, isn't new: many platforms have some form of symbol visibility. I'm not sure why you don't want to express that in LLVM IR... having an implicit HLSL-specific rule li

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

2025-04-23 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: We don't really specify what, exactly, the consequences are for violating noalias in LangRef. But... we do say elsewhere "If memory accesses alias even though they are noalias according to !tbaa metadata, the behavior is undefined." Probably the same has to apply to noal

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

2025-04-23 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: That said, in terms of whether we actually care about what the committee says... both the C and C++ committees have a terrible track record on the fine details of stuff related to memory. I'd be okay with being slightly more aggressive than the standard technically allows

[clang] [clang][CompundLiteralExpr] Don't defer evaluation for CLEs (PR #137163)

2025-04-24 Thread Eli Friedman via cfe-commits
@@ -9125,9 +9126,25 @@ bool LValueExprEvaluator::VisitCompoundLiteralExpr(const CompoundLiteralExpr *E) { assert((!Info.getLangOpts().CPlusPlus || E->isFileScope()) && "lvalue compound literal in c++?"); - // Defer visiting the literal until the lvalue-to-rvalue con

[clang] [clang][CompundLiteralExpr] Don't defer evaluation for CLEs (PR #137163)

2025-04-24 Thread Eli Friedman via cfe-commits
@@ -4622,7 +4618,12 @@ handleLValueToRValueConversion(EvalInfo &Info, const Expr *Conv, QualType Type, } } - CompleteObject LitObj(LVal.Base, &Lit, Base->getType()); + APValue *Lit = + CLE->hasStaticStorage() + ? &CLE->getStaticVa

[clang] Mark CXX module initializer with PACBTI attributes (PR #133716)

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

[clang] [clang][CompundLiteralExpr] Don't defer evaluation for CLEs (PR #137163)

2025-04-25 Thread Eli Friedman via cfe-commits
@@ -4522,6 +4523,38 @@ static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E, BaseVal = MTE->getOrCreateValue(false); assert(BaseVal && "got reference to unevaluated temporary"); + } else if (const CompoundLiteralExpr *CLE = +

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

2025-04-25 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Can you update the documentation for CK_NullToPointer so it notes the result can be a null pointer constant? (I guess it's the right cast kind, but it's not intuitive, so we should call it out.) https://github.com/llvm/llvm-project/pull/137364 _

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

2025-04-25 Thread Eli Friedman 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 efriedma-quic wrote: (Copy-pasting comment since I accidentally put i

[clang] [clang][CompundLiteralExpr] Don't defer evaluation for CLEs (PR #137163)

2025-04-25 Thread Eli Friedman via cfe-commits
@@ -9125,9 +9126,25 @@ bool LValueExprEvaluator::VisitCompoundLiteralExpr(const CompoundLiteralExpr *E) { assert((!Info.getLangOpts().CPlusPlus || E->isFileScope()) && "lvalue compound literal in c++?"); - // Defer visiting the literal until the lvalue-to-rvalue con

[clang] [clang][CompundLiteralExpr] Don't defer evaluation for CLEs (PR #137163)

2025-04-25 Thread Eli Friedman via cfe-commits
@@ -4522,6 +4523,38 @@ static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E, BaseVal = MTE->getOrCreateValue(false); assert(BaseVal && "got reference to unevaluated temporary"); + } else if (const CompoundLiteralExpr *CLE = +

[clang] [Clang][CodeGen] Add metadata for load from reference (PR #98746)

2025-04-25 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Do we have a ubsan check for this? https://github.com/llvm/llvm-project/pull/98746 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [TargetVerifier][AMDGPU] Add TargetVerifier. (PR #123609)

2025-04-22 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > This would be run during the backend after we've already selected the target, > so it can be target-dependent. All IR is "target-dependent" in the sense that it depends on the datalayout. But it's target-independent in the sense that the validity rules don't depend on

[clang] [llvm] [NVPTX] Cleanup and document nvvm.fabs intrinsics, adding f16 support (PR #135644)

2025-04-15 Thread Eli Friedman via cfe-commits
@@ -309,6 +309,60 @@ space casted to this space), 1 is returned, otherwise 0 is returned. Arithmetic Intrinsics - +'``llvm.nvvm.fabs.*``' Intrinsic + + +Syntax: +""" + +.. code-block:: llvm + +declare float @llvm.nvv

[clang] Disable -fdollars-in-identifiers by default (PR #135407)

2025-04-15 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: If you don't want to do anything fancy, can you just add a warning in Lexer::LexTokenInternal if we see a '$' (where we set the token type to tok::unknown)? That should be easy to implement, and have zero impact on lexer performance. https://github.com/llvm/llvm-project/

[clang] Clarify documentation for -funique-source-file-names. (PR #135832)

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

[clang] [clang] Function type attribute to prevent CFI instrumentation (PR #135836)

2025-04-15 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I also think this needs to be a real type. (Probably you can just add a bit to FunctionTypeExtraBitfields.) https://github.com/llvm/llvm-project/pull/135836 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[clang] [CodeGen] Fix new-delete-type-mismatch in ~CodeGenTypes() (PR #135787)

2025-04-15 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Do you need to invoke the destructor? https://github.com/llvm/llvm-project/pull/135787 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CLANG-CL] ignores Wpadded (PR #134426)

2025-04-15 Thread Eli Friedman via cfe-commits
=?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes , =?utf-8?q?Th=C3=A9o?= De Magalhaes ,Theo

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

2025-04-15 Thread Eli Friedman 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] [CodeGen] Fix new-delete-type-mismatch in ~CodeGenTypes() (PR #135787)

2025-04-15 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Please also make the unused "operator delete" in CGFunctionInfo.h deleted, since it shouldn't have any callers. I think this never actually led to a real issue because of that operator delete... it calls the right deallocation function even if it's technically undefined.

[clang] [llvm] Introduce -funique-source-file-names flag. (PR #135728)

2025-04-15 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Is the "name" in this context the whole path? Or just the filename? I know many projects have files with the same name in different folders (including LLVM itsef). https://github.com/llvm/llvm-project/pull/135728 ___

[clang] [CodeGen] Change placeholder from `undef` to `poison` (PR #134731)

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

[clang] [Clang][CodeGen][OpenCL] Add `-fno-delete-null-pointer-checks` to avoid UB. NFC. (PR #135602)

2025-04-14 Thread Eli Friedman via cfe-commits
@@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple "spir-unknown-unknown" -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple "spir-unknown-unknown" -fno-delete-null-pointer-checks -emit-llvm -o - | FileCheck %s efriedma-quic wrote: I don't see any optimi

[clang] [AArch64] Change the coercion type of structs with pointer members. (PR #135064)

2025-04-14 Thread Eli Friedman via cfe-commits
@@ -485,6 +485,39 @@ ABIArgInfo AArch64ABIInfo::classifyArgumentType(QualType Ty, bool IsVariadicFn, } Size = llvm::alignTo(Size, Alignment); +// If the Aggregate is made up of pointers, use an array of pointers for the +// coerced type. This prevents having

[clang] [Clang][DirectX] Always use Diagnostic Printer (PR #135655)

2025-04-14 Thread Eli Friedman via cfe-commits
@@ -2,7 +2,6 @@ // RUN: not %clang_cc1 %s -o - -S -triple=amdgcn-amd-amdhsa 2>&1 | FileCheck %s void test_amdgcn_fence_failure() { - - // CHECK: error: Unsupported atomic synchronization scope + // CHECK: error: :0:0: in function _Z25test_amdgcn_fence_failurev void (): Unsu

[clang] [Clang][CodeGen][OpenCL] Add `-fno-delete-null-pointer-checks` to avoid UB. NFC. (PR #135602)

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

[clang] [clang] [CodeGen] fix crash when Ty isDependentType in CodeGenFunction::EmitAutoVarAlloca (PR #135643)

2025-04-14 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'm not really sure how to go about reducing a testcase in that case; it's not something I've ever run into myself. Please post on Discourse (https://discourse.llvm.org/); maybe someone else has some ideas. https://github.com/llvm/llvm-project/pull/135643

[clang] [clang] [CodeGen] fix crash when Ty isDependentType in CodeGenFunction::EmitAutoVarAlloca (PR #135643)

2025-04-14 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Also, if you're okay with publicly posting your code, it's fine to file a bug with an unreduced testcase. https://github.com/llvm/llvm-project/pull/135643 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang] [Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #135135)

2025-04-14 Thread Eli Friedman via cfe-commits
@@ -3615,6 +3618,23 @@ static void emitCheckHandlerCall(CodeGenFunction &CGF, .addAttribute(llvm::Attribute::NoUnwind); } B.addUWTableAttr(llvm::UWTableKind::Default); + // Add more precise attributes to recoverable ubsan handlers for better + // optimizations. +

[clang] [Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #135135)

2025-04-15 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: LGTM with one minor comment. https://github.com/llvm/llvm-project/pull/135135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [SystemZ][z/OS] Add visibility features for z/OS (eg. _Export, pragma export) (PR #111035)

2025-04-15 Thread Eli Friedman via cfe-commits
@@ -5087,6 +5087,19 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, assert(EllipsisLoc.isInvalid() && "Friend ellipsis but not friend-specified?"); + if (DS.isExportSpecified()) { +VisibilityAttr *existingAttr = TagD->getAttr(); +if

[clang] [llvm] Clang: Add nsz to llvm.minnum and llvm.maxnum emitted from fmin and fmax (PR #113133)

2025-04-27 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Please propose a fix for the definition of nsz itself itself in LangRef; burying an exception to the general nsz rules in the middle of the definition of min/max is, at best, confusing. https://github.com/llvm/llvm-project/pull/113133 __

[clang] [clang][CompundLiteralExpr] Don't defer evaluation for CLEs (PR #137163)

2025-04-28 Thread Eli Friedman via cfe-commits
@@ -4522,6 +4523,38 @@ static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E, BaseVal = MTE->getOrCreateValue(false); assert(BaseVal && "got reference to unevaluated temporary"); + } else if (const CompoundLiteralExpr *CLE = +

[clang] [clang][CompundLiteralExpr] Don't defer evaluation for CLEs (PR #137163)

2025-04-28 Thread Eli Friedman via cfe-commits
@@ -9125,9 +9126,25 @@ bool LValueExprEvaluator::VisitCompoundLiteralExpr(const CompoundLiteralExpr *E) { assert((!Info.getLangOpts().CPlusPlus || E->isFileScope()) && "lvalue compound literal in c++?"); - // Defer visiting the literal until the lvalue-to-rvalue con

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

2025-04-28 Thread Eli Friedman via cfe-commits
@@ -6107,6 +6109,43 @@ static bool isFromSystemHeader(SourceManager &SM, const Decl *D) { SM.isInSystemMacro(D->getLocation()); } +constexpr unsigned countCPlusPlusKeywords() { + unsigned Ret = 0; +#define MODULES_KEYWORD(NAME) +#define KEYWORD(NAME, FLAGS) ++Ret; +

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

2025-04-28 Thread Eli Friedman 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 efriedma-quic wrote: Maybe we can simplify it to just: ``` /// CK_Nu

<    12   13   14   15   16   17   18   19   20   21   >