changeset 260:c4af3c7f699e cbc-llvm18

avoid struct copy in aarch64 / code gear
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 12 Oct 2023 17:39:04 +0900
parents 011663b4a808
children f38b53b43017
files clang/lib/CodeGen/CGCall.cpp
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/clang/lib/CodeGen/CGCall.cpp	Thu Oct 12 15:52:37 2023 +0900
+++ b/clang/lib/CodeGen/CGCall.cpp	Thu Oct 12 17:39:04 2023 +0900
@@ -5163,6 +5163,11 @@
           }
         }
 
+#ifndef noCbC
+        if (this->FnRetTy.getTypePtr()->is__CodeType() && CallInfo.getReturnType().getTypePtr()->is__CodeType()) {
+            NeedCopy = false;
+        }
+#endif
         if (NeedCopy) {
           // Create an aligned temporary, and copy to it.
           Address AI = CreateMemTempWithoutCast(
@@ -5615,10 +5620,11 @@
     else if (IsMustTail)
       Call->setTailCallKind(llvm::CallInst::TCK_MustTail);
 #ifndef noCbC
-    if (! CallInfo.isVariadic() && ! IsMustTail) {
-      if (this->FnRetTy.getTypePtr()->is__CodeType() && CallInfo.getReturnType().getTypePtr()->is__CodeType())
-          Call->setTailCallKind(llvm::CallInst::TCK_Tail);
-    }
+  if (this->FnRetTy.getTypePtr()->is__CodeType() && CallInfo.getReturnType().getTypePtr()->is__CodeType()) {
+     Call->setTailCallKind(llvm::CallInst::TCK_Tail);
+     IsMustTail = true;
+     CI->setDoesNotReturn();
+  }
 #endif
   }