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

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

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

2025-03-02 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM after any extra feedback on format https://github.com/llvm/llvm-project/pull/129304 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [CIR] Upstream basic alloca and load support (PR #128792)

2025-02-27 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM if Erich has no further comments https://github.com/llvm/llvm-project/pull/128792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

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

2025-02-27 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,119 @@ +//===- CIROpsEnumsDialect.h - MLIR Dialect for CIR --*- C++ bcardosolopes wrote: TIL https://github.com/llvm/llvm-project/pull/129072 ___ cfe-commits mailing list cfe-commits@list

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

2025-02-27 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes commented: Great to see this PR Morris! You should also add CIR <-> CIR tests for the linkage types, incubator has some of them. https://github.com/llvm/llvm-project/pull/129072 ___ cfe-commits mailing list cfe-commits

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

2025-02-27 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,11 @@ +// Linkage types of global variables +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o - | FileCheck %s + +int ; bcardosolopes wrote: This new tests uses_this_convention and while the existing-uses-t

[clang] [CIR] Disable gcc partially overloaded virtual warning (PR #130322)

2025-03-07 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM, same observation as Erich regarding CMAKE stuff tho https://github.com/llvm/llvm-project/pull/130322 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[clang] [CIR] Upstream initial support for CIR flattening (PR #130648)

2025-03-10 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/130648 ___ 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 CIR flattening (PR #130648)

2025-03-10 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/130648 ___ 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 CIR flattening (PR #130648)

2025-03-10 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,114 @@ +//===--===// +// +// 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 CIR flattening (PR #130648)

2025-03-11 Thread Bruno Cardoso Lopes via cfe-commits
@@ -428,6 +428,46 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// BrOp +//===--===// + +def BrOp : CIR_Op<"br",

[clang] [CIR] Upstream basic support for ArrayType (PR #130502)

2025-03-11 Thread Bruno Cardoso Lopes via cfe-commits
@@ -280,6 +280,25 @@ def CIR_BoolType : }]; } +//===--===// +// ArrayType +//===--===// + +def CIR_ArrayType : CIR_Type<"Array", "array", +

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

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

[clang] [CIR] Upstream basic alloca and load support (PR #128792)

2025-02-27 Thread Bruno Cardoso Lopes via cfe-commits
@@ -117,6 +117,24 @@ static void printOmittedTerminatorRegion(mlir::OpAsmPrinter &printer, /*printBlockTerminators=*/!omitRegionTerm(region)); } +//===--===// +// AllocaOp +//===

[clang] [CIR] Upstream basic alloca and load support (PR #128792)

2025-02-27 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,82 @@ +//===--===// +// +// 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 CastOp and scalar conversions (PR #130690)

2025-03-13 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM pending on question left in one comment https://github.com/llvm/llvm-project/pull/130690 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

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

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-13 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,58 @@ +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir bcardosolopes wrote: Has this been addressed? https://github.com/llvm/llvm-project/pull/130690 ___ cfe

[clang] [CIR] Add cir-translate and cir-lsp-server tools (PR #131181)

2025-03-13 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,166 @@ +//===--===// +// +// 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] [clang][CIR] Add missing dependency on MLIR headers (PR #131057)

2025-03-13 Thread Bruno Cardoso Lopes via cfe-commits
@@ -11,6 +11,9 @@ add_clang_library(clangCIRFrontendAction DEPENDS MLIRCIROpsIncGen MLIRCIROpInterfacesIncGen + # Add mlir-generic-headers dependency as the header CIRGenAction.h needs to + # include BuiltinOps.h + mlir-generic-headers bcardosolopes wr

[clang] [CIR] Upstream support for emitting ignored statements (PR #130869)

2025-03-12 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1,7 +1,9 @@ // 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 global variable linkage types (PR #129072)

2025-03-05 Thread Bruno Cardoso Lopes via cfe-commits
bcardosolopes wrote: Looks like ready to land, @mmha do you have landing permission? https://github.com/llvm/llvm-project/pull/129072 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for emitting ignored statements (PR #130869)

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

[clang] [CIR] Upstream support for emitting ignored statements (PR #130869)

2025-03-12 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,53 @@ +// 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 support for emitting ignored statements (PR #130869)

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

[clang] [CIR] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-21 Thread Bruno Cardoso Lopes via cfe-commits
@@ -2958,8 +2958,13 @@ defm clangir : BoolFOption<"clangir", BothFlags<[], [ClangOption, CC1Option], "">>; def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>, Group, HelpText<"Build ASTs and then lower to ClangIR">; -def emit_core_mlir : Flag<["-"]

[clang] [CIR] Add cir-opt tool to exercise CIR dialect parsing (PR #128254)

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

[clang] [CIR] Better handling of `void` function return (PR #128089)

2025-02-24 Thread Bruno Cardoso Lopes via cfe-commits
@@ -331,9 +335,38 @@ FuncType FuncType::clone(TypeRange inputs, TypeRange results) const { return get(llvm::to_vector(inputs), results[0], isVarArg()); } -mlir::ParseResult parseFuncTypeArgs(mlir::AsmParser &p, -llvm::SmallVector ¶ms, -

[clang] [CIR] Better handling of `void` function return (PR #128089)

2025-02-24 Thread Bruno Cardoso Lopes via cfe-commits
bcardosolopes wrote: Thanks for the update @dkolsen-pgi, reviewing the incubator change today https://github.com/llvm/llvm-project/pull/128089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] [CIR] Better handling of `void` function return (PR #128089)

2025-02-24 Thread Bruno Cardoso Lopes via cfe-commits
@@ -273,29 +273,36 @@ def CIR_PointerType : CIR_Type<"Pointer", "ptr", def CIR_FuncType : CIR_Type<"Func", "func"> { let summary = "CIR function type"; let description = [{ -The `!cir.func` is a function type. It consists of a single return type, a -list of paramete

[clang] [CIR] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-24 Thread Bruno Cardoso Lopes via cfe-commits
@@ -2958,8 +2958,13 @@ defm clangir : BoolFOption<"clangir", BothFlags<[], [ClangOption, CC1Option], "">>; def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>, Group, HelpText<"Build ASTs and then lower to ClangIR">; -def emit_core_mlir : Flag<["-"]

[clang] [CIR] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-24 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM once remaining comments from others are addressed. https://github.com/llvm/llvm-project/pull/127835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [CIR] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-20 Thread Bruno Cardoso Lopes via cfe-commits
@@ -2958,6 +2958,8 @@ defm clangir : BoolFOption<"clangir", BothFlags<[], [ClangOption, CC1Option], "">>; def emit_cir : Flag<["-"], "emit-cir">, Visibility<[ClangOption, CC1Option]>, Group, HelpText<"Build ASTs and then lower to ClangIR">; +def emit_cir_mlir : Flag<["-"],

[clang] [CIR] Upstream basic alloca and load support (PR #128792)

2025-02-26 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,82 @@ +//===--===// +// +// 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 basic alloca and load support (PR #128792)

2025-02-26 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,82 @@ +//===--===// +// +// 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] Function type return type improvements (PR #128787)

2025-02-26 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM after applying @erichkeane reviews and @xlauko tablegen suggestion https://github.com/llvm/llvm-project/pull/128787 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] [CIR] Upstream basic alloca and load support (PR #128792)

2025-02-26 Thread Bruno Cardoso Lopes via cfe-commits
@@ -115,6 +115,149 @@ def ConstantOp : CIR_Op<"const", let hasFolder = 1; } +//===--===// +// AllocaOp +//===--===// + +class AllocaTypesMa

[clang] [CIR] Upstream type `bool` (PR #128601)

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

[clang] [CIR][Upstream] Local initialization for ArrayType (PR #132974)

2025-03-28 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. I don't have anything else to add, LGTM! https://github.com/llvm/llvm-project/pull/132974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

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

2025-03-28 Thread Bruno Cardoso Lopes via cfe-commits
@@ -710,6 +710,89 @@ class ScalarExprEmitter : public StmtVisitor { HANDLEBINOP(Xor) HANDLEBINOP(Or) #undef HANDLEBINOP + + mlir::Value emitCmp(const BinaryOperator *e) { +mlir::Value result; +QualType lhsTy = e->getLHS()->getType(); +QualType rhsTy = e->getRH

[clang] [CIR][Upstream] Local initialization for ArrayType (PR #132974)

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

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

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

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

2025-03-28 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. Thanks for the updates, LGTM! 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-comm

[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 SelectOp and ShiftOp (PR #133405)

2025-03-28 Thread Bruno Cardoso Lopes via cfe-commits
@@ -759,6 +762,46 @@ LogicalResult cir::BinOp::verify() { return mlir::success(); } +//===--===// +// ShiftOp +//===--===// +LogicalResult

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

2025-03-28 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1117,6 +1117,91 @@ mlir::LogicalResult CIRToLLVMBinOpLowering::matchAndRewrite( return mlir::LogicalResult::success(); } +mlir::LogicalResult CIRToLLVMShiftOpLowering::matchAndRewrite( +cir::ShiftOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewriter &rewrit

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

2025-03-28 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited 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 SelectOp and ShiftOp (PR #133405)

2025-03-29 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes requested changes to this pull request. Looks reasonable to add vector support later for shifts. Because `SelectOp` is independent of `ShiftOp`, one possibility would have been to split it in two PRs to land them faster, but wouldn't bother changing for this rou

[clang] [CIR] Upstream support for promoted types with unary plus/minus (PR #133829)

2025-04-03 Thread Bruno Cardoso Lopes via cfe-commits
@@ -405,3 +405,45 @@ float fpPostInc2() { // OGCG: store float %[[A_INC]], ptr %[[A]], align 4 // OGCG: store float %[[A_LOAD]], ptr %[[B]], align 4 // OGCG: %[[B_TO_OUTPUT:.*]] = load float, ptr %[[B]], align 4 + +_Float16 fp16UPlus(_Float16 f) { + return +f; +} + +// C

[clang] [CIR] Upstream support for promoted types with unary plus/minus (PR #133829)

2025-04-03 Thread Bruno Cardoso Lopes via cfe-commits
@@ -405,3 +405,45 @@ float fpPostInc2() { // OGCG: store float %[[A_INC]], ptr %[[A]], align 4 // OGCG: store float %[[A_LOAD]], ptr %[[B]], align 4 // OGCG: %[[B_TO_OUTPUT:.*]] = load float, ptr %[[B]], align 4 + +_Float16 fp16UPlus(_Float16 f) { + return +f; +} + +// C

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Bruno Cardoso Lopes via cfe-commits
@@ -265,3 +265,125 @@ void test_empty_while_true() { // OGCG: br label %[[WHILE_BODY:.*]] // OGCG: [[WHILE_BODY]]: // OGCG: ret void + +void unreachable_after_continue() { + for (;;) { +continue; +int x = 1; + } +} + +// CIR: cir.func @unreachable_after_continue +

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Bruno Cardoso Lopes via cfe-commits
@@ -265,3 +265,125 @@ void test_empty_while_true() { // OGCG: br label %[[WHILE_BODY:.*]] // OGCG: [[WHILE_BODY]]: // OGCG: ret void + +void unreachable_after_continue() { + for (;;) { +continue; +int x = 1; + } +} + +// CIR: cir.func @unreachable_after_continue +

[clang] [CIR] Upstream support for promoted types with unary plus/minus (PR #133829)

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

[clang] [CIR] Add if statement support (PR #134333)

2025-04-04 Thread Bruno Cardoso Lopes via cfe-commits
@@ -135,6 +135,55 @@ mlir::Location CIRGenFunction::getLoc(mlir::Location lhs, mlir::Location rhs) { return mlir::FusedLoc::get(locs, metadata, &getMLIRContext()); } +bool CIRGenFunction::ContainsLabel(const Stmt *s, bool ignoreCaseStmts) { bcardosolopes wr

[clang] [CIR] Add if statement support (PR #134333)

2025-04-04 Thread Bruno Cardoso Lopes via cfe-commits
@@ -135,6 +135,55 @@ mlir::Location CIRGenFunction::getLoc(mlir::Location lhs, mlir::Location rhs) { return mlir::FusedLoc::get(locs, metadata, &getMLIRContext()); } +bool CIRGenFunction::ContainsLabel(const Stmt *s, bool ignoreCaseStmts) { + // Null statement, not a label

[clang] [CIR] Add if statement support (PR #134333)

2025-04-04 Thread Bruno Cardoso Lopes via cfe-commits
bcardosolopes wrote: @Andres-Salamanca thanks for working on this. We usually write tests that exercise any possible different paths codegen can take. For next rounds: it's fine if you add less things in one go and make it more incremental with the use of (a) errorNYI and (b) assert on missing

[clang] [CIR] Add if statement support (PR #134333)

2025-04-04 Thread Bruno Cardoso Lopes via cfe-commits
@@ -263,6 +264,72 @@ static void terminateBody(CIRGenBuilderTy &builder, mlir::Region &r, b->erase(); } +mlir::LogicalResult CIRGenFunction::emitIfStmt(const IfStmt &s) { + mlir::LogicalResult res = mlir::success(); + // The else branch of a consteval if statement is al

[clang] [CIR] Add if statement support (PR #134333)

2025-04-04 Thread Bruno Cardoso Lopes via cfe-commits
@@ -442,6 +457,25 @@ class CIRGenFunction : public CIRGenTypeCache { mlir::LogicalResult emitDeclStmt(const clang::DeclStmt &s); LValue emitDeclRefLValue(const clang::DeclRefExpr *e); + /// Emit an if on a boolean condition to the specified blocks. + /// FIXME: Based on

[clang] [CIR] Add if statement support (PR #134333)

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

[clang] [CIR] Add if statement support (PR #134333)

2025-04-04 Thread Bruno Cardoso Lopes via cfe-commits
@@ -263,6 +264,72 @@ static void terminateBody(CIRGenBuilderTy &builder, mlir::Region &r, b->erase(); } +mlir::LogicalResult CIRGenFunction::emitIfStmt(const IfStmt &s) { + mlir::LogicalResult res = mlir::success(); + // The else branch of a consteval if statement is al

[clang] [CIR] Add if statement support (PR #134333)

2025-04-04 Thread Bruno Cardoso Lopes via cfe-commits
@@ -462,6 +462,58 @@ def ReturnOp : CIR_Op<"return", [ParentOneOf<["FuncOp", "ScopeOp", "DoWhileOp", let hasVerifier = 1; } +//===--===// +// IfOp +//===-

[clang] [CIR] Upstream support for address of and dereference (PR #134317)

2025-04-04 Thread Bruno Cardoso Lopes via cfe-commits
@@ -193,8 +334,23 @@ LValue CIRGenFunction::emitUnaryOpLValue(const UnaryOperator *e) { switch (op) { case UO_Deref: { -cgm.errorNYI(e->getSourceRange(), "UnaryOp dereference"); -return LValue(); +QualType t = e->getSubExpr()->getType()->getPointeeType(); +

[clang] [CIR] Upstream support for address of and dereference (PR #134317)

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

[clang] [CIR] Upstream insert op for VectorType (PR #139146)

2025-05-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1969,6 +1969,43 @@ def VecCreateOp : CIR_Op<"vec.create", [Pure]> { let hasVerifier = 1; } +//===--===// +// VecInsertOp +//===--===//

[clang] [CIR] Upstream insert op for VectorType (PR #139146)

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

[clang] [CIR] Upstream insert op for VectorType (PR #139146)

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

[clang] [CIR][NFC] Remove ABI handling from CIRGen call handling (PR #139159)

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

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

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

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-09 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes commented: This is also missing a end-to-end test that proves we generate switchflatop if we are coming all the way from source code. There are examples in the incubator on how to check if a pass runs (you can use print-before/after) and the IR for it. https:/

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,68 @@ +// RUN: cir-opt %s | FileCheck %s +!s32i = !cir.int + +cir.func @FlatSwitchWithoutDefault(%arg0: !s32i) { + cir.switch.flat %arg0 : !s32i, ^bb2 [ +1: ^bb1 + ] + ^bb1: +cir.br ^bb2 + ^bb2: +cir.return +} + +// CHECK: cir.switch.flat %arg0 : !s32i,

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public mlir::OpRewritePattern { } }; +class CIRSwitchOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + inline void rewriteYieldOp(mlir::PatternRewriter &rewriter, +

[clang] [CIR] Implement folder for VecExtractOp (PR #139304)

2025-05-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1395,6 +1395,26 @@ LogicalResult cir::VecCreateOp::verify() { return success(); } +//===--===// +// VecExtractOp +//===--===// + +OpFol

[clang] [CIR] Implement folder for VecExtractOp (PR #139304)

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

[clang] [CIR] Implement folder for VecExtractOp (PR #139304)

2025-05-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,20 @@ +// RUN: cir-opt %s -cir-canonicalize -o - | FileCheck %s + +!s32i = !cir.int + +module { + cir.func @fold_extract_vector_op_test() { +%init = cir.alloca !s32i, !cir.ptr, ["e", init] +%const_vec = cir.const #cir.const_vector<[#cir.int<1> : !s32i, #cir.int

[clang] [CIR] LLVMIR lowering for cir.call (PR #138873)

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

[clang] [mlir] [OpenACC][CIR] Implement 'gang' lowering for 'loop' (PR #138968)

2025-05-08 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LG(ang)TM, some minor suggestion https://github.com/llvm/llvm-project/pull/138968 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] [mlir] [OpenACC][CIR] Implement 'gang' lowering for 'loop' (PR #138968)

2025-05-08 Thread Bruno Cardoso Lopes via cfe-commits
@@ -424,6 +436,42 @@ class OpenACCClauseCIREmitter final return clauseNotImplemented(clause); } } + + void VisitGangClause(const OpenACCGangClause &clause) { +if constexpr (isOneOfTypes) { + if (clause.getNumExprs() == 0) { +operation.addEmptyGang(

[clang] [mlir] [OpenACC][CIR] Implement 'gang' lowering for 'loop' (PR #138968)

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

[clang] [CIR] Add test for begin/end range for statements (PR #139134)

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

[clang] [CIR] Implement folder for VecExtractOp (PR #139304)

2025-05-09 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes commented: Thanks for following up on this! Once it lands we should probably backport to incubator too. https://github.com/llvm/llvm-project/pull/139304 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[clang] [CIR] Implement folder for VecExtractOp (PR #139304)

2025-05-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -1395,6 +1395,26 @@ LogicalResult cir::VecCreateOp::verify() { return success(); } +//===--===// +// VecExtractOp +//===--===// + +OpFol

[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
@@ -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 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

[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
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
https://github.com/bcardosolopes commented: Mostly good, some nits! 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 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] Implement folder for VecExtractOp (PR #139304)

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

[clang] [CIR] Implement folder for VecExtractOp (PR #139304)

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

[clang] [CIR] Upstream unary operators for VectorType (PR #139444)

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

[clang] [CIR] Upstream unary operators for VectorType (PR #139444)

2025-05-13 Thread Bruno Cardoso Lopes via cfe-commits
@@ -54,10 +54,10 @@ namespace direct { namespace { /// If the given type is a vector type, return the vector's element type. /// Otherwise return the given type unchanged. -// TODO(cir): Return the vector element type once we have support for vectors -// instead of the identity

[clang] [CIR] Upstream unary operators for VectorType (PR #139444)

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

[clang] [CIR][LLVMLowering] Upstream unary operators for VectorType (PR #139444)

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

[clang] [CIR] Upstream shift operators for VectorType (PR #139465)

2025-05-13 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. Nothing to add on top of Andy's review. LGTM https://github.com/llvm/llvm-project/pull/139465 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[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] [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] [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] 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] 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] +

<    3   4   5   6   7   8   9   10   >