llvm-project/clang/test/CodeGen/PowerPC/musttail-forward-declaration.c
Chen Zheng afd0e6d06b
[PowerPC] Diagnose musttail instead of crash inside backend (#93267)
musttail is not often possible to be generated on PPC targets as when
calling to a function defined in another module, PPC needs to restore
the TOC pointer. To restore the TOC pointer, compiler needs to emit a
nop after the call to let linker generate codes to restore TOC pointer.
Tail call cannot generate expected call sequence for this case.

To avoid the crash inside the compiler backend, a diagnosis is added in
the frontend.

Fixes #63214
2024-07-08 09:30:01 +08:00

12 lines
338 B
C

// RUN: %clang_cc1 %s -triple powerpc64le-unknown-linux-gnu -o /dev/null -emit-llvm -verify=good
// RUN: %clang_cc1 %s -triple powerpc64-unknown-linux-gnu -o /dev/null -emit-llvm -verify=good
int func2(int i);
int external_call2(int i) {
// good-no-diagnostics
[[clang::musttail]] return func2(i);
}
int func2(int i) {
return 0;
}