# HG changeset patch # User Shinji KONO # Date 1697099944 -32400 # Node ID c4af3c7f699ee872dc2682de824fbb903ac8663b # Parent 011663b4a8081cc475ff1585745a1be29aaafbe5 avoid struct copy in aarch64 / code gear diff -r 011663b4a808 -r c4af3c7f699e clang/lib/CodeGen/CGCall.cpp --- 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 }