[clang] [CIR] Add support for member initialization from constructors (PR #144583)

2025-06-18 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/144583 >From 80cd92fd1ea93a2f1c1b037d3a5354ee94f565f6 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 16 Jun 2025 16:39:15 -0700 Subject: [PATCH 1/3] [CIR] Add support for member initialization from construct

[clang] [CIR] Add support for member initialization from constructors (PR #144583)

2025-06-18 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/144583 >From 389f3d95239c28415a95696cc7645e3399a5d9ab Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 16 Jun 2025 16:39:15 -0700 Subject: [PATCH 1/2] [CIR] Add support for member initialization from construct

[clang] [CIR] Add Minimal Destructor Definition Support (PR #144719)

2025-06-18 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/144719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add Minimal Destructor Definition Support (PR #144719)

2025-06-18 Thread Andy Kaylor via cfe-commits
@@ -538,6 +538,104 @@ void CIRGenFunction::emitConstructorBody(FunctionArgList &args) { } } +/// Emits the body of the current destructor. +void CIRGenFunction::emitDestructorBody(FunctionArgList &args) { + const CXXDestructorDecl *dtor = cast(curGD.getDecl()); + CXXDtorT

[clang] [CIR] Add Minimal Destructor Definition Support (PR #144719)

2025-06-18 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. Looks good. I just have a couple of minor suggestions. https://github.com/llvm/llvm-project/pull/144719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] [CIR] Add Minimal Destructor Definition Support (PR #144719)

2025-06-18 Thread Andy Kaylor via cfe-commits
@@ -538,6 +538,104 @@ void CIRGenFunction::emitConstructorBody(FunctionArgList &args) { } } +/// Emits the body of the current destructor. +void CIRGenFunction::emitDestructorBody(FunctionArgList &args) { + const CXXDestructorDecl *dtor = cast(curGD.getDecl()); + CXXDtorT

[clang] [CIR] Add Minimal Destructor Definition Support (PR #144719)

2025-06-18 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,50 @@ +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir -mno-constructor-aliases %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu

[clang] [CIR] Add support for __builtin_assume (PR #144376)

2025-06-17 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. https://github.com/llvm/llvm-project/pull/144376 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Handle global string literals as char array initializer (PR #144384)

2025-06-17 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/144384 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for member initialization from constructors (PR #144583)

2025-06-17 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/144583 Upstream the code to handle member variable initialization in a constructor. At this point only simple scalar values (including members of anonymous unions) are handled. >From 389f3d95239c28415a95696cc7645e

[clang] [CIR] Handle global string literals as char array initializer (PR #144384)

2025-06-17 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/144384 >From 815c01f5041c83c1612f49ee8ccda23c8eca16c8 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 13 Jun 2025 16:03:08 -0700 Subject: [PATCH 1/2] [CIR] Handle global string literals as char array initiali

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-17 Thread Andy Kaylor via cfe-commits
@@ -1858,6 +1858,40 @@ def FuncOp : CIR_Op<"func", [ // CallOp //===--===// +def SE_All : I32EnumAttrCase<"All", 1, "all">; +def SE_Pure : I32EnumAttrCase<"Pure", 2, "pure">; +def SE_Const : I32EnumAttrCase<"

[clang] [CIR][NFCI] Represent Complex RValues As Single Value (PR #144519)

2025-06-17 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. Looks good to me! https://github.com/llvm/llvm-project/pull/144519 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][NFC] Refactor constant pointer l-value handling (PR #144165)

2025-06-16 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/144165 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream ComplexRealPtrOp for ComplexType (PR #144235)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -2385,4 +2385,33 @@ def ComplexCreateOp : CIR_Op<"complex.create", [Pure, SameTypeOperands]> { let hasFolder = 1; } +//===--===// +// ComplexRealPtrOp +//===--

[clang] [CIR] Upstream ComplexRealPtrOp for ComplexType (PR #144235)

2025-06-16 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor commented: I have concerns about the CIR representation here. I think we should be aligning our representation of complex operations with the MLIR complex dialect. As such, we want `__real__` to be lowerable to `complex.re` but the explicit representation of inter

[clang] [CIR] Upstream ComplexRealPtrOp for ComplexType (PR #144235)

2025-06-16 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/144235 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream ComplexType ImaginaryLiteral (PR #144223)

2025-06-16 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. https://github.com/llvm/llvm-project/pull/144223 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -1858,6 +1858,40 @@ def FuncOp : CIR_Op<"func", [ // CallOp //===--===// +def SE_All : I32EnumAttrCase<"All", 1, "all">; +def SE_Pure : I32EnumAttrCase<"Pure", 2, "pure">; +def SE_Const : I32EnumAttrCase<"

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -1940,22 +1975,30 @@ def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> { let arguments = commonArgs; let builders = [ -// Build a call op for a direct call -OpBuilder<(ins "mlir::SymbolRefAttr":$callee, "mlir::Type":$resType, - "mlir::V

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -1858,6 +1858,40 @@ def FuncOp : CIR_Op<"func", [ // CallOp //===--===// +def SE_All : I32EnumAttrCase<"All", 1, "all">; +def SE_Pure : I32EnumAttrCase<"Pure", 2, "pure">; +def SE_Const : I32EnumAttrCase<"

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -1858,6 +1858,40 @@ def FuncOp : CIR_Op<"func", [ // CallOp //===--===// +def SE_All : I32EnumAttrCase<"All", 1, "all">; +def SE_Pure : I32EnumAttrCase<"Pure", 2, "pure">; +def SE_Const : I32EnumAttrCase<"

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -24,16 +24,17 @@ let cppNamespace = "::cir" in { def CIRCallOpInterface : OpInterface<"CIRCallOpInterface", [CallOpInterface]> { // Currently we don't have any methods defined in CIRCallOpInterface. We'll // add more methods as the upstreaming proceeds. -let m

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -1940,22 +1975,30 @@ def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> { let arguments = commonArgs; let builders = [ -// Build a call op for a direct call -OpBuilder<(ins "mlir::SymbolRefAttr":$callee, "mlir::Type":$resType, - "mlir::V

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -1858,6 +1858,40 @@ def FuncOp : CIR_Op<"func", [ // CallOp //===--===// +def SE_All : I32EnumAttrCase<"All", 1, "all">; andykaylor wrote: Can you update this to reflect the changes @xlau

[clang] [CIR][NFC] Refactor constant pointer l-value handling (PR #144165)

2025-06-16 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/144165 >From 92176c5b15f708afc0765dbd41e6a79c7023b700 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 13 Jun 2025 14:33:17 -0700 Subject: [PATCH 1/2] [CIR][NFC] Refactor constant pointer l-value handling This

[clang] [CIR] Upstream ComplexType builtin_complex (PR #144225)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -44,6 +68,15 @@ void ComplexExprEmitter::emitStoreOfComplex(mlir::Location loc, mlir::Value val, builder.createStore(loc, val, destAddr); } +mlir::Value ComplexExprEmitter::VisitCallExpr(const CallExpr *e) { + if (e->getCallReturnType(cgf.getContext())->isReferenceType(

[clang] [CIR] Upstream ComplexType builtin_complex (PR #144225)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -32,6 +46,16 @@ static const ComplexType *getComplexType(QualType type) { return cast(cast(type)->getValueType()); } +mlir::Value ComplexExprEmitter::emitLoadOfLValue(LValue lv, + SourceLocation loc) { + assert(lv.isSimple(

[clang] [CIR] Upstream ComplexType builtin_complex (PR #144225)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -96,6 +96,7 @@ class RValue { er.isVolatile = false; return er; } + andykaylor wrote: Not needed in this PR https://github.com/llvm/llvm-project/pull/144225 ___ cfe-commits mailing list cfe-commits@list

[clang] [CIR] Upstream ComplexType builtin_complex (PR #144225)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -50,6 +50,14 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID, } mlir::Location loc = getLoc(e->getExprLoc()); - cgm.errorNYI(loc, "non constant foldable builtin calls"); + switch (builtinID) { + case Builtin::BI__builtin_complex: {

[clang] [CIR] Upstream ComplexType builtin_complex (PR #144225)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -176,3 +176,27 @@ void foo7() { // OGCG: store float %[[TMP_A]], ptr %[[C_REAL_PTR]], align 4 // OGCG: store float 2.00e+00, ptr %[[C_IMAG_PTR]], align 4 +void foo9(double r, double i) { + double _Complex c = __builtin_complex(r, i); andykaylor wrote:

[clang] [CIR] Upstream ComplexType builtin_complex (PR #144225)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -176,3 +176,27 @@ void foo7() { // OGCG: store float %[[TMP_A]], ptr %[[C_REAL_PTR]], align 4 // OGCG: store float 2.00e+00, ptr %[[C_IMAG_PTR]], align 4 +void foo9(double r, double i) { andykaylor wrote: ```suggestion void foo9(double a, double b) { `

[clang] [CIR] Upstream ComplexType ImaginaryLiteral (PR #144223)

2025-06-16 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/144223 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream ComplexType ImaginaryLiteral (PR #144223)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -176,3 +176,17 @@ void foo7() { // OGCG: store float %[[TMP_A]], ptr %[[C_REAL_PTR]], align 4 // OGCG: store float 2.00e+00, ptr %[[C_IMAG_PTR]], align 4 +void foo8() { andykaylor wrote: Can you add a test case for integer types? https://github.com/ll

[clang] [CIR] Upstream ComplexType ImaginaryLiteral (PR #144223)

2025-06-16 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. Looks good, with request for additional test case https://github.com/llvm/llvm-project/pull/144223 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/

[clang] [CIR] Handle global string literals as char array initializer (PR #144384)

2025-06-16 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/144384 This change adds the line of code needed to handle a string literal as an initializer for a character array. >From 815c01f5041c83c1612f49ee8ccda23c8eca16c8 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: F

[clang] [CIR][NFCI] Update RValue class to reflect changes in classic CodeGen (PR #142779)

2025-06-16 Thread Andy Kaylor via cfe-commits
@@ -34,28 +32,85 @@ namespace clang::CIRGen { class RValue { enum Flavor { Scalar, Complex, Aggregate }; - // Stores first value and flavor. - llvm::PointerIntPair v1; - // Stores second value and volatility. - llvm::PointerIntPair, 1, bool> v2; - // Stores element type

[clang] [CIR][NFC] Refactor constant pointer l-value handling (PR #144165)

2025-06-13 Thread Andy Kaylor via cfe-commits
@@ -329,6 +329,222 @@ emitArrayConstant(CIRGenModule &cgm, mlir::Type desiredType, return {}; } +//===--===// +// ConstantLValueEmitter +//===---

[clang] [CIR][NFC] Refactor constant pointer l-value handling (PR #144165)

2025-06-13 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/144165 This change introduces a ConstantLValueEmitter class, which will be needed for emitting CIR for non-trivial constant pointers. This change introduces the class with most branches reaching an NYI diagnostic.

[clang] [CIR][NFC] Fix forrange.cpp test (PR #144123)

2025-06-13 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/144123 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Support for static variables (PR #143980)

2025-06-13 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/143980 >From 996df6fabc699f36ef352d73a51a2127a993b6ed Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 4 Jun 2025 10:27:48 -0700 Subject: [PATCH 1/2] [CIR] Support for static variables This adds support for em

[clang] [CIR][NFC] Fix forrange.cpp test (PR #144123)

2025-06-13 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/144123 A recent change has cause the begin and end iterators in the forrange.cpp CIR codegen test to be marked as 'init' causing the test to fail. This change fixes the checks in the test. >From 87ae5ce9854f73d07f

[clang] [CIR] Update isSized with upstreamed types (PR #143960)

2025-06-13 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/143960 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Change default assumption about allowing builtins (PR #144004)

2025-06-13 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/144004 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Change default assumption about allowing builtins (PR #144004)

2025-06-12 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/144004 The code to read the "nobuiltins" attributes hasn't been implemented yet, but we were defaulting to the assumption that use of builtins is allowed for function calls that we recognize as standard C library c

[clang] [CIR] Support for static variables (PR #143980)

2025-06-12 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/143980 >From 3041ad6f68f4097dadf0870177eed4e749e915cc Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 4 Jun 2025 10:27:48 -0700 Subject: [PATCH 1/2] [CIR] Support for static variables This adds support for em

[clang] [CIR] Support for static variables (PR #143980)

2025-06-12 Thread Andy Kaylor via cfe-commits
@@ -219,6 +236,252 @@ void CIRGenFunction::emitVarDecl(const VarDecl &d) { return emitAutoVarDecl(d); } +static std::string getStaticDeclName(CIRGenModule &cgm, const VarDecl &d) { + if (cgm.getLangOpts().CPlusPlus) +return cgm.getMangledName(&d).str(); + + // If this

[clang] [CIR] Support for static variables (PR #143980)

2025-06-12 Thread Andy Kaylor via cfe-commits
@@ -219,6 +236,252 @@ void CIRGenFunction::emitVarDecl(const VarDecl &d) { return emitAutoVarDecl(d); } +static std::string getStaticDeclName(CIRGenModule &cgm, const VarDecl &d) { + if (cgm.getLangOpts().CPlusPlus) +return cgm.getMangledName(&d).str(); + + // If this

[clang] [CIR] Support for static variables (PR #143980)

2025-06-12 Thread Andy Kaylor via cfe-commits
@@ -219,6 +236,252 @@ void CIRGenFunction::emitVarDecl(const VarDecl &d) { return emitAutoVarDecl(d); } +static std::string getStaticDeclName(CIRGenModule &cgm, const VarDecl &d) { + if (cgm.getLangOpts().CPlusPlus) +return cgm.getMangledName(&d).str(); + + // If this

[clang] [CIR] Support for static variables (PR #143980)

2025-06-12 Thread Andy Kaylor via cfe-commits
@@ -208,8 +208,25 @@ void CIRGenFunction::emitVarDecl(const VarDecl &d) { if (d.hasExternalStorage()) return; - if (d.getStorageDuration() != SD_Automatic) -cgm.errorNYI(d.getSourceRange(), "emitVarDecl automatic storage duration"); + if (d.getStorageDuration() !=

[clang] [CIR][NFC] Fix build problems with [[maybe_unused]] (PR #143994)

2025-06-12 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/143994 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][NFC] Fix build problems with [[maybe_unused]] (PR #143994)

2025-06-12 Thread Andy Kaylor via cfe-commits
andykaylor wrote: I should mention that the problem was introduced by https://github.com/llvm/llvm-project/pull/143932 Top-of-trunk clang doesn't report an error for this situation. https://github.com/llvm/llvm-project/pull/143994 ___ cfe-commits mai

[clang] [CIR][NFC] Fix build problems with [[maybe_unused]] (PR #143994)

2025-06-12 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/143994 A recent commit introduced the use of [[maybe_unused]] following LLVM_PREFFERED_TYPE(bool) on a member variable declaration. I compiled it with clang 14.0, which doesn't support the `preferred_type` attribut

[clang] [CIR] Add support for delegating constructors (PR #143932)

2025-06-12 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/143932 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Support for static variables (PR #143980)

2025-06-12 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/143980 This adds support for emitting static variables and their initializers. >From 3041ad6f68f4097dadf0870177eed4e749e915cc Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 4 Jun 2025 10:27:48 -0700 Subject:

[clang] [CIR] Add support for delegating constructors (PR #143932)

2025-06-12 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/143932 >From 96cdd2ebeb43d2f30581c15cf290b7d0be0a5c71 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 11 Jun 2025 16:27:28 -0700 Subject: [PATCH 1/2] [CIR] Add support for delegating constructors This change

[clang] [CIR] Add support for delegating constructors (PR #143932)

2025-06-12 Thread Andy Kaylor via cfe-commits
@@ -267,23 +267,60 @@ class AggValueSlot { Address addr; clang::Qualifiers quals; + /// This is set to true if some external code is responsible for setting up a + /// destructor for the slot. Otherwise the code which constructs it should + /// push the appropriate cle

[clang] [CIR][NFC] Fix an unused variable warning (PR #143933)

2025-06-12 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/143933 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-12 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. This looks good with one minor note. Sorry about the ongoing conflicts requiring rebase. Feel free to merge after rebasing. https://github.com/llvm/llvm-project/pull/143377 ___ cfe-commits mail

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-12 Thread Andy Kaylor via cfe-commits
@@ -246,6 +290,44 @@ void AggExprEmitter::emitNullInitializationToLValue(mlir::Location loc, cgf.emitNullInitialization(loc, lv.getAddress(), lv.getType()); } +void AggExprEmitter::VisitCallExpr(const CallExpr *e) { + if (e->getCallReturnType(cgf.getContext())->isReference

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-12 Thread Andy Kaylor via cfe-commits
@@ -312,8 +329,47 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo, assert(!cir::MissingFeatures::opCallBitcastArg()); cirCallArgs[argNo] = v; } else { - assert(!cir::MissingFeatures::opCallAggregateArgs()); - cgm.errorNYI("emitCa

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-12 Thread Andy Kaylor via cfe-commits
@@ -312,8 +329,47 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo, assert(!cir::MissingFeatures::opCallBitcastArg()); cirCallArgs[argNo] = v; } else { - assert(!cir::MissingFeatures::opCallAggregateArgs()); - cgm.errorNYI("emitCa

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-12 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/143377 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for delegating constructors (PR #143932)

2025-06-12 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/143932 This change adds the necessary support for handling delegating constructors in ClangIR. The implementation is kept as small as possible by not handling any other sort of initialization (members, base classes

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-12 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/143639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-12 Thread Andy Kaylor via cfe-commits
@@ -21,6 +21,88 @@ using namespace clang; using namespace clang::CIRGen; +/// Checks whether the given constructor is a valid subject for the +/// complete-to-base constructor delgation optimization, i.e. emitting the +/// complete constructor as a simple call to the base cons

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-11 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/143639 >From 7e08ebf8887cb4ef90a06b853ebacfff1e57f510 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 9 Jun 2025 09:38:55 -0700 Subject: [PATCH 1/2] [CIR] Upstream support for emitting constructors This chang

[clang] [CIR] Implement folder for VecSplatOp (PR #143771)

2025-06-11 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. https://github.com/llvm/llvm-project/pull/143771 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Implement folder for VecCreateOp (PR #143355)

2025-06-11 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. https://github.com/llvm/llvm-project/pull/143355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-11 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/143639 >From aeaef15434292dd7621541f7105356bfb1b9d57c Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 9 Jun 2025 09:38:55 -0700 Subject: [PATCH 1/2] [CIR] Upstream support for emitting constructors This chang

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-11 Thread Andy Kaylor via cfe-commits
@@ -21,6 +21,88 @@ using namespace clang; using namespace clang::CIRGen; +/// Checks whether the given constructor is a valid subject for the +/// complete-to-base constructor delgation optimization, i.e. emitting the +/// complete constructor as a simple call to the base cons

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-11 Thread Andy Kaylor via cfe-commits
@@ -55,12 +59,29 @@ class CIRGenCXXABI { return md->getParent(); } + /// Return whether the given global decl needs a VTT parameter. andykaylor wrote: It's going to look like a typo, but OK. ;-) https://github.com/llvm/llvm-project/pull/143639 ___

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-11 Thread Andy Kaylor via cfe-commits
@@ -21,6 +21,88 @@ using namespace clang; using namespace clang::CIRGen; +/// Checks whether the given constructor is a valid subject for the +/// complete-to-base constructor delgation optimization, i.e. emitting the +/// complete constructor as a simple call to the base cons

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-11 Thread Andy Kaylor via cfe-commits
@@ -496,6 +496,47 @@ cir::FuncOp CIRGenFunction::generateCode(clang::GlobalDecl gd, cir::FuncOp fn, return fn; } +void CIRGenFunction::emitConstructorBody(FunctionArgList &args) { + assert(!cir::MissingFeatures::sanitizers()); + const auto *ctor = cast(curGD.getDecl()); +

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-11 Thread Andy Kaylor via cfe-commits
@@ -496,6 +496,47 @@ cir::FuncOp CIRGenFunction::generateCode(clang::GlobalDecl gd, cir::FuncOp fn, return fn; } +void CIRGenFunction::emitConstructorBody(FunctionArgList &args) { + assert(!cir::MissingFeatures::sanitizers()); + const auto *ctor = cast(curGD.getDecl()); +

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-11 Thread Andy Kaylor via cfe-commits
@@ -72,6 +82,72 @@ void CIRGenItaniumCXXABI::emitInstanceFunctionProlog(SourceLocation loc, } } +void CIRGenItaniumCXXABI::addImplicitStructorParams(CIRGenFunction &cgf, +QualType &retTY, +

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-11 Thread Andy Kaylor via cfe-commits
@@ -21,6 +21,88 @@ using namespace clang; using namespace clang::CIRGen; +/// Checks whether the given constructor is a valid subject for the +/// complete-to-base constructor delgation optimization, i.e. emitting the +/// complete constructor as a simple call to the base cons

[clang] [CIR] Upstream support for calling constructors (PR #143579)

2025-06-10 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/143579 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream splat op for VectorType (PR #139827)

2025-06-10 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. https://github.com/llvm/llvm-project/pull/139827 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-06-10 Thread Andy Kaylor via cfe-commits
@@ -223,21 +272,114 @@ void CIRRecordLowering::fillOutputFields() { fieldTypes.size() - 1; // A field without storage must be a bitfield. assert(!cir::MissingFeatures::bitfields()); + if (!member.data) +setBitFieldInfo(member.fieldDecl, memb

[clang] [CIR] Upstream support for calling constructors (PR #143579)

2025-06-10 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/143579 >From 844b07e53937d3496405fd2c58148bd03c1f7407 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 9 Jun 2025 09:38:55 -0700 Subject: [PATCH 1/3] [CIR] Upstream support for calling constructors This change

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-06-10 Thread Andy Kaylor via cfe-commits
@@ -223,21 +272,114 @@ void CIRRecordLowering::fillOutputFields() { fieldTypes.size() - 1; // A field without storage must be a bitfield. assert(!cir::MissingFeatures::bitfields()); + if (!member.data) +setBitFieldInfo(member.fieldDecl, memb

[clang] [CIR] Upstream support for calling constructors (PR #143579)

2025-06-10 Thread Andy Kaylor via cfe-commits
@@ -1393,6 +1393,57 @@ RValue CIRGenFunction::emitCXXMemberCallExpr(const CXXMemberCallExpr *ce, ce, md, returnValue, hasQualifier, qualifier, isArrow, base); } +void CIRGenFunction::emitCXXConstructExpr(const CXXConstructExpr *e, +

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-06-10 Thread Andy Kaylor via cfe-commits
andykaylor wrote: Sorry for the delay in getting back to this. The summary of what I am about to say is that I'm in agreement with the plan of moving forward with the current implementation, but I have some lingering thoughts about it that I want to explore. > As you noticed, we went higher l

[clang] [Clang][Driver] Override complex number calculation method by -fno-fast-math (PR #132680)

2025-06-10 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm -- thanks for sticking with this! https://github.com/llvm/llvm-project/pull/132680 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] [CIR] Upstream splat op for VectorType (PR #139827)

2025-06-10 Thread Andy Kaylor via cfe-commits
@@ -135,4 +135,38 @@ cir.func @vector_insert_element_test() { // CHECK:cir.return // CHECK: } +cir.func @vector_splat_test() { +%0 = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr>, ["a", init] +%1 = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr>, ["shl", init] +

[clang] [CIR] Upstream splat op for VectorType (PR #139827)

2025-06-10 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/139827 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream splat op for VectorType (PR #139827)

2025-06-10 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. Other than pattern matching the value identifiers in the test, this looks good to me. https://github.com/llvm/llvm-project/pull/139827 ___ cfe-commits mailing list cfe-commits@lists.llvm.org ht

[clang] [CIR] Upstream support for calling constructors (PR #143579)

2025-06-10 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/143579 >From 844b07e53937d3496405fd2c58148bd03c1f7407 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 9 Jun 2025 09:38:55 -0700 Subject: [PATCH 1/2] [CIR] Upstream support for calling constructors This change

[clang] [CIR] Upstream support for calling constructors (PR #143579)

2025-06-10 Thread Andy Kaylor via cfe-commits
@@ -76,6 +83,48 @@ static void appendParameterTypes(const CIRGenTypes &cgt, cgt.getCGModule().errorNYI("appendParameterTypes: hasExtParameterInfos"); } +const CIRGenFunctionInfo & +CIRGenTypes::arrangeCXXStructorDeclaration(GlobalDecl gd) { + auto *md = cast(gd.getDecl());

[clang] [CIR] Upstream support for calling constructors (PR #143579)

2025-06-10 Thread Andy Kaylor via cfe-commits
@@ -63,3 +66,74 @@ Address CIRGenFunction::getAddressOfBaseClass( return value; } + +void CIRGenFunction::emitCXXConstructorCall(const clang::CXXConstructorDecl *d, +clang::CXXCtorType type, +

[clang] [CIR] Upstream support for calling constructors (PR #143579)

2025-06-10 Thread Andy Kaylor via cfe-commits
@@ -141,6 +190,44 @@ arrangeFreeFunctionLikeCall(CIRGenTypes &cgt, CIRGenModule &cgm, return cgt.arrangeCIRFunctionInfo(retType, argTypes, required); } +/// Arrange a call to a C++ method, passing the given arguments. +/// +/// passProtoArgs indicates whether `args` has arg

[clang] [CIR] Upstream support for calling constructors (PR #143579)

2025-06-10 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/143579 This change adds support for calling C++ constructors. The support for actually defining a constructor is still missing and will be added in a later change. >From 844b07e53937d3496405fd2c58148bd03c1f7407 Mon

[clang] [CIR] Add support for accessing members of base classes (PR #143195)

2025-06-09 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/143195 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-09 Thread Andy Kaylor via cfe-commits
@@ -312,8 +329,47 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo, assert(!cir::MissingFeatures::opCallBitcastArg()); cirCallArgs[argNo] = v; } else { - assert(!cir::MissingFeatures::opCallAggregateArgs()); - cgm.errorNYI("emitCa

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-09 Thread Andy Kaylor via cfe-commits
@@ -312,8 +329,47 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo, assert(!cir::MissingFeatures::opCallBitcastArg()); cirCallArgs[argNo] = v; } else { - assert(!cir::MissingFeatures::opCallAggregateArgs()); - cgm.errorNYI("emitCa

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-09 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll +// RUN:

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-09 Thread Andy Kaylor via cfe-commits
@@ -312,8 +329,47 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo, assert(!cir::MissingFeatures::opCallBitcastArg()); cirCallArgs[argNo] = v; } else { - assert(!cir::MissingFeatures::opCallAggregateArgs()); - cgm.errorNYI("emitCa

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-09 Thread Andy Kaylor via cfe-commits
@@ -312,8 +329,47 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo, assert(!cir::MissingFeatures::opCallBitcastArg()); cirCallArgs[argNo] = v; } else { - assert(!cir::MissingFeatures::opCallAggregateArgs()); - cgm.errorNYI("emitCa

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-09 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll +// RUN:

  1   2   3   4   5   6   7   8   9   10   >