[clang] [clang][bytecode] Use a special opcode for trivial defaulted copy/move operator calls (PR #222332)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 9 19:00:27 PDT 2026


================
@@ -6174,6 +6183,35 @@ bool Compiler<Emitter>::VisitCallExpr(const CallExpr *E) {
   }
 
   LocalScope<Emitter> CallScope(this, ScopeKind::Call);
+  ArrayRef<const Expr *> Args(E->getArgs(), E->getNumArgs());
+  bool ActivateLHS = false;
+
+  // Emit a special op for trivial copy/move operators.
+  if (isTrivialMemoryOperation(dyn_cast_if_present<CXXMethodDecl>(FuncDecl))) {
+    const Function *Func = getFunction(FuncDecl);
+    if (!Func)
+      return false;
+
+    if (const auto *OCE = dyn_cast<CXXOperatorCallExpr>(E);
+        OCE && OCE->isAssignmentOp()) {
+      const CXXRecordDecl *LHSRecord = Args[0]->getType()->getAsCXXRecordDecl();
----------------
ojhunt wrote:

does this need to check for a non-defaulted assignment operator?

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


More information about the cfe-commits mailing list