[clang] [HLSL] Change default linkage of HLSL functions and `groupshared` variables (PR #93336)

2024-06-09 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'm not sure messing with the linkage this way will interact well with various C++ features. In particular, there are various places that check the "language linkage", which you're not modifying: from the perspective of anything outside of codegen, these functions are ju

[clang] [llvm] [RISCV] Add riscv_atomic.h and Zawrs/Zalrsc builtins (PR #94578)

2024-06-09 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: lr/sc builtins are extremely fragile: there's no reasonable way for the compiler to guarantee that the sc is placed in such a way that it will eventually succeed. (The equivalent intrinsics do exist on ARM, but ARM has significantly stronger guarantees here. Even then, i

[clang] Fix codegen of consteval functions returning an empty class, and related issues (PR #93115)

2024-06-09 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/93115 >From 816ceb271c28ff6c4dc05485000deec087674e37 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 23 May 2024 18:38:04 -0700 Subject: [PATCH] Fix codegen of consteval functions returning an empty class,

[clang] [Clang][OpenMP] throw compilation error instead of crash in Stmt::OMPScopeDirectiveClass case (#77535) (PR #84135)

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

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

2024-06-10 Thread Eli Friedman via cfe-commits
@@ -214,7 +232,8 @@ declare double @za_shared_callee(double) "aarch64_inout_za" define double @za_new_caller_to_za_shared_callee(double %x) nounwind noinline optnone "aarch64_new_za"{ ; CHECK-COMMON-LABEL: za_new_caller_to_za_shared_callee: ; CHECK-COMMON: // %bb.0: //

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

2024-06-10 Thread Eli Friedman via cfe-commits
@@ -196,12 +196,14 @@ bool AArch64FunctionInfo::needsAsyncDwarfUnwindInfo( const MachineFunction &MF) const { if (!NeedsAsyncDwarfUnwindInfo) { const Function &F = MF.getFunction(); +const AArch64FunctionInfo *AFI = MF.getInfo(); // The check got "minsize" i

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

2024-06-10 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > I feel like this is a property that needs to propagate through types You mean, similar to the way trivial_abi works? That makes sense. https://github.com/llvm/llvm-project/pull/95004 ___ cfe-commits mailing list cfe-commits@lis

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

2024-06-10 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Also, we probably want to specify the interaction between trivial_abi and value_type here... should trivial_abi imply value_type? https://github.com/llvm/llvm-project/pull/95004 ___ cfe-commits mailing list cfe-commits@lists.llvm.

[clang] [llvm] [clang] Reland Add tanf16 builtin and support for tan constrained intrinsic (PR #94559)

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

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

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

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

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

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

2024-06-11 Thread Eli Friedman via cfe-commits
@@ -325,14 +325,19 @@ Address SparcV9ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, break; case ABIArgInfo::Ignore: -return Address(llvm::UndefValue::get(ArgPtrTy), ArgTy, TypeInfo.Align); +return CGF.EmitLoadOfAnyValue( +CGF.MakeAddrLValue

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

2024-06-11 Thread Eli Friedman via cfe-commits
@@ -789,27 +791,37 @@ Address AArch64ABIInfo::EmitAAPCSVAArg(Address VAListAddr, QualType Ty, OnStackBlock, "vaargs.addr"); if (IsIndirect) -return Address(CGF.Builder.CreateLoad(ResAddr, "vaarg.addr"), ElementTy, - TyA

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

2024-06-11 Thread Eli Friedman via cfe-commits
@@ -102,12 +98,7 @@ char *test_ptr(char *fmt, ...) { // N32: [[TMP2:%.+]] = load i64, ptr [[AP_CUR]], align 8 // N32: [[TMP3:%.+]] = trunc i64 [[TMP2]] to i32 // N32: [[PTR:%.+]] = inttoptr i32 [[TMP3]] to ptr -// N32: store ptr [[PTR]], ptr [[AP_CAST]], align 4 -// N32

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

2024-06-11 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: This generally seems fine. https://github.com/llvm/llvm-project/pull/94635 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

2024-06-11 Thread Eli Friedman via cfe-commits
@@ -4777,6 +4783,13 @@ class CodeGenFunction : public CodeGenTypeCache { /// aggregate type into a temporary LValue. LValue EmitAggExprToLValue(const Expr *E); + enum ExprValueKind { EVK_RValue, EVK_NonRValue }; + + /// EmitAggFinalDestCopy - Emit copy of the specified a

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

2024-06-11 Thread Eli Friedman via cfe-commits
@@ -789,27 +791,37 @@ Address AArch64ABIInfo::EmitAAPCSVAArg(Address VAListAddr, QualType Ty, OnStackBlock, "vaargs.addr"); if (IsIndirect) -return Address(CGF.Builder.CreateLoad(ResAddr, "vaarg.addr"), ElementTy, - TyA

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

2024-06-11 Thread Eli Friedman via cfe-commits
@@ -1227,7 +1241,8 @@ void CodeGenModule::EmitDeferredVTables() { #endif for (const CXXRecordDecl *RD : DeferredVTables) -if (shouldEmitVTableAtEndOfTranslationUnit(*this, RD)) +if (shouldEmitVTableAtEndOfTranslationUnit(*this, RD) && +!RD->shouldEmitInExtern

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

2024-06-11 Thread Eli Friedman via cfe-commits
@@ -6853,6 +6853,13 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { if (ES->hasExternalDefinitions(D) == ExternalASTSource::EK_Never) DI->completeUnusedClass(*CRD); } +// If we're emitting a dynamic class from the importable module we're +// emi

[clang] [llvm] [RISCV] Add riscv_atomic.h and Zawrs/Zalrsc builtins (PR #94578)

2024-06-11 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > I don't know much about there intrinsics on ARM, what are the stronger > guarantees? The Arm specifies that there's a memory reservation, and you can write whatever operations you want as long as you don't break that reservation. And the reservation is usually only a f

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

2024-06-12 Thread Eli Friedman via cfe-commits
@@ -789,27 +791,37 @@ Address AArch64ABIInfo::EmitAAPCSVAArg(Address VAListAddr, QualType Ty, OnStackBlock, "vaargs.addr"); if (IsIndirect) -return Address(CGF.Builder.CreateLoad(ResAddr, "vaarg.addr"), ElementTy, - TyA

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

2024-06-12 Thread Eli Friedman via cfe-commits
@@ -789,27 +791,37 @@ Address AArch64ABIInfo::EmitAAPCSVAArg(Address VAListAddr, QualType Ty, OnStackBlock, "vaargs.addr"); if (IsIndirect) -return Address(CGF.Builder.CreateLoad(ResAddr, "vaarg.addr"), ElementTy, - TyA

[clang] added regcall struct by reg support (PR #95257)

2024-06-12 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Do you have a reference for the rules you're implementing? https://github.com/llvm/llvm-project/pull/95257 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-06-12 Thread Eli Friedman via cfe-commits
@@ -6853,6 +6853,13 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { if (ES->hasExternalDefinitions(D) == ExternalASTSource::EK_Never) DI->completeUnusedClass(*CRD); } +// If we're emitting a dynamic class from the importable module we're +// emi

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

2024-06-12 Thread Eli Friedman via cfe-commits
@@ -318,6 +318,9 @@ namespace { if (Diags.hasUnrecoverableErrorOccurred()) return; + if (RD->shouldEmitInExternalSource()) efriedma-quic wrote: Maybe this check should be part of DefineUsedVTables()? https://github.com/llvm/llvm-project/pu

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

2024-06-12 Thread Eli Friedman via cfe-commits
@@ -318,6 +318,9 @@ namespace { if (Diags.hasUnrecoverableErrorOccurred()) return; + if (RD->shouldEmitInExternalSource()) efriedma-quic wrote: Did you mean to change something in ModuleBuilder.cpp? https://github.com/llvm/llvm-project/pul

[clang] [llvm] [clang] Reland Add tanf16 builtin and support for tan constrained intrinsic (PR #94559)

2024-06-12 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Can we change the target-independent bits of the tan() implementation in the backend so it doesn't require each target to explicitly request that tan() needs to be expanded? It should be possible to adjust the code in TargetLoweringBase.cpp a bit so FTAN defaults to being

[clang] added regcall struct by reg support (PR #95257)

2024-06-13 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: What you're implementing in this change doesn't seem like it brings us much closer to what the document says. I mean, it handles the specific structs in your testcase, but the algorithm you're using doesn't generalize. https://github.com/llvm/llvm-project/pull/95257 __

[clang] [clang][CodeGen] Fix EmitInvariantStart for non-zero addrspace (PR #94346)

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

[clang] [llvm] [clang] Reland Add tanf16 builtin and support for tan constrained intrinsic (PR #94559)

2024-06-13 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Yes, I think it's just a historical mistake; sin/cos/log/exp were added a very long time ago, and we weren't as careful about that sort of thing. And nobody has taken the time to try to cleanup the current defaults. https://github.com/llvm/llvm-project/pull/94559

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

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

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

2024-06-13 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. A couple minor comments; otherwise LGTM https://github.com/llvm/llvm-project/pull/94635 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

2024-06-13 Thread Eli Friedman via cfe-commits
@@ -834,5 +834,4 @@ typedef struct {} empty; empty empty_record_test(void) { // CHECK-LABEL: define{{.*}} void @empty_record_test() return va_arg(the_list, empty); -// CHECK: [[GR_OFFS:%[a-z_0-9]+]] = load ptr, ptr @the_list efriedma-quic wrote: Maybe should

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

2024-06-13 Thread Eli Friedman via cfe-commits
@@ -325,14 +325,19 @@ Address SparcV9ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, break; case ABIArgInfo::Ignore: -return Address(llvm::UndefValue::get(ArgPtrTy), ArgTy, TypeInfo.Align); +return CGF.EmitLoadOfAnyValue( +CGF.MakeAddrLValue

[clang] added regcall struct by reg support (PR #95257)

2024-06-13 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Right, the specification requires splitting the whole structure into chunks; if we add a special-case for 8-byte structs, we'll just have to throw it away when we implement the right algorithm. Also, I'm not sure what the isBuiltinType() check is supposed to handle. It s

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

2024-06-13 Thread Eli Friedman via cfe-commits
@@ -318,6 +318,9 @@ namespace { if (Diags.hasUnrecoverableErrorOccurred()) return; + if (RD->shouldEmitInExternalSource()) efriedma-quic wrote: The way I see it, Sema should have the exact right answer for whether the vtable is required.

[clang] [clang-cl] Map /Ot to -O3 instead of -O2 (PR #95406)

2024-06-14 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: If we're trying to match MSVC, the amount of inlining MSVC does at /O2 is probably closer to what clang does at -O2 than -O3. Which is why it was mapped that way in 015ce0f68f791b3abec4225c1b2e532ce5020174, I think. clang's -O3 is really aggressive (which tends to look g

[clang] [libcxx] [clang] Add builtin to clear padding bytes (prework for P0528R3) (PR #75371)

2024-06-14 Thread Eli Friedman via cfe-commits
@@ -2456,6 +2461,139 @@ static RValue EmitHipStdParUnsupportedBuiltin(CodeGenFunction *CGF, return RValue::get(CGF->Builder.CreateCall(UBF, Args)); } +template +void RecursivelyClearPaddingImpl(CodeGenFunction &CGF, Value *Ptr, QualType Ty, size_t CurrentStartOffset, size

[clang] [libcxx] [clang] Add builtin to clear padding bytes (prework for P0528R3) (PR #75371)

2024-06-14 Thread Eli Friedman via cfe-commits
@@ -2538,6 +2539,205 @@ static RValue EmitHipStdParUnsupportedBuiltin(CodeGenFunction *CGF, return RValue::get(CGF->Builder.CreateCall(UBF, Args)); } +template +void RecursivelyClearPaddingImpl(CodeGenFunction &CGF, Value *Ptr, QualType Ty, +

[clang] [libcxx] [clang] Add builtin to clear padding bytes (prework for P0528R3) (PR #75371)

2024-06-14 Thread Eli Friedman via cfe-commits
@@ -2456,6 +2461,139 @@ static RValue EmitHipStdParUnsupportedBuiltin(CodeGenFunction *CGF, return RValue::get(CGF->Builder.CreateCall(UBF, Args)); } +template +void RecursivelyClearPaddingImpl(CodeGenFunction &CGF, Value *Ptr, QualType Ty, size_t CurrentStartOffset, size

[clang] [libcxx] [clang] Add builtin to clear padding bytes (prework for P0528R3) (PR #75371)

2024-06-14 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,807 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

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

2024-06-14 Thread Eli Friedman via cfe-commits
@@ -318,6 +318,9 @@ namespace { if (Diags.hasUnrecoverableErrorOccurred()) return; + if (RD->shouldEmitInExternalSource()) efriedma-quic wrote: Most of the CodeGen code surrounding vtable emission is optimizations. Specifically, to avoid

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

2024-06-14 Thread Eli Friedman via cfe-commits
@@ -6853,6 +6853,7 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { if (ES->hasExternalDefinitions(D) == ExternalASTSource::EK_Never) DI->completeUnusedClass(*CRD); } + efriedma-quic wrote: Unnecessary whitespace change https://github.

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

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

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

2024-06-14 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM with one minor comment https://github.com/llvm/llvm-project/pull/75912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-cl] Map /Ot to -O3 instead of -O2 (PR #95406)

2024-06-14 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: For reference, current MSVC has a flag /Ob3 to request more aggressive inlining. https://github.com/llvm/llvm-project/pull/95406 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [llvm] [Clang][Coroutines] Improve CoroElide with [[clang::coro_structured_concurrency]] attribute for C++ (PR #94693)

2024-06-14 Thread Eli Friedman via cfe-commits
@@ -8015,6 +8015,26 @@ but do not pass them to the underlying coroutine or pass them by value. }]; } +def CoroStructuredConcurrencyDoc : Documentation { + let Category = DocCatDecl; + let Content = [{ +The ``[[clang::coro_structured_concurrency]]`` is a class attribute whic

[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)

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

[clang] [llvm] [Clang][Coroutines] Improve CoroElide with [[clang::coro_structured_concurrency]] attribute for C++ (PR #94693)

2024-06-14 Thread Eli Friedman via cfe-commits
@@ -8015,6 +8015,26 @@ but do not pass them to the underlying coroutine or pass them by value. }]; } +def CoroStructuredConcurrencyDoc : Documentation { + let Category = DocCatDecl; + let Content = [{ +The ``[[clang::coro_structured_concurrency]]`` is a class attribute whic

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-06-17 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Oh, in this particular case, the issue isn't the computed datasize, it's that FieldDecl::isZeroSize() returns the wrong result. If that's the case, maybe we can just change FieldDecl::isZeroSize() to say the field is zero size? So essentially, we pretend all empty field

[clang] [clang-tools-extra] Reland [clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (PR #95802)

2024-06-17 Thread Eli Friedman via cfe-commits
@@ -2422,6 +2422,10 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred, Bldr.addNodes(Dst); break; } + +case Stmt::EmbedExprClass: + llvm_unreachable("Support for EmbedExpr is not implemented."); efriedma-quic wrote: Please do

[clang] [clang-tools-extra] Reland [clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (PR #95802)

2024-06-17 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,98 @@ +// RUN: %clang_cc1 %s -fsyntax-only --embed-dir=%S/Inputs -verify=expected,cxx -Wno-c23-extensions +// RUN: %clang_cc1 -x c -std=c23 %s -fsyntax-only --embed-dir=%S/Inputs -verify=expected,c +#embed +; + +void f (unsigned char x) { (void)x;} +void g () {} +voi

[clang] [clang-tools-extra] Reland [clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (PR #95802)

2024-06-17 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Please don't commit binary files if it isn't absolutely necessary. You can generate whatever files you need in a RUN line. https://github.com/llvm/llvm-project/pull/95802 ___ cfe-commits mailing

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-06-17 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: That would mean if someone wrote `struct Empty {}; struct Z { Empty a,b,c; }`, we'd lower it to `{ [3 x i8] }` instead of `{%Empty, %Empty, %Empty}`, which is a bit ugly. Other than that, sure, I guess we could do that. https://github.com/llvm/llvm-project/pull/93809

[clang] [clang-cl][AST] Fix auto NTTP MSVC 1920+ mangling for pointer types (PR #92477)

2024-06-18 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM Your commit message mentions variables, function pointers, and member function pointers... is there anything else we need to handle? Null pointers? Integers? https://github.com/llvm/llvm-project/pull/92477 __

[clang] added regcall struct by reg support (PR #95257)

2024-06-18 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I don't have any context beyond what's written on https://reviews.llvm.org/D25204 . And at this point, I'm not sure what compiler we're trying to be compatible with. (I added @erichkeane in case he remembers.) https://github.com/llvm/llvm-project/pull/95257 _

[clang] [llvm] security check cookie execute only when needed (PR #95904)

2024-06-18 Thread Eli Friedman via cfe-commits
@@ -5,9 +5,20 @@ declare void @h(ptr, i64, ptr) efriedma-quic wrote: Can we use update_llc_test_checks.py for this test? https://github.com/llvm/llvm-project/pull/95904 ___ cfe-commits mailing list cfe-commits@lists.

[clang] [llvm] security check cookie execute only when needed (PR #95904)

2024-06-18 Thread Eli Friedman via cfe-commits
@@ -97,9 +102,13 @@ define void @test_vla(i32 %n) nounwind ssp { ; MSVC-X64: callq escape ; MSVC-X64: movq [[SLOT]](%rbp), %rcx ; MSVC-X64: xorq %rbp, %rcx -; MSVC-X64: callq __security_check_cookie +; MSVC-X64:movq__security_cookie(%rip), %rax efriedma

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-06-18 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > > couldn't the inverse be true, then - that codegen should ignore if > > something isZeroSize or not? > > Just to clarify, is the suggestion here to remove the special handling of > `isZeroSize` in the RecordLayoutBuilder? We currently need to distinguish between empty

[clang] [libc] [llvm] [NVPTX] Implement variadic functions using IR lowering (PR #96015)

2024-06-18 Thread Eli Friedman via cfe-commits
@@ -203,8 +203,15 @@ ABIArgInfo NVPTXABIInfo::classifyArgumentType(QualType Ty) const { void NVPTXABIInfo::computeInfo(CGFunctionInfo &FI) const { if (!getCXXABI().classifyReturnType(FI)) FI.getReturnInfo() = classifyReturnType(FI.getReturnType()); - for (auto &I : FI.a

[clang] [llvm] [polly] [LLVM] Add InsertPosition union-type to remove overloads of Instruction-creation (PR #94226)

2024-06-19 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I think some of the overloads for constructing an instruction aren't quite right: in some cases, we require a non-null insertion-point so we can retrieve the DataLayout from the insertion-point. (Particularly instructions that have an explicitly specified alignment.) In

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-06-19 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: It's not that hard to compute "no-data": non-RecordDecls are never no-data, RecordDecls are no-data if they don't have a vtable pointer (isDynamicClass()), and all fields are no-data. We can save it in the CGRecordLayout. Assuming that's the route we want to go, of course

[clang] [TBAA] Emit int TBAA metadata on FP math libcalls (PR #96025)

2024-06-19 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: Ideally we could identify errno more precisely somehow, but I guess this is better than nothing. Can we restrict this to targets where libm actually modifies errno? How does this interact with StrictFP? https://github.com/llvm/llvm-project/pull/9602

[clang] [TBAA] Emit int TBAA metadata on FP math libcalls (PR #96025)

2024-06-19 Thread Eli Friedman via cfe-commits
@@ -707,7 +707,38 @@ static RValue emitLibraryCall(CodeGenFunction &CGF, const FunctionDecl *FD, const CallExpr *E, llvm::Constant *calleeValue) { CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, E); CGCallee callee = CGCallee::forDirect(calle

[clang] [TBAA] Emit int TBAA metadata on FP math libcalls (PR #96025)

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

[clang] [llvm] [polly] [LLVM] Add InsertPosition union-type to remove overloads of Instruction-creation (PR #94226)

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

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

2024-05-28 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/90303 >From 4a3612bcf0e6dd3a68e2b648bb662b4faf154b26 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Fri, 26 Apr 2024 16:58:57 -0700 Subject: [PATCH] [clang codegen] Delete unnecessary GEP cleanup code. There'

[clang] [Clang][AArch64][ARM]: Fix Inefficient loads/stores of _BitInt(N) (PR #93495)

2024-05-28 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: How does this interact with #91364? https://github.com/llvm/llvm-project/pull/93495 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] [Modules] Don't mark variables from other modules as constant if its initializer is not constant (PR #93530)

2024-05-28 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: I think if a variable is GVA_AvailableExternally, and we can't emit a constant, we should just completely skip emitting the definition: there isn't any point to emitting an available_externally definition that doesn't actually contain any information

[clang] [C++20] [Modules] Don't generate the defintition for non-const available external variables (PR #93530)

2024-05-28 Thread Eli Friedman via cfe-commits
@@ -5341,6 +5341,15 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D, !IsDefinitionAvailableExternally && D->needsDestruction(getContext()) == QualType::DK_cxx_destructor; + // It is helpless to emit the definition for an available_externally varia

[clang] [llvm] [clang] Add tanf16 builtin and support for tan constrained intrinsic (PR #93314)

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

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

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

[clang] [C++20] [Modules] Don't generate the defintition for non-const available external variables (PR #93530)

2024-05-28 Thread Eli Friedman via cfe-commits
@@ -5341,6 +5341,15 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D, !IsDefinitionAvailableExternally && D->needsDestruction(getContext()) == QualType::DK_cxx_destructor; + // It is helpless to emit the definition for an available_externally varia

[clang] [C++20] [Modules] Don't generate the defintition for non-const available external variables (PR #93530)

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

[clang] [llvm] [AArch64] Add support for Qualcomm Oryon processor (PR #91022)

2024-05-29 Thread Eli Friedman via cfe-commits
@@ -0,0 +1,1659 @@ +//=- AArch64SchedOryon.td - Qualcomm Oryon CPU 001 ---*- tablegen -*-=// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0

[clang] [llvm] [PowerPC] Diagnose musttail instead of crash inside backend (PR #93267)

2024-05-29 Thread Eli Friedman via cfe-commits
@@ -743,6 +743,20 @@ bool Sema::checkMustTailAttr(const Stmt *St, const Attr &MTA) { CallerType.Func = CallerDecl->getType()->getAs(); } + if (Context.getTargetInfo().getTriple().isPPC()) { +if (Context.getTargetInfo().getTriple().isOSAIX()) + return Diag(St->

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

2024-05-29 Thread Eli Friedman via cfe-commits
@@ -2567,16 +2567,16 @@ int main() { // CHECK3-NEXT:[[I:%.*]] = alloca i32, align 4 // CHECK3-NEXT:[[DOTCAPTURE_EXPR__CASTED:%.*]] = alloca i64, align 8 // CHECK3-NEXT:[[DOTBOUND_ZERO_ADDR:%.*]] = alloca i32, align 4 -// CHECK3-NEXT:[[DOTCAPTURE_EXPR__CASTED12:%

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

2024-05-29 Thread Eli Friedman via cfe-commits
@@ -1533,9 +1533,17 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) { Builder.CreateStore(Result.getScalarVal(), ReturnValue); } else { switch (getEvaluationKind(RV->getType())) { -case TEK_Scalar: - Builder.CreateStore(EmitScalarExpr(RV), Retur

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

2024-05-29 Thread Eli Friedman via cfe-commits
@@ -5348,18 +5348,8 @@ Value *ScalarExprEmitter::VisitVAArgExpr(VAArgExpr *VE) { return llvm::UndefValue::get(ArgTy); } - // FIXME Volatility. - llvm::Value *Val = Builder.CreateLoad(ArgPtr); - - // If EmitVAArg promoted the type, we must truncate it. - if (ArgTy !=

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

2024-05-29 Thread Eli Friedman via cfe-commits
@@ -128,6 +128,15 @@ class CodeGenTypes { /// memory representation is usually i8 or i32, depending on the target. llvm::Type *ConvertTypeForMem(QualType T, bool ForBitField = false); + /// Check that size and abi alignment of given LLVM type matches size and + /// align

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

2024-05-29 Thread Eli Friedman via cfe-commits
@@ -436,9 +436,9 @@ class ScalarExprEmitter if (Value *Result = ConstantEmitter(CGF).tryEmitConstantExpr(E)) { if (E->isGLValue()) -return CGF.Builder.CreateLoad(Address( -Result, CGF.ConvertTypeForMem(E->getType()), -CGF.getContext().

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

2024-05-29 Thread Eli Friedman via cfe-commits
@@ -761,6 +761,10 @@ bool ConstStructBuilder::Build(const InitListExpr *ILE, bool AllowOverwrite) { if (Field->hasAttr()) AllowOverwrite = true; } else { + llvm::Type *LoadType = CGM.getTypes().convertTypeForLoadStore( efriedma-quic wrot

[clang] [llvm] [PowerPC] Diagnose musttail instead of crash inside backend (PR #93267)

2024-05-29 Thread Eli Friedman via cfe-commits
@@ -743,6 +743,20 @@ bool Sema::checkMustTailAttr(const Stmt *St, const Attr &MTA) { CallerType.Func = CallerDecl->getType()->getAs(); } + if (Context.getTargetInfo().getTriple().isPPC()) { +if (Context.getTargetInfo().getTriple().isOSAIX()) + return Diag(St->

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

2024-05-29 Thread Eli Friedman via cfe-commits
@@ -5348,18 +5348,8 @@ Value *ScalarExprEmitter::VisitVAArgExpr(VAArgExpr *VE) { return llvm::UndefValue::get(ArgTy); } - // FIXME Volatility. - llvm::Value *Val = Builder.CreateLoad(ArgPtr); - - // If EmitVAArg promoted the type, we must truncate it. - if (ArgTy !=

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-05-30 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I'm skeptical it's correct to skip all the assertions like this; the assertions are there to ensure the layout of the LLVM IR type matches the layout provided by the RecordLayout. If the LLVM IR layout is wrong, address-related computations will be wrong, and ultimately y

[clang] [llvm] Intrinsic: introduce minimumnum and maximumnum (PR #93841)

2024-05-30 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Please add a table to LangRef comparing the behavior of the three versions of min/max intrinsics for various inputs. https://github.com/llvm/llvm-project/pull/93841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[clang] [Clang][objectsize] Generate object size calculation for sub-objects (PR #86858)

2024-05-30 Thread Eli Friedman via cfe-commits
@@ -1062,6 +1063,159 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +class ObjectSizeVisitor +: public ConstStmtVisitor { + bool SkipASE; + +

[clang] [Clang][objectsize] Generate object size calculation for sub-objects (PR #86858)

2024-05-30 Thread Eli Friedman via cfe-commits
@@ -1062,6 +1063,160 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +class ObjectSizeVisitor +: public ConstStmtVisitor { + ASTContext &Ctx;

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

2024-05-31 Thread Eli Friedman via cfe-commits
@@ -2567,16 +2567,16 @@ int main() { // CHECK3-NEXT:[[I:%.*]] = alloca i32, align 4 // CHECK3-NEXT:[[DOTCAPTURE_EXPR__CASTED:%.*]] = alloca i64, align 8 // CHECK3-NEXT:[[DOTBOUND_ZERO_ADDR:%.*]] = alloca i32, align 4 -// CHECK3-NEXT:[[DOTCAPTURE_EXPR__CASTED12:%

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

2024-05-31 Thread Eli Friedman via cfe-commits
@@ -761,6 +761,10 @@ bool ConstStructBuilder::Build(const InitListExpr *ILE, bool AllowOverwrite) { if (Field->hasAttr()) AllowOverwrite = true; } else { + llvm::Type *LoadType = CGM.getTypes().convertTypeForLoadStore( efriedma-quic wrot

[clang] [Clang][objectsize] Generate object size calculation for sub-objects (PR #86858)

2024-05-31 Thread Eli Friedman via cfe-commits
@@ -1062,6 +1063,159 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, return Builder.CreateSelect(Cmp, Res, ConstantInt::get(ResType, 0, IsSigned)); } +namespace { + +class ObjectSizeVisitor +: public ConstStmtVisitor { + bool SkipASE; + +

[clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)

2024-05-31 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > > The correct answer here is probably to fix the sizes in the RecordLayout > > itself; in particular, the DataSize of the members. > > That would be ideal, but also means we'd have to reflect the various C++ > attributes that affect layout in DWARF. Avoiding adding such

[clang] [Clang] Prevent null pointer dereference in target attribute mangling (PR #94228)

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

[clang] [Clang] Prevent null pointer dereference in target attribute mangling (PR #94228)

2024-06-03 Thread Eli Friedman via cfe-commits
@@ -1853,18 +1853,26 @@ static std::string getMangledNameImpl(CodeGenModule &CGM, GlobalDecl GD, break; case MultiVersionKind::Target: { auto *Attr = FD->getAttr(); +assert(Attr && + "Expected TargetAttr to be present for attribute m

[clang] [Clang] Prevent null pointer dereference in target attribute mangling (PR #94228)

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

[clang] [clang CodeGen] Restrict return statements nested in return statements. (PR #94282)

2024-06-03 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/94282 The construct has unclear semantics in general, and it's not really interesting to try to support. So diagnose it. Some subset of the cases this rejects might be possible to handle, if this shows up in pr

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

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

[clang] [Clang] Prevent null pointer dereference in target attribute mangling (PR #94228)

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

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

2024-06-03 Thread Eli Friedman via cfe-commits
@@ -8287,6 +8289,13 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI, SDValue InGlue; if (RequiresSMChange) { + +if (Subtarget->hasSVE()) { efriedma-quic wrote: There are two different kinds of DWARF "unwind info"; one is the kind that's in

[clang] [llvm] [AArch64] Support preserve_none calling convention (PR #91046)

2024-06-03 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: X19 is the base register; can we actually allocate arguments in it in general? This seems hard to fix. It looks like frame lowering assumes X9 is available; that's probably fixable, but the code needs to be reworked, I think. X15 is used on Windows for stack allocation;

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