[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-15 Thread Morris Hafner via cfe-commits
@@ -78,6 +78,111 @@ class LLVMLoweringInfo { class CIR_Op traits = []> : Op, LLVMLoweringInfo; +//===--===// +// CastOp +//===--===// + +

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-15 Thread Andy Kaylor via cfe-commits
@@ -121,29 +364,173 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) { return ScalarExprEmitter(*this, builder).Visit(const_cast(e)); } +[[maybe_unused]] static bool MustVisitNullValue(const Expr *e) { + // If a null pointer expression's type is the C++0x nullp

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-15 Thread Erich Keane via cfe-commits
@@ -121,29 +375,174 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) { return ScalarExprEmitter(*this, builder).Visit(const_cast(e)); } +[[maybe_unused]] static bool MustVisitNullValue(const Expr *e) { + // If a null pointer expression's type is the C++0x nullp

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-15 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,58 @@ +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir andykaylor wrote: It looks like floating casts are still missing. Can you add float-to-double and double-to-float test? https://github.com/llvm/ll

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-14 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. LGTM with one very minor nit https://github.com/llvm/llvm-project/pull/130690 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-14 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,100 @@ +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir -DCIR_ONLY %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-14 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/130690 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-14 Thread Morris Hafner via cfe-commits
@@ -121,29 +364,173 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) { return ScalarExprEmitter(*this, builder).Visit(const_cast(e)); } +[[maybe_unused]] static bool MustVisitNullValue(const Expr *e) { + // If a null pointer expression's type is the C++0x nullp

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-14 Thread Morris Hafner via cfe-commits
@@ -0,0 +1,79 @@ +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s + +unsigned char cxxstaticcast_0(unsigned int x) { + return static_cast(x); +} + +// CHECK: cir.func @cxxstaticcast_0 +// C

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-14 Thread Andy Kaylor via cfe-commits
@@ -121,29 +364,173 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) { return ScalarExprEmitter(*this, builder).Visit(const_cast(e)); } +[[maybe_unused]] static bool MustVisitNullValue(const Expr *e) { + // If a null pointer expression's type is the C++0x nullp

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-14 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,79 @@ +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s + +unsigned char cxxstaticcast_0(unsigned int x) { + return static_cast(x); +} + +// CHECK: cir.func @cxxstaticcast_0 +// C

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-13 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,58 @@ +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir bcardosolopes wrote: Has this been addressed? https://github.com/llvm/llvm-project/pull/130690 ___ cfe

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-13 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes approved this pull request. LGTM pending on question left in one comment https://github.com/llvm/llvm-project/pull/130690 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

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

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-13 Thread Erich Keane via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-13 Thread Erich Keane via cfe-commits
@@ -90,24 +89,279 @@ class ScalarExprEmitter : public StmtVisitor { builder.getCIRBoolAttr(e->getValue())); } - mlir::Value VisitCastExpr(CastExpr *E); + mlir::Value VisitCastExpr(CastExpr *e); + + mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) { +ret

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-13 Thread Erich Keane via cfe-commits
@@ -121,29 +375,174 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) { return ScalarExprEmitter(*this, builder).Visit(const_cast(e)); } +[[maybe_unused]] static bool MustVisitNullValue(const Expr *e) { + // If a null pointer expression's type is the C++0x nullp

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-13 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. 1 nit, else LGTM. https://github.com/llvm/llvm-project/pull/130690 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-13 Thread Erich Keane via cfe-commits
@@ -247,6 +280,179 @@ struct ConvertCIRToLLVMPass StringRef getArgument() const override { return "cir-flat-to-llvm"; } }; +mlir::Type CIRToLLVMCastOpLowering::convertTy(mlir::Type ty) const { + return getTypeConverter()->convertType(ty); +} + +mlir::LogicalResult CIRToLLVM

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

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

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-13 Thread Erich Keane via cfe-commits
@@ -121,29 +375,174 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) { return ScalarExprEmitter(*this, builder).Visit(const_cast(e)); } +[[maybe_unused]] static bool MustVisitNullValue(const Expr *e) { + // If a null pointer expression's type is the C++0x nullp

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/130690 >From a945e21869e5276c66ac979acd893d9bd9afe2cc Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Mon, 10 Mar 2025 16:18:34 -0700 Subject: [PATCH 1/4] [CIR] Upstream CastOp and scalar conversions This patch upstrea

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -90,20 +89,259 @@ class ScalarExprEmitter : public StmtVisitor { builder.getCIRBoolAttr(e->getValue())); } - mlir::Value VisitCastExpr(CastExpr *E); + mlir::Value VisitCastExpr(CastExpr *e); + + mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) { +ret

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -90,24 +89,279 @@ class ScalarExprEmitter : public StmtVisitor { builder.getCIRBoolAttr(e->getValue())); } - mlir::Value VisitCastExpr(CastExpr *E); + mlir::Value VisitCastExpr(CastExpr *e); + + mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) { +ret

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -90,20 +89,259 @@ class ScalarExprEmitter : public StmtVisitor { builder.getCIRBoolAttr(e->getValue())); } - mlir::Value VisitCastExpr(CastExpr *E); + mlir::Value VisitCastExpr(CastExpr *e); + + mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) { +ret

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Morris Hafner via cfe-commits
@@ -121,29 +375,174 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) { return ScalarExprEmitter(*this, builder).Visit(const_cast(e)); } +[[maybe_unused]] static bool MustVisitNullValue(const Expr *e) { + // If a null pointer expression's type is the C++0x nullp

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -90,24 +89,279 @@ class ScalarExprEmitter : public StmtVisitor { builder.getCIRBoolAttr(e->getValue())); } - mlir::Value VisitCastExpr(CastExpr *E); + mlir::Value VisitCastExpr(CastExpr *e); + + mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) { +ret

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -90,24 +89,279 @@ class ScalarExprEmitter : public StmtVisitor { builder.getCIRBoolAttr(e->getValue())); } - mlir::Value VisitCastExpr(CastExpr *E); + mlir::Value VisitCastExpr(CastExpr *e); + + mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) { +ret

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -90,24 +89,279 @@ class ScalarExprEmitter : public StmtVisitor { builder.getCIRBoolAttr(e->getValue())); } - mlir::Value VisitCastExpr(CastExpr *E); + mlir::Value VisitCastExpr(CastExpr *e); + + mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) { +ret

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -78,6 +78,156 @@ class LLVMLoweringInfo { class CIR_Op traits = []> : Op, LLVMLoweringInfo; +//===--===// +// CastOp +//===--===// + +

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -90,24 +89,279 @@ class ScalarExprEmitter : public StmtVisitor { builder.getCIRBoolAttr(e->getValue())); } - mlir::Value VisitCastExpr(CastExpr *E); + mlir::Value VisitCastExpr(CastExpr *e); + + mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) { +ret

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -121,29 +375,174 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) { return ScalarExprEmitter(*this, builder).Visit(const_cast(e)); } +[[maybe_unused]] static bool MustVisitNullValue(const Expr *e) { + // If a null pointer expression's type is the C++0x nullp

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -121,29 +359,159 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) { return ScalarExprEmitter(*this, builder).Visit(const_cast(e)); } +[[maybe_unused]] static bool MustVisitNullValue(const Expr *e) { + // If a null pointer expression's type is the C++0x nullp

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -247,6 +280,179 @@ struct ConvertCIRToLLVMPass StringRef getArgument() const override { return "cir-flat-to-llvm"; } }; +mlir::Type CIRToLLVMCastOpLowering::convertTy(mlir::Type ty) const { + return getTypeConverter()->convertType(ty); +} + +mlir::LogicalResult CIRToLLVM

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/130690 >From a945e21869e5276c66ac979acd893d9bd9afe2cc Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Mon, 10 Mar 2025 16:18:34 -0700 Subject: [PATCH 1/5] [CIR] Upstream CastOp and scalar conversions This patch upstrea

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -90,20 +89,259 @@ class ScalarExprEmitter : public StmtVisitor { builder.getCIRBoolAttr(e->getValue())); } - mlir::Value VisitCastExpr(CastExpr *E); + mlir::Value VisitCastExpr(CastExpr *e); + + mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) { +ret

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -90,20 +89,259 @@ class ScalarExprEmitter : public StmtVisitor { builder.getCIRBoolAttr(e->getValue())); } - mlir::Value VisitCastExpr(CastExpr *E); + mlir::Value VisitCastExpr(CastExpr *e); + + mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) { +ret

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -121,29 +359,159 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) { return ScalarExprEmitter(*this, builder).Visit(const_cast(e)); } +[[maybe_unused]] static bool MustVisitNullValue(const Expr *e) { + // If a null pointer expression's type is the C++0x nullp

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -121,29 +359,159 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) { return ScalarExprEmitter(*this, builder).Visit(const_cast(e)); } +[[maybe_unused]] static bool MustVisitNullValue(const Expr *e) { + // If a null pointer expression's type is the C++0x nullp

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -78,6 +78,111 @@ class LLVMLoweringInfo { class CIR_Op traits = []> : Op, LLVMLoweringInfo; +//===--===// +// CastOp +//===--===// + +

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -90,20 +89,259 @@ class ScalarExprEmitter : public StmtVisitor { builder.getCIRBoolAttr(e->getValue())); } - mlir::Value VisitCastExpr(CastExpr *E); + mlir::Value VisitCastExpr(CastExpr *e); + + mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) { +ret

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-12 Thread Erich Keane via cfe-commits
@@ -90,20 +89,259 @@ class ScalarExprEmitter : public StmtVisitor { builder.getCIRBoolAttr(e->getValue())); } - mlir::Value VisitCastExpr(CastExpr *E); + mlir::Value VisitCastExpr(CastExpr *e); + + mlir::Value VisitExplicitCastExpr(ExplicitCastExpr *e) { +ret

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Morris Hafner via cfe-commits
@@ -78,6 +79,67 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return create(loc, val, dst); } + //======// + // Cast/Conversion Operators + //===--

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,58 @@ +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s + +unsigned char cxxstaticcast_0(unsigned int x) { + return static_cast(x); +} + +// CHECK: cir.func @cxxstaticcast_0 +// C

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Andy Kaylor via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Andy Kaylor via cfe-commits
@@ -36,6 +36,18 @@ class ScalarExprEmitter : public StmtVisitor { bool ira = false) : cgf(cgf), builder(builder), ignoreResultAssign(ira) {} + //======// + //

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,58 @@ +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir andykaylor wrote: Can you expand this test to cover all the cast types you're adding (or remove any that can't be supported yet)? https://github.c

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Andy Kaylor via cfe-commits
@@ -78,6 +79,67 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return create(loc, val, dst); } + //======// + // Cast/Conversion Operators + //===--

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Andy Kaylor via cfe-commits
@@ -36,6 +36,18 @@ class ScalarExprEmitter : public StmtVisitor { bool ira = false) : cgf(cgf), builder(builder), ignoreResultAssign(ira) {} + //======// + //

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Andy Kaylor via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/130690 >From b9a55d112998c468cce5cabff33939e4412e7ded Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Mon, 10 Mar 2025 16:18:34 -0700 Subject: [PATCH 1/2] [CIR] Upstream CastOp and scalar conversions This patch upstrea

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Morris Hafner via cfe-commits
@@ -36,6 +36,18 @@ class ScalarExprEmitter : public StmtVisitor { bool ira = false) : cgf(cgf), builder(builder), ignoreResultAssign(ira) {} + //======// + //

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Morris Hafner via cfe-commits
@@ -78,6 +79,67 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return create(loc, val, dst); } + //======// + // Cast/Conversion Operators + //===--

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
@@ -130,17 +389,136 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *ce) { QualType destTy = ce->getType(); CastKind kind = ce->getCastKind(); + // These cases are generally not written to ignore the result of evaluating + // their sub-expressions, so we clear

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
@@ -78,6 +79,67 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return create(loc, val, dst); } + //======// + // Cast/Conversion Operators + //===--

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

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

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
@@ -130,17 +389,136 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *ce) { QualType destTy = ce->getType(); CastKind kind = ce->getCastKind(); + // These cases are generally not written to ignore the result of evaluating + // their sub-expressions, so we clear

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
@@ -130,17 +389,136 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *ce) { QualType destTy = ce->getType(); CastKind kind = ce->getCastKind(); + // These cases are generally not written to ignore the result of evaluating + // their sub-expressions, so we clear

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: We have to be mroe careful I think with uses of the `errorNYI` in a few places, we are using it too much like `assert` when it is more like `emitDiag`. Also, this patch uses `auto` a bunch in ways that are contrary to the coding standard. See : https

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
@@ -84,26 +96,266 @@ class ScalarExprEmitter : public StmtVisitor { } mlir::Value VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *e) { -mlir::Type type = cgf.convertType(e->getType()); +mlir::Type type = convertType(e->getType()); return builder.create(

[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

2025-03-11 Thread Erich Keane via cfe-commits
@@ -36,6 +36,18 @@ class ScalarExprEmitter : public StmtVisitor { bool ira = false) : cgf(cgf), builder(builder), ignoreResultAssign(ira) {} + //======// + //