[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-04-05 Thread Bruno Cardoso Lopes via cfe-commits
bcardosolopes wrote: > The git history says the FIXME about "Pure" was added when @cmarcelo > introduced `UnaryOp` in the incubator, but there is no PR associated with the > commit so I don't know what discussions may have taken place. We floated the idea of implementing operators as part of `

[clang] [CIR] Upstream initial support for unary op (PR #131369)

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

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-17 Thread Andy Kaylor via cfe-commits
andykaylor wrote: The git history says the FIXME about "Pure" was added when @cmarcelo introduced `UnaryOp` in the incubator, but there is no PR associated with the commit so I don't know what discussions may have taken place. https://github.com/llvm/llvm-project/pull/131369 __

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-15 Thread Erich Keane via cfe-commits
@@ -468,6 +468,55 @@ def BrOp : CIR_Op<"br", }]; } +//===--===// +// UnaryOp +//===--===// + +def UnaryOpKind_Inc : I32EnumAttrCase<"Inc"

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-15 Thread Erich Keane via cfe-commits
@@ -0,0 +1,392 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -Wno-unused-value -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -Wno-unused-value -emit-llvm %s -o %t-cir.ll +// RUN

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-15 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/131369 This adds support for the cir.unary operation. >From d51bb762224f70b2b879198e2466ca0d258f9eae Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 10 Mar 2025 15:07:50 -0700 Subject: [PATCH] [CIR] Upstream

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-15 Thread Erich Keane via cfe-commits
@@ -92,6 +92,222 @@ class ScalarExprEmitter : public StmtVisitor { mlir::Value VisitCastExpr(CastExpr *E); + // Unary Operators. + mlir::Value VisitUnaryPostDec(const UnaryOperator *e) { +LValue lv = cgf.emitLValue(e->getSubExpr()); +return emitScalarPrePostIncDe

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-15 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Andy Kaylor (andykaylor) Changes This adds support for the cir.unary operation. --- Patch is 40.74 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/131369.diff 11 Files Affected: - (modified)

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-15 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,392 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -Wno-unused-value -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -Wno-unused-value -emit-llvm %s -o %t-cir.ll +// RUN

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-15 Thread Erich Keane via cfe-commits
@@ -468,6 +468,55 @@ def BrOp : CIR_Op<"br", }]; } +//===--===// +// UnaryOp +//===--===// + +def UnaryOpKind_Inc : I32EnumAttrCase<"Inc"

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-15 Thread Morris Hafner via cfe-commits
@@ -568,6 +568,128 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMUnaryOpLowering::matchAndRewrite( +cir::UnaryOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewriter &rewriter) const { +

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-15 Thread Andy Kaylor via cfe-commits
@@ -568,6 +568,128 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMUnaryOpLowering::matchAndRewrite( +cir::UnaryOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewriter &rewriter) const { +

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-15 Thread Andy Kaylor via cfe-commits
@@ -92,6 +92,222 @@ class ScalarExprEmitter : public StmtVisitor { mlir::Value VisitCastExpr(CastExpr *E); + // Unary Operators. + mlir::Value VisitUnaryPostDec(const UnaryOperator *e) { +LValue lv = cgf.emitLValue(e->getSubExpr()); +return emitScalarPrePostIncDe

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Andy Kaylor via cfe-commits
@@ -568,6 +568,128 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMUnaryOpLowering::matchAndRewrite( +cir::UnaryOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewriter &rewriter) const { +

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Andy Kaylor via cfe-commits
@@ -568,6 +568,128 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMUnaryOpLowering::matchAndRewrite( +cir::UnaryOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewriter &rewriter) const { +

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I still have the open question on that comment I'd like an answer to, but 1 suggestion here. Else this LGTM. https://github.com/llvm/llvm-project/pull/131369 ___ cfe-commits mailing list cfe-commits@lists.llvm

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Erich Keane via cfe-commits
@@ -165,6 +165,54 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *e) { return LValue(); } +LValue CIRGenFunction::emitUnaryOpLValue(const UnaryOperator *e) { + UnaryOperatorKind op = e->getOpcode(); + + // __extension__ doesn't affect lvalue-ness. + if (op

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Andy Kaylor via cfe-commits
@@ -165,6 +165,54 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *e) { return LValue(); } +LValue CIRGenFunction::emitUnaryOpLValue(const UnaryOperator *e) { + UnaryOperatorKind op = e->getOpcode(); + + // __extension__ doesn't affect lvalue-ness. + if (op

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Andy Kaylor via cfe-commits
@@ -468,6 +468,55 @@ def BrOp : CIR_Op<"br", }]; } +//===--===// +// UnaryOp +//===--===// + +def UnaryOpKind_Inc : I32EnumAttrCase<"Inc"

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/131369 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/131369 >From d51bb762224f70b2b879198e2466ca0d258f9eae Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 10 Mar 2025 15:07:50 -0700 Subject: [PATCH 1/2] [CIR] Upstream initial support for unary op This adds supp

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Andy Kaylor via cfe-commits
@@ -468,6 +468,55 @@ def BrOp : CIR_Op<"br", }]; } +//===--===// +// UnaryOp +//===--===// + +def UnaryOpKind_Inc : I32EnumAttrCase<"Inc"

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Andy Kaylor via cfe-commits
@@ -468,6 +468,55 @@ def BrOp : CIR_Op<"br", }]; } +//===--===// +// UnaryOp +//===--===// + +def UnaryOpKind_Inc : I32EnumAttrCase<"Inc"

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Erich Keane via cfe-commits
@@ -468,6 +468,55 @@ def BrOp : CIR_Op<"br", }]; } +//===--===// +// UnaryOp +//===--===// + +def UnaryOpKind_Inc : I32EnumAttrCase<"Inc"

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Erich Keane via cfe-commits
@@ -92,6 +92,222 @@ class ScalarExprEmitter : public StmtVisitor { mlir::Value VisitCastExpr(CastExpr *E); + // Unary Operators. + mlir::Value VisitUnaryPostDec(const UnaryOperator *e) { +LValue lv = cgf.emitLValue(e->getSubExpr()); +return emitScalarPrePostIncDe

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Erich Keane via cfe-commits
@@ -92,6 +92,222 @@ class ScalarExprEmitter : public StmtVisitor { mlir::Value VisitCastExpr(CastExpr *E); + // Unary Operators. + mlir::Value VisitUnaryPostDec(const UnaryOperator *e) { +LValue lv = cgf.emitLValue(e->getSubExpr()); +return emitScalarPrePostIncDe

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Erich Keane via cfe-commits
@@ -568,6 +568,128 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMUnaryOpLowering::matchAndRewrite( +cir::UnaryOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewriter &rewriter) const { +

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread Erich Keane via cfe-commits
@@ -468,6 +468,55 @@ def BrOp : CIR_Op<"br", }]; } +//===--===// +// UnaryOp +//===--===// + +def UnaryOpKind_Inc : I32EnumAttrCase<"Inc"

[clang] [CIR] Upstream initial support for unary op (PR #131369)

2025-03-14 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clangir Author: Andy Kaylor (andykaylor) Changes This adds support for the cir.unary operation. --- Patch is 40.74 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/131369.diff 11 Files Affected: - (modified