Skip to content

Assertion `LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported UDIV!" regression on mips with 16 branch #60531

@andrewrk

Description

@andrewrk

LLVM version release/16.x branch commit 3f9b92d

reduced.ll

target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"
target triple = "mips-unknown-linux-unknown"

define internal fastcc i16 @"compiler_rt.udivmodei4.test.__udivei4/__umodei4"(i1200 %0) {
Entry:
  %1 = udiv i1200 1, %0
  store i1200 %1, ptr null, align 8
  ret i16 0
}
[nix-shell:~/misc/zig/build]$ ~/local/llvm15-assert/bin/clang -c reduced.ll -target mips-unknown-linux-unknown

[nix-shell:~/misc/zig/build]$ ~/local/llvm16-assert/bin/clang -c reduced.ll -target mips-unknown-linux-unknown
clang: /home/andy/Downloads/llvm-project-16/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:4643: void llvm::DAGTypeLegalizer::ExpandIntRes_UDIV(llvm::SDNode*, llvm::SDValue&, llvm::SDValue&): Assertion `LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported UDIV!"' failed.
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/andy/local/llvm16-assert/bin/clang -c reduced.ll -target mips-unknown-linux-unknown
1.	Code generation
2.	Running pass 'Function Pass Manager' on module 'reduced.ll'.
3.	Running pass 'MIPS DAG->DAG Pattern Instruction Selection' on function '@"compiler_rt.udivmodei4.test.__udivei4/__umodei4"'
 #0 0x00000000035bc671 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/andy/local/llvm16-assert/bin/clang+0x35bc671)
 #1 0x00000000035ba5ac llvm::sys::CleanupOnSignal(unsigned long) (/home/andy/local/llvm16-assert/bin/clang+0x35ba5ac)
 #2 0x00000000035102e8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007fa8bcd5ebf0 __restore_rt (/nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163/lib/libc.so.6+0x3dbf0)
 #4 0x00007fa8bcdabbc7 __pthread_kill_implementation (/nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163/lib/libc.so.6+0x8abc7)
 #5 0x00007fa8bcd5eb46 gsignal (/nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163/lib/libc.so.6+0x3db46)
 #6 0x00007fa8bcd494b5 abort (/nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163/lib/libc.so.6+0x284b5)
 #7 0x00007fa8bcd493d9 _nl_load_domain.cold.0 (/nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163/lib/libc.so.6+0x283d9)
 #8 0x00007fa8bcd577b6 (/nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163/lib/libc.so.6+0x367b6)
 #9 0x000000000485167a llvm::DAGTypeLegalizer::ExpandIntRes_UDIV(llvm::SDNode*, llvm::SDValue&, llvm::SDValue&) (/home/andy/local/llvm16-assert/bin/clang+0x485167a)
#10 0x00000000048706c2 llvm::DAGTypeLegalizer::ExpandIntegerResult(llvm::SDNode*, unsigned int) (/home/andy/local/llvm16-assert/bin/clang+0x48706c2)
#11 0x000000000479bbf6 llvm::DAGTypeLegalizer::run() (/home/andy/local/llvm16-assert/bin/clang+0x479bbf6)
#12 0x000000000479cd9c llvm::SelectionDAG::LegalizeTypes() (/home/andy/local/llvm16-assert/bin/clang+0x479cd9c)
#13 0x0000000004721421 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/home/andy/local/llvm16-assert/bin/clang+0x4721421)
#14 0x0000000004725554 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/andy/local/llvm16-assert/bin/clang+0x4725554)
#15 0x00000000047273fe llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#16 0x00000000019524eb llvm::MipsDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/home/andy/local/llvm16-assert/bin/clang+0x19524eb)
#17 0x00000000028688d5 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#18 0x0000000002dfb2bb llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/andy/local/llvm16-assert/bin/clang+0x2dfb2bb)
#19 0x0000000002dfb4d1 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/andy/local/llvm16-assert/bin/clang+0x2dfb4d1)
#20 0x0000000002dfbd63 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/andy/local/llvm16-assert/bin/clang+0x2dfbd63)
#21 0x0000000003992361 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/home/andy/local/llvm16-assert/bin/clang+0x3992361)
#22 0x0000000004886efe clang::CodeGenAction::ExecuteAction() (/home/andy/local/llvm16-assert/bin/clang+0x4886efe)
#23 0x00000000041260f9 clang::FrontendAction::Execute() (/home/andy/local/llvm16-assert/bin/clang+0x41260f9)
#24 0x00000000040ad206 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/andy/local/llvm16-assert/bin/clang+0x40ad206)
#25 0x00000000041ee0e8 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/andy/local/llvm16-assert/bin/clang+0x41ee0e8)
#26 0x0000000000ad52ad cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/andy/local/llvm16-assert/bin/clang+0xad52ad)
#27 0x0000000000ad13fe ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#28 0x0000000003f15145 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 0x0000000003510724 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/andy/local/llvm16-assert/bin/clang+0x3510724)
#30 0x0000000003f155ee 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 0x0000000003edebec clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/andy/local/llvm16-assert/bin/clang+0x3edebec)
#32 0x0000000003edf74d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/andy/local/llvm16-assert/bin/clang+0x3edf74d)
#33 0x0000000003eedccc clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/andy/local/llvm16-assert/bin/clang+0x3eedccc)
#34 0x0000000000ad3cc6 clang_main(int, char**) (/home/andy/local/llvm16-assert/bin/clang+0xad3cc6)
#35 0x00007fa8bcd4a24e __libc_start_call_main (/nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163/lib/libc.so.6+0x2924e)
#36 0x00007fa8bcd4a309 __libc_start_main@GLIBC_2.2.5 (/nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163/lib/libc.so.6+0x29309)
#37 0x0000000000acc415 _start (/home/andy/local/llvm16-assert/bin/clang+0xacc415)
clang-16: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 16.0.0 (git@github.com:llvm/llvm-project.git 3f9b92d027f5d0bd23f852b66d47c5061363532d)
Target: mips-unknown-linux-unknown
Thread model: posix
InstalledDir: /home/andy/local/llvm16-assert/bin
clang-16: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions