llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.8k stars 11.45k forks source link

clang-19 git fail to build ffmpeg ff_dct_unquantize_h263_neon #98152

Closed wang-bin closed 1 month ago

wang-bin commented 1 month ago
fatal error: error in backend: Do not know how to split the result of this operator!

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.  Program arguments: clang-19 -I. -Isrc/ --sysroot=/home/user/dev/sysroot -D_ISOC11_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -DZLIB_CONST -DHAVE_AV_CONFIG_H -DBUILDING_avcodec -Wa,--noexecstack -fdata-sections -ffunction-sections -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIE -I/home/user/dev/avbuild/tools/Vulkan-Headers/include -I=/usr/include/libdrm -Wa,--noexecstack -fdata-sections -ffunction-sections -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIE --target=arm-linux-gnueabihf -mfloat-abi=hard -std=c17 -fomit-frame-pointer -fPIC -marm -pthread -I/usr/include/libdrm -I/usr/include/alsa -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -Wno-unused-const-variable -Wno-bool-operation -Wno-char-subscripts -Oz -fno-math-errno -fno-signed-zeros -mstack-alignment=16 -Qunused-arguments -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -MMD -MF libavcodec/neon/mpegvideo.d -MT libavcodec/neon/mpegvideo.o -c -o libavcodec/neon/mpegvideo.o src/libavcodec/neon/mpegvideo.c
1.  <eof> parser at end of file
2.  Code generation
3.  Running pass 'Function Pass Manager' on module 'src/libavcodec/neon/mpegvideo.c'.
4.  Running pass 'ARM Instruction Selection' on function '@ff_dct_unquantize_h263_neon'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
CC  libavcodec/qsv_api.o
0  libLLVM.so.19.0      0x00007cbd696b298f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 63
1  libLLVM.so.19.0      0x00007cbd696b0699 llvm::sys::RunSignalHandlers() + 89
2  libLLVM.so.19.0      0x00007cbd695f9b83
3  libLLVM.so.19.0      0x00007cbd695f9b32
4  libLLVM.so.19.0      0x00007cbd696acc00 llvm::sys::Process::Exit(int, bool) + 48
5  clang-19             0x00005cf0bb2448bb
6  libLLVM.so.19.0      0x00007cbd69608f54 llvm::report_fatal_error(llvm::Twine const&, bool) + 276
7  libLLVM.so.19.0      0x00007cbd69608e3d
8  libLLVM.so.19.0      0x00007cbd69e89d25
9  libLLVM.so.19.0      0x00007cbd69e6aedf
10 libLLVM.so.19.0      0x00007cbd69e6e853 llvm::SelectionDAG::LegalizeTypes() + 1315
11 libLLVM.so.19.0      0x00007cbd69f73ec4 llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 308
12 libLLVM.so.19.0      0x00007cbd69f73043 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 3283
CC  libavcodec/qtrle.o
13 libLLVM.so.19.0      0x00007cbd69f7181c llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 412
14 libLLVM.so.19.0      0x00007cbd6bc3b268
15 libLLVM.so.19.0      0x00007cbd69f70252 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) + 178
16 libLLVM.so.19.0      0x00007cbd69aab0b9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 617
17 libLLVM.so.19.0      0x00007cbd6980a972 llvm::FPPassManager::runOnFunction(llvm::Function&) + 786
18 libLLVM.so.19.0      0x00007cbd698104d4 llvm::FPPassManager::runOnModule(llvm::Module&) + 68
19 libLLVM.so.19.0      0x00007cbd6980b11f llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1199
20 libclang-cpp.so.19.0 0x00007cbd72260ae8 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) + 7384
21 libclang-cpp.so.19.0 0x00007cbd725f5217 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 1607
22 libclang-cpp.so.19.0 0x00007cbd710383d9 clang::ParseAST(clang::Sema&, bool, bool) + 649
CC  libavcodec/rangecoder.o
23 libclang-cpp.so.19.0 0x00007cbd731032ec clang::FrontendAction::Execute() + 92
24 libclang-cpp.so.19.0 0x00007cbd73076cf4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 996
25 libclang-cpp.so.19.0 0x00007cbd73181fbc clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 700
26 clang-19             0x00005cf0bb244461 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 5265
27 clang-19             0x00005cf0bb241594
28 libclang-cpp.so.19.0 0x00007cbd72d06ce2
29 libLLVM.so.19.0      0x00007cbd695f9b07 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 151
30 libclang-cpp.so.19.0 0x00007cbd72d06576 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const + 406
31 libclang-cpp.so.19.0 0x00007cbd72ccbd29 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 921
32 libclang-cpp.so.19.0 0x00007cbd72ccbf9f clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const + 159
33 libclang-cpp.so.19.0 0x00007cbd72ce9120 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) + 352
34 clang-19             0x00005cf0bb240fbb clang_main(int, char**, llvm::ToolContext const&) + 6699
35 clang-19             0x00005cf0bb24ea63 main + 131
36 libc.so.6            0x00007cbd6802a1ca
37 libc.so.6            0x00007cbd6802a28b __libc_start_main + 139
38 clang-19             0x00005cf0bb23f195 _start + 37
clang-19: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Ubuntu clang version 19.0.0 (++20240709081756+ad82d1c53f08-1~exp1~20240709081915.272)
Target: arm-unknown-linux-gnueabihf
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
CC  libavcodec/ratecontrol.o
CC  libavcodec/raw.o
CC  libavcodec/rawdec.o
CC  libavcodec/rawenc.o
CC  libavcodec/refstruct.o
CC  libavcodec/rl.o
CC  libavcodec/rv10.o
CC  libavcodec/rv30.o
clang-19: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-19: note: diagnostic msg: /tmp/mpegvideo-eb8b0c.c
clang-19: note: diagnostic msg: /tmp/mpegvideo-eb8b0c.sh
clang-19: note: diagnostic msg: 

********************
CC  libavcodec/rv30dsp.o
CC  libavcodec/rv34.o
make: *** [/home/user/dev/avbuild/FFmpeg/ffbuild/common.mak:81: libavcodec/neon/mpegvideo.o] Error 1
make: *** Waiting for unfinished jobs....

mpegvideo-eb8b0c.zip

llvmbot commented 1 month ago

@llvm/issue-subscribers-backend-arm

Author: WangBin (wang-bin)

``` fatal error: error in backend: Do not know how to split the result of this operator! PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump: 0. Program arguments: clang-19 -I. -Isrc/ --sysroot=/home/user/dev/sysroot -D_ISOC11_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -DZLIB_CONST -DHAVE_AV_CONFIG_H -DBUILDING_avcodec -Wa,--noexecstack -fdata-sections -ffunction-sections -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIE -I/home/user/dev/avbuild/tools/Vulkan-Headers/include -I=/usr/include/libdrm -Wa,--noexecstack -fdata-sections -ffunction-sections -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIE --target=arm-linux-gnueabihf -mfloat-abi=hard -std=c17 -fomit-frame-pointer -fPIC -marm -pthread -I/usr/include/libdrm -I/usr/include/alsa -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -Wno-unused-const-variable -Wno-bool-operation -Wno-char-subscripts -Oz -fno-math-errno -fno-signed-zeros -mstack-alignment=16 -Qunused-arguments -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -MMD -MF libavcodec/neon/mpegvideo.d -MT libavcodec/neon/mpegvideo.o -c -o libavcodec/neon/mpegvideo.o src/libavcodec/neon/mpegvideo.c 1. <eof> parser at end of file 2. Code generation 3. Running pass 'Function Pass Manager' on module 'src/libavcodec/neon/mpegvideo.c'. 4. Running pass 'ARM Instruction Selection' on function '@ff_dct_unquantize_h263_neon' Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): CC libavcodec/qsv_api.o 0 libLLVM.so.19.0 0x00007cbd696b298f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 63 1 libLLVM.so.19.0 0x00007cbd696b0699 llvm::sys::RunSignalHandlers() + 89 2 libLLVM.so.19.0 0x00007cbd695f9b83 3 libLLVM.so.19.0 0x00007cbd695f9b32 4 libLLVM.so.19.0 0x00007cbd696acc00 llvm::sys::Process::Exit(int, bool) + 48 5 clang-19 0x00005cf0bb2448bb 6 libLLVM.so.19.0 0x00007cbd69608f54 llvm::report_fatal_error(llvm::Twine const&, bool) + 276 7 libLLVM.so.19.0 0x00007cbd69608e3d 8 libLLVM.so.19.0 0x00007cbd69e89d25 9 libLLVM.so.19.0 0x00007cbd69e6aedf 10 libLLVM.so.19.0 0x00007cbd69e6e853 llvm::SelectionDAG::LegalizeTypes() + 1315 11 libLLVM.so.19.0 0x00007cbd69f73ec4 llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 308 12 libLLVM.so.19.0 0x00007cbd69f73043 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 3283 CC libavcodec/qtrle.o 13 libLLVM.so.19.0 0x00007cbd69f7181c llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 412 14 libLLVM.so.19.0 0x00007cbd6bc3b268 15 libLLVM.so.19.0 0x00007cbd69f70252 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) + 178 16 libLLVM.so.19.0 0x00007cbd69aab0b9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 617 17 libLLVM.so.19.0 0x00007cbd6980a972 llvm::FPPassManager::runOnFunction(llvm::Function&) + 786 18 libLLVM.so.19.0 0x00007cbd698104d4 llvm::FPPassManager::runOnModule(llvm::Module&) + 68 19 libLLVM.so.19.0 0x00007cbd6980b11f llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1199 20 libclang-cpp.so.19.0 0x00007cbd72260ae8 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) + 7384 21 libclang-cpp.so.19.0 0x00007cbd725f5217 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 1607 22 libclang-cpp.so.19.0 0x00007cbd710383d9 clang::ParseAST(clang::Sema&, bool, bool) + 649 CC libavcodec/rangecoder.o 23 libclang-cpp.so.19.0 0x00007cbd731032ec clang::FrontendAction::Execute() + 92 24 libclang-cpp.so.19.0 0x00007cbd73076cf4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 996 25 libclang-cpp.so.19.0 0x00007cbd73181fbc clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 700 26 clang-19 0x00005cf0bb244461 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 5265 27 clang-19 0x00005cf0bb241594 28 libclang-cpp.so.19.0 0x00007cbd72d06ce2 29 libLLVM.so.19.0 0x00007cbd695f9b07 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 151 30 libclang-cpp.so.19.0 0x00007cbd72d06576 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const + 406 31 libclang-cpp.so.19.0 0x00007cbd72ccbd29 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 921 32 libclang-cpp.so.19.0 0x00007cbd72ccbf9f clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const + 159 33 libclang-cpp.so.19.0 0x00007cbd72ce9120 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) + 352 34 clang-19 0x00005cf0bb240fbb clang_main(int, char**, llvm::ToolContext const&) + 6699 35 clang-19 0x00005cf0bb24ea63 main + 131 36 libc.so.6 0x00007cbd6802a1ca 37 libc.so.6 0x00007cbd6802a28b __libc_start_main + 139 38 clang-19 0x00005cf0bb23f195 _start + 37 clang-19: error: clang frontend command failed with exit code 70 (use -v to see invocation) Ubuntu clang version 19.0.0 (++20240709081756+ad82d1c53f08-1~exp1~20240709081915.272) Target: arm-unknown-linux-gnueabihf Thread model: posix InstalledDir: /usr/lib/llvm-19/bin CC libavcodec/ratecontrol.o CC libavcodec/raw.o CC libavcodec/rawdec.o CC libavcodec/rawenc.o CC libavcodec/refstruct.o CC libavcodec/rl.o CC libavcodec/rv10.o CC libavcodec/rv30.o clang-19: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang-19: note: diagnostic msg: /tmp/mpegvideo-eb8b0c.c clang-19: note: diagnostic msg: /tmp/mpegvideo-eb8b0c.sh clang-19: note: diagnostic msg: ******************** CC libavcodec/rv30dsp.o CC libavcodec/rv34.o make: *** [/home/user/dev/avbuild/FFmpeg/ffbuild/common.mak:81: libavcodec/neon/mpegvideo.o] Error 1 make: *** Waiting for unfinished jobs.... ``` [mpegvideo-eb8b0c.zip](https://github.com/user-attachments/files/16143489/mpegvideo-eb8b0c.zip)
davemgreen commented 1 month ago

It looks like the run line doesn't including Neon. I think this might be due to #95224, where the check in https://github.com/FFmpeg/FFmpeg/blob/9fb8d13d56f20728141fd7070d8a325720727d57/configure#L6446 might no longer be being triggered correctly. It uses a dup, which will be handled as a splat-shuffle which the backend can handle in either case.

@Lukacma FYI, I'm not sure if replacing the frontend error with a backend crash is a better situation to be in https://godbolt.org/z/Y4Eebeqz7. I can see that it would be useful if there are FMV/target attributes where the base doesn't have Neon (as under some configurations of SME), but the base situation under Arm seems worse. It is probably less bad for AArch64 considering that Neon and FP are so closely tied together, and there is still an error for fp (https://godbolt.org/z/3zWdcsMKK / https://godbolt.org/z/3zWdcsMKK)

Lukacma commented 1 month ago

Sorry about this @davemgreen! I have submitted 2nd patch in the series (#98624), which should improve reported errors.

davemgreen commented 1 month ago

Thanks!

wang-bin commented 1 month ago

thanks, the bug is fixed in llvm from ppa