-
Notifications
You must be signed in to change notification settings - Fork 12.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RISC-V] Clang crashes when building with optimization level 2 #82606
Comments
Attached preprocessed source and associated run script: |
@llvm/issue-subscribers-backend-risc-v Author: None (OMaghiarIMG)
Hello, ran into the following error on a RISC-V build when setting optimization level to -O2:
```
fatal error: error in backend: Invalid size request on a scalable vector.
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: /home/omaghiar/riscv-gnu-toolchain/build/bin/clang++ -o tests/common.o -static -O2 -Wall -Wcast-qual -I. -march=rv64gcv_zba -c -MMD -MF tests/common.o.d tests/common.cpp
1. <eof> parser at end of file
2. Optimizer
#0 0x000055a9ba5d5ebf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x1c7bebf)
#1 0x000055a9ba5d3f0c llvm::sys::CleanupOnSignal(unsigned long) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x1c79f0c)
#2 0x000055a9ba5223d7 llvm::CrashRecoveryContext::HandleExit(int) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x1bc83d7)
#3 0x000055a9ba5cb382 llvm::sys::Process::Exit(int, bool) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x1c71382)
#4 0x000055a9b9608b56 (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0xcaeb56)
#5 0x000055a9ba52980a llvm::report_fatal_error(llvm::Twine const&, bool) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x1bcf80a)
#6 0x000055a9ba52999e (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x1bcf99e)
#7 0x000055a9ba57761d (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x1c1d61d)
#8 0x000055a9ba577644 llvm::TypeSize::operator unsigned long() const (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x1c1d644)
#9 0x000055a9b99d03e4 llvm::isSafeToLoadUnconditionally(llvm::Value*, llvm::Align, llvm::APInt&, llvm::DataLayout const&, llvm::Instruction*, llvm::AssumptionCache*, llvm::DominatorTree const*, llvm::TargetLibraryInfo const*) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x10763e4)
#10 0x000055a9b99d1d0d llvm::isSafeToLoadUnconditionally(llvm::Value*, llvm::Type*, llvm::Align, llvm::DataLayout const&, llvm::Instruction*, llvm::AssumptionCache*, llvm::DominatorTree const*, llvm::TargetLibraryInfo const*) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x1077d0d)
#11 0x000055a9bbdcf380 (anonymous namespace)::VectorCombine::widenSubvectorLoad(llvm::Instruction&) VectorCombine.cpp:0:0
#12 0x000055a9bbddaa37 llvm::VectorCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x3480a37)
#13 0x000055a9bb847d26 llvm::detail::PassModel<llvm::Function, llvm::VectorCombinePass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x2eedd26)
#14 0x000055a9ba821ca4 llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x1ec7ca4)
#15 0x000055a9ba0f9e5e llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x179fe5e)
#16 0x000055a9ba81c0c6 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x1ec20c6)
#17 0x000055a9ba0f6900 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x179c900)
#18 0x000055a9ba82dfe8 (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(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>>&, clang::BackendConsumer*) BackendUtil.cpp:0:0
#19 0x000055a9ba83131b 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*) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x1ed731b)
#20 0x000055a9bae0cc2e clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x24b2c2e)
#21 0x000055a9bca36099 clang::ParseAST(clang::Sema&, bool, bool) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x40dc099)
#22 0x000055a9bae0c005 clang::CodeGenAction::ExecuteAction() (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x24b2005)
#23 0x000055a9bb09f3b1 clang::FrontendAction::Execute() (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x27453b1)
#24 0x000055a9bb01a2db clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x26c02db)
#25 0x000055a9bb17f50b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x282550b)
#26 0x000055a9b960a81d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0xcb081d)
#27 0x000055a9b960331d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#28 0x000055a9bae5506d void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#29 0x000055a9ba5222c7 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x1bc82c7)
#30 0x000055a9bae5550c clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#31 0x000055a9bae1bc5e clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x24c1c5e)
#32 0x000055a9bae1c62d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x24c262d)
#33 0x000055a9bae26bdc clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0x24ccbdc)
#34 0x000055a9b9607c11 clang_main(int, char**, llvm::ToolContext const&) (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0xcadc11)
#35 0x000055a9b9555f1b main (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0xbfbf1b)
#36 0x00007f9ab2956083 __libc_start_main /build/glibc-wuryBv/glibc-2.31/csu/../csu/libc-start.c:342:3
#37 0x000055a9b9602ade _start (/home/omaghiar/riscv-gnu-toolchain/build/bin/clang+++0xca8ade)
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 18.1.0rc (https://github.com/llvm/llvm-project.git 6c90f8d)
Target: riscv64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/omaghiar/riscv-gnu-toolchain/build/bin
clang++: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: make: *** [Makefile:61: tests/common.o] Error 1
git clone https://github.com/howjmay/neon2rvv.git set -O2 in Makefile#L20export CROSS_COMPILE=/path/to/toolchain/riscv64-unknown-linux-gnu-
|
…ed type This fixes llvm#82606 by updating isSafeToLoadUnconditionally to handle fixed sized loads from a scalable accessed type.
/cherry-pick b0edc1c |
…ed type (llvm#82650) This fixes llvm#82606 by updating isSafeToLoadUnconditionally to handle fixed sized loads from a scalable accessed type. (cherry picked from commit b0edc1c)
/pull-request #82664 |
…ed type (llvm#82650) This fixes llvm#82606 by updating isSafeToLoadUnconditionally to handle fixed sized loads from a scalable accessed type. (cherry picked from commit b0edc1c)
Hello, ran into the following error on a RISC-V build when setting optimization level to -O2:
Tested on main(bc1c86b) and release/18.x(6c90f8d) branches.
Attached preprocessed file:
common.txt
clang++ -x c++-cpp-output -O2 -march=rv64gcv -c common.txt
Full context:
Building the neon2rvv project(https://github.com/howjmay/neon2rvv) with riscv-gnu-toolchain. Clang version newer than 17 required for latest RVV intrinsics API changes. Clang works when building with -O0/O1 but fails with -O2.
The text was updated successfully, but these errors were encountered: