[clang] [CIR] Upstream VectorType support in helper function (PR #142222)

2025-05-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor commented: This looks mostly reasonable to me, but I'd like to have feedback from @xlauko. It looks like it would be NFC though. Are the new tests verifying anything that didn't work before this change? https://github.com/llvm/llvm-project/pull/14 __

[clang] [CIR] Upstream VectorType support in helper function (PR #142222)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -16,6 +16,7 @@ #include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/Types.h" #include "mlir/Interfaces/DataLayoutInterfaces.h" +#include "clang/CIR/Dialect/IR/CIRTypes.h" andykaylor wrote: Isn't this including the current file? https://github.com/llvm/

[clang] [CIR] Upstream VectorType support in helper function (PR #142222)

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

[clang] [CIR] Enable support for nested struct members in C++ (PR #142205)

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

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -14,6 +14,105 @@ namespace clang::CIRGen { +/// Record with information about how a bitfield should be accessed. This is +/// very similar to what LLVM codegen does, once CIR evolves it's possible we +/// can use a more higher level representation. +/// +/// Often we lay o

[clang] [CIR] Skip generation of a continue block when flattening TernaryOp (PR #142165)

2025-05-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/142165 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Fix dso_local and comdat handling for global vars (PR #142214)

2025-05-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/142214 This change adds extra processing of global variable definitions to correctly set the dso_local and comdat attributes. >From f23b194d46956bd0af34413fa4f4919ea610e643 Mon Sep 17 00:00:00 2001 From: Andy Kaylo

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 Thread Andy Kaylor via cfe-commits
andykaylor wrote: @bcardosolopes, I have some general concerns about the way that we're representing bitfields and bitfield accesses. It seems fundamentally inconsistent with the way we represent unions. For example: ``` union U { char a; int b; long c; }; ``` becomes `!cir.record -> !c

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -223,21 +272,114 @@ void CIRRecordLowering::fillOutputFields() { fieldTypes.size() - 1; // A field without storage must be a bitfield. assert(!cir::MissingFeatures::bitfields()); + if (!member.data) +setBitFieldInfo(member.fieldDecl, memb

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -223,21 +272,114 @@ void CIRRecordLowering::fillOutputFields() { fieldTypes.size() - 1; // A field without storage must be a bitfield. assert(!cir::MissingFeatures::bitfields()); + if (!member.data) +setBitFieldInfo(member.fieldDecl, memb

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -172,6 +195,32 @@ CIRRecordLowering::CIRRecordLowering(CIRGenTypes &cirGenTypes, zeroInitializable(true), zeroInitializableAsBase(true), packed(packed), padded(false) {} +void CIRRecordLowering::setBitFieldInfo(const FieldDecl *fd, +

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -14,6 +14,105 @@ namespace clang::CIRGen { +/// Record with information about how a bitfield should be accessed. This is +/// very similar to what LLVM codegen does, once CIR evolves it's possible we +/// can use a more higher level representation. +/// +/// Often we lay o

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 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 --check-prefix=CIR +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll +//

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -14,6 +14,105 @@ namespace clang::CIRGen { +/// Record with information about how a bitfield should be accessed. This is +/// very similar to what LLVM codegen does, once CIR evolves it's possible we +/// can use a more higher level representation. +/// +/// Often we lay o

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -223,21 +272,114 @@ void CIRRecordLowering::fillOutputFields() { fieldTypes.size() - 1; // A field without storage must be a bitfield. assert(!cir::MissingFeatures::bitfields()); + if (!member.data) +setBitFieldInfo(member.fieldDecl, memb

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -223,21 +272,114 @@ void CIRRecordLowering::fillOutputFields() { fieldTypes.size() - 1; // A field without storage must be a bitfield. assert(!cir::MissingFeatures::bitfields()); + if (!member.data) +setBitFieldInfo(member.fieldDecl, memb

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -223,21 +272,114 @@ void CIRRecordLowering::fillOutputFields() { fieldTypes.size() - 1; // A field without storage must be a bitfield. assert(!cir::MissingFeatures::bitfields()); + if (!member.data) +setBitFieldInfo(member.fieldDecl, memb

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -223,21 +272,114 @@ void CIRRecordLowering::fillOutputFields() { fieldTypes.size() - 1; // A field without storage must be a bitfield. assert(!cir::MissingFeatures::bitfields()); + if (!member.data) +setBitFieldInfo(member.fieldDecl, memb

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -223,21 +272,114 @@ void CIRRecordLowering::fillOutputFields() { fieldTypes.size() - 1; // A field without storage must be a bitfield. assert(!cir::MissingFeatures::bitfields()); + if (!member.data) +setBitFieldInfo(member.fieldDecl, memb

[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -223,21 +272,114 @@ void CIRRecordLowering::fillOutputFields() { fieldTypes.size() - 1; // A field without storage must be a bitfield. assert(!cir::MissingFeatures::bitfields()); + if (!member.data) +setBitFieldInfo(member.fieldDecl, memb

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

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

[clang] [CIR] Enable support for nested struct members in C++ (PR #142205)

2025-05-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/142205 This enables us to compile C++ code with nested structures. The necessary support for this was already in place, but we were hitting an NYI error in a place where the implementation only needed to check for

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/141973 >From 70aa8d668cf610eb7d2486b60112591a19d3db89 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 23 May 2025 11:03:05 -0700 Subject: [PATCH 1/2] [CIR] Add support for global linkage and visibility This c

[clang] [CIR] Upstream converting vector types (PR #142012)

2025-05-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/142012 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/141973 >From 70aa8d668cf610eb7d2486b60112591a19d3db89 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 23 May 2025 11:03:05 -0700 Subject: [PATCH 1/3] [CIR] Add support for global linkage and visibility This c

[clang] [CIR] Call to variadic functions (PR #141942)

2025-05-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/141942 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream ShuffleDynamicOp for VectorType (PR #141411)

2025-05-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/141411 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream splat op for VectorType (PR #139827)

2025-05-30 Thread Andy Kaylor via cfe-commits
@@ -2141,4 +2141,36 @@ def VecCmpOp : CIR_Op<"vec.cmp", [Pure, SameTypeOperands]> { }]; } -#endif // CLANG_CIR_DIALECT_IR_CIROPS_TD +//===--===// +// VecSplatOp +//===---

[clang] [CIR][NFC] Fix warning about unhandled type (PR #142059)

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

[clang] [CIR] Add support for global linkage and visibility (PR #141973)

2025-05-29 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/141973 This change adds support for the CIRGlobalValueInterface and attributes for visibility and comdat to GlobalOp. The comdat attribute isn't correctly calculated yet, but it was required for the CIRGlobalValue

[clang] [CIR] Update tests for global vars (PR #141854)

2025-05-28 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/141854 >From 462dc6afb219a4005e72d516e922c1c4ab0179d9 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 28 May 2025 13:49:25 -0700 Subject: [PATCH 1/2] [CIR] Update testds for global vars This change updates a

[clang] [CIR] Streamline creation of mlir::IntegerAttrs using mlir::Builder (PR #141830)

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

[clang] [CIR] Streamline creation of mlir::IntegerAttrs using mlir::Builder (PR #141830)

2025-05-28 Thread Andy Kaylor via cfe-commits
@@ -282,22 +282,15 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { cir::LoadOp createLoad(mlir::Location loc, Address addr, bool isVolatile = false) { -mlir::IntegerAttr align; -uint64_t alignment = addr.getAlignment().getQuantity()

[clang] [CIR] Streamline creation of mlir::IntegerAttrs using mlir::Builder (PR #141830)

2025-05-28 Thread Andy Kaylor via cfe-commits
@@ -428,13 +422,28 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return OpBuilder::InsertPoint(block, block->begin()); }; - mlir::IntegerAttr getSizeFromCharUnits(mlir::MLIRContext *ctx, - clang::CharUnits size) { -// N

[clang] [CIR] Streamline creation of mlir::IntegerAttrs using mlir::Builder (PR #141830)

2025-05-28 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm with a couple of nits https://github.com/llvm/llvm-project/pull/141830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Update tests for global vars (PR #141854)

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

[clang] [CIR] Update testds for global vars (PR #141854)

2025-05-28 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/141854 >From 462dc6afb219a4005e72d516e922c1c4ab0179d9 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 28 May 2025 13:49:25 -0700 Subject: [PATCH] [CIR] Update testds for global vars This change updates a few

[clang] [CIR] Defer declarations and tentative definitions (PR #141700)

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

[clang] [CIR] Update testds for global vars (PR #141854)

2025-05-28 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/141854 This change updates a few tests for global variable handling to also check classic codegen output so we can easily verify consistency between the two and will be alerted if the classic codegen changes. This

[clang] [CIR] Upstream ShuffleDynamicOp for VectorType (PR #141411)

2025-05-28 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor commented: I have a concern about the masking for the lowering to LLVM IR. Other than that, this looks good. https://github.com/llvm/llvm-project/pull/141411 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:/

[clang] [CIR] Upstream ShuffleDynamicOp for VectorType (PR #141411)

2025-05-28 Thread Andy Kaylor via cfe-commits
@@ -2141,4 +2141,37 @@ def VecCmpOp : CIR_Op<"vec.cmp", [Pure, SameTypeOperands]> { }]; } +//===--===// +// VecShuffleDynamicOp +//===--==

[clang] [CIR] Upstream ShuffleDynamicOp for VectorType (PR #141411)

2025-05-28 Thread Andy Kaylor via cfe-commits
@@ -1871,6 +1872,54 @@ mlir::LogicalResult CIRToLLVMVecCmpOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMVecShuffleDynamicOpLowering::matchAndRewrite( +cir::VecShuffleDynamicOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewr

[clang] [CIR] Upstream ShuffleDynamicOp for VectorType (PR #141411)

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

[clang] [CIR] Allow use different Int types together in Vec Shift Op (PR #141111)

2025-05-28 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/14 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Defer declarations and tentative definitions (PR #141700)

2025-05-28 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/141700 >From f0520c397b3739c09aeaf75c20e33ecf9053c2af Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 23 May 2025 17:53:48 -0700 Subject: [PATCH 1/2] [CIR] Defer declarations and tentative definitions This ch

[clang] [CIR] Defer declarations and tentative definitions (PR #141700)

2025-05-28 Thread Andy Kaylor via cfe-commits
@@ -135,6 +135,10 @@ class CIRGenConsumer : public clang::ASTConsumer { } } } + + void CompleteTentativeDefinition(VarDecl *D) override { +Gen->CompleteTentativeDefinition(D); + } andykaylor wrote: We're using clang naming style in this file ba

[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

2025-05-28 Thread Andy Kaylor via cfe-commits
@@ -540,3 +540,171 @@ void long_shift_example(long long a, short b) { // OGCG: store i64 %[[SHL]], ptr %[[X]] // OGCG: ret void + +void b1(bool a, bool b) { + bool x = a && b; + x = x || b; +} + +// CIR-LABEL: cir.func @_Z2b1bb( +// CIR-SAME: %[[ARG0:.*]]: !c

[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

2025-05-28 Thread Andy Kaylor via cfe-commits
@@ -108,6 +108,152 @@ class CIRGenFunction : public CIRGenTypeCache { mlir::MLIRContext &getMLIRContext() { return cgm.getMLIRContext(); } + // - + // Opaque value handling + // - + + /// Keeps track of the current set of opaque v

[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

2025-05-28 Thread Andy Kaylor via cfe-commits
@@ -1195,6 +1197,93 @@ Address CIRGenFunction::emitArrayToPointerDecay(const Expr *e) { return Address(ptr, addr.getAlignment()); } +/// Emit the operand of a glvalue conditional operator. This is either a glvalue +/// or a (possibly-parenthesized) throw-expression. If thi

[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

2025-05-28 Thread Andy Kaylor via cfe-commits
@@ -1195,6 +1197,93 @@ Address CIRGenFunction::emitArrayToPointerDecay(const Expr *e) { return Address(ptr, addr.getAlignment()); } +/// Emit the operand of a glvalue conditional operator. This is either a glvalue +/// or a (possibly-parenthesized) throw-expression. If thi

[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

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

[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

2025-05-28 Thread Andy Kaylor via cfe-commits
@@ -201,6 +201,20 @@ bool CIRGenFunction::constantFoldsToSimpleInteger(const Expr *cond, return true; } +/// If the specified expression does not fold +/// to a constant, or if it does but contains a label, return false. If it +/// constant folds return true and set the bo

[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

2025-05-28 Thread Andy Kaylor via cfe-commits
@@ -1799,6 +1870,162 @@ mlir::Value ScalarExprEmitter::VisitUnaryExprOrTypeTraitExpr( cgf.cgm.UInt64Ty, e->EvaluateKnownConstInt(cgf.getContext(; } +/// Return true if the specified expression is cheap enough and side-effect-free +/// enough to evaluate un

[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

2025-05-28 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor commented: This looks good. My remaining concerns are mostly about dead code. https://github.com/llvm/llvm-project/pull/138156 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/

[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

2025-05-28 Thread Andy Kaylor via cfe-commits
@@ -1394,13 +1501,84 @@ mlir::Value CIRGenFunction::createDummyValue(mlir::Location loc, return builder.createDummyValue(loc, t, alignment); } -/// This creates an alloca and inserts it into the entry block if -/// \p insertIntoFnEntryBlock is true, otherwise it inserts it

[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

2025-05-28 Thread Andy Kaylor via cfe-commits
@@ -306,6 +306,24 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return createBinop(loc, lhs, cir::BinOpKind::Or, rhs); } + mlir::Value createSelect(mlir::Location loc, mlir::Value condition, + mlir::Value trueValue, mlir::Value falseValu

[clang] [CIR] Defer declarations and tentative definitions (PR #141700)

2025-05-27 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/141700 This change adds code to defer emitting declarations and tentative definitions until they are referenced or trigger by a call to CompleteTentativeDefinition. This is needed to avoid premature handling of dec

[clang] [CIR] Add alignment support for global, store, and load ops (PR #141163)

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

[clang] [OpenACC][CIR] Add lowering for 'copy' array indexes (PR #140971)

2025-05-22 Thread Andy Kaylor via cfe-commits
@@ -184,37 +189,94 @@ class OpenACCClauseCIREmitter final mlir::Location beginLoc; mlir::Value varValue; llvm::StringRef name; +llvm::SmallVector bounds; }; + mlir::Value createBound(mlir::Location boundLoc, mlir::Value lowerBound, +

[clang] [OpenACC][CIR] Add lowering for 'copy' array indexes (PR #140971)

2025-05-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm with just one nit https://github.com/llvm/llvm-project/pull/140971 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [OpenACC][CIR] Add lowering for 'copy' array indexes (PR #140971)

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

[clang] [CIR] Allow use different Int types together in Vec Shift Op (PR #141111)

2025-05-22 Thread Andy Kaylor via cfe-commits
@@ -1427,13 +1427,13 @@ OpFoldResult cir::SelectOp::fold(FoldAdaptor adaptor) { //===--===// LogicalResult cir::ShiftOp::verify() { mlir::Operation *op = getOperation(); - mlir::Type resType = getResult().g

[clang] [CIR][NFC] Fix failing OpenACC NYI test (PR #141155)

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

[clang] [CIR][NFC] Fix failing OpenACC NYI test (PR #141155)

2025-05-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/141155 A recent change to the error message produced for unhandled compound statements without scope introduced a failure in an OpenACC test that was checking for the old error message. This change updates the test

[clang] [CIR] Implement switch case simplify (PR #140649)

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

[clang] [CIR] Upstream support for lowering cir.switch to LLVM (PR #140425)

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

[clang] [CIR] Improve NYI message for emitCompoundStmtWithoutScope (PR #140945)

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

[clang] [CIR] Add support for recursive record layouts (PR #140811)

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

[clang] [CIR] Upstream support for string literals (PR #140796)

2025-05-21 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/140796 >From 7e1e98fd2f1686709fe16b6853dcbf00623e626c Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Tue, 20 May 2025 09:51:41 -0700 Subject: [PATCH 1/5] [CIR] Upstream support for string literals This adds the m

[clang] [CIR] Implement switch case simplify (PR #140649)

2025-05-20 Thread Andy Kaylor via cfe-commits
@@ -159,6 +159,107 @@ struct SimplifySelect : public OpRewritePattern { } }; +/// Simplify `cir.switch` operations by folding cascading cases +/// into a single `cir.case` with the `anyof` kind. +/// +/// This pattern identifies cascading cases within a `cir.switch` operati

[clang] [CIR] Upstream support for string literals (PR #140796)

2025-05-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/140796 >From 7e1e98fd2f1686709fe16b6853dcbf00623e626c Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Tue, 20 May 2025 09:51:41 -0700 Subject: [PATCH 1/4] [CIR] Upstream support for string literals This adds the m

[clang] [CIR] Upstream support for string literals (PR #140796)

2025-05-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/140796 >From 7e1e98fd2f1686709fe16b6853dcbf00623e626c Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Tue, 20 May 2025 09:51:41 -0700 Subject: [PATCH 1/3] [CIR] Upstream support for string literals This adds the m

[clang] [CIR] Implement switch case simplify (PR #140649)

2025-05-20 Thread Andy Kaylor via cfe-commits
@@ -159,6 +159,107 @@ struct SimplifySelect : public OpRewritePattern { } }; +/// Simplify `cir.switch` operations by folding cascading cases +/// into a single `cir.case` with the `anyof` kind. +/// +/// This pattern identifies cascading cases within a `cir.switch` operati

[clang] [CIR] Implement switch case simplify (PR #140649)

2025-05-20 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > @andykaylor @erichkeane @bcardosolopes While implementing this > simplification, I noticed a difference compared to the previous behavior > where the folding happened during codegen. > ... > After applying the new CIR simplify pass, the output is: > > ```mlir > cir.case(any

[clang] [CIR][LLVMLowering] Upstream Bitcast lowering (PR #140774)

2025-05-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/140774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Implement switch case simplify (PR #140649)

2025-05-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor commented: This looks good. I have just a few minor suggestions. https://github.com/llvm/llvm-project/pull/140649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] [CIR] Implement switch case simplify (PR #140649)

2025-05-20 Thread Andy Kaylor via cfe-commits
@@ -159,6 +159,107 @@ struct SimplifySelect : public OpRewritePattern { } }; +/// Simplify `cir.switch` operations by folding cascading cases +/// into a single `cir.case` with the `anyof` kind. +/// +/// This pattern identifies cascading cases within a `cir.switch` operati

[clang] [CIR] Implement switch case simplify (PR #140649)

2025-05-20 Thread Andy Kaylor via cfe-commits
@@ -159,6 +159,107 @@ struct SimplifySelect : public OpRewritePattern { } }; +/// Simplify `cir.switch` operations by folding cascading cases +/// into a single `cir.case` with the `anyof` kind. +/// +/// This pattern identifies cascading cases within a `cir.switch` operati

[clang] [CIR] Implement switch case simplify (PR #140649)

2025-05-20 Thread Andy Kaylor via cfe-commits
@@ -159,6 +159,107 @@ struct SimplifySelect : public OpRewritePattern { } }; +/// Simplify `cir.switch` operations by folding cascading cases +/// into a single `cir.case` with the `anyof` kind. +/// +/// This pattern identifies cascading cases within a `cir.switch` operati

[clang] [CIR] Implement switch case simplify (PR #140649)

2025-05-20 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,196 @@ +// RUN: cir-opt -cir-canonicalize -cir-simplify -o %t.cir %s +// RUN: FileCheck --input-file=%t.cir %s + +!s32i = !cir.int + +module { +cir.func @foldCascade(%arg0: !s32i) { +%0 = cir.alloca !s32i, !cir.ptr, ["a", init] {alignment = 4 : i64} +cir.sto

[clang] [CIR] Implement switch case simplify (PR #140649)

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

[clang] [CIR][NFC] Fix an unused variable warning (PR #140783)

2025-05-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. Thanks for the fixes! https://github.com/llvm/llvm-project/pull/140783 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

2025-05-20 Thread Andy Kaylor via cfe-commits
@@ -1658,6 +1828,170 @@ mlir::Value ScalarExprEmitter::VisitUnaryExprOrTypeTraitExpr( cgf.cgm.UInt64Ty, e->EvaluateKnownConstInt(cgf.getContext(; } +/// Return true if the specified expression is cheap enough and side-effect-free +/// enough to evaluate un

[clang] [CIR] Upstream comparison ops for VectorType (PR #140597)

2025-05-20 Thread Andy Kaylor via cfe-commits
@@ -2083,4 +2083,33 @@ def VecExtractOp : CIR_Op<"vec.extract", [Pure, let hasFolder = 1; } +//===--===// +// VecCmpOp +//===--===// + +def

[clang] [CIR] Upstream comparison ops for VectorType (PR #140597)

2025-05-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. https://github.com/llvm/llvm-project/pull/140597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream lowering of conditional operators to TernaryOp (PR #138156)

2025-05-20 Thread Andy Kaylor via cfe-commits
@@ -948,6 +950,165 @@ void CIRGenFunction::emitIgnoredExpr(const Expr *e) { emitLValue(e); } +// Handle the case where the condition is a constant evaluatable simple integer, +// which means we don't have to separately handle the true/false blocks. +static std::optional han

[clang] [CIR] Upstream support for lowering cir.switch to LLVM (PR #140425)

2025-05-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/140425 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for string literals (PR #140796)

2025-05-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/140796 >From 7e1e98fd2f1686709fe16b6853dcbf00623e626c Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Tue, 20 May 2025 09:51:41 -0700 Subject: [PATCH 1/2] [CIR] Upstream support for string literals This adds the m

[clang] [CIR][NFC] Eliminate ArgInfo structure (PR #140612)

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

[clang] [CIR] Add support for recursive record layouts (PR #140811)

2025-05-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/140811 While processing members of a record, we try to create new record types as we encounter them, but if this would result in recursion (either because the type points to itself or because it points to a type th

[clang] [CIR] Upstream support for string literals (PR #140796)

2025-05-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/140796 This adds the minimal support needed to handle string literals. >From 7e1e98fd2f1686709fe16b6853dcbf00623e626c Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Tue, 20 May 2025 09:51:41 -0700 Subject: [PATCH

[clang] [CIR][NFC] Eliminate ArgInfo structure (PR #140612)

2025-05-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/140612 >From 2310c8af56330682ab15ca318971d530cd45e73b Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 19 May 2025 13:18:55 -0700 Subject: [PATCH 1/2] [CIR][NFC] Eliminate ArgInfo structure A previous refactor

[clang] [CIR][NFC] Eliminate ArgInfo structure (PR #140612)

2025-05-20 Thread Andy Kaylor via cfe-commits
@@ -72,16 +68,15 @@ class RequiredArgs { class CIRGenFunctionInfo final : public llvm::FoldingSetNode, - private llvm::TrailingObjects { - using ArgInfo = CIRGenFunctionInfoArgInfo; - + private llvm::TrailingObjects { andykaylor wrote: Strictly

[clang] [CIR] Upstream support for iterator-based range for loops (PR #140636)

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

[clang] [CIR] Upstream support for iterator-based range for loops (PR #140636)

2025-05-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/140636 This change adds handling for C++ member operator calls, implicit no-op casts, and l-value call expressions. Together, these changes enable handling of range for loops based on iterators. >From 58b8700c4b43

[clang] [CIR] Add support for indirect calls (PR #139748)

2025-05-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. I think this looks good once the error handling on the type conversion is fixed. https://github.com/llvm/llvm-project/pull/139748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://

[clang] [CIR] Upstream support for C++ member function calls (PR #140290)

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

[clang] [CIR] Upstream comparion ops for VectorType (PR #140597)

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

[clang] [CIR] Upstream comparion ops for VectorType (PR #140597)

2025-05-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor commented: This looks OK, but I have a basic question about whether we need a dedicated vector operation here. https://github.com/llvm/llvm-project/pull/140597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang] [CIR] Upstream comparion ops for VectorType (PR #140597)

2025-05-19 Thread Andy Kaylor via cfe-commits
@@ -2083,4 +2083,33 @@ def VecExtractOp : CIR_Op<"vec.extract", [Pure, let hasFolder = 1; } +//===--===// +// VecCmpOp +//===--===// + +def

  1   2   3   4   5   6   7   8   9   10   >