================ @@ -743,6 +743,20 @@ bool Sema::checkMustTailAttr(const Stmt *St, const Attr &MTA) { CallerType.Func = CallerDecl->getType()->getAs<FunctionProtoType>(); } + if (Context.getTargetInfo().getTriple().isPPC()) { + if (Context.getTargetInfo().getTriple().isOSAIX()) + return Diag(St->getBeginLoc(), diag::err_aix_musttail_unsupported); + else if (!Context.getTargetInfo().hasFeature("pcrelative-memops")) { + if (Context.getTargetInfo().hasFeature("longcall")) + return Diag(St->getBeginLoc(), diag::err_ppc_impossible_musttail) << 0; + else if (!CE->getDirectCallee()) + return Diag(St->getBeginLoc(), diag::err_ppc_impossible_musttail) << 1; + else if (isa_and_nonnull<FunctionDecl>(CE->getCalleeDecl()) && ---------------- chenzheng1030 wrote:
Thanks for comments. @efriedma-quic I tried below two cases, ``` $ cat 1.c int func2(int i); int external_call2(int i) { [[clang::musttail]] return func2(i); } int func2(int i) { return 0; } $ cat 2.c __attribute__((weak)) int func2(int i) { return 0; } int external_call2(int i) { [[clang::musttail]] return func2(i); } ``` - `1.c` is good to compile without this patch, but now it is mistakenly reported as invalid to do tail call because the callee is treated as undefined... - `2.c` can not be detected by this patch. Will try to fix this. If you have any idea to fix these two issues in your mind, please let me know! https://github.com/llvm/llvm-project/pull/93267 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits