[clang] [CIR] Upstream initial for-loop support (PR #132266)

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

[clang] [CIR] Upstream initial for-loop support (PR #132266)

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

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-04-05 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/132266 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-04-05 Thread Erich Keane via cfe-commits
@@ -165,6 +165,25 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *e) { return LValue(); } +mlir::Value CIRGenFunction::evaluateExprAsBool(const Expr *e) { erichkeane wrote: Sorry, I meant in 'clang' we consider Bool to be 8 bit(when stored)

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-04-05 Thread Andy Kaylor via cfe-commits
@@ -165,6 +165,25 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *e) { return LValue(); } +mlir::Value CIRGenFunction::evaluateExprAsBool(const Expr *e) { andykaylor wrote: I'm not sure `Bool` is ever used to represent an `i8`. Typically the

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-04-04 Thread Andy Kaylor via cfe-commits
@@ -280,3 +313,77 @@ mlir::LogicalResult CIRGenFunction::emitReturnStmt(const ReturnStmt &s) { return mlir::success(); } + +mlir::LogicalResult CIRGenFunction::emitForStmt(const ForStmt &s) { + cir::ForOp forOp; + + // TODO: pass in an array of attributes. + auto forStmt

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-03-24 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/132266 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-03-23 Thread Erich Keane via cfe-commits
@@ -165,6 +165,25 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *e) { return LValue(); } +mlir::Value CIRGenFunction::evaluateExprAsBool(const Expr *e) { erichkeane wrote: This should only be necessary in C, right? Where 'bool' isn't avail

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-03-20 Thread Andy Kaylor via cfe-commits
@@ -280,3 +313,77 @@ mlir::LogicalResult CIRGenFunction::emitReturnStmt(const ReturnStmt &s) { return mlir::success(); } + +mlir::LogicalResult CIRGenFunction::emitForStmt(const ForStmt &s) { + cir::ForOp forOp; + + // TODO: pass in an array of attributes. + auto forStmt

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-03-20 Thread Bruno Cardoso Lopes via cfe-commits
@@ -52,6 +52,15 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return cir::BoolAttr::get(getContext(), getBoolTy(), state); } + /// Create a for operation. + cir::ForOp createFor( + mlir::Location loc, + llvm::function_ref condBuilder,

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-03-20 Thread Erich Keane via cfe-commits
@@ -280,3 +313,77 @@ mlir::LogicalResult CIRGenFunction::emitReturnStmt(const ReturnStmt &s) { return mlir::success(); } + +mlir::LogicalResult CIRGenFunction::emitForStmt(const ForStmt &s) { + cir::ForOp forOp; + + // TODO: pass in an array of attributes. + auto forStmt

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-03-20 Thread Erich Keane via cfe-commits
@@ -280,3 +313,77 @@ mlir::LogicalResult CIRGenFunction::emitReturnStmt(const ReturnStmt &s) { return mlir::success(); } + +mlir::LogicalResult CIRGenFunction::emitForStmt(const ForStmt &s) { + cir::ForOp forOp; + + // TODO: pass in an array of attributes. + auto forStmt

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-03-20 Thread Erich Keane via cfe-commits
@@ -165,6 +165,25 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *e) { return LValue(); } +mlir::Value CIRGenFunction::evaluateExprAsBool(const Expr *e) { erichkeane wrote: Ah, I see. So even 8-bit 'bool' type is getting converted. It is a

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-03-20 Thread Andy Kaylor via cfe-commits
@@ -52,6 +52,15 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return cir::BoolAttr::get(getContext(), getBoolTy(), state); } + /// Create a for operation. + cir::ForOp createFor( + mlir::Location loc, + llvm::function_ref condBuilder,

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-03-20 Thread Andy Kaylor via cfe-commits
@@ -165,6 +165,25 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *e) { return LValue(); } +mlir::Value CIRGenFunction::evaluateExprAsBool(const Expr *e) { andykaylor wrote: Even for C, we want to generate a cir.bool value. The classic codege

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-03-20 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Andy Kaylor (andykaylor) Changes This change adds support for empty for-loops. This will be the infrastructre needed for complete for loops, but that depends on compare operations, which have not been upstreamed yet. --- Patch is 46.30

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-03-20 Thread Erich Keane via cfe-commits
@@ -52,6 +52,15 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return cir::BoolAttr::get(getContext(), getBoolTy(), state); } + /// Create a for operation. + cir::ForOp createFor( + mlir::Location loc, + llvm::function_ref condBuilder,

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-03-20 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clangir Author: Andy Kaylor (andykaylor) Changes This change adds support for empty for-loops. This will be the infrastructre needed for complete for loops, but that depends on compare operations, which have not been upstreamed yet. --- Patch is 46.3

[clang] [CIR] Upstream initial for-loop support (PR #132266)

2025-03-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/132266 This change adds support for empty for-loops. This will be the infrastructre needed for complete for loops, but that depends on compare operations, which have not been upstreamed yet. >From 20c016291947451b