llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Adam Smith (adams381)

<details>
<summary>Changes</summary>

These 8 CIR tests compile clean with x86_64 calling-convention lowering on, but 
their CHECK lines still pinned the pre-coercion CIR: raw record types in 
signatures, plain by-value loads for temporaries with a non-trivial destructor, 
and matching store/load pairs for empty records.  The pass now emits the 
ABI-correct shape instead: sret return parameters, a dropped or byref-marked 
argument for records that carry no data or that need pass-by-reference, and a 
`#cir.poison` placeholder where a value the pass ignores used to be stored.

Assisted-by: Cursor / claude-opus-5


---

Patch is 32.28 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/218931.diff


8 Files Affected:

- (modified) clang/test/CIR/CodeGen/array-ctor.cpp (+7-13) 
- (modified) clang/test/CIR/CodeGen/cleanup-conditional-with-wrapper-eh.cpp 
(+14-28) 
- (modified) clang/test/CIR/CodeGen/cleanup-conditional-with-wrapper.cpp 
(+14-28) 
- (modified) clang/test/CIR/CodeGen/paren-list-agg-init.cpp (+8-12) 
- (modified) clang/test/CIR/CodeGen/partial-array-cleanup.cpp (+5-9) 
- (modified) clang/test/CIR/CodeGenOpenACC/atomic-capture.cpp (+4-5) 
- (modified) clang/test/CIR/CodeGenOpenACC/atomic-update.cpp (+4-5) 
- (modified) clang/test/CIR/CodeGenOpenACC/atomic-write.cpp (+5-6) 


``````````diff
diff --git a/clang/test/CIR/CodeGen/array-ctor.cpp 
b/clang/test/CIR/CodeGen/array-ctor.cpp
index c5ff5f2b82404..07deb299542aa 100644
--- a/clang/test/CIR/CodeGen/array-ctor.cpp
+++ b/clang/test/CIR/CodeGen/array-ctor.cpp
@@ -1,9 +1,7 @@
-// TODO(cir): drop -fno-clangir-call-conv-lowering once CallConvLowering
-// supports parameters of an empty or tag class.
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-fclangir -fno-clangir-call-conv-lowering -emit-cir -mmlir 
--mlir-print-ir-before=cir-lowering-prepare %s -o -  2>&1 | FileCheck 
--check-prefixes=CIR-BEFORE-LPP %s
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-fclangir -fno-clangir-call-conv-lowering -emit-cir %s -o %t.cir
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-fclangir -emit-cir -mmlir --mlir-print-ir-before=cir-lowering-prepare %s -o -  
2>&1 | FileCheck --check-prefixes=CIR-BEFORE-LPP %s
+// RUN: %clang_cc1 -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 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-fclangir -fno-clangir-call-conv-lowering -emit-llvm %s -o %t-cir.ll
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-fclangir -emit-llvm %s -o %t-cir.ll
 // RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value 
-emit-llvm %s -o %t.ll
 // RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
@@ -208,8 +206,7 @@ void TempInArray() {
 // CIR:        cir.do {
 // CIR-NEXT:     %[[CURRENT:.*]] = cir.load %[[ITER:.*]] : 
!cir.ptr<!cir.ptr<!rec_CausesTemp>>, !cir.ptr<!rec_CausesTemp>
 // CIR-NEXT:     cir.cleanup.scope {
-// CIR-NEXT:       %[[LOAD:.*]] = cir.load {{.*}} %[[TMP]] : 
!cir.ptr<!rec_Temp>, !rec_Temp
-// CIR-NEXT:       cir.call @_ZN10CausesTempC1E4Temp(%[[CURRENT]], %[[LOAD]])
+// CIR-NEXT:       cir.call @_ZN10CausesTempC1E4Temp(%[[CURRENT]], %[[TMP]]) : 
({{.*}}, !cir.ptr<!rec_Temp> {llvm.align = 1 : i64, llvm.byref = !rec_Temp}) -> 
()
 // CIR-NEXT:       cir.yield
 // CIR-NEXT:     } cleanup normal {
 // CIR-NEXT:       cir.call @_ZN4TempD1Ev(%[[TMP]]) nothrow
@@ -230,8 +227,7 @@ void TempInArray() {
 // LLVM:       %[[CURRENT:.*]] = load ptr, ptr %[[ITER]]
 // LLVM:       br label %[[CONSTRUCT_BR:.*]]
 // LLVM:       [[CONSTRUCT_BR]]:
-// LLVM:       %[[LOAD:.*]] = load %struct.Temp, ptr %[[TMP]]
-// LLVM:       call void @_ZN10CausesTempC1E4Temp(ptr {{.*}}%[[CURRENT]], 
%struct.Temp %[[LOAD]])
+// LLVM:       call void @_ZN10CausesTempC1E4Temp(ptr {{.*}}%[[CURRENT]], ptr 
byref(%struct.Temp) align 1 %[[TMP]])
 // LLVM:       br label %[[CLEANUP_BR:.*]]
 // LLVM:       [[CLEANUP_BR]]:
 // LLVM:       call void @_ZN4TempD1Ev({{.*}}[[TMP]])
