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

2025-06-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -274,6 +274,12 @@ class AggValueSlot { public: enum IsZeroed_t { IsNotZeroed, IsZeroed }; + /// ignored - Returns an aggregate value slot indicating that the aggregate bcardosolopes wrote: "ignored - " not necessary https://github.com/llvm/llvm-project

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

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

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

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

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

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

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

2025-06-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1533,6 +1533,17 @@ LogicalResult cir::GetMemberOp::verify() { // VecCreateOp //===--===// +OpFoldResult cir::VecCreateOp::fold(FoldAdaptor adaptor) { + auto elements = getElements(); + if (std::any_of(e

[clang] [CIR] Upstream CreateOp for ComplexType with folder (PR #143192)

2025-06-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,81 @@ +#include "CIRGenBuilder.h" +#include "CIRGenFunction.h" + +#include "clang/AST/StmtVisitor.h" + +using namespace clang; +using namespace clang::CIRGen; + +namespace { +class ComplexExprEmitter : public StmtVisitor { + CIRGenFunction &cgf; + CIRGenBuilderTy &bu

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

2025-06-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -77,12 +77,8 @@ void foo() { // CIR: %[[VEC_F:.*]] = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr>, ["f", init] // CIR: %[[VEC_G:.*]] = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr>, ["g", init] // CIR: %[[VEC_H:.*]] = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr>, ["h", ini

[clang] [CIR] Implement folder for VecShuffleOp (PR #143260)

2025-06-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1580,9 +1580,46 @@ OpFoldResult cir::VecExtractOp::fold(FoldAdaptor adaptor) { } //===--===// -// VecShuffle +// VecShuffleOp //===--

[clang] [CIR] Extend VecShuffleOp verifier to catch invalid index (PR #143262)

2025-06-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1599,6 +1599,14 @@ LogicalResult cir::VecShuffleOp::verify() { << " and " << getResult().getType() << " don't match"; } + const uint64_t maxValidIndex = + getVec1().getType().getSize() + getVec2().getType().getSize() - 1; + for (const auto

[clang] [CIR] Implement folder for VecCmpOp (PR #143322)

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

[clang] [CIR][NFS] Add test cases for VecShuffle with -1 index (PR #143304)

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

[clang] [CIR] Extend VecShuffleOp verifier to catch invalid index (PR #143262)

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

[clang] [CIR] Extend VecShuffleOp verifier to catch invalid index (PR #143262)

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

[clang] [CIR] Implement folder for VecShuffleOp (PR #143260)

2025-06-09 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. Thanks for this folder, one nit and good to go https://github.com/llvm/llvm-project/pull/143260 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/

[clang] [Clang][NFC] Adopt simpified `getTrailingObjects` in CIRGenFunctionInfo (PR #143253)

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

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

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

[clang] [CIR] Implement folder for VecShuffleOp (PR #143260)

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

[clang] [Clang][NFC] Adopt simpified `getTrailingObjects` in CIRGenFunctionInfo (PR #143253)

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

[clang] [Clang][NFC] Adopt simpified `getTrailingObjects` in CIRGenFunctionInfo (PR #143253)

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

[clang] [CIR] Add support for using enum constants (PR #143214)

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

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

2025-06-09 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM, with a non-blocking suggestion https://github.com/llvm/llvm-project/pull/143195 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

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

2025-06-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -2231,4 +2231,48 @@ def VecTernaryOp : CIR_Op<"vec.ternary", let hasVerifier = 1; } +//===--===// +// BaseClassAddrOp +//===--===// + +d

[clang] [CIR] Upstream CreateOp for ComplexType with folder (PR #143192)

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

[clang] [CIR] Upstream CreateOp for ComplexType with folder (PR #143192)

2025-06-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1641,6 +1641,34 @@ LogicalResult cir::VecTernaryOp::verify() { return success(); } +//===--===// +// ComplexCreateOp +//===--===// + +L

[clang] [CIR] Upstream CreateOp for ComplexType with folder (PR #143192)

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

[clang] [CIR][NFC] Use actual operand name in adaptor-obtained operands (PR #143028)

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

[clang] [CIR] Defer emitting function definitions (PR #142862)

2025-06-04 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1523,6 +1523,50 @@ cir::FuncOp CIRGenModule::getOrCreateCIRFunction( cir::FuncOp funcOp = createCIRFunction( invalidLoc ? theModule->getLoc() : getLoc(funcDecl->getSourceRange()), mangledName, mlir::cast(funcType), funcDecl); + + if (!dontDefer) { ---

[clang] [CIR] Defer emitting function definitions (PR #142862)

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

[clang] [CIR] Defer emitting function definitions (PR #142862)

2025-06-04 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. Looks good, minor nit https://github.com/llvm/llvm-project/pull/142862 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for derived class declarations (PR #142823)

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

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

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

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

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

[clang] [CIR] Defer definitions of global variables until they are used. (PR #142496)

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

[clang] [CIR] Upstream TernaryOp for VectorType (PR #142393)

2025-06-04 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM (it will be nice to have a folder too in some follow up PR) https://github.com/llvm/llvm-project/pull/142393 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang] [CIR ] Add DLTI dialect support to module attributes (PR #142241)

2025-06-04 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM pending RUN line suggestion by Andy https://github.com/llvm/llvm-project/pull/142241 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[clang] [CIR] Implement folder for VecShuffleDynamicOp (PR #142315)

2025-06-04 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,18 @@ +// RUN: cir-opt %s -cir-canonicalize -o - | FileCheck %s + +!s32i = !cir.int + +module { + cir.func @fold_shuffle_dynamic_vector_op_test() { +%alloca = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr>, ["r", init] +%vec = cir.const #cir.const_vector<[#cir.in

[clang] [CIR] Implement folder for VecShuffleDynamicOp (PR #142315)

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

[clang] [CIR] Implement folder for VecShuffleDynamicOp (PR #142315)

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

[clang] [CIR] Upstream ShuffleOp for VectorType (PR #142288)

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

[clang] [CIR] Upstream ShuffleOp for VectorType (PR #142288)

2025-06-04 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,35 @@ +//===--===// +// +// 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: Apac

[clang] [CIR] Upstream ShuffleOp for VectorType (PR #142288)

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

[clang] [CIR] Skip generation of a continue block when flattening TernaryOp (PR #142165)

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

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

2025-06-04 Thread Bruno Cardoso Lopes via cfe-commits
bcardosolopes wrote: > Why are we representing each member of a union individually but packing > bitfields away in integer fields? As you noticed, we went higher level for unions (kept the other types around) but didn't for bitfields. I don't see it as inconsistent because in my point of view

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

2025-06-04 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM once all comments are address (looks like you did already?) https://github.com/llvm/llvm-project/pull/139827 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang] [CIR][NFC] Fix warning about unhandled type (PR #142059)

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

[clang] [CIR] Upstream converting vector types (PR #142012)

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

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1075,6 +1089,135 @@ void CIRGenModule::emitTentativeDefinition(const VarDecl *d) { emitGlobalVarDefinition(d); } +static bool shouldAssumeDSOLocal(const CIRGenModule &cgm, + cir::CIRGlobalValueInterface gv) { + if (gv.hasLocalLinkage())

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Bruno Cardoso Lopes via cfe-commits
@@ -966,8 +966,7 @@ void CIRToLLVMGlobalOpLowering::setupRegionInitializedLLVMGlobalOp( const bool isConst = false; assert(!cir::MissingFeatures::addressSpace()); const unsigned addrSpace = 0; - assert(!cir::MissingFeatures::opGlobalDSOLocal()); - const bool isDsoLocal

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1075,6 +1089,135 @@ void CIRGenModule::emitTentativeDefinition(const VarDecl *d) { emitGlobalVarDefinition(d); } +static bool shouldAssumeDSOLocal(const CIRGenModule &cgm, + cir::CIRGlobalValueInterface gv) { + if (gv.hasLocalLinkage())

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1021,8 +1020,7 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite( const bool isConst = false; assert(!cir::MissingFeatures::addressSpace()); const unsigned addrSpace = 0; - assert(!cir::MissingFeatures::opGlobalDSOLocal()); - const bool isDsoLocal =

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM, some minor `auto` nits https://github.com/llvm/llvm-project/pull/141973 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/141973 ___ 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 ComplexType (PR #141369)

2025-05-28 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: cir-opt %s -verify-diagnostics -split-input-file + +!s32i = !cir.int bcardosolopes wrote: Seems like you forgot to remove this file https://github.com/llvm/llvm-project/pull/141369 ___ cfe-com

[clang] [CIR] Upstream global initialization for ComplexType (PR #141369)

2025-05-28 Thread Bruno Cardoso Lopes via cfe-commits
@@ -276,4 +276,46 @@ def ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> { }]; } +//===--===// +// ConstComplexAttr +//===---

[clang] [CIR] Update tests for global vars (PR #141854)

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

[clang] [CIR] Streamline creation of mlir::IntegerAttrs using mlir::Builder (PR #141830)

2025-05-28 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM pending comments from other reviewers https://github.com/llvm/llvm-project/pull/141830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] [CIR] Allow use different Int types together in Vec Shift Op (PR #141111)

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

[clang] [CIR] Add alignment support for global, store, and load ops (PR #141163)

2025-05-23 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM, long needed. Thanks for changing the incubator too. https://github.com/llvm/llvm-project/pull/141163 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

2025-05-21 Thread Bruno Cardoso Lopes via cfe-commits
@@ -948,6 +950,165 @@ void CIRGenFunction::emitIgnoredExpr(const Expr *e) { emitLValue(e); } +// Handle the case where the condition is a constant evaluatable simple integer, +// which means we don't have to separately handle the true/false blocks. +static std::optional han

[clang] [CIR] Implement switch case simplify (PR #140649)

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

[clang] Implement CIR switch case simplify with appropriate tests (PR #140649)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
@@ -159,6 +159,107 @@ struct SimplifySelect : public OpRewritePattern { } }; +/// Simplify `cir.switch` operations by folding cascading cases +/// into a single `cir.case` with the `anyof` kind. +/// +/// This pattern identifies cascading cases within a `cir.switch` operati

[clang] Implement CIR switch case simplify with appropriate tests (PR #140649)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
@@ -186,7 +288,7 @@ void CIRSimplifyPass::runOnOperation() { // Collect operations to apply patterns. llvm::SmallVector ops; getOperation()->walk([&](Operation *op) { -if (isa(op)) +if (isa(op)) bcardosolopes wrote: Can you double check if the te

[clang] Implement CIR switch case simplify with appropriate tests (PR #140649)

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

[clang] Implement CIR switch case simplify with appropriate tests (PR #140649)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes commented: Overall looks good, some inline comments. https://github.com/llvm/llvm-project/pull/140649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for iterator-based range for loops (PR #140636)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. Pretty much straightforward - some skeletons with NYI + the actual range for support. LGTM https://github.com/llvm/llvm-project/pull/140636 ___ cfe-commits mailing list cfe-commits@lists.llv

[clang] [CIR][NFC] Eliminate ArgInfo structure (PR #140612)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
@@ -542,8 +542,15 @@ CIRGenTypes::arrangeCIRFunctionInfo(CanQualType returnType, void *insertPos = nullptr; CIRGenFunctionInfo *fi = functionInfos.FindNodeOrInsertPos(id, insertPos); - if (fi) + if (fi) { +// We found a matching function info based on id. These asser

[clang] [CIR][NFC] Eliminate ArgInfo structure (PR #140612)

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

[clang] [CIR] Upstream comparison ops for VectorType (PR #140597)

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

[clang] [CIR] Upstream comparison ops for VectorType (PR #140597)

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

[clang] [CIR] Upstream comparison ops for VectorType (PR #140597)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
@@ -2083,4 +2083,33 @@ def VecExtractOp : CIR_Op<"vec.extract", [Pure, let hasFolder = 1; } +//===--===// +// VecCmpOp +//===--===// + +def

[clang] [CIR] Upstream comparison ops for VectorType (PR #140597)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
@@ -2083,4 +2083,33 @@ def VecExtractOp : CIR_Op<"vec.extract", [Pure, let hasFolder = 1; } +//===--===// +// VecCmpOp +//===--===// + +def

[clang] [CIR] Upstream comparison ops for VectorType (PR #140597)

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

[clang] [CIR] Upstream support for lowering cir.switch to LLVM (PR #140425)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM after you address Andy's nits. https://github.com/llvm/llvm-project/pull/140425 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

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

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

[clang] [CIR] Add support for indirect calls (PR #139748)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM (pending error propagation) https://github.com/llvm/llvm-project/pull/139748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] [CIR] Add support for indirect calls (PR #139748)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1500,6 +1507,14 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter &converter, converter.addConversion([&](cir::BF16Type type) -> mlir::Type { return mlir::BFloat16Type::get(type.getContext()); }); + converter.addConversion([&](cir::FuncType type) -> mlir

[clang] [NFC][OpenACC] Refactor clause emission- (PR #140586)

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

[clang] [OpenACC][CIR] Implement beginning of 'copy' lowering for compute con… (PR #140304)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. > @bcardosolopes : If it is alright, I'd like to just do the OpenACC clause > refactor in a followup patch. I'll work on it 'next', immediately after this > one. I'd originally done the visitor, then realized it needed to be accessed

[clang] [OpenACC][CIR] Implement beginning of 'copy' lowering for compute con… (PR #140304)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
@@ -36,6 +37,76 @@ template constexpr bool isCombinedType = false; template constexpr bool isCombinedType> = true; +namespace { +struct DataOperandInfo { + mlir::Location beginLoc; + mlir::Value varValue; + llvm::StringRef name; + mlir::ValueRange bounds; + + DataOpera

[clang] [CIR] Fix problem with phantom function arguments (PR #140322)

2025-05-16 Thread Bruno Cardoso Lopes via cfe-commits
@@ -112,8 +112,16 @@ class CIRGenFunctionInfo final // NOLINTNEXTLINE(readability-identifier-naming) void Profile(llvm::FoldingSetNodeID &id) { -id.AddBoolean(required.getOpaqueData()); -getReturnType().Profile(id); +// It's unfortunate that we are looping over

[clang] [CIR] Fix problem with phantom function arguments (PR #140322)

2025-05-16 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM. Is there an easy to add a test for this? I understand sometimes it's hard, but just double checking. https://github.com/llvm/llvm-project/pull/140322 ___ cfe-commits mailing list cfe-c

[clang] [OpenACC][CIR] Implement beginning of 'copy' lowering for compute con… (PR #140304)

2025-05-16 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes commented: A question in the comments but otherwise PR looks good: adds boilerplate and initial cases, deferring more work for incremental PRs, way to go. https://github.com/llvm/llvm-project/pull/140304 ___ cfe-commit

[clang] [OpenACC][CIR] Implement beginning of 'copy' lowering for compute con… (PR #140304)

2025-05-16 Thread Bruno Cardoso Lopes via cfe-commits
@@ -36,6 +37,76 @@ template constexpr bool isCombinedType = false; template constexpr bool isCombinedType> = true; +namespace { +struct DataOperandInfo { + mlir::Location beginLoc; + mlir::Value varValue; + llvm::StringRef name; + mlir::ValueRange bounds; + + DataOpera

[clang] [OpenACC][CIR] Implement beginning of 'copy' lowering for compute con… (PR #140304)

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

[clang] [CIR] Upstream support for C++ member function calls (PR #140290)

2025-05-16 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. Some nits / comments, but this LGTM to me: skeleton for member function calls added, errorNYI used for untested paths and some initial support for the more simple cases. https://github.com/llvm/llvm-project/pull/140290 __

[clang] [CIR] Upstream support for C++ member function calls (PR #140290)

2025-05-16 Thread Bruno Cardoso Lopes via cfe-commits
@@ -109,6 +109,14 @@ struct CallArg { class CallArgList : public llvm::SmallVector { public: void add(RValue rvalue, clang::QualType type) { emplace_back(rvalue, type); } + + /// Add all the arguments from another CallArgList to this one. After doing + /// this, the old Cal

[clang] [CIR] Upstream support for C++ member function calls (PR #140290)

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

[clang] [CIR] Upstream support for C++ member function calls (PR #140290)

2025-05-16 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,45 @@ +//===- CirGenCXXABI.cpp - Interface to C++ ABIs ---===// bcardosolopes wrote: `CIRGenCXXABI.cpp` to match the name of the file? (Or I guess none because this isn't required anymore?) https://github.com/llvm/llvm-projec

[clang] [CIR] Upstream support for C++ member function calls (PR #140290)

2025-05-16 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,45 @@ +//===- CirGenCXXABI.cpp - Interface to C++ ABIs ---===// +// +// 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 support for C++ member function calls (PR #140290)

2025-05-16 Thread Bruno Cardoso Lopes via cfe-commits
@@ -76,11 +77,30 @@ static void appendParameterTypes(const CIRGenTypes &cgt, cgt.getCGModule().errorNYI("appendParameterTypes: hasExtParameterInfos"); } +/// Derives the 'this' type for CIRGen purposes, i.e. ignoring method CVR +/// qualification. Either or both of `rd` and

[clang] [CIR][LLVMLowering] Upstream binary operators for VectorType (PR #140099)

2025-05-16 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM after you address Andy's comments https://github.com/llvm/llvm-project/pull/140099 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

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

2025-05-16 Thread Bruno Cardoso Lopes via cfe-commits
@@ -2037,4 +2037,37 @@ def VecExtractOp : CIR_Op<"vec.extract", [Pure, let hasFolder = 1; } + +//===--===// +// VecSplat +//===--===// + +/

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

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

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

2025-05-16 Thread Bruno Cardoso Lopes via cfe-commits
@@ -2037,4 +2037,37 @@ def VecExtractOp : CIR_Op<"vec.extract", [Pure, let hasFolder = 1; } + +//===--===// +// VecSplat +//===--===// + +/

[clang] [CIR] Add support for indirect calls (PR #139748)

2025-05-16 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1500,6 +1507,14 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter &converter, converter.addConversion([&](cir::BF16Type type) -> mlir::Type { return mlir::BFloat16Type::get(type.getContext()); }); + converter.addConversion([&](cir::FuncType type) -> mlir

[clang] [CIR] Add PointerLikeType interface support for cir::PointerType (PR #139768)

2025-05-13 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,160 @@ +//===--===// +// +// 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 PointerLikeType interface support for cir::PointerType (PR #139768)

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

[clang] [CIR] Add support for indirect calls (PR #139748)

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

[clang] [CIR] Add support for indirect calls (PR #139748)

2025-05-13 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1837,16 +1835,24 @@ class CIR_CallOpBase extra_traits = []> // the upstreaming process moves on. The verifiers is also missing for now, // will add in the future. - dag commonArgs = (ins FlatSymbolRefAttr:$callee, -Variadic:$args); + dag comm

[clang] [CIR] Add support for indirect calls (PR #139748)

2025-05-13 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1500,6 +1507,14 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter &converter, converter.addConversion([&](cir::BF16Type type) -> mlir::Type { return mlir::BFloat16Type::get(type.getContext()); }); + converter.addConversion([&](cir::FuncType type) -> mlir

  1   2   3   4   5   6   7   8   9   >