Skip to content
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

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

Open
beetrees opened this issue Jun 23, 2024 · 1 comment
Labels
backend:MIPS crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@beetrees
Copy link
Contributor

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)
@dtcxzyw dtcxzyw added backend:MIPS crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Jun 23, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jun 23, 2024

@llvm/issue-subscribers-backend-mips

Author: None (beetrees)

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)

alexrp added a commit to alexrp/zig that referenced this issue Aug 13, 2024
alexrp added a commit to alexrp/zig that referenced this issue Aug 14, 2024
richerfu pushed a commit to richerfu/zig that referenced this issue Oct 28, 2024
tgross35 added a commit to tgross35/rust that referenced this issue Nov 3, 2024
With the `compiler-builtins` update to 0.1.137 [1], we now provide
symbols necessary to work with `f128` everywhere. This means that we are
no longer restricted to 64-bit linux, and can enable tests by default.

There are still a handful of platforms that need to remain disabled
because of bugs. This patch additionally disables the following:

1. MIPS [2]
2. 32-bit x86 [3]

Math support is still off by default since those symbols are not yet
available.

[1]: rust-lang#132433
[2]: llvm/llvm-project#96432
[3]: llvm/llvm-project#77401
tgross35 added a commit to tgross35/rust that referenced this issue Nov 4, 2024
With the `compiler-builtins` update to 0.1.137 [1], we now provide
symbols necessary to work with `f128` everywhere. This means that we are
no longer restricted to 64-bit linux, and can enable tests by default.

There are still a handful of platforms that need to remain disabled
because of bugs. This patch additionally disables the following:

1. MIPS [2]
2. 32-bit x86 [3]

Math support is still off by default since those symbols are not yet
available.

[1]: rust-lang#132433
[2]: llvm/llvm-project#96432
[3]: llvm/llvm-project#77401
tgross35 added a commit to tgross35/rust that referenced this issue Nov 4, 2024
With the `compiler-builtins` update to 0.1.137 [1], we now provide
symbols necessary to work with `f128` everywhere. This means that we are
no longer restricted to 64-bit linux, and can enable tests by default.

There are still a handful of platforms that need to remain disabled
because of bugs. This patch additionally disables the following:

1. MIPS [2]
2. 32-bit x86 [3]

Math support is still off by default since those symbols are not yet
available.

[1]: rust-lang#132433
[2]: llvm/llvm-project#96432
[3]: llvm/llvm-project#77401
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:MIPS crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

3 participants