@@ -295,8 +291,7 @@ void Temp2InArray() {
 // CIR-NEXT:     %[[CURRENT:.*]] = cir.load %[[ITER:.*]] : 
!cir.ptr<!cir.ptr<!rec_CausesTemp2>>, !cir.ptr<!rec_CausesTemp2>
 // CIR-NEXT:     cir.call @_ZN5Temp2C1Ev(%[[TMP]])
 // CIR-NEXT:     cir.cleanup.scope {
-// CIR-NEXT:       %[[LOAD:.*]] = cir.load {{.*}} %[[TMP]] : 
!cir.ptr<!rec_Temp2>, !rec_Temp2
-// CIR-NEXT:         cir.call @_ZN11CausesTemp2C1E5Temp2(%[[CURRENT]], 
%[[LOAD]])
+// CIR-NEXT:         cir.call @_ZN11CausesTemp2C1E5Temp2(%[[CURRENT]], 
%[[TMP]]) : ({{.*}}, !cir.ptr<!rec_Temp2> {llvm.align = 1 : i64, llvm.byref = 
!rec_Temp2}) -> ()
 // CIR-NEXT:         cir.yield
 // CIR-NEXT:       } cleanup normal {
 // CIR-NEXT:         cir.call @_ZN5Temp2D1Ev(%[[TMP]]) nothrow
@@ -333,8 +328,7 @@ void Temp2InArray() {
 // LLVM:       call void @_ZN5Temp2C1Ev({{.*}}%[[TMP]])
 // LLVM:       br label %[[CONSTRUCT_BR:.*]]
 // LLVM:       [[CONSTRUCT_BR]]:
-// LLVM:       %[[LOAD:.*]] = load %struct.Temp2, ptr %[[TMP]]
-// LLVM:       call void @_ZN11CausesTemp2C1E5Temp2(ptr {{.*}}%[[CURRENT]], 
%struct.Temp2 %[[LOAD]])
+// LLVM:       call void @_ZN11CausesTemp2C1E5Temp2(ptr {{.*}}%[[CURRENT]], 
ptr byref(%struct.Temp2) align 1 %[[TMP]])
 // LLVM:       br label %[[CLEANUP_BR:.*]]
 // LLVM:       [[CLEANUP_BR]]:
 // LLVM:       call void @_ZN5Temp2D1Ev({{.*}}[[TMP]])
diff --git a/clang/test/CIR/CodeGen/cleanup-conditional-with-wrapper-eh.cpp 
b/clang/test/CIR/CodeGen/cleanup-conditional-with-wrapper-eh.cpp
index 443d15f30fbd6..5792c78cfad49 100644
--- a/clang/test/CIR/CodeGen/cleanup-conditional-with-wrapper-eh.cpp
+++ b/clang/test/CIR/CodeGen/cleanup-conditional-with-wrapper-eh.cpp
@@ -1,8 +1,6 @@
-// TODO(cir): drop -fno-clangir-call-conv-lowering once CallConvLowering
-// supports parameters of an empty or tag class.
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fexceptions 
-fcxx-exceptions -fclangir -fno-clangir-call-conv-lowering -emit-cir %s -o 
%t.cir
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fexceptions 
-fcxx-exceptions -fclangir -emit-cir %s -o %t.cir
 // RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fexceptions 
-fcxx-exceptions -fclangir -fno-clangir-call-conv-lowering -emit-llvm %s -o 
%t-cir.ll
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fexceptions 
-fcxx-exceptions -fclangir -emit-llvm %s -o %t-cir.ll
 // RUN: FileCheck --input-file=%t-cir.ll %s --check-prefix=LLVM
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fexceptions 
-fcxx-exceptions -emit-llvm %s -o %t.ll
 // RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
@@ -41,8 +39,7 @@ Wrapper makeWrapper() {
     : Wrapper::empty();
 }
 
-// CIR: cir.func {{.*}} @_Z11makeWrapperv() -> !rec_Wrapper
-// CIR:   %[[RETVAL:.*]] = cir.alloca "__retval" {{.*}} : 
!cir.ptr<!rec_Wrapper>
+// CIR: cir.func {{.*}} @_Z11makeWrapperv(%[[RETVAL:.*]]: 
!cir.ptr<!rec_Wrapper> {llvm.align = 1 : i64, llvm.dead_on_unwind, 
llvm.noalias, llvm.sret = !rec_Wrapper, llvm.writable}{{.*}})
 // CIR:   %[[CLEANUP_COND:.*]] = cir.alloca "cleanup.cond" {{.*}} : 
!cir.ptr<!cir.bool>
 // CIR:   %[[AGG_TMP0:.*]] = cir.alloca "agg.tmp0" {{.*}} : 
!cir.ptr<!rec_std3A3Aunique_ptr3CBase3E>
 // CIR:   cir.cleanup.scope {
@@ -54,11 +51,9 @@ Wrapper makeWrapper() {
 // CIR:       cir.call @_ZNSt10unique_ptrI4BaseEC1EPS0_(%[[AGG_TMP0]], 
%[[SOURCE]])
 // CIR:       %[[TRUE:.*]] = cir.const #true
 // CIR:       cir.store %[[TRUE]], %[[CLEANUP_COND]]
-// CIR:       %[[AGG_TMP0_LOAD:.*]] = cir.load{{.*}} %[[AGG_TMP0]]
-// CIR:       cir.call @_ZN7WrapperC1ESt10unique_ptrI4BaseE(%[[RETVAL]], 
%[[AGG_TMP0_LOAD]])
+// CIR:       cir.call @_ZN7WrapperC1ESt10unique_ptrI4BaseE(%[[RETVAL]], 
%[[AGG_TMP0]]) : ({{.*}}, !cir.ptr<!rec_std3A3Aunique_ptr3CBase3E> {llvm.align 
= 1 : i64, llvm.byref = !rec_std3A3Aunique_ptr3CBase3E}) -> ()
 // CIR:     } else {
-// CIR:       %[[EMPTY:.*]] = cir.call @_ZN7Wrapper5emptyEv()
-// CIR:       cir.store{{.*}} %[[EMPTY]], %[[RETVAL]] : !rec_Wrapper, 
!cir.ptr<!rec_Wrapper>
+// CIR:       cir.call @_ZN7Wrapper5emptyEv(%[[RETVAL]])
 // CIR:     }
 // CIR:     cir.yield
 // CIR:   } cleanup all {
@@ -68,11 +63,9 @@ Wrapper makeWrapper() {
 // CIR:     }
 // CIR:     cir.yield
 // CIR:   }
-// CIR:   %[[RET:.*]] = cir.load %[[RETVAL]]
-// CIR:   cir.return %[[RET]] : !rec_Wrapper
+// CIR:   cir.return
 
-// LLVM: define {{.*}} %struct.Wrapper @_Z11makeWrapperv()
-// LLVM:   %[[RETVAL:.*]] = alloca %struct.Wrapper
+// LLVM: define {{.*}} void @_Z11makeWrapperv(ptr {{.*}} sret(%struct.Wrapper) 
{{.*}} %[[RETVAL:.*]])
 // LLVM:   %[[CLEANUP_COND:.*]] = alloca i8
 // LLVM:   %[[AGG_TMP0:.*]] = alloca %"struct.std::unique_ptr<Base>"
 // LLVM:   br label %[[INIT:.*]]
