<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63036>63036</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            BPF backend crashes when returning 128-bit integers
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          GabrielRavier
      </td>
    </tr>
</table>

<pre>
    The following code:
```cpp
__int128_t f()
{
    return 0;
}
```

currently makes trunk Clang crash when using the eBPF backend, with the following error message:
```
fatal error: error in backend: unable to allocate function return #1
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: /opt/compiler-explorer/clang-trunk/bin/clang++ -g -o /app/output.s -S -target bpf -fcolor-diagnostics -fno-crash-diagnostics -O3 <source>
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '<source>'.
4.      Running pass 'BPF DAG->DAG Pattern Instruction Selection' on function '@_Z1fv'
 #0 0x000055b1e113db9f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3616b9f)
 #1 0x000055b1e113bbcc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3614bcc)
 #2 0x000055b1e108b597 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3564597)
 #3 0x000055b1e11337c2 llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x360c7c2)
 #4 0x000055b1de9c0d86 (/opt/compiler-explorer/clang-trunk/bin/clang+++0xe99d86)
 #5 0x000055b1e109458a llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x356d58a)
 #6 0x000055b1e045d1bf llvm::CCState::AnalyzeReturn(llvm::SmallVectorImpl<llvm::ISD::OutputArg> const&, bool (*)(unsigned int, llvm::MVT, llvm::MVT, llvm::CCValAssign::LocInfo, llvm::ISD::ArgFlagsTy, llvm::CCState&)) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x29361bf)
 #7 0x000055b1df415b24 llvm::BPFTargetLowering::LowerReturn(llvm::SDValue, unsigned int, bool, llvm::SmallVectorImpl<llvm::ISD::OutputArg> const&, llvm::SmallVectorImpl<llvm::SDValue> const&, llvm::SDLoc const&, llvm::SelectionDAG&) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x18eeb24)
 #8 0x000055b1e2100f80 llvm::SelectionDAGBuilder::visitRet(llvm::ReturnInst const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45d9f80)
 #9 0x000055b1e21030f8 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45dc0f8)
#10 0x000055b1e21783de llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, true>, bool&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x46513de)
#11 0x000055b1e217968f llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x465268f)
#12 0x000055b1e217be76 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#13 0x000055b1e05b0f10 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#14 0x000055b1e0acfc7a llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x2fa8c7a)
#15 0x000055b1e0acfe09 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x2fa8e09)
#16 0x000055b1e0ad09f0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x2fa99f0)
#17 0x000055b1e13ae4b0 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>>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x38874b0)
#18 0x000055b1e22bc68c clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x479568c)
#19 0x000055b1e368c139 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5b65139)
#20 0x000055b1e22bb745 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4794745)
#21 0x000055b1e1b9fbb1 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4078bb1)
#22 0x000055b1e1b238b3 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3ffc8b3)
#23 0x000055b1e1c7eae3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4157ae3)
#24 0x000055b1de9c230c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xe9b30c)
#25 0x000055b1de9bda0f ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#26 0x000055b1e19802dd 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
#27 0x000055b1e108b487 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3564487)
#28 0x000055b1e198051c 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
#29 0x000055b1e1947f5e clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e20f5e)
#30 0x000055b1e194892d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e2192d)
#31 0x000055b1e1952ffc clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3e2bffc)
#32 0x000055b1de9bff0f clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xe98f0f)
#33 0x000055b1de8bd255 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xd96255)
#34 0x00007f81a2001083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#35 0x000055b1de9b9cee _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xe92cee)
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Compiler returned: 70
```

this appears to be caused by LLVM seemingly not knowing how to handle returning 128-bit objects.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWklv4zgW_jXKhXAgUfshB8eJq6uRQgVxpg5zMUjqyWaHJj0klWV-_YBabFHlpKq7XYMBBsgicf3ew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