[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 global variable linkage types (PR #129072)

2025-02-27 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/129072 This change implements variable linkage types in ClangIR except for common linkage which requires Comdat support. >From b9453787a96008cfe347c2ae2d027d5de12871ae Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: T

[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] Don't generate ClangIR after an unrecoverable error occured (PR #130971)

2025-03-12 Thread Morris Hafner via cfe-commits
@@ -43,6 +43,8 @@ void CIRGenerator::Initialize(ASTContext &astContext) { mlir::ModuleOp CIRGenerator::getModule() const { return cgm->getModule(); } bool CIRGenerator::HandleTopLevelDecl(DeclGroupRef group) { + if (diags.hasUnrecoverableErrorOccurred()) +return true; ---

[clang] [CIR] Don't generate ClangIR after an unrecoverable error occured (PR #130971)

2025-03-12 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/130971 None >From 92066054a6a14f2e16b7f2256bf730762ab5d5d6 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Wed, 12 Mar 2025 07:28:09 -0700 Subject: [PATCH] [CIR] Don't generate ClangIR after an unrecoverable error occ

[clang] [CIR] Add cir-translate and cir-lsp-server tools (PR #131181)

2025-03-13 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/131181 >From 5847660fc62645844e009f6b67a0c238b66f99ae Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 13 Mar 2025 10:57:12 -0700 Subject: [PATCH 1/3] [CIR] Add cir-translate tool --- clang/test/CIR/Tools/cir-tran

[clang] [CIR] Add cir-translate and cir-lsp-server tools (PR #131181)

2025-03-13 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/131181 @erichkeane @andykaylor @dkolsen-pgi >From 5847660fc62645844e009f6b67a0c238b66f99ae Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 13 Mar 2025 10:57:12 -0700 Subject: [PATCH 1/2] [CIR] Add cir-translate t

[clang] [CIR] Add cir-translate and cir-lsp-server tools (PR #131181)

2025-03-13 Thread Morris Hafner via cfe-commits
@@ -0,0 +1,166 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[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 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 global variable linkage types (PR #129072)

2025-03-05 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/129072 >From 1432050465c1e351edfdfe908de52d1d6d1cf15e Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Mon, 3 Mar 2025 18:44:40 +0100 Subject: [PATCH 1/7] [CIR] Upstream global variable linkage types This change impleme

[clang] [CIR] Upstream global variable linkage types (PR #129072)

2025-03-05 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/129072 >From f19e6f6c5da44bd47c71a1b3d047aa1a0df96568 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Wed, 5 Mar 2025 16:36:21 +0100 Subject: [PATCH 1/7] [CIR] Upstream global variable linkage types This change impleme

[clang] [CIR] Upstream global variable linkage types (PR #129072)

2025-03-05 Thread Morris Hafner via cfe-commits
mmha wrote: Great! I don't have committer status, yet, if that's your question. https://github.com/llvm/llvm-project/pull/129072 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Don't generate ClangIR after an unrecoverable error occured (PR #130971)

2025-03-12 Thread Morris Hafner via cfe-commits
mmha wrote: @ekeane @dkolsen-pgi @andykaylor https://github.com/llvm/llvm-project/pull/130971 ___ 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 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-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-15 Thread Morris Hafner via cfe-commits
@@ -78,6 +78,111 @@ class LLVMLoweringInfo { class CIR_Op traits = []> : Op, LLVMLoweringInfo; +//===--===// +// CastOp +//===--===// + +

[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] Add binary operators (PR #132420)

2025-03-21 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/132420 This patch adds upstreams support for BinOp and BinOverflowOp including lvalue assignments and rudimentary support for pointer arithmetic. Note that this does not include ternary ops, ShiftOp and SelectOp which are

[clang] [CIR] Add binary operators (PR #132420)

2025-03-21 Thread Morris Hafner via cfe-commits
mmha wrote: @erichkeane @dkolsen-pgi @andykaylor https://github.com/llvm/llvm-project/pull/132420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add binary operators (PR #132420)

2025-03-24 Thread Morris Hafner via cfe-commits
@@ -143,6 +147,114 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return createCast(loc, cir::CastKind::bitcast, src, newTy); } + mlir::Value createBinop(mlir::Value lhs, cir::BinOpKind kind, + const llvm::APInt &rhs) { +return create(

[clang] [CIR] Add binary operators (PR #132420)

2025-03-24 Thread Morris Hafner via cfe-commits
@@ -826,6 +826,129 @@ def ForOp : CIR_Op<"for", [LoopOpInterface, NoRegionArguments]> { }]; } +//===--===// +// BinOp +//===--===// + +//

[clang] [CIR] Emit allocas into the proper lexical scope (PR #132468)

2025-03-24 Thread Morris Hafner via cfe-commits
@@ -0,0 +1,81 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apac

[clang] [CIR] Add binary operators (PR #132420)

2025-03-24 Thread Morris Hafner via cfe-commits
@@ -143,6 +147,114 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return createCast(loc, cir::CastKind::bitcast, src, newTy); } + mlir::Value createBinop(mlir::Value lhs, cir::BinOpKind kind, + const llvm::APInt &rhs) { +return create(

[clang] [CIR] Add binary operators (PR #132420)

2025-03-24 Thread Morris Hafner via cfe-commits
@@ -143,6 +147,114 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return createCast(loc, cir::CastKind::bitcast, src, newTy); } + mlir::Value createBinop(mlir::Value lhs, cir::BinOpKind kind, + const llvm::APInt &rhs) { +return create(

[clang] [CIR] Add binary operators (PR #132420)

2025-03-24 Thread Morris Hafner via cfe-commits
mmha wrote: As @andykaylor suggested, I'm going to split off `BinOpOverflowOp` and the pointer arithmetic bits into a separate patch next. https://github.com/llvm/llvm-project/pull/132420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:/

[clang] [CIR] Add binary operators (PR #132420)

2025-03-24 Thread Morris Hafner via cfe-commits
@@ -93,16 +96,20 @@ struct MissingFeatures { static bool stackSaveOp() { return false; } static bool aggValueSlot() { return false; } static bool generateDebugInfo() { return false; } + static bool getFPFeaturesInEffect() { return false; } + static bool pointerOverflowS

[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 support for type aliases (PR #131912)

2025-03-19 Thread Morris Hafner via cfe-commits
@@ -89,6 +89,7 @@ list(APPEND CLANG_TEST_DEPS if(CLANG_ENABLE_CIR) list(APPEND CLANG_TEST_DEPS cir-opt +cir-translate mmha wrote: Thanks! I missed that. I can see that the incubator has `mlir-translate` as a dependency, too. Should we add this now a

[clang] [CIR] Upstream support for type aliases (PR #131912)

2025-03-19 Thread Morris Hafner via cfe-commits
@@ -1,5 +1,5 @@ # Test runner infrastructure for Clang. This configures the Clang test trees -# for use by Lit, and delegates to LLVM's lit test handlers. +# for use by Lit, and delegates to LLVM's lit test handlers.int mmha wrote: copy/paste error? https://git

[clang] [CIR] Add binary operators (PR #132420)

2025-04-05 Thread Morris Hafner via cfe-commits
@@ -558,8 +624,225 @@ class ScalarExprEmitter : public StmtVisitor { return res; } + + BinOpInfo emitBinOps(const BinaryOperator *e, + QualType promotionType = QualType()) { +BinOpInfo result; +result.lhs = cgf.emitPromotedScalarExpr(e->ge

[clang] [CIR] Upstream CmpOp (PR #133159)

2025-04-05 Thread Morris Hafner via cfe-commits
mmha wrote: cc @andykaylor @erichkeane @dkolsen-pgi https://github.com/llvm/llvm-project/pull/133159 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add binary operators (PR #132420)

2025-03-25 Thread Morris Hafner via cfe-commits
@@ -200,7 +200,7 @@ class ASTContext : public RefCountedBase { mutable llvm::ContextualFoldingSet ConstantArrayTypes; mutable llvm::FoldingSet IncompleteArrayTypes; - mutable std::vector VariableArrayTypes; + mutable std::vector VariableArrayTypes;

[clang] [CIR] Add BinOpOverflowOp and basic pointer arithmetic support (PR #133118)

2025-03-26 Thread Morris Hafner via cfe-commits
mmha wrote: cc @andykaylor @erichkeane @dkolsen-pgi https://github.com/llvm/llvm-project/pull/133118 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][NFC] Fix warnings in ClangIR code (PR #133134)

2025-03-26 Thread Morris Hafner via cfe-commits
@@ -170,7 +170,7 @@ mlir::Value CIRGenFunction::evaluateExprAsBool(const Expr *e) { SourceLocation loc = e->getExprLoc(); assert(!cir::MissingFeatures::pgoUse()); - if (const MemberPointerType *MPT = e->getType()->getAs()) { + if (e->getType()->getAs()) { -

[clang] [CIR][NFC] Fix warnings in ClangIR code (PR #133134)

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

[clang] [CIR] Add BinOpOverflowOp and basic pointer arithmetic support (PR #133118)

2025-03-26 Thread Morris Hafner via cfe-commits
@@ -1117,6 +1118,122 @@ mlir::LogicalResult CIRToLLVMBinOpLowering::matchAndRewrite( return mlir::LogicalResult::success(); } +mlir::LogicalResult CIRToLLVMBinOpOverflowOpLowering::matchAndRewrite( +cir::BinOpOverflowOp op, OpAdaptor adaptor, +mlir::ConversionPatter

[clang] [CIR][NFC] Fix warnings in ClangIR code (PR #133134)

2025-03-26 Thread Morris Hafner via cfe-commits
@@ -1251,13 +1236,12 @@ void ConvertCIRToLLVMPass::runOnOperation() { patterns.add(converter, patterns.getContext(), dl); patterns.add(converter, patterns.getContext(), dl); patterns.add(converter, patterns.getContext(), dl); - patterns.add(converter, patterns.getContex

[clang] [CIR][NFC] Fix warnings in ClangIR code (PR #133134)

2025-03-26 Thread Morris Hafner via cfe-commits
@@ -1366,8 +1366,7 @@ mlir::Value ScalarExprEmitter::VisitUnaryExprOrTypeTraitExpr( const mlir::Location loc = cgf.getLoc(e->getSourceRange()); if (auto kind = e->getKind(); kind == UETT_SizeOf || kind == UETT_DataSizeOf) { -if (const VariableArrayType *variableA

[clang] [CIR][NFC] Fix warnings in ClangIR code (PR #133134)

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

[clang] [CIR] Add BinOpOverflowOp and basic pointer arithmetic support (PR #133118)

2025-03-26 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/133118 This was part of #132420 originally but split off to reduce the diff size. This patch adds support for overflowing binary operators and all the plumbing required for pointer arithmetic except for the actual Ops (`P

[clang] [CIR] Add BinOpOverflowOp and basic pointer arithmetic support (PR #133118)

2025-03-26 Thread Morris Hafner via cfe-commits
@@ -223,6 +223,16 @@ class CIRGenFunction : public CIRGenTypeCache { void emitDecl(const clang::Decl &d); + /// Same as IRBuilder::CreateInBoundsGEP, but additionally emits a check to + /// detect undefined behavior when the pointer overflow sanitizer is enabled. + /// \

[clang] [CIR] Upstream CmpOp (PR #133159)

2025-03-26 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/133159 This patch adds support for comparison operators with ClangIR, both integral and floating point. >From 6db5880fa7cdf6363d7e0025f811f42ec273df52 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Wed, 26 Mar 2025 2

[clang] [CIR] Upstream CmpOp (PR #133159)

2025-03-26 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/133159 >From 6db5880fa7cdf6363d7e0025f811f42ec273df52 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Wed, 26 Mar 2025 20:50:57 + Subject: [PATCH 1/2] [CIR] Upstream CmpOp This patch adds support for comparison ope

[clang] [CIR] Upstream CmpOp (PR #133159)

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

[clang] [CIR] Upstream CmpOp (PR #133159)

2025-03-27 Thread Morris Hafner via cfe-commits
@@ -710,6 +710,89 @@ class ScalarExprEmitter : public StmtVisitor { HANDLEBINOP(Xor) HANDLEBINOP(Or) #undef HANDLEBINOP + + mlir::Value emitCmp(const BinaryOperator *e) { +mlir::Value result; +QualType lhsTy = e->getLHS()->getType(); +QualType rhsTy = e->getRH

[clang] [CIR] Upstream CmpOp (PR #133159)

2025-03-27 Thread Morris Hafner via cfe-commits
@@ -710,6 +710,89 @@ class ScalarExprEmitter : public StmtVisitor { HANDLEBINOP(Xor) HANDLEBINOP(Or) #undef HANDLEBINOP + + mlir::Value emitCmp(const BinaryOperator *e) { +mlir::Value result; +QualType lhsTy = e->getLHS()->getType(); +QualType rhsTy = e->getRH

[clang] [CIR] Upstream CmpOp (PR #133159)

2025-03-27 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/133159 >From 6db5880fa7cdf6363d7e0025f811f42ec273df52 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Wed, 26 Mar 2025 20:50:57 + Subject: [PATCH 1/3] [CIR] Upstream CmpOp This patch adds support for comparison ope

[clang] [CIR] Upstream CmpOp (PR #133159)

2025-03-27 Thread Morris Hafner via cfe-commits
@@ -514,9 +515,17 @@ mlir::LogicalResult CIRToLLVMCastOpLowering::matchAndRewrite( assert(!MissingFeatures::cxxABI()); assert(!MissingFeatures::dataMemberType()); break; - case cir::CastKind::ptr_to_bool: -assert(!cir::MissingFeatures::opCmp()); + case cir::C

[clang] [CIR] Upstream CmpOp (PR #133159)

2025-03-27 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/133159 >From 6db5880fa7cdf6363d7e0025f811f42ec273df52 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Wed, 26 Mar 2025 20:50:57 + Subject: [PATCH 1/4] [CIR] Upstream CmpOp This patch adds support for comparison ope

[clang] [CIR] Upstream CmpOp (PR #133159)

2025-03-27 Thread Morris Hafner via cfe-commits
@@ -0,0 +1,233 @@ +// 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 binary assignments and comma (PR #135115)

2025-04-09 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/135115 This patch adds `VisitBinAssign` and `VisitBinComma` to the ClangIR `ScalarExprEmitter` to enable assignments and the comma operator. >From bcaeadf7fff01d2d92b0d234b40f8d5884974e4c Mon Sep 17 00:00:00 2001 From: Mo

[clang] [CIR] Upstream binary assignments and comma (PR #135115)

2025-04-10 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/135115 >From bcaeadf7fff01d2d92b0d234b40f8d5884974e4c Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 10 Apr 2025 03:53:43 +0200 Subject: [PATCH 1/2] [CIR] Upstream binary assignments and comma This patch adds `Vi

[clang] [CIR] Upstream binary assignments and comma (PR #135115)

2025-04-10 Thread Morris Hafner via cfe-commits
@@ -0,0 +1,53 @@ +// RUN: %clang_cc1 -std=c23 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR +// RUN: %clang_cc1 -std=c23 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o

[clang] [CIR] Upstream binary assignments and comma (PR #135115)

2025-04-09 Thread Morris Hafner via cfe-commits
mmha wrote: cc @erichkeane @andykaylor @dkolsen-pgi https://github.com/llvm/llvm-project/pull/135115 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream CmpOp (PR #133159)

2025-04-08 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/133159 >From 57b1d4e30ab61c1723b34fea137e2e900b53e30e Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Tue, 8 Apr 2025 15:02:12 +0200 Subject: [PATCH 1/5] [CIR] Upstream CmpOp This patch adds support for comparison oper

[clang] [CIR] Upstream binary assignments and comma (PR #135115)

2025-04-11 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/135115 >From bcaeadf7fff01d2d92b0d234b40f8d5884974e4c Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 10 Apr 2025 03:53:43 +0200 Subject: [PATCH 1/3] [CIR] Upstream binary assignments and comma This patch adds `Vi

[clang] [CIR] Upstream binary assignments and comma (PR #135115)

2025-04-11 Thread Morris Hafner via cfe-commits
@@ -807,6 +808,65 @@ class ScalarExprEmitter : public StmtVisitor { VISITCOMP(EQ) VISITCOMP(NE) #undef VISITCOMP + + mlir::Value VisitBinAssign(const BinaryOperator *e) { +const bool ignore = std::exchange(ignoreResultAssign, false); + +mlir::Value rhs; +LValu

[clang] [CIR] Upstream binary assignments and comma (PR #135115)

2025-04-11 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/135115 >From 2a9a282dc3227710ce6462d2847876565ba5eb49 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 11 Apr 2025 16:17:45 +0200 Subject: [PATCH 1/3] [CIR] Upstream binary assignments and comma This patch adds `Vi

[clang] [CIR] Upstream binary assignments and comma (PR #135115)

2025-04-11 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/135115 >From 2a9a282dc3227710ce6462d2847876565ba5eb49 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 11 Apr 2025 16:17:45 +0200 Subject: [PATCH 1/4] [CIR] Upstream binary assignments and comma This patch adds `Vi

[clang] [CIR] Upstream binary assignments and comma (PR #135115)

2025-04-11 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/135115 >From 2a9a282dc3227710ce6462d2847876565ba5eb49 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 11 Apr 2025 16:17:45 +0200 Subject: [PATCH 1/4] [CIR] Upstream binary assignments and comma This patch adds `Vi

[clang] [CIR] Upstream binary assignments and comma (PR #135115)

2025-04-11 Thread Morris Hafner via cfe-commits
@@ -219,6 +219,13 @@ void CIRGenFunction::emitStoreOfScalar(mlir::Value value, Address addr, assert(!cir::MissingFeatures::opTBAA()); } +void CIRGenFunction::emitStoreThroughBitfieldLValue(RValue src, LValue dst, +mlir::Va

[clang] [CIR] Add binary operators (PR #132420)

2025-03-24 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/132420 >From 594005c964b5c1e6605dc8ac170f1b43aa018bea Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 21 Mar 2025 17:55:00 +0100 Subject: [PATCH 1/5] [CIR] Add binary operators This patch adds upstreams support fo

[clang] [CIR] Add binary operators (PR #132420)

2025-03-24 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/132420 >From 594005c964b5c1e6605dc8ac170f1b43aa018bea Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 21 Mar 2025 17:55:00 +0100 Subject: [PATCH 1/6] [CIR] Add binary operators This patch adds upstreams support fo

[clang] [CIR] Emit allocas into the proper lexical scope (PR #132468)

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

[clang] [CIR] Emit allocas into the proper lexical scope (PR #132468)

2025-03-24 Thread Morris Hafner via cfe-commits
@@ -44,3 +44,100 @@ void l0() { // OGCG: br label %[[FOR_COND:.*]] // OGCG: [[FOR_COND]]: // OGCG: br label %[[FOR_COND]] + +void l1() { + for (int i = 0; ; ) { + } +} + +// CIR: cir.func @l1 +// CIR-NEXT: cir.scope { +// CIR-NEXT: %[[I:.*]] = cir.alloca !s32i,

[clang] [CIR] Emit allocas into the proper lexical scope (PR #132468)

2025-03-24 Thread Morris Hafner via cfe-commits
@@ -293,7 +294,8 @@ void CIRGenFunction::startFunction(GlobalDecl gd, QualType returnType, mlir::Value addrVal = emitAlloca(cast(paramVar)->getName(), - convertType(paramVar->getType()), paramLoc, alignment); + convertType(param

[clang] [CIR] Emit allocas into the proper lexical scope (PR #132468)

2025-03-24 Thread Morris Hafner via cfe-commits
@@ -0,0 +1,81 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apac

[clang] [CIR] Emit allocas into the proper lexical scope (PR #132468)

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

[clang] [CIR] Add binary operators (PR #132420)

2025-03-24 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/132420 >From 594005c964b5c1e6605dc8ac170f1b43aa018bea Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 21 Mar 2025 17:55:00 +0100 Subject: [PATCH 1/2] [CIR] Add binary operators This patch adds upstreams support fo

[clang] [CIR] Add binary operators (PR #132420)

2025-03-24 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/132420 >From 594005c964b5c1e6605dc8ac170f1b43aa018bea Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 21 Mar 2025 17:55:00 +0100 Subject: [PATCH 1/3] [CIR] Add binary operators This patch adds upstreams support fo

[clang] [CIR] Add binary operators (PR #132420)

2025-03-24 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/132420 >From 594005c964b5c1e6605dc8ac170f1b43aa018bea Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 21 Mar 2025 17:55:00 +0100 Subject: [PATCH 1/4] [CIR] Add binary operators This patch adds upstreams support fo

[clang] [CIR] Emit allocas into the proper lexical scope (PR #132468)

2025-03-25 Thread Morris Hafner via cfe-commits
@@ -0,0 +1,81 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apac

[clang] [CIR] Upstream SelectOp and ShiftOp (PR #133405)

2025-03-28 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/133405 Since SelectOp will only generated by a future pass that transforms a TernaryOp this only includes the lowering bits. This patch also improves the testing of the existing binary operators. >From fc549133df0092c9c2

[clang] [CIR] Upstream SelectOp and ShiftOp (PR #133405)

2025-03-28 Thread Morris Hafner via cfe-commits
mmha wrote: cc @andykaylor @erichkeane @dkolsen-pgi https://github.com/llvm/llvm-project/pull/133405 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add binary operators (PR #132420)

2025-03-25 Thread Morris Hafner via cfe-commits
@@ -143,6 +147,114 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return createCast(loc, cir::CastKind::bitcast, src, newTy); } + mlir::Value createBinop(mlir::Value lhs, cir::BinOpKind kind, + const llvm::APInt &rhs) { +return create(

[clang] [CIR] Add binary operators (PR #132420)

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

[clang] [CIR] Upstream SelectOp and ShiftOp (PR #133405)

2025-04-14 Thread Morris Hafner via cfe-commits
@@ -1294,6 +1296,90 @@ mlir::LogicalResult CIRToLLVMCmpOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMShiftOpLowering::matchAndRewrite( +cir::ShiftOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewriter &rewriter) const { +

[clang] [CIR] Upstream SelectOp and ShiftOp (PR #133405)

2025-04-14 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/133405 >From 13833779faad62f95ef3fc0e2de3ed9b7c44d2f5 Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Fri, 11 Apr 2025 17:46:00 +0200 Subject: [PATCH 1/2] [CIR] Upstream SelectOp and ShiftOp Since SelectOp will only ge

[clang] [CIR] Upstream SelectOp and ShiftOp (PR #133405)

2025-04-14 Thread Morris Hafner via cfe-commits
@@ -759,6 +762,46 @@ LogicalResult cir::BinOp::verify() { return mlir::success(); } +//===--===// +// ShiftOp +//===--===// +LogicalResult

[clang] [CIR] Upstream SelectOp and ShiftOp (PR #133405)

2025-04-17 Thread Morris Hafner via cfe-commits
@@ -1294,6 +1296,90 @@ mlir::LogicalResult CIRToLLVMCmpOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMShiftOpLowering::matchAndRewrite( +cir::ShiftOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewriter &rewriter) const { +

[clang] [OpenACC][CIR] Implement 'async' lowering. (PR #136626)

2025-04-22 Thread Morris Hafner via cfe-commits
@@ -639,6 +639,9 @@ OpenACCClause *SemaOpenACCClauseVisitor::VisitVectorLengthClause( OpenACCClause *SemaOpenACCClauseVisitor::VisitAsyncClause( SemaOpenACC::OpenACCParsedClause &Clause) { + if (DisallowSinceLastDeviceType(Clause)) mmha wrote: Can you u

[clang] [CIR] Upstream TernaryOp (PR #137184)

2025-04-24 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/137184 This patch adds TernaryOp to CIR plus a pass that flattens the operator in FlattenCFG. This is the first PR out of (probably) 3 wrt. TernaryOp. I split the patches up to make reviewing them easier. As such, this P

[clang] [CIR] Upstream TernaryOp (PR #137184)

2025-04-24 Thread Morris Hafner via cfe-commits
@@ -609,8 +609,8 @@ def ConditionOp : CIR_Op<"condition", [ //===--===// def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator, - ParentOneOf<["IfOp", "ScopeOp", "WhileOp", -

[clang] [CIR] Upstream TernaryOp (PR #137184)

2025-04-24 Thread Morris Hafner via cfe-commits
@@ -1246,6 +1246,59 @@ def SelectOp : CIR_Op<"select", [Pure, }]; } +//===--===// +// TernaryOp +//===--===// + +def TernaryOp : CIR_Op<"te

[clang] [CIR] Upstream TernaryOp (PR #137184)

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

[clang] [CIR] Upstream TernaryOp (PR #137184)

2025-04-25 Thread Morris Hafner via cfe-commits
@@ -1246,6 +1246,59 @@ def SelectOp : CIR_Op<"select", [Pure, }]; } +//===--===// +// TernaryOp +//===--===// + +def TernaryOp : CIR_Op<"te

[clang] [CIR] Upstream TernaryOp (PR #137184)

2025-04-25 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/137184 >From 1eed90e3859c2ad8d703708f89976cad8f0faeec Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 24 Apr 2025 16:12:37 +0200 Subject: [PATCH 1/3] [CIR] Upstream TernaryOp This patch adds TernaryOp to CIR plus

[clang] [CIR] Upstream TernaryOp (PR #137184)

2025-04-25 Thread Morris Hafner via cfe-commits
@@ -609,8 +609,8 @@ def ConditionOp : CIR_Op<"condition", [ //===--===// def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator, - ParentOneOf<["IfOp", "ScopeOp", "WhileOp", -

[clang] [CIR] Upstream TernaryOp (PR #137184)

2025-04-24 Thread Morris Hafner via cfe-commits
https://github.com/mmha updated https://github.com/llvm/llvm-project/pull/137184 >From 1eed90e3859c2ad8d703708f89976cad8f0faeec Mon Sep 17 00:00:00 2001 From: Morris Hafner Date: Thu, 24 Apr 2025 16:12:37 +0200 Subject: [PATCH 1/2] [CIR] Upstream TernaryOp This patch adds TernaryOp to CIR plus

[clang] [CIR] Add cir-simplify pass (PR #138317)

2025-05-02 Thread Morris Hafner via cfe-commits
https://github.com/mmha created https://github.com/llvm/llvm-project/pull/138317 This patch adds the cir-simplify pass for SelectOp and TernaryOp. It also adds the SelectOp folder and adds the constant materializer for the CIR dialect. >From 2b6ecd77c4fac0a2982172294d12ae858f0a2b34 Mon Sep 17 0

[clang] [CIR] Add cir-simplify pass (PR #138317)

2025-05-02 Thread Morris Hafner via cfe-commits
@@ -27,6 +27,8 @@ def CIR_Dialect : Dialect { let useDefaultAttributePrinterParser = 0; let useDefaultTypePrinterParser = 0; + let hasConstantMaterializer = 1; mmha wrote: There's some documentation here: https://mlir.llvm.org/docs/Canonicalization/#gen

[clang] [CIR] Refactor global variable emission and initialization (PR #138222)

2025-05-02 Thread Morris Hafner via cfe-commits
@@ -365,46 +406,108 @@ mlir::Value CIRGenModule::getAddrOfGlobalVar(const VarDecl *d, mlir::Type ty, void CIRGenModule::emitGlobalVarDefinition(const clang::VarDecl *vd, bool isTentative) { const QualType astTy = vd->getType(); - c

[clang] [CIR] Refactor global variable emission and initialization (PR #138222)

2025-05-02 Thread Morris Hafner via cfe-commits
@@ -90,8 +90,100 @@ class ConstExprEmitter } mlir::Attribute VisitCastExpr(CastExpr *e, QualType destType) { -cgm.errorNYI(e->getBeginLoc(), "ConstExprEmitter::VisitCastExpr"); -return {}; +if (const auto *ece = dyn_cast(e)) + cgm.errorNYI(e->getBeginLoc()

[clang] [CIR] Refactor global variable emission and initialization (PR #138222)

2025-05-02 Thread Morris Hafner via cfe-commits
@@ -31,6 +31,15 @@ class ConstantEmitter { private: bool abstract = false; + /// Whether non-abstract components of the emitter have been initialized. + bool initializedNonAbstract = false; mmha wrote: Is this just for sanity checking? Should this be wrap

[clang] [CIR] Refactor global variable emission and initialization (PR #138222)

2025-05-02 Thread Morris Hafner via cfe-commits
@@ -365,46 +406,108 @@ mlir::Value CIRGenModule::getAddrOfGlobalVar(const VarDecl *d, mlir::Type ty, void CIRGenModule::emitGlobalVarDefinition(const clang::VarDecl *vd, bool isTentative) { const QualType astTy = vd->getType(); - c

[clang] [CIR] Refactor global variable emission and initialization (PR #138222)

2025-05-02 Thread Morris Hafner via cfe-commits
@@ -118,7 +210,26 @@ class ConstExprEmitter } mlir::Attribute VisitInitListExpr(InitListExpr *ile, QualType t) { -cgm.errorNYI(ile->getBeginLoc(), "ConstExprEmitter::VisitInitListExpr"); +if (ile->isTransparent()) + return Visit(ile->getInit(0), t); + +if

[clang] [CIR] Refactor global variable emission and initialization (PR #138222)

2025-05-02 Thread Morris Hafner via cfe-commits
https://github.com/mmha commented: Mostly a few nits. https://github.com/llvm/llvm-project/pull/138222 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   >