[clang] [CIR] Upstream proper function alias lowering (PR #150520)

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

[clang] [CIR] Upstream Unary Plus & Minus op for ComplexType (PR #150281)

2025-07-29 Thread Andy Kaylor via cfe-commits
@@ -174,6 +185,58 @@ mlir::Value ComplexExprEmitter::emitCast(CastKind ck, Expr *op, return {}; } +mlir::Value ComplexExprEmitter::VisitUnaryPlus(const UnaryOperator *e, + QualType promotionType) { + QualType promotionTy = prom

[clang] [CIR] Upstream support for function-level variable decompositions (PR #151073)

2025-07-29 Thread Andy Kaylor via cfe-commits
@@ -584,6 +584,12 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *e) { return lv; } + if (const auto *bd = dyn_cast(nd)) { +assert(!e->refersToEnclosingVariableOrCapture() && + !cir::MissingFeatures::lambdaCaptures()); andy

[clang] [CIR] Upstream support for variable template specializations (PR #151069)

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

[clang] [CIR] Add support for C++ conversion operators (PR #151066)

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

[clang] [CIR] Add support for array cleanups (PR #150499)

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

[clang] [CIR] Upstream proper function alias lowering (PR #150520)

2025-07-29 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/150520 >From 88039a468792435666e3026b5bf42ad31405d332 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Thu, 24 Jul 2025 13:14:35 -0700 Subject: [PATCH 1/3] [CIR] Upstream proper function alias lowering This change

[clang] [CIR] Add proper handling for no prototype function calls (PR #150553)

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

[clang] [flang] [mlir] [mlir][core] Move `InitAll***` implementation into static library. (PR #150805)

2025-07-28 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. I verified that CIR builds for me also with the latest changes. https://github.com/llvm/llvm-project/pull/150805 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] [CIR] Add proper handling for no prototype function calls (PR #150553)

2025-07-25 Thread Andy Kaylor via cfe-commits
@@ -1729,6 +1783,34 @@ cir::FuncOp CIRGenModule::getOrCreateCIRFunction( invalidLoc ? theModule->getLoc() : getLoc(funcDecl->getSourceRange()), mangledName, mlir::cast(funcType), funcDecl); + // If we already created a function with the same mangled name (but diff

[clang] [CIR] Add support for array cleanups (PR #150499)

2025-07-25 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/150499 >From 13c8a3d27a92808485ed594d7f4f57c3597ee884 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 23 Jul 2025 11:56:44 -0700 Subject: [PATCH 1/2] [CIR] Initial support for array cleanups This adds initial

[clang] [CIR] Add support for array cleanups (PR #150499)

2025-07-25 Thread Andy Kaylor via cfe-commits
@@ -658,10 +693,38 @@ void CIRGenFunction::emitNullabilityCheck(LValue lhs, mlir::Value rhs, /// elements void CIRGenFunction::emitDestroy(Address addr, QualType type, Destroyer *destroyer) { - if (getContext().getAsArrayType(type)) -cgm

[clang] [CIR] Add support for array cleanups (PR #150499)

2025-07-25 Thread Andy Kaylor via cfe-commits
@@ -649,6 +649,41 @@ void CIRGenFunction::emitNullabilityCheck(LValue lhs, mlir::Value rhs, assert(!cir::MissingFeatures::sanitizers()); } +/// Destroys all the elements of the given array, beginning from last to first. +/// The array cannot be zero-length. +/// +/// \param

[clang] [CIR] Implement LValueBitcast for ComplexType (PR #150668)

2025-07-25 Thread Andy Kaylor via cfe-commits
@@ -923,4 +923,129 @@ CIRGenFunction::emitArrayLength(const clang::ArrayType *origArrayType, return builder.getConstInt(*currSrcLoc, SizeTy, countFromCLAs); } +// TODO(cir): most part of this function can be shared between CIRGen andykaylor wrote: ```sugge

[clang] [CIR] Implement LValueBitcast for ComplexType (PR #150668)

2025-07-25 Thread Andy Kaylor via cfe-commits
@@ -923,4 +923,129 @@ CIRGenFunction::emitArrayLength(const clang::ArrayType *origArrayType, return builder.getConstInt(*currSrcLoc, SizeTy, countFromCLAs); } +// TODO(cir): most part of this function can be shared between CIRGen +// and traditional LLVM codegen +void CIRGe

[clang] [CIR] Implement LValueBitcast for ComplexType (PR #150668)

2025-07-25 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. Looks good, with a few nits. https://github.com/llvm/llvm-project/pull/150668 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Implement LValueBitcast for ComplexType (PR #150668)

2025-07-25 Thread Andy Kaylor via cfe-commits
@@ -1208,6 +1208,16 @@ cir::GlobalOp CIRGenModule::getGlobalForStringLiteral(const StringLiteral *s, return gv; } +void CIRGenModule::emitExplicitCastExprType(const ExplicitCastExpr *e, +CIRGenFunction *cgf) { + // Bind VLAs in t

[clang] [CIR] Implement LValueBitcast for ComplexType (PR #150668)

2025-07-25 Thread Andy Kaylor via cfe-commits
@@ -923,4 +923,129 @@ CIRGenFunction::emitArrayLength(const clang::ArrayType *origArrayType, return builder.getConstInt(*currSrcLoc, SizeTy, countFromCLAs); } +// TODO(cir): most part of this function can be shared between CIRGen +// and traditional LLVM codegen +void CIRGe

[clang] [CIR] Implement LValueBitcast for ComplexType (PR #150668)

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

[clang] [CIR] Add support for C++ initializer lists (PR #150681)

2025-07-25 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/150681 This adds basic support for using C++ initializer lists to initialize fields of a record. >From 37662e274d664c34b09b909c62de943913ee2164 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Thu, 24 Jul 2025 18:

[clang] [CIR] Add proper handling for no prototype function calls (PR #150553)

2025-07-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/150553 This adds standard-comforming handling for calls to functions that were declared in C source in the no prototype form. >From 77391e361f5c40baca8974dce31d3d007ac97c4f Mon Sep 17 00:00:00 2001 From: Andy Kaylo

[clang] [CIR] Upstream proper function alias lowering (PR #150520)

2025-07-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/150520 This change implements correct lowering of function aliases to the LLVM dialect. >From 88039a468792435666e3026b5bf42ad31405d332 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Thu, 24 Jul 2025 13:14:35 -070

[clang] [clang][driver] Improve warning message for complex range overrides and GCC incompatibility (PR #149028)

2025-07-24 Thread Andy Kaylor via cfe-commits
andykaylor wrote: I'm not sure the combined warning is necessary. I think just stating that the clang option overrides the GCC option is sufficient since there is no sense in which clang-specific options can be incompatible with GCC if GCC doesn't implement the option. I think we're all in ag

[clang] [CIR] Unblock destructor alias handling (PR #150497)

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

[clang] [CIR] Add support for array cleanups (PR #150499)

2025-07-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/150499 This adds support for array cleanups, including the ArrayDtor op. >From 13c8a3d27a92808485ed594d7f4f57c3597ee884 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 23 Jul 2025 11:56:44 -0700 Subject: [PAT

[clang] [CIR] Unblock destructor alias handling (PR #150497)

2025-07-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/150497 This change removes a stale errorNYI message to allow destructor alias handling. The error message was an artifact of the order in which various parts of the implementation were upstreamed. Now that all the

[clang] [CIR] Add support for normal cleanups (PR #149948)

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

[clang] [CIR] Add support for normal cleanups (PR #149948)

2025-07-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/149948 >From e3119acb922ad93f6a9b66a5067271834726e77d Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Thu, 17 Jul 2025 11:18:57 -0700 Subject: [PATCH 1/2] [CIR] Add support for normal cleanups This change adds bas

[clang] [CIR] Add support for normal cleanups (PR #149948)

2025-07-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/149948 >From 03ed26afb3fd0dc9618b0243daf3b05ece14d95b Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Thu, 17 Jul 2025 11:18:57 -0700 Subject: [PATCH 1/2] [CIR] Add support for normal cleanups This change adds bas

[clang] [CIR] Implement CK_LValueToRValueBitCast for ComplexType (PR #150296)

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

[clang] [CIR] Add folders for bit manipulation operations (PR #150235)

2025-07-24 Thread Andy Kaylor via cfe-commits
@@ -2132,6 +2133,117 @@ LogicalResult cir::ComplexImagPtrOp::verify() { return success(); } +//===--===// +// Bit manipulation operations +//===---

[clang] [CIR] Add folders for bit manipulation operations (PR #150235)

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

[clang] [CIR] Add folders for bit manipulation operations (PR #150235)

2025-07-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm -- thanks for the test updates! https://github.com/llvm/llvm-project/pull/150235 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] [CIR] Add support for array constructors (PR #149142)

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

[clang] [CIR] Add support for array constructors (PR #149142)

2025-07-22 Thread Andy Kaylor via cfe-commits
@@ -311,6 +312,115 @@ void CIRGenFunction::emitInitializerForField(FieldDecl *field, LValue lhs, assert(!cir::MissingFeatures::requiresCleanups()); } +/// Emit a loop to call a particular constructor for each of several members +/// of an array. +/// +/// \param ctor the co

[clang] [CIR] Add support for array constructors (PR #149142)

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

[clang] [CIR] Add support for array constructors (PR #149142)

2025-07-22 Thread Andy Kaylor via cfe-commits
@@ -22,15 +24,97 @@ struct LoweringPreparePass : public LoweringPrepareBase { void runOnOperation() override; void runOnOp(Operation *op); + void lowerArrayCtor(ArrayCtor op); }; } // namespace -void LoweringPreparePass::runOnOp(Operation *op) {} +void LoweringPrep

[clang] [CIR] Add support for array constructors (PR #149142)

2025-07-22 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,93 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir -mmlir --mlir-print-ir-before=cir-lowering-prepare %s -o - 2>&1 | FileCheck --check-prefixes=CIR-BEFORE-LPP %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-u

[clang] [CIR] Add support for array constructors (PR #149142)

2025-07-22 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,93 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir -mmlir --mlir-print-ir-before=cir-lowering-prepare %s -o - 2>&1 | FileCheck --check-prefixes=CIR-BEFORE-LPP %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-u

[clang] [CIR] Add support for array constructors (PR #149142)

2025-07-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm, with one nit remaining and a couple of test requests https://github.com/llvm/llvm-project/pull/149142 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [CIR] Upstream Cast kinds for ComplexType (PR #149717)

2025-07-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm if @xlauko is satisfied. https://github.com/llvm/llvm-project/pull/149717 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for binary operations on bitfield members (PR #149676)

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

[clang] [CIR] Add support for array constructors (PR #149142)

2025-07-21 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,70 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -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

[clang] [CIR] Add complete destructor handling (PR #149552)

2025-07-21 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/149552 >From a129747782cf1bf3ac863cff28757c847f256c00 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 18 Jul 2025 10:32:43 -0700 Subject: [PATCH 1/2] [CIR] Add complete destructor handling The initial impleme

[clang] [CIR][NFC] Replace bool by cir::UnaryOpKind in emitComplexPrePostIncDec (PR #149566)

2025-07-18 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. LGTM We should make this same change in `ScalarExprEmitter::EmitScalarPrePostIncDec` https://github.com/llvm/llvm-project/pull/149566 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[clang] [CIR] Upstream CompoundLiteralExpr for Scalar (PR #148943)

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

[clang] [CIR] Add complete destructor handling (PR #149552)

2025-07-18 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/149552 The initial implementation for emitting destructors emitted the complete destructor body for both D1 and D2 destructors. This change updates the code to have the D1 destructor call the D2 destructor. >From

[clang] [CIR] Add support for array constructors (PR #149142)

2025-07-17 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,70 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -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

[clang] [CIR] Add support for array constructors (PR #149142)

2025-07-17 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,70 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -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

[clang] [CIR] Upstream Unary Inc/Dec for ComplexType (PR #149162)

2025-07-16 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. This looks good, but I'm asking for changes to make the tests more readable. https://github.com/llvm/llvm-project/pull/149162 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://list

[clang] [CIR] Upstream Unary Inc/Dec for ComplexType (PR #149162)

2025-07-16 Thread Andy Kaylor via cfe-commits
@@ -83,8 +83,204 @@ void foo2() { // OGCG: %[[A_REAL:.*]] = load float, ptr %[[A_REAL_PTR]], align 4 // OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[COMPLEX]], i32 0, i32 1 // OGCG: %[[A_IMAG:.*]] = load float, ptr %[[A_IMAG_PTR]], align 4 -//

[clang] [CIR] Upstream Unary Inc/Dec for ComplexType (PR #149162)

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

[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

  1   2   3   4   5   6   7   8   9   10   >