[clang] [CIR] Add value initialization for scalar types (PR #156036)

2025-08-29 Thread Morris Hafner via cfe-commits
https://github.com/mmha closed https://github.com/llvm/llvm-project/pull/156036 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add value initialization for scalar types (PR #156036)

2025-08-29 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/156036 None >From a79c57ee6cedd19ea15565fe7e7ca9872d416f2c Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 29 Aug 2025 16:45:44 +0200 Subject: [PATCH] [CIR] Add value initialization for scalar types --- clang/li

[clang] [OpenACC] 'reduction' init lowering for +, |, ^, || (PR #155924)

2025-08-29 Thread Morris Hafner via cfe-commits
@@ -3,9 +3,32 @@ // CHECK: acc.reduction.recipe @reduction_lor__ZTSA5_f : !cir.ptr> reduction_operator init { // CHECK-NEXT: ^bb0(%[[ARG:.*]]: !cir.ptr>{{.*}}) -// CHECK-NEXT: cir.alloca !cir.array, !cir.ptr>, ["openacc.reduction.init"] -// TODO OpenACC: Expecting an initia

[clang] [CIR] Add value initialization for scalar types (PR #156036)

2025-08-29 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/156036 >From a79c57ee6cedd19ea15565fe7e7ca9872d416f2c Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 29 Aug 2025 16:45:44 +0200 Subject: [PATCH 1/3] [CIR] Add value initialization for scalar types --- clang/lib/

[clang] [CIR] Add value initialization for scalar types (PR #156036)

2025-08-29 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/156036 >From a79c57ee6cedd19ea15565fe7e7ca9872d416f2c Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 29 Aug 2025 16:45:44 +0200 Subject: [PATCH 1/2] [CIR] Add value initialization for scalar types --- clang/lib/

[clang] [CIR] Add constant record ILE support (PR #155663)

2025-08-29 Thread Morris Hafner via cfe-commits
@@ -21,20 +20,526 @@ #include "clang/AST/APValue.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Attr.h" +#include "clang/AST/CharUnits.h" #include "clang/AST/OperationKinds.h" #include "clang/AST/RecordLayout.h" #include "clang/AST/StmtVisitor.h" #include "clang/B

[clang] [CIR] Add constant record ILE support (PR #155663)

2025-08-28 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/155663 >From c2ba9037496f23e22e43b2f4a2bfcddb3aaad535 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Wed, 27 Aug 2025 19:36:34 +0200 Subject: [PATCH 1/4] [CIR] Add constant record ILE support This patch adds basic sup

[clang] [CIR] Add constant record ILE support (PR #155663)

2025-08-28 Thread Morris Hafner via cfe-commits
@@ -130,6 +132,44 @@ void CIRGenBuilderTy::computeGlobalViewIndicesFromFlatOffset( computeGlobalViewIndicesFromFlatOffset(offset, subType, layout, indices); } +static mlir::Type getAttributeType(mlir::Attribute attr) { + return mlir::cast(attr).getType(); +} + +cir::Record

[clang] [CIR] Add constant record ILE support (PR #155663)

2025-08-28 Thread Morris Hafner via cfe-commits
@@ -21,20 +20,571 @@ #include "clang/AST/APValue.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Attr.h" +#include "clang/AST/CharUnits.h" #include "clang/AST/OperationKinds.h" #include "clang/AST/RecordLayout.h" #include "clang/AST/StmtVisitor.h" #include "clang/B

[clang] [CIR] Add constant record ILE support (PR #155663)

2025-08-28 Thread Morris Hafner via cfe-commits
@@ -130,6 +132,44 @@ void CIRGenBuilderTy::computeGlobalViewIndicesFromFlatOffset( computeGlobalViewIndicesFromFlatOffset(offset, subType, layout, indices); } +static mlir::Type getAttributeType(mlir::Attribute attr) { + return mlir::cast(attr).getType(); +} + +cir::Record

[clang] [CIR] Add constant record ILE support (PR #155663)

2025-08-27 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/155663 >From c2ba9037496f23e22e43b2f4a2bfcddb3aaad535 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Wed, 27 Aug 2025 19:36:34 +0200 Subject: [PATCH 1/2] [CIR] Add constant record ILE support This patch adds basic sup

[clang] [CIR] Upstream GotoSolver pass (PR #154596)

2025-08-21 Thread Morris Hafner via cfe-commits
https://github.com/mmha edited https://github.com/llvm/llvm-project/pull/154596 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream GotoSolver pass (PR #154596)

2025-08-21 Thread Morris Hafner via cfe-commits
@@ -0,0 +1,52 @@ +#include "PassDetail.h" +#include "clang/CIR/Dialect/IR/CIRDialect.h" +#include "clang/CIR/Dialect/Passes.h" +#include "llvm/Support/TimeProfiler.h" +#include + +using namespace mlir; +using namespace cir; + +namespace { + +struct GotoSolverPass : public GotoSol

[clang] [CIR] Upstream GotoSolver pass (PR #154596)

2025-08-21 Thread Morris Hafner via cfe-commits
https://github.com/mmha approved this pull request. LGTM, just one nit https://github.com/llvm/llvm-project/pull/154596 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add CIR vtable attribute (PR #154415)

2025-08-21 Thread Morris Hafner via cfe-commits
https://github.com/mmha approved this pull request. https://github.com/llvm/llvm-project/pull/154415 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-21 Thread Morris Hafner via cfe-commits
https://github.com/mmha approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/154060 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add CIR vtable attribute (PR #154415)

2025-08-20 Thread Morris Hafner via cfe-commits
mmha wrote: Is this also meant to cover VTTs? https://github.com/llvm/llvm-project/pull/154415 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for string literal lvalues in ConstantLValueEmitter (PR #154514)

2025-08-20 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/154514 Reopening #154360 because the target branch was deleted first. >From 3b8951482dc4a4a779bb914706d6d85e75c83743 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Tue, 19 Aug 2025 17:13:51 +0200 Subject: [PATCH] [CIR

[clang] [CIR] Add constant attribute to GlobalOp (PR #154359)

2025-08-20 Thread Morris Hafner via cfe-commits
https://github.com/mmha closed https://github.com/llvm/llvm-project/pull/154359 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Implement__builtin_va_arg (PR #153834)

2025-08-20 Thread Morris Hafner via cfe-commits
https://github.com/mmha closed https://github.com/llvm/llvm-project/pull/153834 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for base classes in type conversion safety check (PR #154385)

2025-08-20 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/154385 >From df7866a4b60570fd2aa834656a2fbc62729b4277 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Tue, 19 Aug 2025 18:58:29 +0200 Subject: [PATCH] [CIR] Add support for derived classes in type info conversion safet

[clang] [CIR] Add support for base classes in type conversion safety check (PR #154385)

2025-08-20 Thread Morris Hafner via cfe-commits
https://github.com/mmha edited https://github.com/llvm/llvm-project/pull/154385 ___ 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 classes in type info conversion safety … (PR #154385)

2025-08-19 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/154385 …check This patch enables the record layout computation of types that are dervied more than once. >From 0a0e87c263c56d4fce307e6325cb07a080d7ef94 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Tue, 19 Aug 2025

[clang] [CIR] Add constant attribute to GlobalOp (PR #154359)

2025-08-19 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/154359 >From 50399d0569e01a5a00878afc5d52c27a52e54d4a Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Tue, 19 Aug 2025 16:58:44 +0200 Subject: [PATCH 1/2] [CIR] Add constant attribute to GlobalOp This patch adds the co

[clang] [CIR] Add constant attribute to GlobalOp (PR #154359)

2025-08-19 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/154359 This patch adds the constant attribute to cir.global, the appropriate lowering to LLVM constant and updates the tests. >From 50399d0569e01a5a00878afc5d52c27a52e54d4a Mon Sep 17 00:00:00 2001 From: Morris Hafner Da

[clang] [CIR][NFC] Fix regression by #153819 (PR #154346)

2025-08-19 Thread Morris Hafner via cfe-commits
https://github.com/mmha approved this pull request. Thanks for fixing this! This also ran fine on my Arch + clang 20 machine which is why I didn't catch it. https://github.com/llvm/llvm-project/pull/154346 ___ cfe-commits mailing list cfe-commits@list

[clang] [CIR] Implement__builtin_va_arg (PR #153834)

2025-08-19 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/153834 >From d1245a1d3c0ac2d904049b3a6a9937f75da49eea Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Tue, 19 Aug 2025 12:23:12 +0200 Subject: [PATCH 1/2] [CIR] Implement__builtin_va_arg Part of #153286. Depends on #15

[clang] [CIR] Implement__builtin_va_arg (PR #153834)

2025-08-19 Thread Morris Hafner via cfe-commits
@@ -382,3 +382,13 @@ void CIRGenFunction::emitVAStartEnd(mlir::Value argValue, bool isStart) { else cir::VAEndOp::create(builder, argValue.getLoc(), argValue); } + +// FIXME(cir): This completely abstracts away the ABI with a generic CIR Op. We +// need to decide how to

[clang] [CIR] Implement__builtin_va_arg (PR #153834)

2025-08-19 Thread Morris Hafner via cfe-commits
@@ -382,3 +382,13 @@ void CIRGenFunction::emitVAStartEnd(mlir::Value argValue, bool isStart) { else cir::VAEndOp::create(builder, argValue.getLoc(), argValue); } + +// FIXME(cir): This completely abstracts away the ABI with a generic CIR Op. We mmha wrot

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-19 Thread Morris Hafner via cfe-commits
https://github.com/mmha closed https://github.com/llvm/llvm-project/pull/153677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-19 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/153677 >From 2e799c0cd75e6e79735f591e1d72015047b414dc Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 14 Aug 2025 22:44:35 +0200 Subject: [PATCH 1/8] [CIR] Implement Statement Expressions This patch adds support f

[clang] [CIR] Upstream __builtin_va_start and __builtin_va_end (PR #153819)

2025-08-19 Thread Morris Hafner via cfe-commits
https://github.com/mmha closed https://github.com/llvm/llvm-project/pull/153819 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-18 Thread Morris Hafner via cfe-commits
https://github.com/mmha commented: Thanks for working on this! I mostly have style related comments. https://github.com/llvm/llvm-project/pull/154060 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-18 Thread Morris Hafner via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o - | FileCheck %s mmha wrote: Can you compare CIR, classic codegen and the new LLVM coden in this test? See `clang/test/CIR/CodeGen/call.c` for an example. https://g

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-18 Thread Morris Hafner via cfe-commits
@@ -553,6 +591,35 @@ RValue CIRGenFunction::emitLoadOfLValue(LValue lv, SourceLocation loc) { return RValue::get(nullptr); } +static cir::FuncOp emitFunctionDeclPointer(CIRGenModule &cgm, GlobalDecl gd) { + assert(!cir::MissingFeatures::weakRefReference()); + return cgm.g

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-18 Thread Morris Hafner via cfe-commits
@@ -553,6 +591,35 @@ RValue CIRGenFunction::emitLoadOfLValue(LValue lv, SourceLocation loc) { return RValue::get(nullptr); } +static cir::FuncOp emitFunctionDeclPointer(CIRGenModule &cgm, GlobalDecl gd) { + assert(!cir::MissingFeatures::weakRefReference()); + return cgm.g

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-18 Thread Morris Hafner via cfe-commits
https://github.com/mmha edited https://github.com/llvm/llvm-project/pull/154060 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-18 Thread Morris Hafner via cfe-commits
@@ -73,21 +73,59 @@ Address CIRGenFunction::emitPointerWithAlignment(const Expr *expr, // Casts: if (auto const *ce = dyn_cast(expr)) { -if (isa(ce)) { - cgm.errorNYI(expr->getSourceRange(), - "emitPointerWithAlignment: explicit cast"); - r

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-18 Thread Morris Hafner via cfe-commits
@@ -553,6 +591,35 @@ RValue CIRGenFunction::emitLoadOfLValue(LValue lv, SourceLocation loc) { return RValue::get(nullptr); } +static cir::FuncOp emitFunctionDeclPointer(CIRGenModule &cgm, GlobalDecl gd) { + assert(!cir::MissingFeatures::weakRefReference()); + return cgm.g

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-18 Thread Morris Hafner via cfe-commits
@@ -73,21 +73,59 @@ Address CIRGenFunction::emitPointerWithAlignment(const Expr *expr, // Casts: if (auto const *ce = dyn_cast(expr)) { -if (isa(ce)) { - cgm.errorNYI(expr->getSourceRange(), - "emitPointerWithAlignment: explicit cast"); - r

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-18 Thread Morris Hafner via cfe-commits
@@ -609,6 +676,16 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *e) { return emitLValue(bd->getBinding()); } + if (const auto *FD = dyn_cast(nd)) { +LValue LV = emitFunctionDeclLValue(*this, e, FD); mmha wrote: ```suggestion if (

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-18 Thread Morris Hafner via cfe-commits
@@ -73,21 +73,59 @@ Address CIRGenFunction::emitPointerWithAlignment(const Expr *expr, // Casts: if (auto const *ce = dyn_cast(expr)) { -if (isa(ce)) { - cgm.errorNYI(expr->getSourceRange(), - "emitPointerWithAlignment: explicit cast"); - r

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-18 Thread Morris Hafner via cfe-commits
@@ -553,6 +591,35 @@ RValue CIRGenFunction::emitLoadOfLValue(LValue lv, SourceLocation loc) { return RValue::get(nullptr); } +static cir::FuncOp emitFunctionDeclPointer(CIRGenModule &cgm, GlobalDecl gd) { + assert(!cir::MissingFeatures::weakRefReference()); + return cgm.g

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-18 Thread Morris Hafner via cfe-commits
@@ -553,6 +591,35 @@ RValue CIRGenFunction::emitLoadOfLValue(LValue lv, SourceLocation loc) { return RValue::get(nullptr); } +static cir::FuncOp emitFunctionDeclPointer(CIRGenModule &cgm, GlobalDecl gd) { + assert(!cir::MissingFeatures::weakRefReference()); + return cgm.g

[clang] [CIR] Handle FunctionToPointerDecay casts (#153657) (PR #154060)

2025-08-18 Thread Morris Hafner via cfe-commits
@@ -73,21 +73,59 @@ Address CIRGenFunction::emitPointerWithAlignment(const Expr *expr, // Casts: if (auto const *ce = dyn_cast(expr)) { -if (isa(ce)) { - cgm.errorNYI(expr->getSourceRange(), - "emitPointerWithAlignment: explicit cast"); - r

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-18 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/153677 >From 19733bc353bb40f86a931219f10837d525b8f144 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 14 Aug 2025 22:44:35 +0200 Subject: [PATCH 1/8] [CIR] Implement Statement Expressions This patch adds support f

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-18 Thread Morris Hafner via cfe-commits
@@ -1178,11 +1178,11 @@ static void pushTemporaryCleanup(CIRGenFunction &cgf, ->getBaseElementTypeUnsafe() ->getAs()) { // Get the destructor for the reference temporary. -auto *classDecl =

[clang] [CIR] Upstream __builtin_va_start and __builtin_va_end (PR #153819)

2025-08-18 Thread Morris Hafner via cfe-commits
mmha wrote: I changed the op definition to keep the count in CIR. So I'm asking for a small re-review :) It leads to somewhat worse LLVM IR because of a dead load but I don't think there's much we can do here. https://github.com/llvm/llvm-project/pull/153819 __

[clang] [CIR] Upstream __builtin_va_start and __builtin_va_end (PR #153819)

2025-08-18 Thread Morris Hafner via cfe-commits
@@ -3415,4 +3415,81 @@ def CIR_FAbsOp : CIR_UnaryFPToFPBuiltinOp<"fabs", "FAbsOp"> { }]; } +//===--===// +// Variadic Operations +//===--=

[clang] [CIR] Upstream __builtin_va_start and __builtin_va_end (PR #153819)

2025-08-18 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/153819 >From dae7b978b994f5d160fae784fcd32bb3734f3208 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 15 Aug 2025 17:18:19 +0200 Subject: [PATCH 1/2] [CIR] Upstream __builtin_va_start and __builtin_va_end --- cla

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-17 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/153677 >From d68b52a0af50bb4d18df40e81c54c32bd700e702 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 14 Aug 2025 22:44:35 +0200 Subject: [PATCH 1/7] [CIR] Implement Statement Expressions This patch adds support f

[clang] [CIR] Implement __builtin_return_address and __builtin_frame_address (PR #153698)

2025-08-15 Thread Morris Hafner via cfe-commits
https://github.com/mmha closed https://github.com/llvm/llvm-project/pull/153698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-15 Thread Morris Hafner via cfe-commits
@@ -561,7 +558,6 @@ cir::FuncOp CIRGenFunction::generateCode(clang::GlobalDecl gd, cir::FuncOp fn, emitImplicitAssignmentOperatorBody(args); } else if (body) { if (mlir::failed(emitFunctionBody(body))) { -fn.erase(); mmha wrote: This c

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-15 Thread Morris Hafner via cfe-commits
@@ -1178,11 +1178,11 @@ static void pushTemporaryCleanup(CIRGenFunction &cgf, ->getBaseElementTypeUnsafe() ->getAs()) { // Get the destructor for the reference temporary. -auto *classDecl =

[clang] [CIR] Implement__builtin_va_arg (PR #153834)

2025-08-15 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/153834 Part of https://github.com/llvm/llvm-project/issues/153286. Depends on https://github.com/llvm/llvm-project/pull/153819. This patch adds support for __builtin_va_arg by adding the cir.va.arg operator. Unlike the in

[clang] [CIR] Upstream __builtin_va_start and __builtin_va_end (PR #153819)

2025-08-15 Thread Morris Hafner via cfe-commits
https://github.com/mmha edited https://github.com/llvm/llvm-project/pull/153819 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream __builtin_va_start and __builtin_va_end (PR #153819)

2025-08-15 Thread Morris Hafner via cfe-commits
https://github.com/mmha edited https://github.com/llvm/llvm-project/pull/153819 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream __builtin_va_start and __builtin_va_end (PR #153819)

2025-08-15 Thread Morris Hafner via cfe-commits
@@ -3415,4 +3415,81 @@ def CIR_FAbsOp : CIR_UnaryFPToFPBuiltinOp<"fabs", "FAbsOp"> { }]; } +//===--===// +// Variadic Operations +//===--=

[clang] [CIR] Upstream __builtin_va_start and __builtin_va_end (PR #153819)

2025-08-15 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/153819 None >From dae7b978b994f5d160fae784fcd32bb3734f3208 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 15 Aug 2025 17:18:19 +0200 Subject: [PATCH] [CIR] Upstream __builtin_va_start and __builtin_va_end --- c

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-15 Thread Morris Hafner via cfe-commits
https://github.com/mmha edited https://github.com/llvm/llvm-project/pull/153677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-15 Thread Morris Hafner via cfe-commits
@@ -0,0 +1,166 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir mmha wrote: `stmtexpr-init.c` is not useful because we lack record init list exprs. I added a few C++ tests but I noticed that we don't call destructors for

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-15 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/153677 >From d68b52a0af50bb4d18df40e81c54c32bd700e702 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 14 Aug 2025 22:44:35 +0200 Subject: [PATCH 1/5] [CIR] Implement Statement Expressions This patch adds support f

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-15 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/153677 >From d68b52a0af50bb4d18df40e81c54c32bd700e702 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 14 Aug 2025 22:44:35 +0200 Subject: [PATCH 1/3] [CIR] Implement Statement Expressions This patch adds support f

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-14 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/153677 >From d68b52a0af50bb4d18df40e81c54c32bd700e702 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 14 Aug 2025 22:44:35 +0200 Subject: [PATCH 1/3] [CIR] Implement Statement Expressions This patch adds support f

[clang] [CIR] Implement __builtin_return_address and __builtin_frame_address (PR #153698)

2025-08-14 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/153698 >From 1de984292efcc907405812ccb02f348e0a36e0af Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 15 Aug 2025 00:05:14 +0200 Subject: [PATCH 1/3] [CIR] Implement __builtin_return_address and __builtin_frame_ad

[clang] [CIR] Implement __builtin_return_address and __builtin_frame_address (PR #153698)

2025-08-14 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/153698 >From 1de984292efcc907405812ccb02f348e0a36e0af Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 15 Aug 2025 00:05:14 +0200 Subject: [PATCH 1/2] [CIR] Implement __builtin_return_address and __builtin_frame_ad

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-14 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/153677 >From d68b52a0af50bb4d18df40e81c54c32bd700e702 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 14 Aug 2025 22:44:35 +0200 Subject: [PATCH 1/2] [CIR] Implement Statement Expressions This patch adds support f

[clang] [CIR] Implement __builtin_return_address and __builtin_frame_address (PR #153698)

2025-08-14 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/153698 This adds ReturnAddrOp and FrameAddrOp that represent __builtin_return_address and __builtin_frame_address and the respective lowering to LLVM parts. >From 1de984292efcc907405812ccb02f348e0a36e0af Mon Sep 17 00:00:

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-14 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/153677 >From 4c0aea8b8a1dd05eab7c4e0befbf3610e6123ffc Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 14 Aug 2025 22:44:35 +0200 Subject: [PATCH] [CIR] Implement Statement Expressions This patch adds support for s

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-14 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/153677 >From 34b219ffb5412599ea7548cc7579bff454343b95 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 14 Aug 2025 22:44:35 +0200 Subject: [PATCH] [CIR] Implement Statement Expressions This patch adds support for s

[clang] [CIR][NFC] Add Symbol Table to CIRGenFunction (PR #153625)

2025-08-14 Thread Morris Hafner via cfe-commits
https://github.com/mmha closed https://github.com/llvm/llvm-project/pull/153625 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Implement Statement Expressions (PR #153677)

2025-08-14 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/153677 Depends on #153625 This patch adds support for statement expressions. It also changes emitCompoundStmt and emitCompoundStmtWithoutScope to accept an Address that the optional result is written to. This allows the

[clang] [CIR] Add `InlineAsmOp` (PR #153362)

2025-08-14 Thread Morris Hafner via cfe-commits
https://github.com/mmha edited https://github.com/llvm/llvm-project/pull/153362 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add `InlineAsmOp` (PR #153362)

2025-08-14 Thread Morris Hafner via cfe-commits
@@ -2406,6 +2406,212 @@ OpFoldResult RotateOp::fold(FoldAdaptor adaptor) { return IntAttr::get(input.getContext(), input.getType(), resultValue); } +//===--===// +// InlineAsmOp +//===---

[clang] [CIR] Add `InlineAsmOp` (PR #153362)

2025-08-14 Thread Morris Hafner via cfe-commits
https://github.com/mmha approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/153362 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Introduce more cleanup infrastructure (PR #152589)

2025-08-11 Thread Morris Hafner via cfe-commits
@@ -70,45 +70,89 @@ void EHScopeStack::deallocate(size_t size) { } void *EHScopeStack::pushCleanup(CleanupKind kind, size_t size) { - char *buffer = allocate(size); + char *buffer = allocate(EHCleanupScope::getSizeForCleanupSize(size)); - // When the full implementation i

[clang] [CIR] Introduce more cleanup infrastructure (PR #152589)

2025-08-11 Thread Morris Hafner via cfe-commits
@@ -14,10 +14,117 @@ #ifndef CLANG_LIB_CIR_CODEGEN_CIRGENCLEANUP_H #define CLANG_LIB_CIR_CODEGEN_CIRGENCLEANUP_H +#include "Address.h" #include "EHScopeStack.h" +#include "mlir/IR/Value.h" namespace clang::CIRGen { +/// A protected scope for zero-cost EH handling. +class

[clang] [CIR] Introduce more cleanup infrastructure (PR #152589)

2025-08-11 Thread Morris Hafner via cfe-commits
@@ -70,45 +70,89 @@ void EHScopeStack::deallocate(size_t size) { } void *EHScopeStack::pushCleanup(CleanupKind kind, size_t size) { - char *buffer = allocate(size); + char *buffer = allocate(EHCleanupScope::getSizeForCleanupSize(size)); - // When the full implementation i

[clang] [CIR] Introduce more cleanup infrastructure (PR #152589)

2025-08-11 Thread Morris Hafner via cfe-commits
https://github.com/mmha approved this pull request. LGTM, just a few minor comments. https://github.com/llvm/llvm-project/pull/152589 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Introduce more cleanup infrastructure (PR #152589)

2025-08-11 Thread Morris Hafner via cfe-commits
https://github.com/mmha edited https://github.com/llvm/llvm-project/pull/152589 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream LabelOp (PR #152802)

2025-08-11 Thread Morris Hafner via cfe-commits
https://github.com/mmha approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/152802 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream LabelOp (PR #152802)

2025-08-11 Thread Morris Hafner via cfe-commits
@@ -1125,6 +1125,9 @@ class CIRGenFunction : public CIRGenTypeCache { mlir::Value emitOpOnBoolExpr(mlir::Location loc, const clang::Expr *cond); + mlir::LogicalResult emitLabel(const clang::LabelDecl *d); + mlir::LogicalResult emitLabelStmt(const clang::LabelStmt &s); ---

[clang] [CIR] Upstream LabelOp (PR #152802)

2025-08-11 Thread Morris Hafner via cfe-commits
@@ -272,6 +275,17 @@ mlir::LogicalResult CIRGenFunction::emitSimpleStmt(const Stmt *s, return mlir::success(); } +mlir::LogicalResult CIRGenFunction::emitLabelStmt(const clang::LabelStmt &s) { + + if (emitLabel(s.getDecl()).failed()) +return mlir::failure(); + + // Is

[clang] [CIR] Upstream LabelOp (PR #152802)

2025-08-11 Thread Morris Hafner via cfe-commits
@@ -429,6 +443,32 @@ CIRGenFunction::emitContinueStmt(const clang::ContinueStmt &s) { return mlir::success(); } +mlir::LogicalResult CIRGenFunction::emitLabel(const clang::LabelDecl *d) { + // Create a new block to tag with a label and add a branch from mm

[clang] [CIR] Upstream LabelOp (PR #152802)

2025-08-11 Thread Morris Hafner via cfe-commits
https://github.com/mmha edited https://github.com/llvm/llvm-project/pull/152802 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream LabelOp (PR #152802)

2025-08-11 Thread Morris Hafner via cfe-commits
mmha wrote: Can you add tests where you put a label in some unreachable code? ```c++ void after_return() { return; label: } void after_throw() { throw 0; label: } ``` https://github.com/llvm/llvm-project/pull/152802 ___ cfe-commits mailing li

[clang] [CIR] Upstream EHScopeStack memory allocator (PR #152215)

2025-08-07 Thread Morris Hafner via cfe-commits
@@ -33,6 +34,54 @@ using namespace clang::CIRGen; void EHScopeStack::Cleanup::anchor() {} +/// Push an entry of the given size onto this protected-scope stack. +char *EHScopeStack::allocate(size_t size) { + size = llvm::alignTo(size, ScopeStackAlignment); + if (!startOfBuff

[clang] [CIR] add support for file scope assembly (PR #152093)

2025-08-07 Thread Morris Hafner via cfe-commits
https://github.com/mmha approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/152093 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for variable template specializations (PR #151069)

2025-08-06 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/151069 >From c9bd371217cad933639170a362ad8e23bd8c3fc5 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Wed, 6 Aug 2025 15:58:44 +0200 Subject: [PATCH 1/2] [CIR] Upstream support for variable template specializations --

[clang] [CIR] Upstream support for function-level variable decompositions (PR #151073)

2025-07-31 Thread Morris Hafner via cfe-commits
https://github.com/mmha closed https://github.com/llvm/llvm-project/pull/151073 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for function-level variable decompositions (PR #151073)

2025-07-31 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/151073 >From ebedb14a06f964ae6d75ffc2443ce5e44304e023 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Tue, 29 Jul 2025 04:23:46 +0200 Subject: [PATCH 1/4] [CIR] Upstream support for function-level variable decompositio

[clang] [CIR] Upstream support for function-level variable decompositions (PR #151073)

2025-07-31 Thread Morris Hafner via cfe-commits
@@ -797,3 +799,11 @@ void CIRGenFunction::emitAutoVarTypeCleanup( assert(!cir::MissingFeatures::ehCleanupFlags()); ehStack.pushCleanup(cleanupKind, addr, type, destroyer); } + +void CIRGenFunction::maybeEmitDeferredVarDeclInit(const VarDecl *vd) { + if (auto *dd = dyn_cast

[clang] [CIR] Support more declarations without any codegen (PR #151076)

2025-07-31 Thread Morris Hafner via cfe-commits
https://github.com/mmha closed https://github.com/llvm/llvm-project/pull/151076 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for function-level variable decompositions (PR #151073)

2025-07-30 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/151073 >From 22b36ac0fb0323f518de18fa4058f0c168c8d476 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Tue, 29 Jul 2025 04:23:46 +0200 Subject: [PATCH 1/3] [CIR] Upstream support for function-level variable decompositio

[clang] [CIR] Upstream support for function-level variable decompositions (PR #151073)

2025-07-29 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/151073 >From 1a77ffaa97180947a4bfb5c09d801f7feb9b173b Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Tue, 29 Jul 2025 04:23:46 +0200 Subject: [PATCH 1/2] [CIR] Upstream support for function-level variable decompositio

[clang] [CIR] Support more declarations without any codegen (PR #151076)

2025-07-29 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/151076 >From 41de9a3ded9751ec72715122ed9d5b91f7efd121 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Tue, 29 Jul 2025 04:54:42 +0200 Subject: [PATCH 1/2] [CIR] Support more declarations without any codegen This patch

[clang] [CIR] Support more declarations without any codegen (PR #151076)

2025-07-28 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/151076 >From 41de9a3ded9751ec72715122ed9d5b91f7efd121 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Tue, 29 Jul 2025 04:54:42 +0200 Subject: [PATCH] [CIR] Support more declarations without any codegen This patch adds

[clang] [CIR] Support more declarations without any codegen (PR #151076)

2025-07-28 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/151076 This patch adds or completes support for a couple of top level declaration types that don't emit any code: Most notably these include Concepts, static_assert and type aliases. >From fb52c398ad796aa3728b7f7c8edaf4

[clang] [CIR] Upstream support for function-level variable decompositions (PR #151073)

2025-07-28 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/151073 This implements support for structured bindings on a function scope level. It does not add support for global structured bindings. >From 1a77ffaa97180947a4bfb5c09d801f7feb9b173b Mon Sep 17 00:00:00 2001 From: Morri

[clang] [CIR] Upstream support for variable template specializations (PR #151069)

2025-07-28 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/151069 >From a636f04d087eb18e10e6ec738244e2e394deb60b Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Tue, 29 Jul 2025 03:11:11 +0200 Subject: [PATCH 1/2] [CIR] Upstream support for variable template specializations -

  1   2   3   >