[clang] [OpenACC][CIR] Lower 'num_workers' for parallel/kernels (PR #136578)

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -109,14 +126,15 @@ class OpenACCClauseCIREmitter final } void VisitDeviceTypeClause(const OpenACCDeviceTypeClause &clause) { +lastDeviceTypeClause = &clause; andykaylor wrote: What's the lifetime of this object? Who owns it? https://github.com/llv

[clang] [OpenACC][CIR] Lower 'num_workers' for parallel/kernels (PR #136578)

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -109,14 +126,15 @@ class OpenACCClauseCIREmitter final } void VisitDeviceTypeClause(const OpenACCDeviceTypeClause &clause) { +lastDeviceTypeClause = &clause; if constexpr (isOneOfTypes) { llvm::SmallVector deviceTypes; std::optional existingDevice

[clang] [CIR] Introduce type aliases for records (PR #136387)

2025-04-21 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > ALSO, I see no tests that contain `ty_anon`, can you write some? We don't actually generate anon records (either upstream or in the incubator). I think we should just make them illegal. Anonymous structs in the source are given a name in CIR (`anon.`) https://github.com/ll

[clang] [CIR] Upstream support for accessing structure members (PR #136383)

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -309,6 +309,37 @@ RecordType::computeStructAlignment(const mlir::DataLayout &dataLayout) const { return recordAlignment; } +uint64_t RecordType::getElementOffset(const ::mlir::DataLayout &dataLayout, + unsigned idx) const { + assert(

[clang] [CIR] Upstream StackSave and StackRestoreOp (PR #136426)

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -1419,6 +1419,50 @@ def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> { }]>]; } +//===--===// +// StackSave & StackRestoreOp andykaylor wrote: ```suggestion // StackSaveOp & St

[clang] [CIR] Upstream StackSave and StackRestoreOp (PR #136426)

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -1419,6 +1419,50 @@ def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> { }]>]; } +//===--===// +// StackSave & StackRestoreOp +//===---

[clang] [CIR] Upstream StackSave and StackRestoreOp (PR #136426)

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

[clang] [CIR] Upstream StackSave and StackRestoreOp (PR #136426)

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,19 @@ +// RUN: cir-opt %s -cir-to-llvm -o - | FileCheck %s -check-prefix=MLIR andykaylor wrote: Can you also add a RUN line to lower this to LLVM IR? https://github.com/llvm/llvm-project/pull/136426 ___ cfe-

[clang] [CIR] Upstream StackSave and StackRestoreOp (PR #136426)

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -1419,6 +1419,50 @@ def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> { }]>]; } +//===--===// +// StackSave & StackRestoreOp +//===---

[clang] [CIR] Upstream StackSave and StackRestoreOp (PR #136426)

2025-04-21 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. Looks good, with a couple of minor requests. https://github.com/llvm/llvm-project/pull/136426 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [CIR] Upstream StackSave and StackRestoreOp (PR #136426)

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -1419,6 +1419,50 @@ def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> { }]>]; } +//===--===// +// StackSave & StackRestoreOp +//===---

[clang] [CIR] Upstream initial support for fixed size VectorType (PR #136488)

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -637,6 +637,42 @@ ArrayType::getABIAlignment(const ::mlir::DataLayout &dataLayout, return dataLayout.getTypeABIAlignment(getEltType()); } +//===--===// +// VectorType Definitions +//===--

[clang] [CIR] Upstream initial support for fixed size VectorType (PR #136488)

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -637,6 +637,42 @@ ArrayType::getABIAlignment(const ::mlir::DataLayout &dataLayout, return dataLayout.getTypeABIAlignment(getEltType()); } +//===--===// +// VectorType Definitions +//===--

[clang] [CIR] Upstream initial support for fixed size VectorType (PR #136488)

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -82,6 +82,9 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { cir::IntType>(ty)) return true; +if (mlir::isa(ty)) andykaylor wrote: ```suggestion if (auto vt = mlir::dyn_cast(ty)) ``` Then this would replace the `mli

[clang] [CIR] Upstream initial support for fixed size VectorType (PR #136488)

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -399,6 +399,14 @@ mlir::Type CIRGenTypes::convertType(QualType type) { break; } + case Type::ExtVector: + case Type::Vector: { +const VectorType *vec = cast(ty); +const mlir::Type elemTy = convertTypeForMem(vec->getElementType()); andykaylor

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

2025-04-21 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. Looks good to me. Just a couple of nits regarding the comment block. https://github.com/llvm/llvm-project/pull/136626 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

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

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

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

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -97,11 +97,13 @@ class OpenACCClauseCIREmitter final // Handle a clause affected by the 'device-type' to the point that they need // to have the attributes added in the correct/corresponding order, such as - // 'num_workers' or 'vector_length' on a compute construct. -

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

2025-04-21 Thread Andy Kaylor via cfe-commits
@@ -97,11 +97,13 @@ class OpenACCClauseCIREmitter final // Handle a clause affected by the 'device-type' to the point that they need // to have the attributes added in the correct/corresponding order, such as - // 'num_workers' or 'vector_length' on a compute construct. -

[clang] [CIR] Implement lowering for LinkageSpecDecl (PR #137634)

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

[clang] [CIR] Upstream initial support for union type (PR #137501)

2025-04-28 Thread Andy Kaylor via cfe-commits
@@ -306,3 +320,71 @@ CIRGenTypes::computeRecordLayout(const RecordDecl *rd, cir::RecordType *ty) { // TODO: implement verification return rl; } + +void CIRRecordLowering::lowerUnion() { + CharUnits layoutSize = astRecordLayout.getSize(); + mlir::Type storageType = nullpt

[clang] [CIR] Upstream initial support for union type (PR #137501)

2025-04-28 Thread Andy Kaylor via cfe-commits
@@ -5,25 +5,146 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll // RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s +union U1 { andykaylor wrote: Can you add tests for a union that requires padding, a union that is packed

[clang] [CIR] Upstream initial support for union type (PR #137501)

2025-04-28 Thread Andy Kaylor via cfe-commits
@@ -5,25 +5,146 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll // RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s +union U1 { + int n; + char c; +}; + +// CIR: !rec_U1 = !cir.record +// LLVM: %union.U1 = type { i32 } +// OGCG: %union.

[clang] [CIR] Upstream initial support for union type (PR #137501)

2025-04-28 Thread Andy Kaylor via cfe-commits
@@ -306,3 +320,71 @@ CIRGenTypes::computeRecordLayout(const RecordDecl *rd, cir::RecordType *ty) { // TODO: implement verification return rl; } + +void CIRRecordLowering::lowerUnion() { + CharUnits layoutSize = astRecordLayout.getSize(); + mlir::Type storageType = nullpt

[clang] [CIR] Upstream initial support for union type (PR #137501)

2025-04-28 Thread Andy Kaylor via cfe-commits
@@ -306,3 +320,71 @@ CIRGenTypes::computeRecordLayout(const RecordDecl *rd, cir::RecordType *ty) { // TODO: implement verification return rl; } + +void CIRRecordLowering::lowerUnion() { + CharUnits layoutSize = astRecordLayout.getSize(); + mlir::Type storageType = nullpt

[clang] [CIR] Upstream initial support for union type (PR #137501)

2025-04-28 Thread Andy Kaylor via cfe-commits
@@ -306,3 +320,71 @@ CIRGenTypes::computeRecordLayout(const RecordDecl *rd, cir::RecordType *ty) { // TODO: implement verification return rl; } + +void CIRRecordLowering::lowerUnion() { + CharUnits layoutSize = astRecordLayout.getSize(); + mlir::Type storageType = nullpt

[clang] [CIR] Upstream initial support for union type (PR #137501)

2025-04-28 Thread Andy Kaylor via cfe-commits
@@ -306,3 +320,71 @@ CIRGenTypes::computeRecordLayout(const RecordDecl *rd, cir::RecordType *ty) { // TODO: implement verification return rl; } + +void CIRRecordLowering::lowerUnion() { + CharUnits layoutSize = astRecordLayout.getSize(); + mlir::Type storageType = nullpt

[clang] [CIR] Upstream initial support for union type (PR #137501)

2025-04-28 Thread Andy Kaylor via cfe-commits
@@ -317,20 +317,25 @@ LValue CIRGenFunction::emitLValueForField(LValue base, const FieldDecl *field) { } unsigned recordCVR = base.getVRQualifiers(); - if (rec->isUnion()) { -cgm.errorNYI(field->getSourceRange(), "emitLValueForField: union"); -return LValue(); -

[clang] [CIR] Upstream initial support for union type (PR #137501)

2025-04-28 Thread Andy Kaylor via cfe-commits
@@ -230,17 +230,41 @@ void RecordType::complete(ArrayRef members, bool packed, bool padded) { llvm_unreachable("failed to complete record"); } +/// Return the largest member of in the type. +/// +/// Recurses into union members never returning a union as the largest membe

[clang] [CIR] Upstream initial support for union type (PR #137501)

2025-04-28 Thread Andy Kaylor via cfe-commits
@@ -5,25 +5,146 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll // RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s +union U1 { + int n; + char c; +}; + +// CIR: !rec_U1 = !cir.record +// LLVM: %union.U1 = type { i32 } +// OGCG: %union.

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -524,7 +523,9 @@ CIRGenTypes::arrangeCIRFunctionInfo(CanQualType returnType) { if (retInfo.canHaveCoerceToType() && retInfo.getCoerceToType() == nullptr) retInfo.setCoerceToType(convertType(fi->getReturnType())); - assert(!cir::MissingFeatures::opCallArgs()); + for

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -13,20 +13,76 @@ #include "CIRGenCall.h" #include "CIRGenFunction.h" +#include "CIRGenFunctionInfo.h" #include "clang/CIR/MissingFeatures.h" using namespace clang; using namespace clang::CIRGen; -CIRGenFunctionInfo *CIRGenFunctionInfo::create(CanQualType resultType)

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -13,20 +13,76 @@ #include "CIRGenCall.h" #include "CIRGenFunction.h" +#include "CIRGenFunctionInfo.h" #include "clang/CIR/MissingFeatures.h" using namespace clang; using namespace clang::CIRGen; -CIRGenFunctionInfo *CIRGenFunctionInfo::create(CanQualType resultType)

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -13,20 +13,76 @@ #include "CIRGenCall.h" #include "CIRGenFunction.h" +#include "CIRGenFunctionInfo.h" #include "clang/CIR/MissingFeatures.h" using namespace clang; using namespace clang::CIRGen; -CIRGenFunctionInfo *CIRGenFunctionInfo::create(CanQualType resultType)

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -47,18 +98,51 @@ class CIRGenFunctionInfo final // This function has to be CamelCase because llvm::FoldingSet requires so. // NOLINTNEXTLINE(readability-identifier-naming) - static void Profile(llvm::FoldingSetNodeID &id, CanQualType resultType) { + static void Profil

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -32,8 +32,14 @@ void X8664ABIInfo::computeInfo(CIRGenFunctionInfo &funcInfo) const { // Top level CIR has unlimited arguments and return types. Lowering for ABI // specific concerns should happen during a lowering phase. Assume everything // is direct for now. - asse

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -13,20 +13,76 @@ #include "CIRGenCall.h" #include "CIRGenFunction.h" +#include "CIRGenFunctionInfo.h" #include "clang/CIR/MissingFeatures.h" using namespace clang; using namespace clang::CIRGen; -CIRGenFunctionInfo *CIRGenFunctionInfo::create(CanQualType resultType)

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -47,18 +98,51 @@ class CIRGenFunctionInfo final // This function has to be CamelCase because llvm::FoldingSet requires so. // NOLINTNEXTLINE(readability-identifier-naming) - static void Profile(llvm::FoldingSetNodeID &id, CanQualType resultType) { + static void Profil

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -13,20 +13,76 @@ #include "CIRGenCall.h" #include "CIRGenFunction.h" +#include "CIRGenFunctionInfo.h" #include "clang/CIR/MissingFeatures.h" using namespace clang; using namespace clang::CIRGen; -CIRGenFunctionInfo *CIRGenFunctionInfo::create(CanQualType resultType)

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -47,18 +98,51 @@ class CIRGenFunctionInfo final // This function has to be CamelCase because llvm::FoldingSet requires so. // NOLINTNEXTLINE(readability-identifier-naming) - static void Profile(llvm::FoldingSetNodeID &id, CanQualType resultType) { + static void Profil

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -13,20 +13,76 @@ #include "CIRGenCall.h" #include "CIRGenFunction.h" +#include "CIRGenFunctionInfo.h" #include "clang/CIR/MissingFeatures.h" using namespace clang; using namespace clang::CIRGen; -CIRGenFunctionInfo *CIRGenFunctionInfo::create(CanQualType resultType)

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -13,20 +13,76 @@ #include "CIRGenCall.h" #include "CIRGenFunction.h" +#include "CIRGenFunctionInfo.h" #include "clang/CIR/MissingFeatures.h" using namespace clang; using namespace clang::CIRGen; -CIRGenFunctionInfo *CIRGenFunctionInfo::create(CanQualType resultType)

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -13,20 +13,76 @@ #include "CIRGenCall.h" #include "CIRGenFunction.h" +#include "CIRGenFunctionInfo.h" #include "clang/CIR/MissingFeatures.h" using namespace clang; using namespace clang::CIRGen; -CIRGenFunctionInfo *CIRGenFunctionInfo::create(CanQualType resultType)

[clang] [CIR] Introduce type aliases for records (PR #136387)

2025-04-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/136387 >From f161bed5972815b535fb21b48ec243d483978685 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 18 Apr 2025 16:24:53 -0700 Subject: [PATCH 1/3] [CIR] Introduce type aliases for records This introduces M

[clang] [CIR] Upstream support for name mangling (PR #137094)

2025-04-24 Thread Andy Kaylor via cfe-commits
@@ -639,13 +674,82 @@ cir::FuncOp CIRGenModule::getAddrOfFunction(clang::GlobalDecl gd, funcType = convertType(fd->getType()); } - assert(!cir::MissingFeatures::mangledNames()); - cir::FuncOp func = getOrCreateCIRFunction( - cast(gd.getDecl())->getIdentifier()->g

[clang] [CIR] Upstream support for name mangling (PR #137094)

2025-04-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/137094 >From 8268f7f56d522af6d6f4d1becc8c12b4c049b235 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 23 Apr 2025 17:10:05 -0700 Subject: [PATCH 1/2] [CIR] Upstream support for name mangling We have been usin

[clang] [OpenACC][CIR] Implement 'num_gangs' lowering (PR #137216)

2025-04-24 Thread Andy Kaylor via cfe-commits
@@ -95,19 +95,41 @@ class OpenACCClauseCIREmitter final .CaseLower("radeon", mlir::acc::DeviceType::Radeon); } - // Handle a clause affected by the 'device-type' to the point that they need - // to have the attributes added in the correct/corresponding order, such

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream support for l-value references (PR #138001)

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

[clang] [CIR] Upstream support for references (PR #138001)

2025-04-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/138001 This adds basic support for handling reference values. >From 1aaf67db799b0fb8d2593d9978b0fd9c27bf6e7e Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 30 Apr 2025 10:30:32 -0700 Subject: [PATCH] [CIR] U

[clang] [CIR] Upstream support for references (PR #138001)

2025-04-30 Thread Andy Kaylor via cfe-commits
@@ -102,3 +102,20 @@ size_type max_size() { // CHECK: %3 = cir.cast(integral, %2 : !s32i), !u64i // CHECK: %4 = cir.const #cir.int<8> : !u64i // CHECK: %5 = cir.binop(div, %3, %4) : !u64i + +void ref_arg(int &x) { + int y = x; + x = 3; +} andykaylor wro

[clang] [CIR] Upstream support for references (PR #138001)

2025-04-30 Thread Andy Kaylor via cfe-commits
@@ -439,7 +439,13 @@ LValue CIRGenFunction::emitDeclRefLValue(const DeclRefExpr *e) { cgm.errorNYI(e->getSourceRange(), "emitDeclRefLValue: static local"); } -return makeAddrLValue(addr, ty, AlignmentSource::Type); +// Drill into reference types. +LValue

[clang] [CIR] Upstream support for references (PR #138001)

2025-04-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/138001 Rate limit ยท GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,san

[clang] [CIR] Upstream support for references (PR #138001)

2025-04-30 Thread Andy Kaylor via cfe-commits
@@ -102,3 +102,20 @@ size_type max_size() { // CHECK: %3 = cir.cast(integral, %2 : !s32i), !u64i // CHECK: %4 = cir.const #cir.int<8> : !u64i // CHECK: %5 = cir.binop(div, %3, %4) : !u64i + +void ref_arg(int &x) { + int y = x; + x = 3; +} andykaylor wro

[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

2025-04-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/138041 This adds support for explicit pointer arithmetic, including unary increment and decrement of pointer values. >From ae1fd50a03a0e5f7c0c40463dc6a07f981f79f66 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date:

[clang] [CIR] Upstream support for l-value references (PR #138001)

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

[clang] [OpenACC][CIR] Implement 'num_gangs' lowering (PR #137216)

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

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -13,20 +13,76 @@ #include "CIRGenCall.h" #include "CIRGenFunction.h" +#include "CIRGenFunctionInfo.h" #include "clang/CIR/MissingFeatures.h" using namespace clang; using namespace clang::CIRGen; -CIRGenFunctionInfo *CIRGenFunctionInfo::create(CanQualType resultType)

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -13,20 +13,76 @@ #include "CIRGenCall.h" #include "CIRGenFunction.h" +#include "CIRGenFunctionInfo.h" #include "clang/CIR/MissingFeatures.h" using namespace clang; using namespace clang::CIRGen; -CIRGenFunctionInfo *CIRGenFunctionInfo::create(CanQualType resultType)

[clang] [CIR] Cleanup support for C functions (PR #136854)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -233,6 +233,19 @@ int f8(int *p) { // OGCG: %[[P2:.*]] = load ptr, ptr %[[P_PTR]], align 8 // OGCG: %[[STAR_P:.*]] = load i32, ptr %[[P2]], align 4 + +void f9() {} andykaylor wrote: It seems like a lot of code was added compared to what is covered by t

[clang] [CIR] Introduce type aliases for records (PR #136387)

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

[clang] Upstream enum support (PR #136807)

2025-04-23 Thread Andy Kaylor via cfe-commits
@@ -253,3 +253,8 @@ size_type max_size(void) { // OGCG: define{{.*}} i64 @max_size() // OGCG: ret i64 2305843009213693951 + +enum { + um = 0, + dois = 1, +}; andykaylor wrote: It looks like you don't have a newline at the end of the file. https://github.

[clang] [CIR] Upstream support for name mangling (PR #137094)

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

[clang] [CIR] Upstream namepsace handling (PR #137253)

2025-04-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/137253 This adds the handlers for Decl::Namespace and Decl::UsingDirective (which is needed for anonymous namespaces). >From 8e8baed406019bee2b5acd71b0d08b65360ee032 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date

[clang] [CIR] Upstream namepsace handling (PR #137253)

2025-04-24 Thread Andy Kaylor via cfe-commits
@@ -0,0 +1,55 @@ +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o - 2>&1 | FileCheck %s + +// Test anonymous namespace. +namespace { + int g1 = 1; + + // Note: This causes a warning about the function being undefined, but we + // curren

[clang] [CIR] Upstream support for name mangling (PR #137094)

2025-04-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/137094 >From 8268f7f56d522af6d6f4d1becc8c12b4c049b235 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 23 Apr 2025 17:10:05 -0700 Subject: [PATCH 1/3] [CIR] Upstream support for name mangling We have been usin

[clang] [OpenACC][CIR] Implement 'num_gangs' lowering (PR #137216)

2025-04-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. Looks good now that I have at least some idea what segments mean. https://github.com/llvm/llvm-project/pull/137216 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

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

2025-04-24 Thread Andy Kaylor 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-24 Thread Andy Kaylor via cfe-commits
@@ -1058,6 +1058,48 @@ LogicalResult cir::BinOp::verify() { return mlir::success(); } +//===--===// +// TernaryOp +//===--===// + +/// Give

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

2025-04-24 Thread Andy Kaylor via cfe-commits
@@ -254,10 +254,61 @@ class CIRLoopOpInterfaceFlattening } }; +class CIRTernaryOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + mlir::LogicalResult + matchAndRewrite(cir::TernaryOp op, + mlir::Pattern

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

2025-04-24 Thread Andy Kaylor 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 Andy Kaylor 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-24 Thread Andy Kaylor 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-24 Thread Andy Kaylor via cfe-commits
@@ -254,10 +254,61 @@ class CIRLoopOpInterfaceFlattening } }; +class CIRTernaryOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + mlir::LogicalResult + matchAndRewrite(cir::TernaryOp op, + mlir::Pattern

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

2025-04-24 Thread Andy Kaylor via cfe-commits
@@ -1058,6 +1058,48 @@ LogicalResult cir::BinOp::verify() { return mlir::success(); } +//===--===// +// TernaryOp +//===--===// + +/// Give

[clang] [CIR] Fix calling defined functions (PR #137271)

2025-04-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/137271 Until now our function symbol lookup has been assuming that the function did not exist and creating a definition for it. This caused us to create a duplicate definition if we ever tried to call a function th

[clang] [CIR] Upstream namepsace handling (PR #137253)

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

[clang] [CIR] Fix calling defined functions (PR #137271)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -773,6 +773,58 @@ cir::FuncOp CIRGenModule::getOrCreateCIRFunction( StringRef mangledName, mlir::Type funcType, GlobalDecl gd, bool forVTable, bool dontDefer, bool isThunk, ForDefinition_t isForDefinition, mlir::ArrayAttr extraAttrs) { + const Decl *d = gd.getDe

[clang] [CIR][NFC] Fix a build warning in CIRGenCall.cpp (PR #137366)

2025-04-25 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/137366 ___ 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 Andy Kaylor 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-25 Thread Andy Kaylor 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 Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. I've still got a couple of open nits about the comments in CIRDialect.cpp, but otherwise this looks good. https://github.com/llvm/llvm-project/pull/137184 ___ cfe-commits mailing list cfe-commi

[clang] [CIR] Fix calling defined functions (PR #137271)

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

[clang] [CIR] Upstream initial support for fixed size VectorType (PR #136488)

2025-04-25 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. This looks good to me if @xlauko is satisfied with the new changes. https://github.com/llvm/llvm-project/pull/136488 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang] [CIR][NFC] Fix a build warning in CIRGenCall.cpp (PR #137366)

2025-04-25 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/137366 We have been getting a warning about a default statement in a fully covered switch statement. This change fixes that by removing the default, updating all paths to return a value rather than depending on a l

[clang] [mlir] [OpenACC][NFCI] Implement 'helpers' for all of the clauses I've used so far (PR #137396)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -1785,6 +1850,21 @@ def OpenACC_DataOp : OpenACC_Op<"data", /// Return the wait devnum value clause for the given device_type if /// present. mlir::Value getWaitDevnum(mlir::acc::DeviceType deviceType); +/// Add an entry to the 'async-only' attribute (clause

[clang] [mlir] [OpenACC][NFCI] Implement 'helpers' for all of the clauses I've used so far (PR #137396)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -1535,6 +1560,21 @@ def OpenACC_SerialOp : OpenACC_Op<"serial", static mlir::acc::Construct getConstructId() { return mlir::acc::Construct::acc_construct_serial; } +/// Add an entry to the 'async-only' attribute (clause spelled without +/// arguments)fo

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -422,6 +428,121 @@ mlir::LogicalResult CIRGenFunction::emitBreakStmt(const clang::BreakStmt &s) { return mlir::success(); } +template +mlir::LogicalResult +CIRGenFunction::emitCaseDefaultCascade(const T *stmt, mlir::Type condType, +

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -600,3 +721,99 @@ mlir::LogicalResult CIRGenFunction::emitWhileStmt(const WhileStmt &s) { terminateBody(builder, whileOp.getBody(), getLoc(s.getEndLoc())); return mlir::success(); } + +mlir::LogicalResult CIRGenFunction::emitSwitchBody(const Stmt *s) { + // It is rare

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [mlir] [OpenACC][NFCI] Implement 'helpers' for all of the clauses I've used so far (PR #137396)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -1785,6 +1850,21 @@ def OpenACC_DataOp : OpenACC_Op<"data", /// Return the wait devnum value clause for the given device_type if /// present. mlir::Value getWaitDevnum(mlir::acc::DeviceType deviceType); +/// Add an entry to the 'async-only' attribute (clause

<    4   5   6   7   8   9   10   11   >