Skip to content

Compiler crash when targeting mips64 when returning fp128 after calling a function returning { i8, i128 } #96432

Description

@beetrees

Attempting to compiler the following IR causes LLVM to crash (compiler explorer):

target triple = "mips64el-unknown-linux-gnuabi64"

define fp128 @foo() {
  call { i8, i128 } @bar()
  ret fp128 0xL00000000000000000000000000000000
}

define { i8, i128 } @bar() {
  ret { i8, i128 } zeroinitializer
}

Crash backtrace:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'MIPS DAG->DAG Pattern Instruction Selection' on function '@foo'
 #0 0x0000000003739428 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3739428)
 #1 0x0000000003736dac SignalHandler(int) Signals.cpp:0:0
 #2 0x0000718fcb642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00000000034c3bb3 llvm::SelectionDAG::FoldConstantArithmetic(unsigned int, llvm::SDLoc const&, llvm::EVT, llvm::ArrayRef<llvm::SDValue>, llvm::SDNodeFlags) (/opt/compiler-explorer/clang-trunk/bin/llc+0x34c3bb3)
 #4 0x00000000034c79f4 llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::EVT, llvm::SDValue, llvm::SDNodeFlags) (/opt/compiler-explorer/clang-trunk/bin/llc+0x34c79f4)
 #5 0x0000000003430a84 getCopyFromParts(llvm::SelectionDAG&, llvm::SDLoc const&, llvm::SDValue const*, unsigned int, llvm::MVT, llvm::EVT, llvm::Value const*, llvm::SDValue, std::optional<unsigned int>, std::optional<llvm::ISD::NodeType>) (.isra.0) SelectionDAGBuilder.cpp:0:0
 #6 0x000000000343fb56 llvm::TargetLowering::LowerCallTo(llvm::TargetLowering::CallLoweringInfo&) const (/opt/compiler-explorer/clang-trunk/bin/llc+0x343fb56)
 #7 0x000000000344172d llvm::SelectionDAGBuilder::lowerInvokable(llvm::TargetLowering::CallLoweringInfo&, llvm::BasicBlock const*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x344172d)
 #8 0x0000000003462354 llvm::SelectionDAGBuilder::LowerCallTo(llvm::CallBase const&, llvm::SDValue, bool, bool, llvm::BasicBlock const*, llvm::TargetLowering::PtrAuthInfo const*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3462354)
 #9 0x0000000003478998 llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3478998)
#10 0x000000000348d487 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x348d487)
#11 0x0000000003505a53 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true, llvm::BasicBlock>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true, llvm::BasicBlock>, false, true>, bool&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3505a53)
#12 0x0000000003507124 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3507124)
#13 0x0000000003508f94 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3508f94)
#14 0x00000000015c3c1b llvm::MipsDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x15c3c1b)
#15 0x00000000034f8ac1 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x34f8ac1)
#16 0x000000000283368b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#17 0x0000000002d72152 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2d72152)
#18 0x0000000002d722d1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2d722d1)
#19 0x0000000002d73f80 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2d73f80)
#20 0x0000000000846ed4 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#21 0x000000000073ece6 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x73ece6)
#22 0x0000718fcb629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#23 0x0000718fcb629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#24 0x000000000083eb0e _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x83eb0e)

