[clang] [llvm] [PowerPC] Diagnose musttail instead of crash inside backend (PR #93267)
Chen Zheng via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 28 04:31:56 PDT 2024
================
@@ -5751,8 +5751,29 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
if (llvm::CallInst *Call = dyn_cast<llvm::CallInst>(CI)) {
if (TargetDecl && TargetDecl->hasAttr<NotTailCalledAttr>())
Call->setTailCallKind(llvm::CallInst::TCK_NoTail);
- else if (IsMustTail)
+ else if (IsMustTail) {
+ if (getTarget().getTriple().isPPC()) {
+ if (getTarget().getTriple().isOSAIX())
+ CGM.getDiags().Report(Loc, diag::err_aix_musttail_unsupported);
+ else if (!getTarget().hasFeature("pcrelative-memops")) {
+ if (getTarget().hasFeature("longcall"))
+ CGM.getDiags().Report(Loc, diag::err_ppc_impossible_musttail) << 0;
+ else if (Call->isIndirectCall())
+ CGM.getDiags().Report(Loc, diag::err_ppc_impossible_musttail) << 1;
+ else if (isa_and_nonnull<FunctionDecl>(TargetDecl) &&
+ cast<FunctionDecl>(TargetDecl)->isWeak())
----------------
chenzheng1030 wrote:
Thanks very much. I've added the check, hope these are the APIs you expected.
https://github.com/llvm/llvm-project/pull/93267
More information about the cfe-commits
mailing list