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

2025-03-11 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/127835 >From 02218dfb3cdc1282b474b5f0fde3c6cc8791e0a0 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 14 Feb 2025 17:30:54 -0800 Subject: [PATCH 1/7] [CIR] Initial implementation of lowering CIR to MLIR Add s

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

2025-03-11 Thread Andy Kaylor via cfe-commits
andykaylor wrote: We agreed at the clangir upstreaming meeting today that this PR should be put on hold. We don't intend to keep lowering to MLIR standard dialects up-to-date as we upstream the rest of the implementation, and it is currently missing a lot of functionality in the incubator, so

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

2025-03-06 Thread Andy Kaylor via cfe-commits
andykaylor wrote: I've rebased this PR to bring in recent changes, fixed a few problems that were caused by recent changes, and generally refactored the command-line handling to align with a similar change that was made in the incubator. This doesn't lower the ops and types that have been adde

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

2025-03-06 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/127835 >From 4f69f1700f9f982e9271157c5b870eda71e0c0f2 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 14 Feb 2025 17:30:54 -0800 Subject: [PATCH 1/6] [CIR] Initial implementation of lowering CIR to MLIR Add s

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

2025-02-26 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. I'm happy with this as is, though note Aaron is away at WG14 in Graz this week. But it looks like you've done everything he's asked for, so feel free to merge. https://github.com/llvm/llvm-project/pull/127835 ___

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

2025-02-26 Thread Andy Kaylor via cfe-commits
andykaylor wrote: @AaronBallman , @erichkeane I think I've addressed the review comments. Is there anything else you'd like changed? https://github.com/llvm/llvm-project/pull/127835 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists

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

2025-02-24 Thread Ronan Keryell via cfe-commits
https://github.com/keryell approved this pull request. Thank you! https://github.com/llvm/llvm-project/pull/127835 ___ 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-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-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-21 Thread Ronan Keryell via cfe-commits
keryell wrote: I appreciate the parallelism for sure! :smile: It would be nice if your team can book more time to work on the fundamental issues related to CIR→MLIR in the incubator. https://github.com/llvm/llvm-project/pull/127835 ___ cfe-commits mai

[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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-21 Thread Valentin Clement バレンタイン クレメン 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-21 Thread Andy Kaylor 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-21 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/127835 >From a03e9a97e90e2bb0fe22903cc15f35cbf71f94d2 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 14 Feb 2025 17:30:54 -0800 Subject: [PATCH 1/4] [CIR] Initial implementation of lowering CIR to MLIR Add s

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

2025-02-21 Thread Andrzej Warzyński 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-21 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,201 @@ +//- LowerCIRToMLIR.cpp - Lowering from CIR to MLIR ===// +// +// 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: Ap

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

2025-02-21 Thread Aaron Ballman via cfe-commits
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer { void Initialize(clang::ASTContext &astContext) override; bool HandleTopLevelDecl(clang::DeclGroupRef group) override; mlir::ModuleOp getModule() const; + mlir::MLIRContext &getMLIRContext() { return *mlir

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

2025-02-20 Thread Valentin Clement バレンタイン クレメン 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-20 Thread Valentin Clement バレンタイン クレメン 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-20 Thread Andy Kaylor 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] 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-20 Thread Andy Kaylor via cfe-commits
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer { void Initialize(clang::ASTContext &astContext) override; bool HandleTopLevelDecl(clang::DeclGroupRef group) override; mlir::ModuleOp getModule() const; + mlir::MLIRContext &getMLIRContext() { return *mlir

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

2025-02-20 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,79 @@ +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-core-mlir %s -o %t.mlir +// RUN: FileCheck --input-file=%t.mlir %s + +char c; +// CHECK: memref.global "public" @c : memref + +signed char sc; +// CHECK: memref.global "public" @sc :

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

2025-02-20 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/127835 ___ 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-20 Thread Aaron Ballman via cfe-commits
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer { void Initialize(clang::ASTContext &astContext) override; bool HandleTopLevelDecl(clang::DeclGroupRef group) override; mlir::ModuleOp getModule() const; + mlir::MLIRContext &getMLIRContext() { return *mlir

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

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -90,6 +92,15 @@ class CIRGenConsumer : public clang::ASTConsumer { MlirModule->print(*OutputStream, Flags); } break; +case CIRGenAction::OutputType::EmitMLIR: { + auto LoweredMlirModule = lowerFromCIRToMLIR(MlirModule, MlirCtx);

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

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,201 @@ +//- LowerCIRToMLIR.cpp - Lowering from CIR to MLIR ===// +// +// 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: Ap

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

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,201 @@ +//- LowerCIRToMLIR.cpp - Lowering from CIR to MLIR ===// +// +// 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: Ap

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

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,201 @@ +//- LowerCIRToMLIR.cpp - Lowering from CIR to MLIR ===// +// +// 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: Ap

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

2025-02-20 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,79 @@ +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-core-mlir %s -o %t.mlir +// RUN: FileCheck --input-file=%t.mlir %s + +char c; +// CHECK: memref.global "public" @c : memref + +signed char sc; +// CHECK: memref.global "public" @sc :

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

2025-02-20 Thread Henrich Lauko via cfe-commits
https://github.com/xlauko edited https://github.com/llvm/llvm-project/pull/127835 ___ 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-20 Thread Henrich Lauko 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-20 Thread Henrich Lauko 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-19 Thread Andy Kaylor via cfe-commits
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer { void Initialize(clang::ASTContext &astContext) override; bool HandleTopLevelDecl(clang::DeclGroupRef group) override; mlir::ModuleOp getModule() const; + mlir::MLIRContext &getContext() { return *mlirCont

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

2025-02-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/127835 >From a03e9a97e90e2bb0fe22903cc15f35cbf71f94d2 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 14 Feb 2025 17:30:54 -0800 Subject: [PATCH 1/2] [CIR] Initial implementation of lowering CIR to MLIR Add s

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

2025-02-19 Thread Erich Keane 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-19 Thread Andy Kaylor 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-19 Thread David Olsen via cfe-commits
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer { void Initialize(clang::ASTContext &astContext) override; bool HandleTopLevelDecl(clang::DeclGroupRef group) override; mlir::ModuleOp getModule() const; + mlir::MLIRContext &getContext() { return *mlirCont

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

2025-02-19 Thread Erich Keane 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-19 Thread Andy Kaylor 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-19 Thread Andy Kaylor 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-19 Thread Valentin Clement バレンタイン クレメン 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-19 Thread Erich Keane 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-19 Thread Erich Keane 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-19 Thread Erich Keane via cfe-commits
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer { void Initialize(clang::ASTContext &astContext) override; bool HandleTopLevelDecl(clang::DeclGroupRef group) override; mlir::ModuleOp getModule() const; + mlir::MLIRContext &getContext() { return *mlirCont

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

2025-02-19 Thread Andy Kaylor 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] Initial implementation of lowering CIR to MLIR (PR #127835)

2025-02-19 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clangir Author: Andy Kaylor (andykaylor) Changes Add support for lowering CIR to more general MLIR and emitting an MLIR text file, including a new command-line option for emitting MLIR via ClangIR. This does not yet support lowering to LLVM IR or other

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

2025-02-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/127835 Add support for lowering CIR to more general MLIR and emitting an MLIR text file, including a new command-line option for emitting MLIR via ClangIR. This does not yet support lowering to LLVM IR or other tar