[clang] [CIR] Upstream zero init for global variables (PR #133100)

2025-03-26 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/133100 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream CmpOp (PR #133159)

2025-03-26 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. I don't have anything to add on top of Andy's review. LGTM once those comments are addressed. https://github.com/llvm/llvm-project/pull/133159 ___ cfe-commits mailing list cfe-commits@lists.

[clang] [CIR] Upstream initial function call support (PR #134673)

2025-04-09 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM after few extra nits https://github.com/llvm/llvm-project/pull/134673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream ArraySubscriptExpr for fixed size array (PR #134536)

2025-04-09 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/134536 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream initial function call support (PR #134673)

2025-04-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -304,6 +305,102 @@ RValue CIRGenFunction::emitAnyExpr(const Expr *e) { llvm_unreachable("bad evaluation kind"); } +static cir::FuncOp emitFunctionDeclPointer(CIRGenModule &cgm, GlobalDecl gd) { + assert(!cir::MissingFeatures::weakRefReference()); + return cgm.getAddrOfF

[clang] [CIR] Upstream initial function call support (PR #134673)

2025-04-09 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/134673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream initial function call support (PR #134673)

2025-04-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,17 @@ +// RUN: cir-opt %s | FileCheck %s + bcardosolopes wrote: Not a review item, more like a general "it will be nice comment": `mlir-opt` has a `--verify-roundtrip` flag, which we should add at some point to `cir-opt` to make such testings even mo

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

2025-04-09 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM. Btw I started seeing tons of these in the incubator since my latest macOS update too, will do a round of cleanup there as well https://github.com/llvm/llvm-project/pull/135046 ___ cfe-

[clang] [CIR] Upstream initial function call support (PR #134673)

2025-04-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1342,6 +1342,47 @@ def FuncOp : CIR_Op<"func", [ let hasVerifier = 1; } +//===--===// +// CallOp +//===--===// + +class CIR_CallOpBase

[clang] [CIR] Upstream initial function call support (PR #134673)

2025-04-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -304,6 +305,102 @@ RValue CIRGenFunction::emitAnyExpr(const Expr *e) { llvm_unreachable("bad evaluation kind"); } +static cir::FuncOp emitFunctionDeclPointer(CIRGenModule &cgm, GlobalDecl gd) { + assert(!cir::MissingFeatures::weakRefReference()); + return cgm.getAddrOfF

[clang] [CIR] Upstream initial function call support (PR #134673)

2025-04-09 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/134673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream ArraySubscriptExpr for fixed size array (PR #134536)

2025-04-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -29,8 +29,15 @@ int f[5] = {1, 2}; void func() { int arr[10]; - // CHECK: %[[ARR:.*]] = cir.alloca !cir.array, !cir.ptr>, ["arr"] + + int e = arr[1]; + // CHECK: %[[INIT:.*]] = cir.alloca !s32i, !cir.ptr, ["e", init] + // CHECK: %[[IDX:.*]] = cir.const #cir.int<1>

[clang] [CIR][NFC] Upstream LValueBaseInfo handling (PR #134928)

2025-04-09 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. Ship it! https://github.com/llvm/llvm-project/pull/134928 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream ArraySubscriptExpr for fixed size array (PR #134536)

2025-04-09 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/134536 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for while and do..while loops (PR #133157)

2025-03-28 Thread Bruno Cardoso Lopes via cfe-commits
@@ -759,6 +761,84 @@ def BrCondOp : CIR_Op<"brcond", }]; } +//===--===// +// While & DoWhileOp +//===--===// + +class WhileOpBase : CIR_Op

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-17 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. https://github.com/llvm/llvm-project/pull/131369 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-11 Thread Bruno Cardoso Lopes via cfe-commits
@@ -400,13 +400,126 @@ def VoidPtr : Type< "cir::VoidType::get($_builder.getContext()))"> { } +//===--===// +// StructType +// +// The base type for all RecordDecls. +//===---

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-11 Thread Bruno Cardoso Lopes via cfe-commits
bcardosolopes wrote: > I'm still waiting for input from @bcardosolopes. sorry for the delay, busy week! https://github.com/llvm/llvm-project/pull/135105 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-11 Thread Bruno Cardoso Lopes via cfe-commits
@@ -400,13 +400,126 @@ def VoidPtr : Type< "cir::VoidType::get($_builder.getContext()))"> { } +//===--===// +// StructType +// +// The base type for all RecordDecls. +//===---

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-11 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,116 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-11 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM, really happy to see structs (now "records") landing! https://github.com/llvm/llvm-project/pull/135105 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang] [CIR] Make LLVM & OGCG variables match the same pattern (PR #135427)

2025-04-11 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. Nice! https://github.com/llvm/llvm-project/pull/135427 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream SelectOp and ShiftOp (PR #133405)

2025-04-17 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. https://github.com/llvm/llvm-project/pull/133405 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for record packing and padding (PR #136036)

2025-04-17 Thread Bruno Cardoso Lopes via cfe-commits
@@ -229,4 +229,32 @@ def ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> { }]; } +//===--===// +// RecordLayoutAttr +//===---

[clang] [CIR] Upstream support for record packing and padding (PR #136036)

2025-04-17 Thread Bruno Cardoso Lopes via cfe-commits
@@ -502,6 +502,15 @@ def CIR_RecordType : CIR_Type<"Record", "record", void complete(llvm::ArrayRef members, bool packed, bool isPadded); + + // Utilities for lazily computing and cacheing data layout info. + // FIXME: currently opaque because there's a

[clang] [CIR] Upstream support for record packing and padding (PR #136036)

2025-04-17 Thread Bruno Cardoso Lopes via cfe-commits
@@ -225,17 +235,108 @@ void RecordType::complete(ArrayRef members, bool packed, bool padded) { //===--===// llvm::TypeSize -RecordType::getTypeSizeInBits(const ::mlir::DataLayout &dataLayout, -

[clang] [CIR] Upstream support for record packing and padding (PR #136036)

2025-04-17 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM once @xlauko is happy https://github.com/llvm/llvm-project/pull/136036 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for record packing and padding (PR #136036)

2025-04-17 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/136036 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream SelectOp and ShiftOp (PR #133405)

2025-04-17 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1294,6 +1296,90 @@ mlir::LogicalResult CIRToLLVMCmpOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMShiftOpLowering::matchAndRewrite( +cir::ShiftOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewriter &rewriter) const { +

[clang] [CIR] Upstream support for accessing structure members (PR #136383)

2025-04-22 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1310,6 +1310,70 @@ def GetGlobalOp : CIR_Op<"get_global", let hasVerifier = 0; } +//===--===// +// GetMemberOp +//===--===// + +def Get

[clang] [CIR] Introduce type aliases for records (PR #136387)

2025-04-22 Thread Bruno Cardoso Lopes via cfe-commits
bcardosolopes wrote: > I think we should just make them illegal. sounds good to me https://github.com/llvm/llvm-project/pull/136387 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream global initialization for VectorType (PR #137511)

2025-04-28 Thread Bruno Cardoso Lopes via cfe-commits
@@ -215,6 +215,37 @@ def ConstArrayAttr : CIR_Attr<"ConstArray", "const_array", [TypedAttrInterface]> }]; } +//===--===// +// ConstVectorAttr +//===--

[clang] Upstream enum support (PR #136807)

2025-04-23 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes commented: Title should start with `[CIR] ...`, more comments inline https://github.com/llvm/llvm-project/pull/136807 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[clang] [CIR] Introduce type aliases for records (PR #136387)

2025-04-23 Thread Bruno Cardoso Lopes via cfe-commits
bcardosolopes wrote: > It generates anonymous records for vtables and typeinfo oh right, that was it! thanks for double checking https://github.com/llvm/llvm-project/pull/136387 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llv

[clang] Upstream enum support (PR #136807)

2025-04-23 Thread Bruno Cardoso Lopes via cfe-commits
@@ -617,6 +617,9 @@ void CIRGenModule::emitTopLevelDecl(Decl *decl) { case Decl::OpenACCDeclare: emitGlobalOpenACCDecl(cast(decl)); break; + case Decl::Enum: +assert(!cir::MissingFeatures::generateDebugInfo() && "NYI"); bcardosolopes wrote: `ass

[clang] [CIR] Upstream cir.call with scalar arguments (PR #136810)

2025-04-23 Thread Bruno Cardoso Lopes via cfe-commits
@@ -68,20 +168,70 @@ static cir::CIRCallOpInterface emitCallLikeOp(CIRGenFunction &cgf, assert(builder.getInsertionBlock() && "expected valid basic block"); assert(!cir::MissingFeatures::opCallIndirect()); - return builder.createCallOp(callLoc, directFuncOp); + return b

[clang] [CIR] Upstream cir.call with scalar arguments (PR #136810)

2025-04-23 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1496,6 +1496,10 @@ def FuncOp : CIR_Op<"func", [ return getFunctionType().getReturnTypes(); } +// TODO(cir): this should be an operand attribute, but for now we just hard- +// wire this as a function. Will later add a $no_proto argument to this op. +

[clang] [CIR] Create CIR_TypedAttr common class (PR #136852)

2025-04-23 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. https://github.com/llvm/llvm-project/pull/136852 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Upstream enum support (PR #136807)

2025-04-23 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/136807 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream enum support (PR #136807)

2025-04-24 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/136807 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenACC][CIR] Start work to lower 'loop' (PR #137972)

2025-04-30 Thread Bruno Cardoso Lopes via cfe-commits
bcardosolopes wrote: > In the future, we'll have to teach the OpenACC dialect how to derive the > upperbound, lowerbound, and step from the cir.for loop Yea, even better if the `cir.for` representation can itself be improved to expose that information (either by transforming it into a more ref

[clang] [CIR] Upstream ArraySubscriptExpr from function parameter with pointer base (PR #135493)

2025-04-14 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes commented: Nothing to add after Andy comments are addressed https://github.com/llvm/llvm-project/pull/135493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co

[clang] [CIR] cir.call with scalar return type (PR #135552)

2025-04-14 Thread Bruno Cardoso Lopes via cfe-commits
@@ -515,9 +519,32 @@ verifyCallCommInSymbolUses(mlir::Operation *op, return op->emitOpError() << "'" << fnAttr.getValue() << "' does not reference a valid function"; - // TODO(cir): verify function arguments and return type + auto callIf = dy

[clang] [CIR] cir.call with scalar return type (PR #135552)

2025-04-14 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,89 @@ +//==-- ABIArgInfo.h - Abstract info regarding ABI-specific arguments ---==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [CIR] cir.call with scalar return type (PR #135552)

2025-04-14 Thread Bruno Cardoso Lopes via cfe-commits
@@ -18,9 +18,12 @@ using namespace clang; using namespace clang::CIRGen; -CIRGenFunctionInfo *CIRGenFunctionInfo::create() { - // For now we just create an empty CIRGenFunctionInfo. - CIRGenFunctionInfo *fi = new CIRGenFunctionInfo(); +CIRGenFunctionInfo *CIRGenFunctionInfo:

[clang] [CIR] cir.call with scalar return type (PR #135552)

2025-04-14 Thread Bruno Cardoso Lopes via cfe-commits
@@ -87,9 +110,48 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo, assert(!cir::MissingFeatures::opCallMustTail()); assert(!cir::MissingFeatures::opCallReturn()); - // For now we just return nothing because we don't have support for return - // valu

[clang] [CIR] Upstream SelectOp and ShiftOp (PR #133405)

2025-04-14 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1294,6 +1296,90 @@ mlir::LogicalResult CIRToLLVMCmpOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMShiftOpLowering::matchAndRewrite( +cir::ShiftOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewriter &rewriter) const { +

[clang] [CIR] Upstream ArraySubscriptExpr from function parameter with pointer base (PR #135493)

2025-04-14 Thread Bruno Cardoso Lopes via cfe-commits
@@ -350,20 +350,87 @@ void func7() { // OGCG: %[[ARR:.*]] = alloca [1 x ptr], align 8 // OGCG: call void @llvm.memset.p0.i64(ptr align 8 %[[ARR]], i8 0, i64 8, i1 false) -void func8(int p[10]) {} -// CIR: cir.func @func8(%arg0: !cir.ptr -// CIR: cir.alloca !cir.ptr, !cir.ptr>

[clang] [CIR] Upstream minimal support for structure types (PR #135105)

2025-04-14 Thread Bruno Cardoso Lopes via cfe-commits
@@ -67,6 +72,166 @@ void CIRDialect::printType(Type type, DialectAsmPrinter &os) const { llvm::report_fatal_error("printer is missing a handler for this type"); } +//===--===// +// RecordType Definitions +/

[clang] [CIR] Upstream enum support (PR #136807)

2025-04-30 Thread Bruno Cardoso Lopes via cfe-commits
@@ -399,6 +399,14 @@ mlir::Type CIRGenTypes::convertType(QualType type) { break; } + case Type::Enum: { +const EnumDecl *ED = cast(ty)->getDecl(); +if (ED->isCompleteDefinition() || ED->isFixed()) + return convertType(ED->getIntegerType());

[clang] [CIR] Upstream support for switch statements case kinds (PR #138003)

2025-04-30 Thread Bruno Cardoso Lopes via cfe-commits
@@ -428,6 +429,52 @@ mlir::LogicalResult CIRGenFunction::emitBreakStmt(const clang::BreakStmt &s) { return mlir::success(); } +const CaseStmt *CIRGenFunction::foldCaseStmt(const clang::CaseStmt &s, + mlir::Type condType, +

[clang] [CIR] Upstream support for switch statements case kinds (PR #138003)

2025-04-30 Thread Bruno Cardoso Lopes via cfe-commits
@@ -428,6 +429,52 @@ mlir::LogicalResult CIRGenFunction::emitBreakStmt(const clang::BreakStmt &s) { return mlir::success(); } +const CaseStmt *CIRGenFunction::foldCaseStmt(const clang::CaseStmt &s, + mlir::Type condType, +

[clang] [CIR] Upstream enum support (PR #136807)

2025-05-06 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/136807 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [mlir] [OpenACC] Implement tile/collapse lowering (PR #138576)

2025-05-06 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. https://github.com/llvm/llvm-project/pull/138576 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [mlir] [OpenACC] Implement tile/collapse lowering (PR #138576)

2025-05-06 Thread Bruno Cardoso Lopes via cfe-commits
@@ -82,6 +83,17 @@ class OpenACCClauseCIREmitter final return conversionOp.getResult(0); } + mlir::Value createConstantInt(mlir::Location loc, unsigned width, +int64_t value) { +mlir::IntegerType ty = mlir::IntegerType::get( +

[clang] [mlir] [OpenACC] Implement tile/collapse lowering (PR #138576)

2025-05-06 Thread Bruno Cardoso Lopes via cfe-commits
@@ -82,6 +83,17 @@ class OpenACCClauseCIREmitter final return conversionOp.getResult(0); } + mlir::Value createConstantInt(mlir::Location loc, unsigned width, +int64_t value) { +mlir::IntegerType ty = mlir::IntegerType::get( +

[clang] [CIR] Add cir-simplify pass (PR #138317)

2025-05-06 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes commented: LGTM with minor tip: can you also add a source to CIR test that guarantee this kicks in from the driver? https://github.com/llvm/llvm-project/pull/138317 ___ cfe-commits mailing list cfe-commits@lists.llvm.

[clang] [CIR] Unblock simple C++ structure support (PR #138368)

2025-05-06 Thread Bruno Cardoso Lopes via cfe-commits
@@ -365,10 +365,15 @@ mlir::Attribute ConstantEmitter::tryEmitPrivateForVarInit(const VarDecl &d) { if (!d.hasLocalStorage()) { QualType ty = cgm.getASTContext().getBaseElementType(d.getType()); if (ty->isRecordType()) - if (d.getInit() && isa(d.getInit())) { -

[clang] [CIR] Unblock simple C++ structure support (PR #138368)

2025-05-06 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/138368 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream extract op for VectorType (PR #138413)

2025-05-06 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes commented: Overall looks good. While here, can you please implement a folder for this operation? It should kick-in if both idx and input vector are constants. https://github.com/llvm/llvm-project/pull/138413 ___ cfe-co

[clang] [CIR] Add cir-simplify pass (PR #138317)

2025-05-06 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,184 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [CIR] Add cir-simplify pass (PR #138317)

2025-05-06 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/138317 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream cir.call with scalar arguments (PR #136810)

2025-04-24 Thread Bruno Cardoso Lopes via cfe-commits
@@ -21,9 +21,24 @@ let cppNamespace = "::cir" in { // The CIRCallOpInterface must be used instead of CallOpInterface when looking // at arguments and other bits of CallOp. This creates a level of abstraction // that's useful for handling indirect calls and other details.

[clang] Upstream enum support (PR #136807)

2025-04-23 Thread Bruno Cardoso Lopes via cfe-commits
@@ -253,3 +253,8 @@ size_type max_size(void) { // OGCG: define{{.*}} i64 @max_size() // OGCG: ret i64 2305843009213693951 + +enum { + um = 0, + dois = 1, +}; bcardosolopes wrote: You should add equivalent filecheck CHECK like lines here and in the other t

[clang] [CIR] Upstream cir.call with scalar arguments (PR #136810)

2025-04-24 Thread Bruno Cardoso Lopes via cfe-commits
@@ -18,22 +18,118 @@ using namespace clang; using namespace clang::CIRGen; -CIRGenFunctionInfo *CIRGenFunctionInfo::create(CanQualType resultType) { - void *buffer = operator new(totalSizeToAlloc(1)); +CIRGenFunctionInfo * +CIRGenFunctionInfo::create(CanQualType resultType, +

[clang] [CIR] Upstream cir.call with scalar arguments (PR #136810)

2025-04-24 Thread Bruno Cardoso Lopes via cfe-commits
@@ -68,20 +168,70 @@ static cir::CIRCallOpInterface emitCallLikeOp(CIRGenFunction &cgf, assert(builder.getInsertionBlock() && "expected valid basic block"); assert(!cir::MissingFeatures::opCallIndirect()); - return builder.createCallOp(callLoc, directFuncOp); + return b

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-24 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. I don't have anything to say that wasn't covered, LGTM once Andy is happy! https://github.com/llvm/llvm-project/pull/136854 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang] [mlir] [OpenACC][NFCI] Implement 'helpers' for all of the clauses I've used so far (PR #137396)

2025-04-25 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. https://github.com/llvm/llvm-project/pull/137396 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream ArraySubscriptExpr from function parameter with pointer base (PR #135493)

2025-04-15 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. https://github.com/llvm/llvm-project/pull/135493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] cir.call with scalar return type (PR #135552)

2025-04-15 Thread Bruno Cardoso Lopes via cfe-commits
@@ -29,13 +32,29 @@ CIRGenCallee CIRGenCallee::prepareConcreteCallee(CIRGenFunction &cgf) const { return *this; } -static const CIRGenFunctionInfo &arrangeFreeFunctionLikeCall(CIRGenTypes &cgt) { +static const CIRGenFunctionInfo & +arrangeFreeFunctionLikeCall(CIRGenTypes &

[clang] [CIR] cir.call with scalar return type (PR #135552)

2025-04-15 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM, pending if Andy has any other followup https://github.com/llvm/llvm-project/pull/135552 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[clang] [CIR] cir.call with scalar return type (PR #135552)

2025-04-15 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/135552 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream ArraySubscriptExpr from function parameter with pointer base (PR #135493)

2025-04-14 Thread Bruno Cardoso Lopes via cfe-commits
@@ -350,20 +350,87 @@ void func7() { // OGCG: %[[ARR:.*]] = alloca [1 x ptr], align 8 // OGCG: call void @llvm.memset.p0.i64(ptr align 8 %[[ARR]], i8 0, i64 8, i1 false) -void func8(int p[10]) {} -// CIR: cir.func @func8(%arg0: !cir.ptr -// CIR: cir.alloca !cir.ptr, !cir.ptr>

[clang] [CIR] cir.call with scalar return type (PR #135552)

2025-04-15 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,50 @@ +#include "TargetInfo.h" +#include "ABIInfo.h" +#include "CIRGenFunctionInfo.h" +#include "clang/CIR/MissingFeatures.h" + +using namespace clang; +using namespace clang::CIRGen; + +static bool testIfIsVoidTy(QualType ty) { + const auto *builtinTy = ty->getAs(); +

[clang] [CIR] Upstream initial support for complete record types (PR #135844)

2025-04-15 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/135844 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream initial support for complete record types (PR #135844)

2025-04-15 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM with minor nit https://github.com/llvm/llvm-project/pull/135844 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream initial support for complete record types (PR #135844)

2025-04-15 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,222 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [CIR] Upstream initial support for complete record types (PR #135844)

2025-04-15 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/135844 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for record packing and padding (PR #136036)

2025-04-18 Thread Bruno Cardoso Lopes via cfe-commits
@@ -225,17 +235,108 @@ void RecordType::complete(ArrayRef members, bool packed, bool padded) { //===--===// llvm::TypeSize -RecordType::getTypeSizeInBits(const ::mlir::DataLayout &dataLayout, -

[clang] [CIR] Upstream support for record packing and padding (PR #136036)

2025-04-18 Thread Bruno Cardoso Lopes via cfe-commits
@@ -502,6 +502,15 @@ def CIR_RecordType : CIR_Type<"Record", "record", void complete(llvm::ArrayRef members, bool packed, bool isPadded); + + // Utilities for lazily computing and cacheing data layout info. + // FIXME: currently opaque because there's a

[clang] [OpenACC][CIR] Lower 'num_workers' for parallel/kernels (PR #136578)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. Minor nit, but LGTM otherwise https://github.com/llvm/llvm-project/pull/136578 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

[clang] [OpenACC][CIR] Lower 'num_workers' for parallel/kernels (PR #136578)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/136578 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenACC][CIR] Lower 'num_workers' for parallel/kernels (PR #136578)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
@@ -136,6 +154,51 @@ class OpenACCClauseCIREmitter final if (!clause.getArchitectures().empty()) operation.setDeviceType( decodeDeviceType(clause.getArchitectures()[0].getIdentifierInfo())); +} else if constexpr (isOneOfTypes) { + // Nothing

[clang] [CIR] Upstream support for accessing structure members (PR #136383)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1310,6 +1310,70 @@ def GetGlobalOp : CIR_Op<"get_global", let hasVerifier = 0; } +//===--===// +// GetMemberOp +//===--===// + +def Get

[clang] [CIR] Upstream support for accessing structure members (PR #136383)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
@@ -309,6 +309,37 @@ RecordType::computeStructAlignment(const mlir::DataLayout &dataLayout) const { return recordAlignment; } +uint64_t RecordType::getElementOffset(const ::mlir::DataLayout &dataLayout, + unsigned idx) const { + assert(

[clang] [CIR] Upstream support for accessing structure members (PR #136383)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM pending discussion/comments https://github.com/llvm/llvm-project/pull/136383 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] [CIR] Introduce type aliases for records (PR #136387)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
bcardosolopes wrote: > I question stealing ty as the prefix to this instead of rt (or something more > specific to records), but I'm not sure I feel particularly strongly. Just it > seems that ty is going to be pretty meaningless perhaps? Good point, `rec` or `rt` probably make more sense. I'm

[clang] [CIR] Introduce type aliases for records (PR #136387)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM pending `ty_anon` test mentioned by Erich https://github.com/llvm/llvm-project/pull/136387 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/

[clang] [CIR] Upstream StackSave and StackRestoreOp (PR #136426)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1419,6 +1419,48 @@ def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> { }]>]; } +//===--===// +// StackSave & StackRestoreOp +//===---

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

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes closed https://github.com/llvm/llvm-project/pull/136431 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream StackSave and StackRestoreOp (PR #136426)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. The PR looks good overall, it adds the operation, tests for parsing/printing + LLVM lowering, leaving CIRGen to support to be done incrementally. LGTM once the operation names are used consistently. https://github.com/llvm/llvm-proje

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

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/136431 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream initial support for fixed size VectorType (PR #136488)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
@@ -530,7 +567,7 @@ def CIRRecordType : Type< //===--===// def CIR_AnyType : AnyTypeOf<[ - CIR_VoidType, CIR_BoolType, CIR_ArrayType, CIR_IntType, CIR_AnyFloat, + CIR_VoidType, CIR_BoolType, CIR_ArrayType,

[clang] [CIR] Upstream initial support for fixed size VectorType (PR #136488)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
@@ -637,6 +637,41 @@ ArrayType::getABIAlignment(const ::mlir::DataLayout &dataLayout, return dataLayout.getTypeABIAlignment(getEltType()); } +//===--===// +// VectorType Definitions +//===--

[clang] [CIR] Upstream initial support for fixed size VectorType (PR #136488)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
@@ -307,6 +307,26 @@ def CIR_ArrayType : CIR_Type<"Array", "array", }]; } +//===--===// +// VectorType (fixed size) +//===--===// + +def CI

[clang] [CIR] Upstream initial support for fixed size VectorType (PR #136488)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
@@ -307,6 +307,26 @@ def CIR_ArrayType : CIR_Type<"Array", "array", }]; } +//===--===// +// VectorType (fixed size) +//===--===// + +def CI

[clang] [CIR] Upstream initial support for fixed size VectorType (PR #136488)

2025-04-21 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/136488 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream global variable linkage types (PR #129072)

2025-02-28 Thread Bruno Cardoso Lopes via cfe-commits
@@ -210,6 +223,193 @@ void CIRGenModule::emitGlobalDefinition(clang::GlobalDecl gd, llvm_unreachable("Invalid argument to CIRGenModule::emitGlobalDefinition"); } +static bool shouldBeInCOMDAT(CIRGenModule &cgm, const Decl &d) { + assert(!cir::MissingFeatures::supportComdat

[clang] [CIR] Upstream global variable linkage types (PR #129072)

2025-02-28 Thread Bruno Cardoso Lopes via cfe-commits
@@ -210,6 +223,193 @@ void CIRGenModule::emitGlobalDefinition(clang::GlobalDecl gd, llvm_unreachable("Invalid argument to CIRGenModule::emitGlobalDefinition"); } +static bool shouldBeInCOMDAT(CIRGenModule &cgm, const Decl &d) { + assert(!cir::MissingFeatures::supportComdat

[clang] [CIR] Upstream floating point literal expressions (PR #129304)

2025-02-28 Thread Bruno Cardoso Lopes via cfe-commits
@@ -57,3 +57,15 @@ bool boolfunc() { return true; } // CHECK: %0 = cir.const #true // CHECK: cir.return %0 : !cir.bool // CHECK: } + +float floatfunc() { return 42.42f; } +// CHECK: cir.func @floatfunc() -> !cir.float { +// CHECK: %0 = cir.const #cir.fp<4.242000e+01> : !c

<    2   3   4   5   6   7   8   9   10   >