[clang] [CIR] Lower calls to trivial copy constructor to cir::CopyOp (PR #168281)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 18 14:49:16 PST 2025


================
@@ -984,6 +987,28 @@ void LoweringPreparePass::lowerArrayCtor(cir::ArrayCtor op) {
                              true);
 }
 
+void LoweringPreparePass::lowerTrivialCopyCall(cir::CallOp op) {
+  FuncOp funcOp = getCalledFunction(op);
+  if (!funcOp)
+    return;
+
+  llvm::errs() << "Lower trivial copy call: " << funcOp.getName() << "\n";
+
+  std::optional<cir::CtorKind> ctorKind = funcOp.getCxxConstructorKind();
+  if (ctorKind && *ctorKind == cir::CtorKind::Copy
----------------
andykaylor wrote:

There are also cases we could handle for trivial assign operators.

https://github.com/llvm/llvm-project/pull/168281


More information about the cfe-commits mailing list