[clang] [CIR] Bit manipulation builtin functions (PR #146529)

2025-07-01 Thread Sirui Mu via cfe-commits
https://github.com/Lancern created https://github.com/llvm/llvm-project/pull/146529 This patch adds CIR support for the following families of bit manipulation builtin functions: - `__builtin_clrsb`, represented by the `cir.bit.clrsb` operation - `__builtin_ctz`, represented by the `cir.bit.clz

[clang] [CIR] Add nothrow attribute to the call operation (PR #145178)

2025-06-29 Thread Sirui Mu via cfe-commits
Lancern wrote: I conducted a minor refactor in the latest commit. Prior to the latest commit, CallOp build functions (namely, `CallOp::build`, `CIRBaseBuilderTy::createCallOp`, and `CIRBaseBuilderTy::createIndirectCallOp`) takes quite a lot parameters, including the extra optional call attribu

[clang] [CIR] Add nothrow attribute to the call operation (PR #145178)

2025-06-29 Thread Sirui Mu via cfe-commits
@@ -102,3 +104,16 @@ void f12() { // LLVM: %[[#slot:]] = alloca %struct.S, i64 1, align 4 // LLVM-NEXT:%[[#ret:]] = call %struct.S @_Z3f10v() // LLVM-NEXT:store %struct.S %[[#ret]], ptr %[[#slot]], align 4 + +void f13() noexcept; +void f14() { + f13(); +} + +//

[clang] [CIR] Add nothrow attribute to the call operation (PR #145178)

2025-06-29 Thread Sirui Mu via cfe-commits
@@ -368,4 +368,34 @@ def CIR_VisibilityAttr : CIR_Attr<"Visibility", "visibility"> { }]; } +//===--===// +// ExtraFuncAttributesAttr +//===---

[clang] [CIR] Add nothrow attribute to the call operation (PR #145178)

2025-06-29 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited https://github.com/llvm/llvm-project/pull/145178 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Initial extra attributes for call operation (PR #145178)

2025-06-29 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/145178 >From 183dad89003c36f3c3d11c4b930908b829f40f17 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Sun, 29 Jun 2025 20:06:51 +0800 Subject: [PATCH] [CIR] Add nothrow attribute to call operations This patch adds nothr

[clang] [CIR] Add OptInfo attribute (PR #146261)

2025-06-29 Thread Sirui Mu via cfe-commits
https://github.com/Lancern created https://github.com/llvm/llvm-project/pull/146261 This patch adds the `#cir.opt_info` attribute which holds module-level optimization information. >From c1f884577af1d55cb7cc9b65276e43bd96b82378 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Sun, 29 Jun 2025 15

[clang] [Sema][clangd] add noexcept to override functions during code completion (PR #75937)

2025-06-27 Thread Sirui Mu via cfe-commits
https://github.com/Lancern closed https://github.com/llvm/llvm-project/pull/75937 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema][clangd] add noexcept to override functions during code completion (PR #75937)

2025-06-27 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/75937 >From 36f970d7ecd4e68c73eaae7d82c7f6c6f6b037db Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Sat, 28 Jun 2025 01:44:44 +0800 Subject: [PATCH] [clangd][Sema] add noexcept to override functions during code complet

[clang] [Sema][clangd] add noexcept to override functions during code completion (PR #75937)

2025-06-27 Thread Sirui Mu via cfe-commits
Lancern wrote: I have removed the unrelated formatting changes. Will land later if the CI is green. https://github.com/llvm/llvm-project/pull/75937 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [CIR] Add basic support for operator new (PR #145802)

2025-06-26 Thread Sirui Mu via cfe-commits
https://github.com/Lancern approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/145802 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for function linkage and visibility (PR #145600)

2025-06-25 Thread Sirui Mu via cfe-commits
@@ -1737,25 +1737,51 @@ def GetMemberOp : CIR_Op<"get_member"> { def FuncOp : CIR_Op<"func", [ AutomaticAllocationScope, CallableOpInterface, FunctionOpInterface, + DeclareOpInterfaceMethods, IsolatedFromAbove ]> { let summary = "Declare or define a function"; let

[clang] [CIR] Add support for function linkage and visibility (PR #145600)

2025-06-25 Thread Sirui Mu via cfe-commits
@@ -1534,6 +1567,27 @@ void CIRGenModule::setGVPropertiesAux(mlir::Operation *op, assert(!cir::MissingFeatures::opGlobalPartition()); } +void CIRGenModule::setFunctionAttributes(GlobalDecl globalDecl, + cir::FuncOp func, +

[clang] [CIR] Add support for function linkage and visibility (PR #145600)

2025-06-25 Thread Sirui Mu via cfe-commits
https://github.com/Lancern approved this pull request. https://github.com/llvm/llvm-project/pull/145600 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for function linkage and visibility (PR #145600)

2025-06-25 Thread Sirui Mu via cfe-commits
@@ -1737,25 +1737,51 @@ def GetMemberOp : CIR_Op<"get_member"> { def FuncOp : CIR_Op<"func", [ AutomaticAllocationScope, CallableOpInterface, FunctionOpInterface, + DeclareOpInterfaceMethods, IsolatedFromAbove ]> { let summary = "Declare or define a function"; let

[clang] [CIR] Add support for __builtin_expect (PR #144726)

2025-06-24 Thread Sirui Mu via cfe-commits
@@ -2446,4 +2446,41 @@ def AssumeOp : CIR_Op<"assume"> { }]; } +//===--===// +// Branch Probability Operations +//===--===// + +def ExpectO

[clang] [CIR] Add support for __builtin_expect (PR #144726)

2025-06-24 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/144726 >From 647ca2961b26b92bc859677741bc208818e85d55 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Wed, 18 Jun 2025 23:25:10 +0800 Subject: [PATCH] [CIR] Add support for __builtin_expect This patch adds support for t

[clang] [CIR] Add support for __builtin_expect (PR #144726)

2025-06-24 Thread Sirui Mu via cfe-commits
@@ -989,6 +989,19 @@ mlir::LogicalResult CIRToLLVMConstantOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMExpectOpLowering::matchAndRewrite( +cir::ExpectOp op, OpAdaptor adaptor, +mlir::ConversionPatternRewriter &rewriter) const

[clang] [CIR] Initial extra attributes for call operation (PR #145178)

2025-06-21 Thread Sirui Mu via cfe-commits
https://github.com/Lancern created https://github.com/llvm/llvm-project/pull/145178 This patch adds extra function attributes to the `cir.call` operation. The extra attributes now may contain a single `cir.nothrow` attribute that indicates whether the callee throws. >From ca4ea5e82bb67f41004f

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-18 Thread Sirui Mu via cfe-commits
https://github.com/Lancern closed https://github.com/llvm/llvm-project/pull/144201 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for __builtin_expect (PR #144726)

2025-06-18 Thread Sirui Mu via cfe-commits
https://github.com/Lancern created https://github.com/llvm/llvm-project/pull/144726 This patch adds support for the `__builtin_expect` and `__builtin_expect_with_probability` builtin functions. >From 684994022716f10c83aadeaa8985d6842064bb9e Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Wed, 1

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-18 Thread Sirui Mu via cfe-commits
@@ -1858,6 +1858,40 @@ def FuncOp : CIR_Op<"func", [ // CallOp //===--===// +def SE_All : I32EnumAttrCase<"All", 1, "all">; +def SE_Pure : I32EnumAttrCase<"Pure", 2, "pure">; +def SE_Const : I32EnumAttrCase<"

[clang] [CIR] Add support for __builtin_assume (PR #144376)

2025-06-18 Thread Sirui Mu via cfe-commits
https://github.com/Lancern closed https://github.com/llvm/llvm-project/pull/144376 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for __builtin_assume (PR #144376)

2025-06-17 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited https://github.com/llvm/llvm-project/pull/144376 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Add support for __builtin_assume (PR #144376)

2025-06-17 Thread Sirui Mu via cfe-commits
@@ -49,7 +52,43 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID, } } + assert(!cir::MissingFeatures::opCallBuiltin()); Lancern wrote: Replaced it with several fine-grained missing feature flags. https://github.com/l

[clang] [CIR] Add support for __builtin_assume (PR #144376)

2025-06-17 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/144376 >From 74b80387abe26da76d73b81682105228ef3dfc73 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Tue, 17 Jun 2025 23:39:34 +0800 Subject: [PATCH] [CIR] Add support for __builtin_assume This patch adds support for t

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-17 Thread Sirui Mu via cfe-commits
@@ -24,16 +24,17 @@ let cppNamespace = "::cir" in { def CIRCallOpInterface : OpInterface<"CIRCallOpInterface", [CallOpInterface]> { // Currently we don't have any methods defined in CIRCallOpInterface. We'll // add more methods as the upstreaming proceeds. -let m

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-17 Thread Sirui Mu via cfe-commits
@@ -1858,6 +1858,40 @@ def FuncOp : CIR_Op<"func", [ // CallOp //===--===// +def SE_All : I32EnumAttrCase<"All", 1, "all">; Lancern wrote: Done. https://github.com/llvm/llvm-project/pull/14

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-17 Thread Sirui Mu via cfe-commits
@@ -1940,22 +1975,30 @@ def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> { let arguments = commonArgs; let builders = [ -// Build a call op for a direct call -OpBuilder<(ins "mlir::SymbolRefAttr":$callee, "mlir::Type":$resType, - "mlir::V

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-17 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/144201 >From 77d093f1a9c6c6fc742e788f8b05aa9c601480de Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Tue, 17 Jun 2025 22:35:50 +0800 Subject: [PATCH] [CIR] Add support for __builtin_assume This patch adds support for t

[clang] [CIR] Add support for __builtin_assume (PR #144376)

2025-06-16 Thread Sirui Mu via cfe-commits
https://github.com/Lancern created https://github.com/llvm/llvm-project/pull/144376 This patch adds support for the `__builtin_assume` builtin function. >From 886097329c486b48ceb32ea7ea807e561ad8abdd Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Mon, 16 Jun 2025 23:38:47 +0800 Subject: [PATCH]

[clang] [clang][bytecode] Avoid revisiting decomposition decl in visitDeclRef (PR #144226)

2025-06-15 Thread Sirui Mu via cfe-commits
https://github.com/Lancern closed https://github.com/llvm/llvm-project/pull/144226 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Avoid revisiting decomposition decl in visitDeclRef (PR #144226)

2025-06-15 Thread Sirui Mu via cfe-commits
Lancern wrote: I'll merge it once the CI is green. https://github.com/llvm/llvm-project/pull/144226 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][bytecode] Avoid revisiting decomposition decl in visitDeclRef (PR #144226)

2025-06-15 Thread Sirui Mu via cfe-commits
@@ -141,3 +141,11 @@ template constexpr auto c() { } auto y = c<1>(); // both-note {{in instantiation of function template specialization 'c<1>' requested here}} + +namespace non_constexpr_structured_binding { Lancern wrote: Sorry about that... Updated. ht

[clang] [clang][bytecode] Avoid revisiting decomposition decl in visitDeclRef (PR #144226)

2025-06-15 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/144226 >From c9649ce4a054cd20b81b12e51f25afa1cfbcf855 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Sat, 14 Jun 2025 22:25:48 +0800 Subject: [PATCH] [clang][Bytecode] Avoid revisiting decomposition decl --- clang/lib

[clang] [clang][bytecode] Avoid revisiting decomposition decl in visitDeclRef (PR #144226)

2025-06-15 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/144226 >From 72b99e66ff7b7534604eed5e555ceaf261b3c78e Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Sat, 14 Jun 2025 22:25:48 +0800 Subject: [PATCH] [clang][Bytecode] Avoid revisiting decomposition decl --- clang/lib

[clang] [clang][bytecode] Avoid revisiting decomposition decl in visitDeclRef (PR #144226)

2025-06-14 Thread Sirui Mu via cfe-commits
@@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -std=c++17 -verify %s -fexperimental-new-constant-interpreter +// RUN: %clang_cc1 -std=c++17 -verify %s + +void f1() { Lancern wrote: Updated https://github.com/llvm/llvm-project/pull/144226 __

[clang] [clang][bytecode] Avoid revisiting decomposition decl in visitDeclRef (PR #144226)

2025-06-14 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/144226 >From 8046031437a5cfafac17c7c9d978c25fb8ed2479 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Sat, 14 Jun 2025 22:25:48 +0800 Subject: [PATCH] [clang][Bytecode] Avoid revisiting decomposition decl --- clang/lib

[clang] [CIR] Upstream ComplexType ImaginaryLiteral (PR #144223)

2025-06-14 Thread Sirui Mu via cfe-commits
https://github.com/Lancern approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/144223 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream ComplexType builtin_complex (PR #144225)

2025-06-14 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited https://github.com/llvm/llvm-project/pull/144225 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream ComplexType builtin_complex (PR #144225)

2025-06-14 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited https://github.com/llvm/llvm-project/pull/144225 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream ComplexType builtin_complex (PR #144225)

2025-06-14 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited https://github.com/llvm/llvm-project/pull/144225 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream ComplexType builtin_complex (PR #144225)

2025-06-14 Thread Sirui Mu via cfe-commits
@@ -44,6 +68,15 @@ void ComplexExprEmitter::emitStoreOfComplex(mlir::Location loc, mlir::Value val, builder.createStore(loc, val, destAddr); } +mlir::Value ComplexExprEmitter::VisitCallExpr(const CallExpr *e) { + if (e->getCallReturnType(cgf.getContext())->isReferenceType(

[clang] [CIR][NFCI] Update RValue class to reflect changes in classic CodeGen (PR #142779)

2025-06-14 Thread Sirui Mu via cfe-commits
@@ -34,28 +32,85 @@ namespace clang::CIRGen { class RValue { enum Flavor { Scalar, Complex, Aggregate }; - // Stores first value and flavor. - llvm::PointerIntPair v1; - // Stores second value and volatility. - llvm::PointerIntPair, 1, bool> v2; - // Stores element type

[clang] [clang][bytecode] Avoid revisiting decomposition decl in visitDeclRef (PR #144226)

2025-06-14 Thread Sirui Mu via cfe-commits
https://github.com/Lancern created https://github.com/llvm/llvm-project/pull/144226 This simple patch removes the code to revisit `DecompositionDecl` in `visitDeclRef`. The revisit will try to emit the initializer of the `DecompositionDecl`, which could result in evaluation errors if the `Dec

[clang] [CIR] Add side effect attribute to call operations (PR #144201)

2025-06-13 Thread Sirui Mu via cfe-commits
https://github.com/Lancern created https://github.com/llvm/llvm-project/pull/144201 This patch adds `side_effect` attribute to `cir.call` operation. Other function call attributes will be added in later patches. >From ccf7371db9793ac980093fb3a43f24a7e9b176e7 Mon Sep 17 00:00:00 2001 From: Siru

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-13 Thread Sirui Mu via cfe-commits
https://github.com/Lancern closed https://github.com/llvm/llvm-project/pull/143377 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-12 Thread Sirui Mu via cfe-commits
@@ -312,8 +329,47 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo, assert(!cir::MissingFeatures::opCallBitcastArg()); cirCallArgs[argNo] = v; } else { - assert(!cir::MissingFeatures::opCallAggregateArgs()); - cgm.errorNYI("emitCa

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-12 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/143377 >From f524308595a06833b7e58f0138f281c7da84 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Mon, 9 Jun 2025 18:35:08 +0800 Subject: [PATCH] [CIR] Function calls with aggregate arguments and return values This

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-12 Thread Sirui Mu via cfe-commits
@@ -312,8 +329,47 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo, assert(!cir::MissingFeatures::opCallBitcastArg()); cirCallArgs[argNo] = v; } else { - assert(!cir::MissingFeatures::opCallAggregateArgs()); - cgm.errorNYI("emitCa

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-12 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/143377 >From e45c2ad46d7589ae1c7aa78b3ea19f7c6e5df094 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Mon, 9 Jun 2025 18:35:08 +0800 Subject: [PATCH] [CIR] Function calls with aggregate arguments and return values This

[clang] [Sema][clangd] add noexcept to override functions during code completion (PR #75937)

2025-06-12 Thread Sirui Mu via cfe-commits
Lancern wrote: Ping. Does this PR still get a chance to be merged? https://github.com/llvm/llvm-project/pull/75937 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema][clangd] add noexcept to override functions during code completion (PR #75937)

2025-06-12 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/75937 >From 8924617e16a035730c4c33f17c726dd5e5bb5f00 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Tue, 19 Dec 2023 22:24:23 +0800 Subject: [PATCH] [clangd][Sema] add noexcept to override functions during code complet

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-12 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/143377 >From 2296d60a753de77415ad4b95e35509bbf3bd437b Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Mon, 9 Jun 2025 18:35:08 +0800 Subject: [PATCH] [CIR] Function calls with aggregate arguments and return values This

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-12 Thread Sirui Mu via cfe-commits
https://github.com/Lancern approved this pull request. https://github.com/llvm/llvm-project/pull/143639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-12 Thread Sirui Mu via cfe-commits
@@ -21,6 +21,88 @@ using namespace clang; using namespace clang::CIRGen; +/// Checks whether the given constructor is a valid subject for the +/// complete-to-base constructor delgation optimization, i.e. emitting the +/// complete constructor as a simple call to the base cons

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-10 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/143377 >From df020dfa578d504521c1178dcc161a651eb0b0fa Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Mon, 9 Jun 2025 18:35:08 +0800 Subject: [PATCH] [CIR] Function calls with aggregate arguments and return values This

[clang] [CIR] Upstream minimal builtin function call support (PR #142981)

2025-06-10 Thread Sirui Mu via cfe-commits
@@ -0,0 +1,78 @@ +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fcla

[clang] [CIR] Upstream minimal builtin function call support (PR #142981)

2025-06-10 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited https://github.com/llvm/llvm-project/pull/142981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream minimal builtin function call support (PR #142981)

2025-06-10 Thread Sirui Mu via cfe-commits
@@ -229,6 +231,19 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { cir::IntType getUInt32Ty() { return typeCache.UInt32Ty; } cir::IntType getUInt64Ty() { return typeCache.UInt64Ty; } + cir::ConstantOp getConstInt(mlir::Location loc, llvm::APSInt intVal); + + cir

[clang] [CIR] Upstream minimal builtin function call support (PR #142981)

2025-06-10 Thread Sirui Mu via cfe-commits
https://github.com/Lancern approved this pull request. LGTM except 2 nits https://github.com/llvm/llvm-project/pull/142981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-10 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited https://github.com/llvm/llvm-project/pull/143639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-10 Thread Sirui Mu via cfe-commits
@@ -496,6 +496,47 @@ cir::FuncOp CIRGenFunction::generateCode(clang::GlobalDecl gd, cir::FuncOp fn, return fn; } +void CIRGenFunction::emitConstructorBody(FunctionArgList &args) { + assert(!cir::MissingFeatures::sanitizers()); + const auto *ctor = cast(curGD.getDecl()); +

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-10 Thread Sirui Mu via cfe-commits
https://github.com/Lancern requested changes to this pull request. https://github.com/llvm/llvm-project/pull/143639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-10 Thread Sirui Mu via cfe-commits
@@ -21,6 +21,88 @@ using namespace clang; using namespace clang::CIRGen; +/// Checks whether the given constructor is a valid subject for the +/// complete-to-base constructor delgation optimization, i.e. emitting the +/// complete constructor as a simple call to the base cons

[clang] [CIR] Upstream support for emitting constructors (PR #143639)

2025-06-10 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited https://github.com/llvm/llvm-project/pull/143639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-10 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/143377 >From 2999e0180e22724fc1a7247c9ed3520a8b2349dc Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Mon, 9 Jun 2025 18:35:08 +0800 Subject: [PATCH] [CIR] Function calls with aggregate arguments and return values This

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-10 Thread Sirui Mu via cfe-commits
@@ -312,8 +329,47 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo, assert(!cir::MissingFeatures::opCallBitcastArg()); cirCallArgs[argNo] = v; } else { - assert(!cir::MissingFeatures::opCallAggregateArgs()); - cgm.errorNYI("emitCa

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-10 Thread Sirui Mu via cfe-commits
@@ -312,8 +329,47 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo, assert(!cir::MissingFeatures::opCallBitcastArg()); cirCallArgs[argNo] = v; } else { - assert(!cir::MissingFeatures::opCallAggregateArgs()); - cgm.errorNYI("emitCa

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-10 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited https://github.com/llvm/llvm-project/pull/143377 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-10 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/143377 >From ea7297baf0d801f892065523749903a14aa59ee0 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Mon, 9 Jun 2025 18:35:08 +0800 Subject: [PATCH] [CIR] Function calls with aggregate arguments and return values This

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-10 Thread Sirui Mu via cfe-commits
@@ -312,8 +329,47 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo, assert(!cir::MissingFeatures::opCallBitcastArg()); cirCallArgs[argNo] = v; } else { - assert(!cir::MissingFeatures::opCallAggregateArgs()); - cgm.errorNYI("emitCa

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-10 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/143377 >From fc98c3d1e0995d5519a4cb5313affd07f088ab44 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Mon, 9 Jun 2025 18:35:08 +0800 Subject: [PATCH] [CIR] Function calls with aggregate arguments and return values This

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-09 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited https://github.com/llvm/llvm-project/pull/143377 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Function calls with aggregate arguments and return values (PR #143377)

2025-06-09 Thread Sirui Mu via cfe-commits
https://github.com/Lancern created https://github.com/llvm/llvm-project/pull/143377 This patch updates cir.call operation and allows function calls with aggregate arguments and return values. It seems that C++ class support is still at a minimum now. I try to make a call to a C++ function wit

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

2025-05-30 Thread Sirui Mu via cfe-commits
https://github.com/Lancern closed 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] Call to variadic functions (PR #141942)

2025-05-29 Thread Sirui Mu via cfe-commits
@@ -409,6 +409,18 @@ void CIRGenFunction::emitCallArg(CallArgList &args, const clang::Expr *e, args.add(emitAnyExprToTemp(e), argType); } +QualType CIRGenFunction::getVarArgType(const Expr *arg) { + // System headers on Windows define NULL to 0 instead of 0LL on Win64. MSV

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

2025-05-29 Thread Sirui Mu via cfe-commits
@@ -39,6 +39,26 @@ class RequiredArgs { bool allowsOptionalArgs() const { return numRequired != ~0U; } + /// Compute the arguments required by the given formal prototype, given that + /// there may be some additional, non-formal arguments in play. + /// + /// If FD is n

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

2025-05-29 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/141942 >From 862cb3bd98bc2ed6a6b01efe0f08ebfaf8ad63e0 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Thu, 29 May 2025 17:21:06 +0800 Subject: [PATCH] [CIR] Call to variadic functions --- clang/include/clang/CIR/Missin

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

2025-05-29 Thread Sirui Mu via cfe-commits
https://github.com/Lancern created https://github.com/llvm/llvm-project/pull/141942 This PR adds support for calling variadic functions in CIR. >From 800e4b1a02520e4c3137a02e284cc8406cf36602 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Thu, 29 May 2025 17:21:06 +0800 Subject: [PATCH] [CIR] Ca

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

2025-05-20 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited 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][NFC] Eliminate ArgInfo structure (PR #140612)

2025-05-20 Thread Sirui Mu via cfe-commits
@@ -72,16 +68,15 @@ class RequiredArgs { class CIRGenFunctionInfo final : public llvm::FoldingSetNode, - private llvm::TrailingObjects { - using ArgInfo = CIRGenFunctionInfoArgInfo; - + private llvm::TrailingObjects { Lancern wrote: It would be

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

2025-05-20 Thread Sirui Mu via cfe-commits
https://github.com/Lancern approved this pull request. LGTM with one nit 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 indirect calls (PR #139748)

2025-05-20 Thread Sirui Mu via cfe-commits
https://github.com/Lancern closed https://github.com/llvm/llvm-project/pull/139748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-05-20 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/139748 >From 71009b450a333d4537d9a84176707656c5bdcea1 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Thu, 15 May 2025 23:01:18 +0800 Subject: [PATCH] [CIR] Add support for indirect calls --- .../CIR/Dialect/Builder/CI

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

2025-05-18 Thread Sirui Mu via cfe-commits
@@ -1148,6 +1146,35 @@ mlir::Value CIRGenFunction::emitAlloca(StringRef name, mlir::Type ty, return addr; } +// Note: this function also emit constructor calls to support a MSVC extensions +// allowing explicit constructor function call. +RValue CIRGenFunction::emitCXXMembe

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

2025-05-18 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited 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 support for C++ member function calls (PR #140290)

2025-05-18 Thread Sirui Mu via cfe-commits
https://github.com/Lancern approved this pull request. 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 support for C++ member function calls (PR #140290)

2025-05-18 Thread Sirui Mu via cfe-commits
https://github.com/Lancern approved this pull request. 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] Add support for indirect calls (PR #139748)

2025-05-17 Thread Sirui Mu via cfe-commits
@@ -1500,6 +1507,14 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter &converter, converter.addConversion([&](cir::BF16Type type) -> mlir::Type { return mlir::BFloat16Type::get(type.getContext()); }); + converter.addConversion([&](cir::FuncType type) -> mlir

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

2025-05-17 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited https://github.com/llvm/llvm-project/pull/139748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-05-17 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited https://github.com/llvm/llvm-project/pull/139748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-05-17 Thread Sirui Mu via cfe-commits
https://github.com/Lancern edited https://github.com/llvm/llvm-project/pull/139748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-05-17 Thread Sirui Mu via cfe-commits
@@ -937,8 +937,28 @@ CIRGenCallee CIRGenFunction::emitCallee(const clang::Expr *e) { return emitDirectCallee(cgm, funcDecl); } - cgm.errorNYI(e->getSourceRange(), "Unsupported callee kind"); - return {}; + assert(!cir::MissingFeatures::opCallPseudoDtor());

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

2025-05-17 Thread Sirui Mu via cfe-commits
@@ -539,15 +573,16 @@ mlir::ParseResult cir::CallOp::parse(mlir::OpAsmParser &parser, } void cir::CallOp::print(mlir::OpAsmPrinter &p) { - printCallCommon(*this, getCalleeAttr(), p); + mlir::Value indirectCallee = isIndirect() ? getIndirectCall() : nullptr; + printCallComm

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

2025-05-17 Thread Sirui Mu via cfe-commits
@@ -464,15 +464,35 @@ OpFoldResult cir::CastOp::fold(FoldAdaptor adaptor) { // CallOp //===--===// +mlir::OperandRange cir::CallOp::getArgOperands() { + if (isIndirect()) +return getArgs().drop_front(1);

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

2025-05-17 Thread Sirui Mu via cfe-commits
@@ -1861,13 +1867,23 @@ def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> { let arguments = commonArgs; let builders = [OpBuilder<(ins "mlir::SymbolRefAttr":$callee, - "mlir::Type":$resType, - "mlir::V

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

2025-05-17 Thread Sirui Mu via cfe-commits
@@ -1861,13 +1867,23 @@ def CallOp : CIR_CallOpBase<"call", [NoRegionArguments]> { let arguments = commonArgs; let builders = [OpBuilder<(ins "mlir::SymbolRefAttr":$callee, - "mlir::Type":$resType, - "mlir::V

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

2025-05-17 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/139748 >From 614849751f24c47c6da53ebc1fb296b806223557 Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Thu, 15 May 2025 23:01:18 +0800 Subject: [PATCH] [CIR] Add support for indirect calls --- .../CIR/Dialect/Builder/CI

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

2025-05-17 Thread Sirui Mu via cfe-commits
https://github.com/Lancern updated https://github.com/llvm/llvm-project/pull/139748 >From eb08d386728d1d9876f68dc40b4042bace9e5d5c Mon Sep 17 00:00:00 2001 From: Sirui Mu Date: Thu, 15 May 2025 23:01:18 +0800 Subject: [PATCH] [CIR] Add support for indirect calls --- .../CIR/Dialect/Builder/CI

  1   2   3   >