@@ -96,16 +89,14 @@ Wrapper makeWrapper() {
 // LLVM:                       to label %[[INVOKE_CONTINUE_2:.*]] unwind label 
%[[INVOKE_CLEANUP:.*]]
 // LLVM: [[INVOKE_CONTINUE_2]]:
 // LLVM:   store i8 1, ptr %[[CLEANUP_COND]]
-// LLVM:   %[[AGG_TMP0_LOAD:.*]] = load %"struct.std::unique_ptr<Base>", ptr 
%[[AGG_TMP0]]
-// LLVM:   invoke void @_ZN7WrapperC1ESt10unique_ptrI4BaseE(ptr {{.*}} 
%[[RETVAL]], %"struct.std::unique_ptr<Base>" %[[AGG_TMP0_LOAD]])
+// LLVM:   invoke void @_ZN7WrapperC1ESt10unique_ptrI4BaseE(ptr {{.*}} 
%[[RETVAL]], ptr byref(%"struct.std::unique_ptr<Base>") align 1 %[[AGG_TMP0]])
 // LLVM:                       to label %[[INVOKE_CONTINUE_3:.*]] unwind label 
%[[INVOKE_CLEANUP:.*]]
 // LLVM: [[INVOKE_CONTINUE_3]]:
 // LLVM:   br label %[[CONSTRUCT_CONTINUE:.*]]
 // LLVM: [[CONSTRUCT_FALSE]]:
-// LLVM:   %[[EMPTY:.*]] = invoke %struct.Wrapper @_ZN7Wrapper5emptyEv()
+// LLVM:   invoke void @_ZN7Wrapper5emptyEv(ptr {{.*}} sret(%struct.Wrapper) 
{{.*}} %[[RETVAL]])
 // LLVM:                       to label %[[INVOKE_CONTINUE_4:.*]] unwind label 
%[[INVOKE_CLEANUP:.*]]
 // LLVM: [[INVOKE_CONTINUE_4]]:
-// LLVM:   store %struct.Wrapper %[[EMPTY]], ptr %[[RETVAL]]
 // LLVM:   br label %[[CONSTRUCT_DONE:.*]]
 // LLVM: [[CONSTRUCT_DONE]]:
 // LLVM:   %[[CLEANUP_FLAG:.*]] = load i8, ptr %[[CLEANUP_COND]]
@@ -130,8 +121,7 @@ Wrapper makeWrapper() {
 // LLVM: [[CLEANUP_DONE]]:
 // LLVM:   resume
 // LLVM: [[DONE]]:
-// LLVM:   %[[RET:.*]] = load %struct.Wrapper, ptr %[[RETVAL]]
-// LLVM:   ret %struct.Wrapper %[[RET]]
+// LLVM:   ret void
   
 // OGCG: define {{.*}} void @_Z11makeWrapperv(ptr{{.*}} sret(%struct.Wrapper) 
{{.*}} %[[RETVAL:.*]])
 // OGCG:   %[[RESULT_PTR:.*]] = alloca ptr
@@ -214,8 +204,7 @@ void APFixedPoint::add(int x) const {
 // CIR:             %[[TRUE:.*]] = cir.const #true
 // CIR:             cir.store %[[TRUE]], %[[CLEANUP_COND_TRUE]]
 // CIR:           } else {
-// CIR:             %[[CALL_RES:.*]] = cir.call 
@_ZN5APInt8uadd_satEv(%[[THISVAL]])
-// CIR:             cir.store{{.*}} %[[CALL_RES]], %[[AGG_TMP]]
+// CIR:             cir.call @_ZN5APInt8uadd_satEv(%[[AGG_TMP]], %[[THISVAL]]) 
: (!cir.ptr<!rec_APInt> {llvm.align = 1 : i64, llvm.dead_on_unwind, llvm.sret = 
!rec_APInt, llvm.writable}, {{.*}}) -> ()
 // CIR:             %[[TRUE:.*]] = cir.const #true
 // CIR:             cir.store %[[TRUE]], %[[CLEANUP_COND_FALSE]]
 // CIR:           }
@@ -249,10 +238,9 @@ void APFixedPoint::add(int x) const {
 // LLVM: [[COND_TRUE]]:
 // LLVM:   store i8 1, ptr %[[CLEANUP_COND_TRUE]]
 // LLVM: [[COND_FALSE]]:
-// LLVM:   %[[CALL_RES:.*]] = invoke %struct.APInt @_ZN5APInt8uadd_satEv(ptr 
{{.*}} %[[THISVAL]])
+// LLVM:   invoke void @_ZN5APInt8uadd_satEv(ptr {{.*}} sret(%struct.APInt) 
{{.*}} %[[AGG_TMP]], ptr {{.*}} %[[THISVAL]])
 // LLVM:           to label %[[INVOKE_CONT:.*]] unwind label %[[LPAD:.*]]
 // LLVM: [[INVOKE_CONT]]:
-// LLVM:   store %struct.APInt %[[CALL_RES]], ptr %[[AGG_TMP]]
 // LLVM:   store i8 1, ptr %[[CLEANUP_COND_FALSE]]
 // LLVM:   %[[FF:.*]] = load i8, ptr %[[CLEANUP_COND_FALSE]]
 // LLVM:   %[[FF_B:.*]] = trunc i8 %[[FF]] to i1
@@ -373,8 +361,7 @@ void makeEntry() {
 // CIR:         %{{.*}} = cir.get_global @g_path
 // CIR:         %[[TRUE:.*]] = cir.const #true
 // CIR:         cir.store %[[TRUE]], %[[CLEANUP_COND]]
-// CIR:         %[[PATH_LOAD:.*]] = cir.load{{.*}} %[[AGG_TMP0]]
-// CIR:         cir.call @_ZN5EntryC1E4Path(%[[ENSURED_F]], %[[PATH_LOAD]])
+// CIR:         cir.call @_ZN5EntryC1E4Path(%[[ENSURED_F]], %[[AGG_TMP0]]) : 
({{.*}}, !cir.ptr<!rec_Path> {llvm.align = 1 : i64, llvm.byref = !rec_Path}) -> 
()
 // CIR:       }
 // CIR:       cir.yield
 // CIR:     } cleanup all {
@@ -408,8 +395,7 @@ void makeEntry() {
 // LLVM:   br label %[[COND_END:.*]]
 // LLVM: [[FALSE_BB]]:
 // LLVM:   store i8 1, ptr %[[CLEANUP_COND]]
-// LLVM:   %[[PATH_LOAD:.*]] = load %struct.Path, ptr %[[AGG_TMP0]]
-// LLVM:   invoke void @_ZN5EntryC1E4Path(ptr {{.*}} %[[ENSURED_F]], 
%struct.Path %[[PATH_LOAD]])
+// LLVM:   invoke void @_ZN5EntryC1E4Path(ptr {{.*}} %[[ENSURED_F]], ptr 
byref(%struct.Path) align 1 %[[AGG_TMP0]])
 // LLVM:                     to label %[[FALSE_CONT:.*]] unwind label %[[LPAD]]
 // LLVM: [[FALSE_CONT]]:
 // LLVM:   br label %[[COND_END]]
diff --git a/clang/test/CIR/CodeGen/cleanup-conditional-with-wrapper.cpp 
b/clang/test/CIR/CodeGen/cleanup-conditional-with-wrapper.cpp
index 09d1d59631d69..19aaeff91199b 100644
--- a/clang/test/CIR/CodeGen/cleanup-conditional-with-wrapper.cpp
+++ b/clang/test/CIR/CodeGen/cleanup-conditional-with-wrapper.cpp
@@ -1,8 +1,6 @@
-// TODO(cir): drop -fno-clangir-call-conv-lowering once CallConvLowering
-// supports parameters of an empty or tag class.
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir 
-fno-clangir-call-conv-lowering -emit-cir %s -o %t.cir
+// RUN: %clang_cc1 -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 -triple x86_64-unknown-linux-gnu -fclangir 
-fno-clangir-call-conv-lowering -emit-llvm %s -o %t-cir.ll
+// RUN: %clang_cc1 -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 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
 // RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
