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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2023-12-12 Thread Eli Friedman 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] [libcxx] [PowerPC] Emit libcall to frexpl for calls to frexp(ppcDoublDouble) (PR #75226)

2023-12-12 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: How hard is it to fix the backend to handle this properly? We should already have support for other libcalls, I think. I'd like to avoid adding temporary hacks to clang. https://github.com/llvm/llvm-project/pull/75226 ___ cfe-c

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

2023-12-12 Thread Eli Friedman 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] [libcxx] [clang-tools-extra] [clang] [libc] [flang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-12 Thread Eli Friedman via cfe-commits
@@ -740,3 +1058,589 @@ void test10(struct union_of_fams *p, int index) { void test11(struct annotated *p, int index) { p->array[index] = __builtin_dynamic_object_size(&p->count, 1); } + +// SANITIZE-WITH-ATTR-LABEL: define dso_local i64 @test11_bdos( +// SANITIZE-WITH-ATTR-SA

[llvm] [clang] [polly] [polly][ScheduleOptimizer] Fix long compile time(hang) reported in polly (PR #75141)

2023-12-12 Thread Eli Friedman via cfe-commits
@@ -860,7 +867,25 @@ static void runIslScheduleOptimizer( SC = SC.set_proximity(Proximity); SC = SC.set_validity(Validity); SC = SC.set_coincidence(Validity); + +// Save error handling behavior +long MaxOperations = isl_ctx_get_max_operations(Ctx); +isl_

[clang] [llvm] [polly] [polly][ScheduleOptimizer] Fix long compile time(hang) reported in polly (PR #75141)

2023-12-12 Thread Eli Friedman via cfe-commits
@@ -860,7 +867,25 @@ static void runIslScheduleOptimizer( SC = SC.set_proximity(Proximity); SC = SC.set_validity(Validity); SC = SC.set_coincidence(Validity); + +// Save error handling behavior efriedma-quic wrote: Would it be possible to use t

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

2023-12-12 Thread Eli Friedman 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] [clang] Add size filter for stack auto init (PR #74777)

2023-12-12 Thread Eli Friedman via cfe-commits
@@ -1759,20 +1759,29 @@ void CodeGenFunction::emitZeroOrPatternForAutoVarInit(QualType type, const VarDecl &D, Address Loc) { auto trivialAutoVarInit = getContext().ge

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

2023-12-12 Thread Eli Friedman 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

[libcxx] [clang] [PowerPC] Emit libcall to frexpl for calls to frexp(ppcDoublDouble) (PR #75226)

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

[libcxx] [clang] [PowerPC] Emit libcall to frexpl for calls to frexp(ppcDoublDouble) (PR #75226)

2023-12-12 Thread Eli Friedman via cfe-commits
@@ -149,6 +153,11 @@ llvm::Constant *CodeGenModule::getBuiltinLibFunction(const FunctionDecl *FD, &getTarget().getLongDoubleFormat() == &llvm::APFloat::IEEEquad() && F128Builtins.contains(BuiltinID)) Name = F128Builtins[BuiltinID]; +else if (getTriple

[libcxx] [clang] [PowerPC] Emit libcall to frexpl for calls to frexp(ppcDoublDouble) (PR #75226)

2023-12-12 Thread Eli Friedman via cfe-commits
@@ -3410,9 +3419,15 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, { Src0->getType(), Src1->getType() }); return RValue::get(Builder.CreateCall(F, { Src0, Src1 })); } + case Builtin::BI__builtin_fre

[libcxx] [clang] [PowerPC] Emit libcall to frexpl for calls to frexp(ppcDoublDouble) (PR #75226)

2023-12-12 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic commented: If the PPC backend maintainers intend to deprecate ppc-long-double support in LLVM, I guess we can hack clang to limp along until the cut happens. https://github.com/llvm/llvm-project/pull/75226 ___ cfe-comm

[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-12 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Adding workarounds to LLVM for host compiler bugs is something we do from time to time, but any such workarounds need to be clearly documented in the source code, and as narrowly targeted as possible (for example, under an `#ifdef __CYGWIN__`). Since this is an issue with

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

2023-12-12 Thread Eli Friedman 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] [llvm] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #67454)

2023-12-12 Thread Eli Friedman 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] [clang][Driver] Support -fms-volatile as equivalent to /volatile:ms (PR #74790)

2023-12-12 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/74790 >From 476402a90cc24a5697efbef0b3bcb1276a4bc6f5 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 7 Dec 2023 16:21:53 -0800 Subject: [PATCH] [clang][Driver] Support -fms-volatile as equivalent to /vola

[clang] [clang][Driver] Support -fms-volatile as equivalent to /volatile:ms (PR #74790)

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

[clang] [llvm] [polly] [polly][ScheduleOptimizer] Fix long compile time(hang) reported in polly (PR #75141)

2023-12-13 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: The isl_options_set_on_error thing still seems like an issue; there's a path to restore on_error, but it doesn't run if the quota is hit. Do we actually need to explicitly check hasQuotaExceeded() at all? If there's an error, the schedule should be null, and there's alrea

[libcxx] [clang] [clang-tools-extra] [llvm] [compiler-rt] [flang] [libc] Don't emit relax relocs like R_X86_64_REX_GOTPCRELX on X86 target for OPENMP internal vars. (PR #75564)

2023-12-15 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Scattering around `setDSOLocal(false)` makes the logic hard to understand. I'd strongly prefer to fix the initial setting of dso_local when we create the global variable. We can refactor the code to make that work. https://github.com/llvm/llvm-project/pull/75564

[libcxx] [clang] [PowerPC] Emit libcall to frexpl for calls to frexp(ppcDoublDouble) (PR #75226)

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

[clang] [clang] Strict aliasing warning ala GCC [PR50066] (PR #74155)

2023-12-15 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: > > Making Sema pull the TBAA info out of clang/lib/CodeGen is a layering > > violation (and probably breaks if we aren't actually generating code). If > > we need some notion of "aliasing" in Sema, we should pull the relevant code > > into clang/lib/AST. > > That's unfor

[clang] [llvm] [RISCV] Update TargetAttr target-cpu override rule (PR #75804)

2023-12-18 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: It doesn't seem like a good idea to make target-independent logic behave in target-specific ways; that's going to confusing for both people hacking on clang, and for users if it's user-visible. Is there some way we can make this logic consistent across targets? Maybe we

[llvm] [clang] [lld] [LTO] Improve diagnostics handling when parsing module-level inline assembly (PR #75726)

2023-12-18 Thread Eli Friedman via cfe-commits
@@ -418,6 +418,8 @@ void BackendConsumer::anchor() { } } // namespace clang bool ClangDiagnosticHandler::handleDiagnostics(const DiagnosticInfo &DI) { + if (DI.getSeverity() == DS_Error) +HasErrors = true; efriedma-quic wrote: I'm not sure I like the way

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[clang] [clang][CodeGen] Emit atomic IR in place of optimized libcalls. (PR #73176)

2023-12-21 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: When I said "inconsistencies", I just meant the way the responsibility for lowering atomics is split between LLVM and clang; I didn't mean anything was actually broken. https://github.com/llvm/llvm-project/pull/73176 ___ cfe-comm

[clang] [polly] [llvm] [polly][ScheduleOptimizer] Fix long compile time(hang) reported in polly (PR #75141)

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

[clang] [llvm] [polly] [polly][ScheduleOptimizer] Fix long compile time(hang) reported in polly (PR #75141)

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

[compiler-rt] [clang] [clang][UBSan] Add implicit conversion check for bitfields (PR #75481)

2024-01-02 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Please add test coverage for compound assignment and increment/decrement. This seems like a reasonable extension of the existing integer truncation checks, but we might want to consider giving it a unique name. Otherwise, people using integer truncation checks will have t

[clang] [polly] [llvm] [polly][ScheduleOptimizer] Fix long compile time(hang) reported in polly (PR #75141)

2024-01-02 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Pushed revert. @kartcq please fix the test so it either doesn't depend on DEBUG output, or uses `REQUIRES: asserts`. https://github.com/llvm/llvm-project/pull/75141 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://

[llvm] [clang] [WIP] Correct lowering of `fp128` intrinsics (PR #76558)

2024-01-03 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: This is basically the approach I was expecting: we check the type of "long double" when we build the TargetLowering, and pick appropriate names based on that. I expect that for -mlong-double-128, you just want to add a module flag that overrides the default choice. I thi

[clang] [clang] Fix parenthesized list initialization of arrays not working with `new` (PR #76976)

2024-01-05 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: Have you considered the following case? ``` void foo() { char* arr = new char[]("asdf"); } ``` https://github.com/llvm/llvm-project/pull/76976 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [clang] Fix parenthesized list initialization of arrays not working with `new` (PR #76976)

2024-01-09 Thread Eli Friedman via cfe-commits
@@ -5495,14 +5495,12 @@ static void TryOrBuildParenListInitialization( return; } // ...and value-initialized for each k < i <= n; -if (ArrayLength > Args.size()) { efriedma-quic wrote: What is this change supposed to do? The existing cod

[clang] [clang] Fix parenthesized list initialization of arrays not working with `new` (PR #76976)

2024-01-09 Thread Eli Friedman via cfe-commits
@@ -1038,11 +1038,14 @@ void CodeGenFunction::EmitNewArrayInitializer( return true; }; + const InitListExpr *ILE = dyn_cast(Init); + const CXXParenListInitExpr *CPLIE = dyn_cast(Init); + const StringLiteral *SL = dyn_cast(Init); // If the initializer is an initiali

[clang] 0fb16d5 - Fix clang regression test after 5c486ce0

2021-07-26 Thread Eli Friedman via cfe-commits
Author: Eli Friedman Date: 2021-07-26T11:59:40-07:00 New Revision: 0fb16d5ad126a14213ceee6b20b86c721ea49d4e URL: https://github.com/llvm/llvm-project/commit/0fb16d5ad126a14213ceee6b20b86c721ea49d4e DIFF: https://github.com/llvm/llvm-project/commit/0fb16d5ad126a14213ceee6b20b86c721ea49d4e.diff

[clang] 27a5749 - [Sema][Windows] Don't special-case void* in __unaligned conversions.

2022-03-10 Thread Eli Friedman via cfe-commits
Author: Eli Friedman Date: 2022-03-10T14:49:16-08:00 New Revision: 27a574962567224d3a36a70cf8abf0ad3d751ec5 URL: https://github.com/llvm/llvm-project/commit/27a574962567224d3a36a70cf8abf0ad3d751ec5 DIFF: https://github.com/llvm/llvm-project/commit/27a574962567224d3a36a70cf8abf0ad3d751ec5.diff

[clang] 5791e28 - Complete the list of single-underscore keywords for MSVC compat.

2022-03-15 Thread Eli Friedman via cfe-commits
Author: Eli Friedman Date: 2022-03-15T11:58:40-07:00 New Revision: 5791e28f30168a5a930c1f869529b03b95405afe URL: https://github.com/llvm/llvm-project/commit/5791e28f30168a5a930c1f869529b03b95405afe DIFF: https://github.com/llvm/llvm-project/commit/5791e28f30168a5a930c1f869529b03b95405afe.diff

[clang] 04ba344 - [CodeGen] Inline _byteswap_* builtins.

2022-03-16 Thread Eli Friedman via cfe-commits
Author: Eli Friedman Date: 2022-03-16T16:18:51-07:00 New Revision: 04ba344176b239c0abc0c9efc8b7524e551e58ed URL: https://github.com/llvm/llvm-project/commit/04ba344176b239c0abc0c9efc8b7524e551e58ed DIFF: https://github.com/llvm/llvm-project/commit/04ba344176b239c0abc0c9efc8b7524e551e58ed.diff

[clang] d791de0 - Restrict lvalue-to-rvalue conversions in CGExprConstant.

2022-04-13 Thread Eli Friedman via cfe-commits
Author: Eli Friedman Date: 2022-04-13T12:34:57-07:00 New Revision: d791de0e25e13cd8ae066e6f0fa03b384502b02e URL: https://github.com/llvm/llvm-project/commit/d791de0e25e13cd8ae066e6f0fa03b384502b02e DIFF: https://github.com/llvm/llvm-project/commit/d791de0e25e13cd8ae066e6f0fa03b384502b02e.diff

[clang] 5955a0f - Allow flexible array initialization in C++.

2022-04-14 Thread Eli Friedman via cfe-commits
Author: Eli Friedman Date: 2022-04-14T11:56:40-07:00 New Revision: 5955a0f9375a8c0b134eeb4a8de5155dcce7c94f URL: https://github.com/llvm/llvm-project/commit/5955a0f9375a8c0b134eeb4a8de5155dcce7c94f DIFF: https://github.com/llvm/llvm-project/commit/5955a0f9375a8c0b134eeb4a8de5155dcce7c94f.diff

[clang] 6cf0b1b - Comment out assertions about initializer size added in D123649.

2022-04-14 Thread Eli Friedman via cfe-commits
Author: Eli Friedman Date: 2022-04-14T13:58:17-07:00 New Revision: 6cf0b1b3da3e8662baf030a2d741e3becaaab2b0 URL: https://github.com/llvm/llvm-project/commit/6cf0b1b3da3e8662baf030a2d741e3becaaab2b0 DIFF: https://github.com/llvm/llvm-project/commit/6cf0b1b3da3e8662baf030a2d741e3becaaab2b0.diff

[clang] 4802edd - Fix size of flexible array initializers, and re-enable assertions.

2022-04-15 Thread Eli Friedman via cfe-commits
Author: Eli Friedman Date: 2022-04-15T12:09:57-07:00 New Revision: 4802edd1ac7a5aea8c8488b5baec221d722cbdde URL: https://github.com/llvm/llvm-project/commit/4802edd1ac7a5aea8c8488b5baec221d722cbdde DIFF: https://github.com/llvm/llvm-project/commit/4802edd1ac7a5aea8c8488b5baec221d722cbdde.diff

[clang] ecc8479 - Look through calls to std::addressof to compute pointer alignment.

2022-04-20 Thread Eli Friedman via cfe-commits
Author: Eli Friedman Date: 2022-04-20T11:30:11-07:00 New Revision: ecc8479a01d3bee1c145a0f7990271651db72ab0 URL: https://github.com/llvm/llvm-project/commit/ecc8479a01d3bee1c145a0f7990271651db72ab0 DIFF: https://github.com/llvm/llvm-project/commit/ecc8479a01d3bee1c145a0f7990271651db72ab0.diff

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