[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 basic alloca and load support (PR #128792)

2025-02-27 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed 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/cfe-commits

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

2025-02-27 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. 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/cfe-commits

[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 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-26 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,128 @@ +//===--===// +// +// 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 basic alloca and load support (PR #128792)

2025-02-26 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 1b39328d7440aa7a94af4083257ef1c2f9394887 1ffe43b0ca298df1e35f692d98401579f32d528d --e

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

2025-02-26 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/128792 >From 235ef9e23a314f8946b48143294da367b80f7d14 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Tue, 25 Feb 2025 12:31:08 -0800 Subject: [PATCH 1/3] [CIR] Upstream basic alloca and load support This change i

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

2025-02-26 Thread Andy Kaylor via cfe-commits
@@ -52,6 +54,19 @@ class ScalarExprEmitter : public StmtVisitor { return {}; } + /// Emits the address of the l-value, then loads and returns the result. + mlir::Value emitLoadOfLValue(const Expr *e) { +LValue lv = cgf.emitLValue(e); +// FIXME: add some akin t

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

2025-02-26 Thread Andy Kaylor 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 Erich Keane 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 Andy Kaylor 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 David Olsen 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 Andy Kaylor 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] 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
@@ -115,6 +115,149 @@ def ConstantOp : CIR_Op<"const", let hasFolder = 1; } +//===--===// +// AllocaOp +//===--===// + +class AllocaTypesMa

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

2025-02-26 Thread Andy Kaylor 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-26 Thread Andy Kaylor 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 Andy Kaylor via cfe-commits
@@ -0,0 +1,76 @@ +//===--===// +// +// 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 Erich Keane 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 Erich Keane 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-26 Thread Erich Keane via cfe-commits
@@ -0,0 +1,128 @@ +//===--===// +// +// 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 basic alloca and load support (PR #128792)

2025-02-26 Thread Erich Keane 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 Andy Kaylor 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-26 Thread Andy Kaylor via cfe-commits
@@ -75,3 +110,34 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) { return ScalarExprEmitter(*this, builder).Visit(const_cast(e)); } + +// Emit code for an explicit or implicit cast. Implicit +// casts have to handle a more broad range of conversions than explic

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

2025-02-26 Thread Andy Kaylor 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 Andy Kaylor via cfe-commits
@@ -65,7 +80,27 @@ class ScalarExprEmitter : public StmtVisitor { cgf.getLoc(e->getExprLoc()), type, builder.getCIRBoolAttr(e->getValue())); } + + mlir::Value VisitCastExpr(CastExpr *E); + + /// Emit a conversion from the specified type to the specified des

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

2025-02-26 Thread Andy Kaylor 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 Andy Kaylor 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 Andy Kaylor 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 Andy Kaylor via cfe-commits
@@ -115,6 +115,149 @@ def ConstantOp : CIR_Op<"const", let hasFolder = 1; } +//===--===// +// AllocaOp +//===--===// + +class AllocaTypesMa

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

2025-02-26 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o - | FileCheck %s + +int f1(); andykaylor wrote: Probably no purpose. It was in the incubator test that I'm starting to bring over here. I had taken it out

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

2025-02-25 Thread Erich Keane 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-25 Thread Erich Keane via cfe-commits
@@ -0,0 +1,128 @@ +//===--===// +// +// 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 basic alloca and load support (PR #128792)

2025-02-25 Thread Erich Keane via cfe-commits
@@ -0,0 +1,128 @@ +//===--===// +// +// 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 basic alloca and load support (PR #128792)

2025-02-25 Thread Erich Keane via cfe-commits
@@ -75,3 +110,34 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) { return ScalarExprEmitter(*this, builder).Visit(const_cast(e)); } + +// Emit code for an explicit or implicit cast. Implicit +// casts have to handle a more broad range of conversions than explic

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

2025-02-25 Thread Erich Keane 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-25 Thread Erich Keane via cfe-commits
@@ -0,0 +1,128 @@ +//===--===// +// +// 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 basic alloca and load support (PR #128792)

2025-02-25 Thread Erich Keane via cfe-commits
@@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o - | FileCheck %s + +int f1(); erichkeane wrote: Silly question: What is the purpose here for the forward declaration of f1? https://github.com/llvm/llvm-p

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

2025-02-25 Thread Erich Keane via cfe-commits
@@ -0,0 +1,76 @@ +//===--===// +// +// 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-25 Thread Erich Keane via cfe-commits
@@ -0,0 +1,128 @@ +//===--===// +// +// 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 basic alloca and load support (PR #128792)

2025-02-25 Thread Erich Keane via cfe-commits
@@ -0,0 +1,125 @@ +//===--===// +// +// 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 basic alloca and load support (PR #128792)

2025-02-25 Thread Erich Keane via cfe-commits
@@ -0,0 +1,128 @@ +//===--===// +// +// 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 basic alloca and load support (PR #128792)

2025-02-25 Thread Erich Keane 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-25 Thread Erich Keane 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-25 Thread Erich Keane via cfe-commits
@@ -115,6 +115,149 @@ def ConstantOp : CIR_Op<"const", let hasFolder = 1; } +//===--===// +// AllocaOp +//===--===// + +class AllocaTypesMa

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

2025-02-25 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/128792 >From 235ef9e23a314f8946b48143294da367b80f7d14 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Tue, 25 Feb 2025 12:31:08 -0800 Subject: [PATCH 1/2] [CIR] Upstream basic alloca and load support This change i

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

2025-02-25 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clangir Author: Andy Kaylor (andykaylor) Changes This change implements basic support in ClangIR for local variables using the cir.alloca and cir.load operations. --- Patch is 42.22 KiB, truncated to 20.00 KiB below, full version: https://github.com/

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

2025-02-25 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/128792 This change implements basic support in ClangIR for local variables using the cir.alloca and cir.load operations. >From 235ef9e23a314f8946b48143294da367b80f7d14 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Da