@@ -41,8 +39,7 @@ Wrapper makeWrapper() {
     : Wrapper::empty();
 }
 
-// CIR: cir.func {{.*}} @_Z11makeWrapperv() -> !rec_Wrapper
-// CIR:   %[[RETVAL:.*]] = cir.alloca "__retval" {{.*}} : 
!cir.ptr<!rec_Wrapper>
+// CIR: cir.func {{.*}} @_Z11makeWrapperv(%[[RETVAL:.*]]: 
!cir.ptr<!rec_Wrapper> {llvm.align = 1 : i64, llvm.dead_on_unwind, 
llvm.noalias, llvm.sret = !rec_Wrapper, llvm.writable}{{.*}})
 // CIR:   %[[CLEANUP_COND:.*]] = cir.alloca "cleanup.cond" {{.*}} : 
!cir.ptr<!cir.bool>
 // CIR:   %[[AGG_TMP0:.*]] = cir.alloca "agg.tmp0" {{.*}} : 
!cir.ptr<!rec_std3A3Aunique_ptr3CBase3E>
 // CIR:   cir.cleanup.scope {
@@ -54,11 +51,9 @@ Wrapper makeWrapper() {
 // CIR:       cir.call @_ZNSt10unique_ptrI4BaseEC1EPS0_(%[[AGG_TMP0]], 
%[[SOURCE]])
 // CIR:       %[[TRUE:.*]] = cir.const #true
 // CIR:       cir.store %[[TRUE]], %[[CLEANUP_COND]]
-// CIR:       %[[AGG_TMP0_LOAD:.*]] = cir.load{{.*}} %[[AGG_TMP0]]
-// CIR:       cir.call @_ZN7WrapperC1ESt10unique_ptrI4BaseE(%[[RETVAL]], 
%[[AGG_TMP0_LOAD]])
+// CIR:       cir.call @_ZN7WrapperC1ESt10unique_ptrI4BaseE(%[[RETVAL]], 
%[[AGG_TMP0]]) : ({{.*}}, !cir.ptr<!rec_std3A3Aunique_ptr3CBase3E> {llvm.align 
= 1 : i64, llvm.byref = !rec_std3A3Aunique_ptr3CBase3E}) -> ()
 // CIR:     } else {
-// CIR:       %[[EMPTY:.*]] = cir.call @_ZN7Wrapper5emptyEv()
-// CIR:       cir.store{{.*}} %[[EMPTY]], %[[RETVAL]] : !rec_Wrapper, 
!cir.ptr<!rec_Wrapper>
+// CIR:       cir.call @_ZN7Wrapper5emptyEv(%[[RETVAL]])
 // CIR:     }
 // CIR:     cir.yield
 // CIR:   } cleanup normal {
@@ -68,11 +63,9 @@ Wrapper makeWrapper() {
 // CIR:     }
 // CIR:     cir.yield
 // CIR:   }
-// CIR:   %[[RET:.*]] = cir.load %[[RETVAL]]
-// CIR:   cir.return %[[RET]] : !rec_Wrapper
+// CIR:   cir.return
 
-// LLVM: define {{.*}} %struct.Wrapper @_Z11makeWrapperv()
-// LLVM:   %[[RETVAL:.*]] = alloca %struct.Wrapper
+// LLVM: define {{.*}} void @_Z11makeWrapperv(ptr {{.*}} sret(%struct.Wrapper) 
{{.*}} %[[RETVAL:.*]])
 // LLVM:   %[[CLEANUP_COND:.*]] = alloca i8
 // LLVM:   %[[AGG_TMP0:.*]] = alloca %"struct.std::unique_ptr<Base>"
 // LLVM:   br label %[[INIT:.*]]
@@ -82,12 +75,10 @@ Wrapper makeWrapper() {
 // LLVM:   %[[SOURCE:.*]] = call {{.*}} ptr @_Z9getSourcev()
 // LLVM:   call void @_ZNSt10unique_ptrI4BaseEC1EPS0_(ptr {{.*}} 
%[[AGG_TMP0]], ptr {{.*}} %[[SOURCE]])
 // LLVM:   store i8 1, ptr %[[CLEANUP_COND]]
