[clang] [CIR] Destroy callee-destroyed parameters in the callee (PR #245032)

Chibuoyim Ogbonna via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 22 08:29:17 PST 2026


================
@@ -0,0 +1,75 @@
+// RUN: %clang_cc1 -std=c++20 -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++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
+
+struct __attribute__((trivial_abi)) Handle {
+  int *p;
+  Handle();
+  Handle(const Handle &);
+  ~Handle();
+};
+
+void take(Handle h) {}
+
+// CIR-LABEL: cir.func {{.*}} @_Z4take6Handle(
+// CIR:         %[[H:.+]] = cir.alloca "h"
+// CIR:         cir.call @_ZN6HandleD1Ev(%[[H]])
+// CIR:         cir.return
+
+// LLVM-LABEL: define {{.*}} void @_Z4take6Handle(
----------------
bruteforceboy wrote:

nit: In the checks here, the LLVM and OGCG checks are basically duplicates. Can we merge them into one prefix?

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


More information about the cfe-commits mailing list