[clang] [CIR][NFC] Fix LoweringPrepare pass multi lines summary (PR #148826)

2025-07-15 Thread Andy Kaylor via cfe-commits
@@ -73,8 +73,8 @@ def CIRFlattenCFG : Pass<"cir-flatten-cfg"> { } def LoweringPrepare : Pass<"cir-lowering-prepare"> { - let summary = "Lower to more fine-grained CIR operations before lowering to -other dialects"; + let summary = "Lower to more fine-grained CIR operatio

[clang] [CIR] Implement SubOp for ComplexType (PR #148025)

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

[clang] [CIR] Add support for non-virtual base class initialization (PR #148080)

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

[clang] [CIR] Add handlers for 'using enum' and namespace alias (PR #148011)

2025-07-10 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/148011 These decl types don't require any code generation, though when debug info is implemented, we will need to add handling for that. Until then, we just need to have a handler so they don't generate an NYI err

[clang] [CIR] Upstream new SetBitfieldOp for handling C and C++ struct bitfields (PR #147609)

2025-07-10 Thread Andy Kaylor via cfe-commits
@@ -1669,6 +1669,94 @@ def GetGlobalOp : CIR_Op<"get_global", }]; } +//===--===// +// SetBitfieldOp +//===--===// + +def SetBitfieldOp : CI

[clang] [CIR] Emit init of local variables (PR #130164)

2025-07-10 Thread Andy Kaylor via cfe-commits
@@ -105,6 +106,27 @@ class CIRGenFunction : public CIRGenTypeCache { mlir::Value emitAlloca(llvm::StringRef name, mlir::Type ty, mlir::Location loc, clang::CharUnits alignment); +private: + // Track current variable initialization (if there's one) +

[clang] [CIR] Add bit reverse and byte reverse operations (PR #147200)

2025-07-10 Thread Andy Kaylor via cfe-commits
@@ -2661,6 +2661,45 @@ def BitPopcountOp : CIR_BitOpBase<"bit.popcnt", }]; } +def BitReverseOp : CIR_BitOpBase<"bit.reverse", + CIR_UIntOfWidths<[8, 16, 32, 64]>> { + let summary = "Reverse the bit pattern of the operand integer"; + let desc

[clang] [CIR] Upstream new SetBitfieldOp for handling C and C++ struct bitfields (PR #147609)

2025-07-10 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm, apart from my request for an additional test case https://github.com/llvm/llvm-project/pull/147609 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang] [CIR] Upstream new SetBitfieldOp for handling C and C++ struct bitfields (PR #147609)

2025-07-10 Thread Andy Kaylor via cfe-commits
@@ -1669,6 +1669,94 @@ def GetGlobalOp : CIR_Op<"get_global", }]; } +//===--===// +// SetBitfieldOp +//===--===// + +def SetBitfieldOp : CI

[clang] [CIR] Fold ComplexRealOp from ComplexCreateOp (PR #147592)

2025-07-08 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor commented: I'm not sure we want to do this as part of our general canonicalization. It's a good optimization, but I don't think this kind of thing should be happening before the optimization phase. That may be true of most of our folders. I suppose this is a broad

[clang] Propose new ClangIR Maintainer (PR #147365)

2025-07-07 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. I strongly approve! https://github.com/llvm/llvm-project/pull/147365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [cir-translate] Fix crash issue where the data layout string is missing (PR #147209)

2025-07-07 Thread Andy Kaylor via cfe-commits
@@ -82,12 +85,17 @@ llvm::LogicalResult prepareCIRModuleDataLayout(mlir::ModuleOp mod, // Data layout is fully determined by the target triple. Here we only pass the // triple to get the data layout. + llvm::IntrusiveRefCntPtr diagID( + new clang::DiagnosticIDs); +

[clang] [cir-translate] Fix crash issue where the data layout string is missing (PR #147209)

2025-07-07 Thread Andy Kaylor via cfe-commits
@@ -82,12 +85,17 @@ llvm::LogicalResult prepareCIRModuleDataLayout(mlir::ModuleOp mod, // Data layout is fully determined by the target triple. Here we only pass the // triple to get the data layout. + llvm::IntrusiveRefCntPtr diagID( + new clang::DiagnosticIDs); +

[clang] [CIR] Upstream get_bitfield operation to load bit-field members from structs (PR #145971)

2025-06-30 Thread Andy Kaylor via cfe-commits
@@ -65,6 +65,10 @@ struct CIROpAsmDialectInterface : public OpAsmDialectInterface { os << (boolAttr.getValue() ? "true" : "false"); return AliasResult::FinalAlias; } +if (auto bitfield = mlir::dyn_cast(attr)) { andykaylor wrote: Yes, I see

[clang] [CIR] Implement NotEqualOp for ComplexType (PR #146129)

2025-06-27 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > Is there any reason why this is special a operation and not `cmp` operation > parameterized by (ne, eq) as for floats, integers? I like this suggestion. https://github.com/llvm/llvm-project/pull/146129 ___ cfe-commits mailing list

[clang] [mlir] [OpenACC][CIR] Implement 'exit data' construct + clauses (PR #146167)

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

[clang] [CIR] Upstream support for operator assign (PR #145979)

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

[clang] [CIR] Upstream get_bitfield operation to load bit-field members from structs (PR #145971)

2025-06-27 Thread Andy Kaylor via cfe-commits
@@ -76,3 +77,31 @@ void def() { T t; U u; } + +int load_field(S* s) { + return s->c; andykaylor wrote: Can you add a test case with an unsigned field? https://github.com/llvm/llvm-project/pull/145971 ___ cfe-co

[clang] [CIR] Upstream get_bitfield operation to load bit-field members from structs (PR #145971)

2025-06-27 Thread Andy Kaylor via cfe-commits
@@ -2244,6 +2245,54 @@ mlir::LogicalResult CIRToLLVMComplexImagOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMGetBitfieldOpLowering::matchAndRewrite( +cir::GetBitfieldOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewriter &r

[clang] [CIR] Upstream get_bitfield operation to load bit-field members from structs (PR #145971)

2025-06-27 Thread Andy Kaylor via cfe-commits
@@ -65,6 +65,10 @@ struct CIROpAsmDialectInterface : public OpAsmDialectInterface { os << (boolAttr.getValue() ? "true" : "false"); return AliasResult::FinalAlias; } +if (auto bitfield = mlir::dyn_cast(attr)) { andykaylor wrote: Can you ad

[clang] [CIR] Upstream get_bitfield operation to load bit-field members from structs (PR #145971)

2025-06-27 Thread Andy Kaylor via cfe-commits
@@ -2244,6 +2245,54 @@ mlir::LogicalResult CIRToLLVMComplexImagOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMGetBitfieldOpLowering::matchAndRewrite( +cir::GetBitfieldOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewriter &r

[clang] [CIR] Upstream get_bitfield operation to load bit-field members from structs (PR #145971)

2025-06-27 Thread Andy Kaylor via cfe-commits
@@ -326,13 +326,61 @@ mlir::Value CIRGenFunction::emitStoreThroughBitfieldLValue(RValue src, return {}; } +RValue CIRGenFunction::emitLoadOfBitfieldLValue(LValue lv, SourceLocation loc) { + const CIRGenBitFieldInfo &info = lv.getBitFieldInfo(); + + // Get the output type

[clang] [CIR] Upstream get_bitfield operation to load bit-field members from structs (PR #145971)

2025-06-27 Thread Andy Kaylor via cfe-commits
@@ -405,6 +406,16 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { return createGlobal(module, loc, uniqueName, type, linkage); } + + mlir::Value createGetBitfield(mlir::Location loc, mlir::Type resultType, +mlir::Value addr, mli

[clang] [CIR] Upstream get_bitfield operation to load bit-field members from structs (PR #145971)

2025-06-27 Thread Andy Kaylor via cfe-commits
@@ -375,4 +375,42 @@ def CIR_VisibilityAttr : CIR_EnumAttr { }]; } +//===--===// +// BitfieldInfoAttr +//===--===// + +def BitfieldInfoAttr

[clang] [CIR] Upstream get_bitfield operation to load bit-field members from structs (PR #145971)

2025-06-27 Thread Andy Kaylor via cfe-commits
@@ -375,4 +375,42 @@ def CIR_VisibilityAttr : CIR_EnumAttr { }]; } +//===--===// +// BitfieldInfoAttr +//===--===// + +def BitfieldInfoAttr

[clang] [CIR] Upstream support for operator assign (PR #145979)

2025-06-27 Thread Andy Kaylor via cfe-commits
@@ -258,6 +258,30 @@ void CIRGenFunction::emitDelegateCXXConstructorCall( /*Delegating=*/true, thisAddr, delegateArgs, loc); } +void CIRGenFunction::emitImplicitAssignmentOperatorBody(FunctionArgList &args) { + const auto *assignOp = cast(curGD.getDe

[clang] [CIR] Upstream support for operator assign (PR #145979)

2025-06-27 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/145979 >From af4621f2944e84801f425bba3c77313ab625e714 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 16 May 2025 14:14:21 -0700 Subject: [PATCH 1/2] [CIR] Upstream support for operator assign This adds suppo

[clang] [CIR] Upstream support for operator assign (PR #145979)

2025-06-27 Thread Andy Kaylor via cfe-commits
@@ -258,6 +258,30 @@ void CIRGenFunction::emitDelegateCXXConstructorCall( /*Delegating=*/true, thisAddr, delegateArgs, loc); } +void CIRGenFunction::emitImplicitAssignmentOperatorBody(FunctionArgList &args) { + const auto *assignOp = cast(curGD.getDe

[clang] [CIR][NFC] Fix init llvm::ArrayRef warning (PR #146147)

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

[clang] [CIR] Upstream support for operator assign (PR #145979)

2025-06-27 Thread Andy Kaylor via cfe-commits
@@ -258,6 +258,30 @@ void CIRGenFunction::emitDelegateCXXConstructorCall( /*Delegating=*/true, thisAddr, delegateArgs, loc); } +void CIRGenFunction::emitImplicitAssignmentOperatorBody(FunctionArgList &args) { + const auto *assignOp = cast(curGD.getDe

[clang] [CIR] Upstream support for operator assign (PR #145979)

2025-06-27 Thread Andy Kaylor via cfe-commits
@@ -258,6 +258,30 @@ void CIRGenFunction::emitDelegateCXXConstructorCall( /*Delegating=*/true, thisAddr, delegateArgs, loc); } +void CIRGenFunction::emitImplicitAssignmentOperatorBody(FunctionArgList &args) { + const auto *assignOp = cast(curGD.getDe

[clang] [CIR] Add basic support for operator new (PR #145802)

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

[clang] [CIR] Add support for constructor aliases (PR #145792)

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

[clang] [CIR] Add basic support for operator new (PR #145802)

2025-06-26 Thread Andy Kaylor via cfe-commits
@@ -95,6 +95,7 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext, // TODO(CIR): Should be updated once TypeSizeInfoAttr is upstreamed const unsigned sizeTypeSize = astContext.getTypeSize(astContext.getSignedSizeType()); + SizeSizeInBytes = astContext.toCha

[clang] [CIR] Add basic support for operator new (PR #145802)

2025-06-26 Thread Andy Kaylor via cfe-commits
@@ -95,6 +95,7 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext, // TODO(CIR): Should be updated once TypeSizeInfoAttr is upstreamed const unsigned sizeTypeSize = astContext.getTypeSize(astContext.getSignedSizeType()); + SizeSizeInBytes = astContext.toCha

[clang] [CIR] Add basic support for operator new (PR #145802)

2025-06-26 Thread Andy Kaylor via cfe-commits
@@ -66,6 +66,16 @@ struct CIRGenTypeCache { unsigned char PointerSizeInBytes; }; + /// The size and alignment of size_t. + union { +unsigned char SizeSizeInBytes; // sizeof(size_t) andykaylor wrote: It will eventually be used by the array cookie i

[clang] [CIR] Add support for constructor aliases (PR #145792)

2025-06-26 Thread Andy Kaylor via cfe-commits
@@ -888,6 +888,69 @@ void CIRGenModule::updateCompletedType(const TagDecl *td) { genTypes.updateCompletedType(td); } +void CIRGenModule::addReplacement(StringRef name, mlir::Operation *op) { + replacements[name] = op; +} + +void CIRGenModule::replacePointerTypeArgs(cir::Fun

[clang] [CIR] Add support for constructor aliases (PR #145792)

2025-06-26 Thread Andy Kaylor via cfe-commits
@@ -79,17 +79,102 @@ void CIRGenItaniumCXXABI::emitInstanceFunctionProlog(SourceLocation loc, } } +// Find out how to cirgen the complete destructor and constructor +namespace { +enum class StructorCIRGen { Emit, RAUW, Alias, COMDAT }; +} + +static StructorCIRGen getCIRGenT

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

2025-06-26 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. Thanks for the fix. For some reason my compiler (clang 14) doesn't warn about these situations. https://github.com/llvm/llvm-project/pull/145922 ___ cfe-commits mailing list cfe-commits@lists.l

[clang] [CIR] Add support for constructor aliases (PR #145792)

2025-06-25 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/145792 This change adds support for handling the -mconstructor-aliases option in CIR. Aliases are not yet correctly lowered to LLVM IR. That will be implemented in a future change. >From b9fa4c7e927b01bf998380334d

[clang] [OpenACC][CIR] Implement 'modifier-list' lowering (PR #145770)

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

[clang] [CIR][NFC] Sort the 'Misc' section of MissingFeatures (PR #145750)

2025-06-25 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/145750 This sorts the 'Misc' section of the MissingFeatures.h file lexicographically. The goal is to reduce the number of merge conflicts we're having with this file. Currently, we've been adding new entries at the

[clang] [CIR] Add support for function linkage and visibility (PR #145600)

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

[clang] [CIR] Upstream support for builtin_vectorelements (PR #144877)

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

[clang] [CIR] Add support for function linkage and visibility (PR #145600)

2025-06-25 Thread Andy Kaylor via cfe-commits
@@ -1737,25 +1737,51 @@ def GetMemberOp : CIR_Op<"get_member"> { def FuncOp : CIR_Op<"func", [ AutomaticAllocationScope, CallableOpInterface, FunctionOpInterface, + DeclareOpInterfaceMethods, IsolatedFromAbove ]> { let summary = "Declare or define a function"; let

[clang] [CIR] Add support for function linkage and visibility (PR #145600)

2025-06-25 Thread Andy Kaylor via cfe-commits
@@ -1737,25 +1737,51 @@ def GetMemberOp : CIR_Op<"get_member"> { def FuncOp : CIR_Op<"func", [ AutomaticAllocationScope, CallableOpInterface, FunctionOpInterface, + DeclareOpInterfaceMethods, IsolatedFromAbove ]> { let summary = "Declare or define a function"; let

[clang] [CIR] Restore the underscore in dso_local (PR #145551)

2025-06-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/145551 The CIR handling of `dso_local` for globals was upstreamed without the underscore, making it inconsistent with the incubator and LLVM IR. This change restores the underscore. >From f3927e3fd07cad46f183e4341

[clang] [CIR] Fix NYI AAPCS bit-fields by skipping unsupported case (PR #145560)

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

[clang] [CIR] Fix NYI AAPCS bit-fields by skipping unsupported case (PR #145560)

2025-06-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. Thanks for handling this! I have a minor comment, but let's just merge this as is to get the tests passing. https://github.com/llvm/llvm-project/pull/145560 ___ cfe-commits mailing list cfe-co

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

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

[clang] [CIR] Fix NYI AAPCS bit-fields by skipping unsupported case (PR #145560)

2025-06-24 Thread Andy Kaylor via cfe-commits
@@ -778,10 +778,8 @@ void CIRRecordLowering::computeVolatileBitfields() { !cirGenTypes.getCGModule().getCodeGenOpts().AAPCSBitfieldWidth) return; - for ([[maybe_unused]] auto &I : bitFields) { + for ([[maybe_unused]] auto &I : bitFields) andykaylor

[clang] [CIR] Fix NYI AAPCS bit-fields by skipping unsupported case (PR #145560)

2025-06-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/145560 ___ 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-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/144583 >From 79e712f0f3bd9ff64308a8dc30fb48eff2fd1706 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] Upstream BinAssign for ComplexType (PR #144868)

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

[clang] [CIR] Upstream BinAssign for ComplexType (PR #144868)

2025-06-20 Thread Andy Kaylor via cfe-commits
@@ -48,6 +55,48 @@ static const ComplexType *getComplexType(QualType type) { return cast(cast(type)->getValueType()); } +LValue ComplexExprEmitter::emitBinAssignLValue(const BinaryOperator *e, + mlir::Value &value) { + assert(cg

[clang] [CIR] Upstream BinAssign for ComplexType (PR #144868)

2025-06-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/144868 ___ 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-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

  1   2   3   4   5   6   7   8   9   10   >