-// LLVM:   %[[AGG_TMP0_LOAD:.*]] = load %"struct.std::unique_ptr<Base>", ptr 
%[[AGG_TMP0]]
-// LLVM:   call void @_ZN7WrapperC1ESt10unique_ptrI4BaseE(ptr {{.*}} 
%[[RETVAL]], %"struct.std::unique_ptr<Base>" %[[AGG_TMP0_LOAD]])
+// LLVM:   call void @_ZN7WrapperC1ESt10unique_ptrI4BaseE(ptr {{.*}} 
%[[RETVAL]], ptr byref(%"struct.std::unique_ptr<Base>") align 1 %[[AGG_TMP0]])
 // LLVM:   br label %[[CONSTRUCT_CONTINUE:.*]]
 // LLVM: [[CONSTRUCT_FALSE]]:
-// LLVM:   %[[EMPTY:.*]] = call %struct.Wrapper @_ZN7Wrapper5emptyEv()
-// LLVM:   store %struct.Wrapper %[[EMPTY]], ptr %[[RETVAL]]
+// LLVM:   call void @_ZN7Wrapper5emptyEv(ptr {{.*}} sret(%struct.Wrapper) 
{{.*}} %[[RETVAL]])
 // LLVM:   br label %[[CONSTRUCT_DONE:.*]]
 // LLVM: [[CONSTRUCT_DONE]]:
 // LLVM:   %[[CLEANUP_FLAG:.*]] = load i8, ptr %[[CLEANUP_COND]]
@@ -97,8 +88,7 @@ Wrapper makeWrapper() {
 // LLVM:   call void @_ZNSt10unique_ptrI4BaseED1Ev(ptr {{.*}} %[[AGG_TMP0]])
 // LLVM:   br label %[[DONE:.*]]
 // LLVM: [[DONE]]:
-// LLVM:   %[[RET:.*]] = load %struct.Wrapper, ptr %[[RETVAL]]
-// LLVM:   ret %struct.Wrapper %[[RET]]
+// LLVM:   ret void
   
 // OGCG: define {{.*}} void @_Z11makeWrapperv(ptr{{.*}} sret(%struct.Wrapper) 
{{.*}} %[[RETVAL:.*]])
 // OGCG:   %[[RESULT_PTR:.*]] = alloca ptr
@@ -167,8 +157,7 @@ void APFixedPoint::add(int x) const {
 // CIR:             %[[TRUE:.*]] = cir.const #true
 // CIR:             cir.store %[[TRUE]], %[[CLEANUP_COND_TRUE]]
 // CIR:           } else {
-// CIR:             %[[CALL_RES:.*]] = cir.call 
@_ZN5APInt8uadd_satEv(%[[THISVAL]])
-// CIR:             cir.store{{.*}} %[[CALL_RES]], %[[AGG_TMP]]
+// CIR:             cir.call @_ZN5APInt8uadd_satEv(%[[AGG_TMP]], %[[THISVAL]]) 
: (!cir.ptr<!rec_APInt> {llvm.align = 1 : i64, llvm.dead_on_unwind, llvm.sret = 
!rec_APInt, llvm.writable}, {{.*}}) -> ()
 // CIR:             %[[TRUE:.*]] = cir.const #true
 // CIR:             cir.store %[[TRUE]], %[[CLEANUP_COND_FALSE]]
 // CIR:           }
@@ -202,8 +191,7 @@ void APFixedPoint::add(int x) const {
 // LLVM: [[COND_TRUE]]:
 // LLVM:   store i8 1, ptr %[[CLEANUP_COND_TRUE]]
 // LLVM: [[COND_FALSE]]:
-// LLVM:   %[[CALL_RES:.*]] = call %struct.APInt @_ZN5APInt8uadd_satEv(ptr 
{{.*}} %[[THISVAL]])
-// LLVM:   store %struct.APInt %[[CALL_RES]], ptr %[[AGG_TMP]]
+// LLVM:   call void @_ZN5APInt8uadd_satEv(ptr {{.*}} sret(%struct.APInt) 
{{.*}} %[[AGG_TMP]], ptr {{.*}} %[[THISVAL]])
 // LLVM:   store i8 1, ptr %[[CLEANUP_COND_FALSE]]
 // LLVM:   %[[FF:.*]] = load i8, ptr %[[CLEANUP_COND_FALSE]]
 // LLVM:   %[[FF_B:.*]] = trunc i8 %[[FF]] to i1
