Closed sharkcz closed 1 month ago
@llvm/issue-subscribers-backend-powerpc
Author: Dan Horák (sharkcz)
Reduced Test Case:
target datalayout = "e-m:e-Fn32-i64:64-n32:64-S128-v256:256:256-v512:512:512"
target triple = "ppc64le-redhat-linux-gnu"
define void @_ZN8portableL16set_base_pointerEPNS_6ParamsEP21SkRasterPipelineStageffff(ptr %0, ptr %1, float %2, float %3, float %4, float %5) {
musttail call void null(ptr null, ptr null, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00)
ret void
}
The error message should be fixed by https://github.com/llvm/llvm-project/pull/93267 (which was merged into LLVM 19). https://github.com/llvm/llvm-project/issues/98859 tracks actually adding complete musttail support.
I tired this with the most recent Top of Trunk on main
branch and I have this error instead:
/builddir/build/BUILD/webkitgtk-2.45.92-build/webkitgtk-2.45.92/Source/ThirdParty/skia/src/opts/SkRasterPipeline_opts.h:3852:471: error: 'musttail' attribute for this call is impossible because indirect calls can not be tail called on PPC
3852 | __attribute__((always_inline)) static inline void set_base_pointer_k(std::byte* p, size_t dx, size_t dy, std::byte*& base, F& r, F& g, F& b, F& a, F& dr, F& dg, F& db, F& da); static void set_base_pointer(Params* params, SkRasterPipelineStage* program, F r, F g, F b, F a) { set_base_pointer_k(Ctx{program}, params->dx,params->dy,params->base, r,g,b,a, params->dr, params->dg, params->db, params->da); ++program; auto fn = (Stage)program->fn; [[clang::musttail]] return fn(params, program, r,g,b,a); } __attribute__((always_inline)) static inline void set_base_pointer_k(std::byte* p, size_t dx, size_t dy, std::byte*& base, F& r, F& g, F& b, F& a, F& dr, F& dg, F& db, F& da) {
As mentioned above this is currently a limitation on PowerPC.
@efriedma-quic So the correct fix then is to fix the application to not add the MustTail attribute on PowerPC ?
Also is it possible to have __has_cpp_attribute(clang::musttail)
return false only on PowerPC ?
Also is it possible to have __has_cpp_attribute(clang::musttail) return false only on PowerPC ?
This would certainly make it easier to write portable software.
Also is it possible to have __has_cpp_attribute(clang::musttail) return false only on PowerPC ?
This would certainly make it easier to write portable software.
To be clear, PPC does support tail call, but it can not do tail call for some kind of calls like indirect calls.
Compiling WebKitGtk, resp. the bundled Skia library, on Fedora Rawhide on ppc64le fails with a backend error.
SkOpts-e2b158.cpp.gz SkOpts-e2b158.sh.gz