[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-08 Thread Amr Hesham via cfe-commits
AmrDeveloper wrote: > I have mixed feelings about this change. It mostly overlaps with what I am > working on, which is class `LexicalScope`, which has a bunch of the code for > handling the return value. I think I would prefer that this PR be dropped, as > the changes will be part of the PR I

[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-06 Thread Amr Hesham via cfe-commits
https://github.com/AmrDeveloper closed https://github.com/llvm/llvm-project/pull/129933 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-05 Thread David Olsen via cfe-commits
dkolsen-pgi wrote: I have mixed feelings about this change. It mostly overlaps with what I am working on, which is class `LexicalScope`, which has a bunch of the code for handling the return value. I think I would prefer that this PR be dropped, as the changes will be part of the PR I am wor

[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-05 Thread Andy Kaylor via cfe-commits
@@ -195,7 +195,16 @@ void CIRGenFunction::startFunction(GlobalDecl gd, QualType returnType, mlir::Location fnBodyBegin = getLoc(fd->getBody()->getBeginLoc()); builder.CIRBaseBuilderTy::createStore(fnBodyBegin, paramVal, addrVal); } + assert(builder.getInsertionBlo

[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-05 Thread Andy Kaylor via cfe-commits
@@ -312,4 +326,12 @@ LValue CIRGenFunction::emitLValue(const Expr *e) { } } +void CIRGenFunction::emitAndUpdateRetAlloca(QualType ty, mlir::Location loc, +CharUnits alignment) { + if (ty->isVoidType()) { +return; + } + --

[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-05 Thread Andy Kaylor via cfe-commits
@@ -13,8 +13,9 @@ void voidret() { return; } int intfunc() { return 42; } // CHECK: cir.func @intfunc() -> !cir.int { -// CHECK: %0 = cir.const #cir.int<42> : !cir.int -// CHECK: cir.return %0 : !cir.int +// CHECK: %0 = cir.alloca !cir.int, !cir.ptr>, ["__retval"] {alig

[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-05 Thread Andy Kaylor via cfe-commits
@@ -13,8 +13,9 @@ void voidret() { return; } int intfunc() { return 42; } // CHECK: cir.func @intfunc() -> !cir.int { -// CHECK: %0 = cir.const #cir.int<42> : !cir.int -// CHECK: cir.return %0 : !cir.int +// CHECK: %0 = cir.alloca !cir.int, !cir.ptr>, ["__retval"] {alig

[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-05 Thread Erich Keane via cfe-commits
@@ -49,6 +49,8 @@ class CIRGenFunction : public CIRGenTypeCache { public: clang::QualType fnRetTy; erichkeane wrote: Actually I question the need for `fnRetTy` too, particularly since `fnRetQualTy` and `fnRetTy` are not being set together... https://githu

[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-05 Thread Erich Keane via cfe-commits
@@ -195,7 +195,16 @@ void CIRGenFunction::startFunction(GlobalDecl gd, QualType returnType, mlir::Location fnBodyBegin = getLoc(fd->getBody()->getBeginLoc()); builder.CIRBaseBuilderTy::createStore(fnBodyBegin, paramVal, addrVal); } + assert(builder.getInsertionBlo

[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-05 Thread Erich Keane via cfe-commits
@@ -213,6 +222,11 @@ mlir::LogicalResult CIRGenFunction::emitFunctionBody(const clang::Stmt *body) { cir::FuncOp CIRGenFunction::generateCode(clang::GlobalDecl gd, cir::FuncOp fn, cir::FuncType funcType) { const auto funcDecl = cast(g

[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-05 Thread Erich Keane via cfe-commits
@@ -195,7 +195,16 @@ void CIRGenFunction::startFunction(GlobalDecl gd, QualType returnType, mlir::Location fnBodyBegin = getLoc(fd->getBody()->getBeginLoc()); builder.CIRBaseBuilderTy::createStore(fnBodyBegin, paramVal, addrVal); } + assert(builder.getInsertionBlo

[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-05 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clangir Author: Amr Hesham (AmrDeveloper) Changes This change adds support for the basic case of emitAndUpdateRetAlloca --- Full diff: https://github.com/llvm/llvm-project/pull/129933.diff 3 Files Affected: - (modified) clang/lib/CIR/CodeGen/CIRGenFu

[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-05 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Amr Hesham (AmrDeveloper) Changes This change adds support for the basic case of emitAndUpdateRetAlloca --- Full diff: https://github.com/llvm/llvm-project/pull/129933.diff 3 Files Affected: - (modified) clang/lib/CIR/CodeGen/CIRGenFunc

[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)

2025-03-05 Thread Amr Hesham via cfe-commits
https://github.com/AmrDeveloper created https://github.com/llvm/llvm-project/pull/129933 This change adds support for the basic case of emitAndUpdateRetAlloca >From 1db2baafe9ed0ab360517810144300db0e7410f6 Mon Sep 17 00:00:00 2001 From: AmrDeveloper Date: Wed, 5 Mar 2025 18:18:07 +0100 Subject