@@ -294,8 +282,7 @@ void makeEntry() {
 // CIR:         %{{.*}} = cir.get_global @g_path
 // CIR:         %[[TRUE:.*]] = cir.const #true
 // CIR:         cir.store %[[TRUE]], %[[CLEANUP_COND]]
-// CIR:         %[[PATH_LOAD:.*]] = cir.load{{.*}} %[[AGG_TMP0]]
-// CIR:         cir.call @_ZN5EntryC1E4Path(%[[ENSURED_F]], %[[PATH_LOAD]])
+// CIR:         cir.call @_ZN5EntryC1E4Path(%[[ENSURED_F]], %[[AGG_TMP0]]) : 
({{.*}}, !cir.ptr<!rec_Path> {llvm.align = 1 : i64, llvm.byref = !rec_Path}) -> 
()
 // CIR:       }
 // CIR:       cir.yield
 // CIR:     } cleanup normal {
@@ -327,8 +314,7 @@ void makeEntry() {
 // LLVM:   br label %[[COND_END:.*]]
 // LLVM: [[FALSE_BB]]:
 // LLVM:   store i8 1, ptr %[[CLEANUP_COND]]
-// LLVM:   %[[PATH_LOAD:.*]] = load %struct.Path, ptr %[[AGG_TMP0]]
-// LLVM:   call void @_ZN5EntryC1E4Path(ptr {{.*}} %[[ENSURED_F]], 
%struct.Path %[[PATH_LOAD]])
+// LLVM:   call void @_ZN5EntryC1E4Path(ptr {{.*}} %[[ENSURED_F]], ptr 
byref(%struct.Path) align 1 %[[AGG_TMP0]])
 // LLVM:   br label %[[COND_END]]
 // LLVM: [[COND_END]]:
 // LLVM:   br label %[[AFTER_INNER:.*]]
diff --git a/clang/test/CIR/CodeGen/paren-list-agg-init.cpp 
b/clang/test/CIR/CodeGen/paren-list-agg-init.cpp
index 9a25b590a3a2e..72bcf2c2e7ac1 100644
--- a/clang/test/CIR/CodeGen/paren-list-agg-init.cpp
+++ b/clang/test/CIR/CodeGen/paren-list-agg-init.cpp
@@ -1,6 +1,4 @@
-// TODO(cir): drop -fno-clangir-call-conv-lowering once CallConvLowering
-// supports padded, packed, and over-aligned record shapes.
-// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir 
-fno-clangir-call-conv-lowering -emit-cir %s -o %t.cir
+// 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 
-fno-clangir-call-conv-lowering -emit-llvm %s -o %t-cir.ll
 // RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM,LLVMCIR
@@ -174,20 +172,18 @@ A foo1() {
 
 // LLVM: define dso_local {{.*}}@{{.*foo2.*}}
 // LLVM: call void @llvm.memcpy.p0.p0.i64(ptr align 8 {{.*}}, ptr align 8 
[[B1]], i64 24, i1 false)
-// CIR: cir.func {{.*}}@_Z4foo2v()
-// CIR: %[[B_ALLOCA:.*]] = cir.alloca "__retval" align(8) : 
!cir.ptr<![[STRUCT_B]]>
+// CIR: cir.func {{.*}}@_Z4foo2v(%[[B_RETVAL:.*]]: !cir.ptr<![[STRUCT_B]]> 
{llvm.align = 8 : i64, llvm.dead_on_unwind, llvm.noalias, llvm.sret = 
![[STRUCT_B]], llvm.writable}{{.*}})
 // CIR: %[[GET_GLOB:.*]] = cir.get_global @_ZL2b1 : !cir.ptr<![[STRUCT_B]]>
-// ...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/218931
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to