Activity

  1. added
    crashPrefer [crash-on-valid] or [crash-on-invalid]
    and removed on Jun 23, 2024
  2. llvmbot commented on Jun 23, 2024

    @llvmbot
    Member

    @llvm/issue-subscribers-backend-mips

    Author: None (beetrees)

    Details Attempting to compiler the following IR causes LLVM to crash ([compiler explorer](https://godbolt.org/z/cqKz4Ybxb)):
    target triple = "mips64el-unknown-linux-gnuabi64"
    
    define fp128 @<!-- -->foo() {
      call { i8, i128 } @<!-- -->bar()
      ret fp128 0xL00000000000000000000000000000000
    }
    
    define { i8, i128 } @<!-- -->bar() {
      ret { i8, i128 } zeroinitializer
    }

    Crash backtrace:

    PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
    Stack dump:
    0.	Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel &lt;source&gt;
    1.	Running pass 'Function Pass Manager' on module '&lt;source&gt;'.
    2.	Running pass 'MIPS DAG-&gt;DAG Pattern Instruction Selection' on function '@<!-- -->foo'
     #<!-- -->0 0x0000000003739428 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3739428)
     #<!-- -->1 0x0000000003736dac SignalHandler(int) Signals.cpp:0:0
     #<!-- -->2 0x0000718fcb642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
     #<!-- -->3 0x00000000034c3bb3 llvm::SelectionDAG::FoldConstantArithmetic(unsigned int, llvm::SDLoc const&amp;, llvm::EVT, llvm::ArrayRef&lt;llvm::SDValue&gt;, llvm::SDNodeFlags) (/opt/compiler-explorer/clang-trunk/bin/llc+0x34c3bb3)
     #<!-- -->4 0x00000000034c79f4 llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&amp;, llvm::EVT, llvm::SDValue, llvm::SDNodeFlags) (/opt/compiler-explorer/clang-trunk/bin/llc+0x34c79f4)
     #<!-- -->5 0x0000000003430a84 getCopyFromParts(llvm::SelectionDAG&amp;, llvm::SDLoc const&amp;, llvm::SDValue const*, unsigned int, llvm::MVT, llvm::EVT, llvm::Value const*, llvm::SDValue, std::optional&lt;unsigned int&gt;, std::optional&lt;llvm::ISD::NodeType&gt;) (.isra.0) SelectionDAGBuilder.cpp:0:0
     #<!-- -->6 0x000000000343fb56 llvm::TargetLowering::LowerCallTo(llvm::TargetLowering::CallLoweringInfo&amp;) const (/opt/compiler-explorer/clang-trunk/bin/llc+0x343fb56)
     #<!-- -->7 0x000000000344172d llvm::SelectionDAGBuilder::lowerInvokable(llvm::TargetLowering::CallLoweringInfo&amp;, llvm::BasicBlock const*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x344172d)
     #<!-- -->8 0x0000000003462354 llvm::SelectionDAGBuilder::LowerCallTo(llvm::CallBase const&amp;, llvm::SDValue, bool, bool, llvm::BasicBlock const*, llvm::TargetLowering::PtrAuthInfo const*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3462354)
     #<!-- -->9 0x0000000003478998 llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&amp;) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3478998)
    #<!-- -->10 0x000000000348d487 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&amp;) (/opt/compiler-explorer/clang-trunk/bin/llc+0x348d487)
    #<!-- -->11 0x0000000003505a53 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits&lt;llvm::ilist_detail::node_options&lt;llvm::Instruction, false, false, void, true, llvm::BasicBlock&gt;, false, true&gt;, llvm::ilist_iterator_w_bits&lt;llvm::ilist_detail::node_options&lt;llvm::Instruction, false, false, void, true, llvm::BasicBlock&gt;, false, true&gt;, bool&amp;) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3505a53)
    #<!-- -->12 0x0000000003507124 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&amp;) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3507124)
    #<!-- -->13 0x0000000003508f94 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3508f94)
    #<!-- -->14 0x00000000015c3c1b llvm::MipsDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) (/opt/compiler-explorer/clang-trunk/bin/llc+0x15c3c1b)
    #<!-- -->15 0x00000000034f8ac1 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&amp;) (/opt/compiler-explorer/clang-trunk/bin/llc+0x34f8ac1)
    #<!-- -->16 0x000000000283368b llvm::MachineFunctionPass::runOnFunction(llvm::Function&amp;) (.part.0) MachineFunctionPass.cpp:0:0
    #<!-- -->17 0x0000000002d72152 llvm::FPPassManager::runOnFunction(llvm::Function&amp;) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2d72152)
    #<!-- -->18 0x0000000002d722d1 llvm::FPPassManager::runOnModule(llvm::Module&amp;) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2d722d1)
    #<!-- -->19 0x0000000002d73f80 llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2d73f80)
    #<!-- -->20 0x0000000000846ed4 compileModule(char**, llvm::LLVMContext&amp;) llc.cpp:0:0
    #<!-- -->21 0x000000000073ece6 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x73ece6)
    #<!-- -->22 0x0000718fcb629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
    #<!-- -->23 0x0000718fcb629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
    #<!-- -->24 0x000000000083eb0e _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x83eb0e)
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:MIPScrashPrefer [crash-on-valid] or [crash-on-invalid]

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions