Issue 97849
Summary [RISC-V] Crash in SoftPromoteHalfOperand with "V" and "Zvfhmin" extensions
Labels new issue
Assignees
Reporter mshabunin
    Reproduced with LLVM @ _main_ (~ July 5, 2024)

Arch flags: `-march=rv64gc_v_zvfhmin`

[test_arithm-1e8bff.cpp.txt](https://github.com/user-attachments/files/16112505/test_arithm-1e8bff.cpp.txt)
[test_arithm-1e8bff.sh.txt](https://github.com/user-attachments/files/16112508/test_arithm-1e8bff.sh.txt)

```
FAILED: modules/core/CMakeFiles/opencv_test_core.dir/test/test_arithm.cpp.o 
ccache /work/chains/llvm-main/bin/clang++ --target=riscv64-unknown-linux-gnu --sysroot=/work/chains/riscv-gcc-14.1.0/sysroot -DOPENCV_ALLOCATOR_STATS_COUNTER_TYPE=int -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__OPENCV_TESTS=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/work/opencv/3rdparty/clapack/include -I/work/opencv/modules/ts/include -I/work/opencv/modules/core/include -I/work/opencv/modules/imgcodecs/include -I/work/opencv/modules/videoio/include -I/work/opencv/modules/imgproc/include -I/work/opencv/modules/highgui/include -I/work/build-opencv-rvv10/modules/core/test -isystem /work/build-opencv-rvv10 -march=rv64gc --gcc-toolchain=/work/chains/riscv-gcc-14.1.0 -w    -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -DCV_RVV_SCALABLE -static -static-libgcc -static-libstdc++ -march=rv64gc_v_zvfhmin -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG -fPIE -std=c++11 -MD -MT modules/core/CMakeFiles/opencv_test_core.dir/test/test_arithm.cpp.o -MF modules/core/CMakeFiles/opencv_test_core.dir/test/test_arithm.cpp.o.d -o modules/core/CMakeFiles/opencv_test_core.dir/test/test_arithm.cpp.o -c /work/opencv/modules/core/test/test_arithm.cpp
SoftPromoteHalfOperand Op #0: t114: v8f16 = BUILD_VECTOR t46, t47, t48, t49, t50, t51, t52, t53

fatal error: error in backend: Do not know how to soft promote this operator's operand!
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: /work/chains/llvm-main/bin/clang++ --target=riscv64-unknown-linux-gnu --sysroot=/work/chains/riscv-gcc-14.1.0/sysroot -march=rv64gc --gcc-toolchain=/work/chains/riscv-gcc-14.1.0 -w -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -static -static-libgcc -static-libstdc++ -march=rv64gc_v_zvfhmin -fvisibility=hidden -fvisibility-inlines-hidden -O3 -fPIE -std=c++11 -DOPENCV_ALLOCATOR_STATS_COUNTER_TYPE=int -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__OPENCV_TESTS=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/work/opencv/3rdparty/clapack/include -I/work/opencv/modules/ts/include -I/work/opencv/modules/core/include -I/work/opencv/modules/imgcodecs/include -I/work/opencv/modules/videoio/include -I/work/opencv/modules/imgproc/include -I/work/opencv/modules/highgui/include -I/work/build-opencv-rvv10/modules/core/test -isystem /work/build-opencv-rvv10 -DCV_RVV_SCALABLE -DNDEBUG -DNDEBUG -c -MD -MT modules/core/CMakeFiles/opencv_test_core.dir/test/test_arithm.cpp.o -MF modules/core/CMakeFiles/opencv_test_core.dir/test/test_arithm.cpp.o.d -fcolor-diagnostics -o modules/core/CMakeFiles/opencv_test_core.dir/test/test_arithm.cpp.o /work/opencv/modules/core/test/test_arithm.cpp
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '/work/opencv/modules/core/test/test_arithm.cpp'.
4.	Running pass 'RISC-V DAG->DAG Pattern Instruction Selection' on function '@_ZN11opencv_test12_GLOBAL__N_110InRangeSOp5refopERKSt6vectorIN2cv3MatESaIS4_EERS4_RKS4_'
 #0 0x000064d73e39cb0d llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /work/chains/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:11
 #1 0x000064d73e39cffb PrintStackTraceSignalHandler(void*) /work/chains/llvm-project/llvm/lib/Support/Unix/Signals.inc:798:1
 #2 0x000064d73e39b026 llvm::sys::RunSignalHandlers() /work/chains/llvm-project/llvm/lib/Support/Signals.cpp:105:5
 #3 0x000064d73e39c37e llvm::sys::CleanupOnSignal(unsigned long) /work/chains/llvm-project/llvm/lib/Support/Unix/Signals.inc:368:1
 #4 0x000064d73e2c0c34 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /work/chains/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:0:7
 #5 0x000064d73e2c0b58 llvm::CrashRecoveryContext::HandleExit(int) /work/chains/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:446:3
 #6 0x000064d73e396503 llvm::sys::Process::Exit(int, bool) /work/chains/llvm-project/llvm/lib/Support/Process.cpp:115:7
 #7 0x000064d73a497de6 (/work/chains/llvm-main/bin/clang+++0x1fa7de6)
 #8 0x000064d73e2cda89 llvm::report_fatal_error(llvm::Twine const&, bool) /work/chains/llvm-project/llvm/lib/Support/ErrorHandling.cpp:104:5
 #9 0x000064d73e2cd9d2 /work/chains/llvm-project/llvm/lib/Support/ErrorHandling.cpp:83:3
#10 0x000064d7400dac9d llvm::DAGTypeLegalizer::SoftPromoteHalfOperand(llvm::SDNode*, unsigned int) /work/chains/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:0:5
#11 0x000064d7400202b1 llvm::DAGTypeLegalizer::run() /work/chains/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:356:26
#12 0x000064d7400249ab llvm::SelectionDAG::LegalizeTypes() /work/chains/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:1057:34
#13 0x000064d73ff6fe6e llvm::SelectionDAGISel::CodeGenAndEmitDAG() /work/chains/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:953:13
#14 0x000064d73ff6f7e3 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true, llvm::BasicBlock>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true, llvm::BasicBlock>, false, true>, bool&) /work/chains/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:851:1
#15 0x000064d73ff6f215 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /work/chains/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1864:11
#16 0x000064d73ff6c694 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /work/chains/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:631:3
#17 0x000064d73c144325 llvm::RISCVDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /work/chains/llvm-project/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h:36:5
#18 0x000064d73ff6b6a0 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /work/chains/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:374:3
#19 0x000064d73d260f79 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /work/chains/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:94:8
#20 0x000064d73da7e96a llvm::FPPassManager::runOnFunction(llvm::Function&) /work/chains/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1440:23
#21 0x000064d73da837e2 llvm::FPPassManager::runOnModule(llvm::Module&) /work/chains/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1486:16
#22 0x000064d73da7f26b (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /work/chains/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1555:23
#23 0x000064d73da7edd4 llvm::legacy::PassManagerImpl::run(llvm::Module&) /work/chains/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:541:16
#24 0x000064d73da83ac1 llvm::legacy::PassManager::run(llvm::Module&) /work/chains/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1682:3
#25 0x000064d73e7ad4b6 (anonymous namespace)::EmitAssemblyHelper::RunCodegenPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&) /work/chains/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1158:3
#26 0x000064d73e7a711d (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) /work/chains/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1182:7
#27 0x000064d73e7a65af 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*) /work/chains/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1341:3
#28 0x000064d73f23a49b clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /work/chains/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:354:3
#29 0x000064d7428ce219 clang::ParseAST(clang::Sema&, bool, bool) /work/chains/llvm-project/clang/lib/Parse/ParseAST.cpp:183:12
#30 0x000064d73f535ac7 clang::ASTFrontendAction::ExecuteAction() /work/chains/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1194:1
#31 0x000064d73f23e426 clang::CodeGenAction::ExecuteAction() /work/chains/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1145:5
...
#49 0x000064d73a4bfd35 main /work/chains/llvm-project/build/tools/clang/tools/driver/clang-driver.cpp:17:3
#50 0x000077e540829d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#51 0x000077e540829e40 call_init ./csu/../csu/libc-start.c:128:20
#52 0x000077e540829e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#53 0x000064d73a4879b5 _start (/work/chains/llvm-main/bin/clang+++0x1f979b5)
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 00c622e596f918d9d83674b58097c8982ae1af95)
Target: riscv64-unknown-linux-gnu
Thread model: posix
InstalledDir: /work/chains/llvm-main/bin
Build config: +unoptimized, +assertions
clang++: note: diagnostic msg: 
********************
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to