Skip to content

32-bit sparc backend fails to allocate by-value returns of 256 bytes #48042

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

Closed
nagisa opened this issue Jan 8, 2021 · 6 comments
Closed

32-bit sparc backend fails to allocate by-value returns of 256 bytes #48042

nagisa opened this issue Jan 8, 2021 · 6 comments
Labels
backend:Sparc bugzilla Issues migrated from bugzilla

Comments

@nagisa
Copy link
Member

nagisa commented Jan 8, 2021

Bugzilla Link 48698
Version trunk
OS All

Extended Description

Code

define i256 @test() unnamed_addr {
start:
  ret i256 0
}

built with llc -mtriple=sparc will fail with the following assertion:

LLVM ERROR: unable to allocate function return #​6
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.

Stack dump:

0.	Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o ./output.s -mtriple=sparc <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'SPARC DAG->DAG Pattern Instruction Selection' on function '@test'

#7 0x0000558c147c69b6 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/llc+0x1b7e9b6)
#8 0x0000558c13f8c16d llvm::SparcTargetLowering::LowerReturn_32(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/llc+0x134416d)
#9 0x0000558c151c77cb llvm::SelectionDAGBuilder::visitRet(llvm::ReturnInst const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x257f7cb)
#10 0x0000558c151ec4fc llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x25a44fc)

Compiler returned: 255

Possibly related to bug 27161

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
@rorth
Copy link
Collaborator

rorth commented Jul 15, 2022

Still happens with llc from main as of 2022-07-08.

@koachan
Copy link
Contributor

koachan commented Jul 15, 2022

This is still happening as of 15git (commit 0a11ad2).

LLVM ERROR: unable to allocate function return #6
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: bin/llc -mtriple=sparc gh48042.ll
1.	Running pass 'Function Pass Manager' on module 'gh48042.ll'.
2.	Running pass 'SPARC DAG->DAG Pattern Instruction Selection' on function '@test'
 #0 0x00007f560d1c793a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/k/llvm-debug/src/llvm-project/llvm/lib/Support/Unix/Signals.inc:569:11
 #1 0x00007f560d1c7aeb PrintStackTraceSignalHandler(void*) /home/k/llvm-debug/src/llvm-project/llvm/lib/Support/Unix/Signals.inc:636:1
 #2 0x00007f560d1c6166 llvm::sys::RunSignalHandlers() /home/k/llvm-debug/src/llvm-project/llvm/lib/Support/Signals.cpp:103:5
 #3 0x00007f560d1c8215 SignalHandler(int) /home/k/llvm-debug/src/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
 #4 0x00007f560b63e8e0 (/usr/lib/libc.so.6+0x3e8e0)
 #5 0x00007f560b68e36c (/usr/lib/libc.so.6+0x8e36c)
 #6 0x00007f560b63e838 gsignal (/usr/lib/libc.so.6+0x3e838)
 #7 0x00007f560b628535 abort (/usr/lib/libc.so.6+0x28535)
 #8 0x00007f560d04d314 llvm::report_fatal_error(llvm::Twine const&, bool) /home/k/llvm-debug/src/llvm-project/llvm/lib/Support/ErrorHandling.cpp:125:5
 #9 0x00007f560d6ddb1e llvm::CCState::AnalyzeReturn(llvm::SmallVectorImpl<llvm::ISD::OutputArg> const&, bool (*)(unsigned int, llvm::MVT, llvm::MVT, llvm::CCValAssign::LocInfo, llvm::ISD::ArgFlagsTy, llvm::CCState&)) /home/k/llvm-debug/src/llvm-project/llvm/lib/CodeGen/CallingConvLower.cpp:118:3
#10 0x00007f5610ce3953 llvm::SparcTargetLowering::LowerReturn_32(llvm::SDValue, unsigned int, bool, llvm::SmallVectorImpl<llvm::ISD::OutputArg> const&, llvm::SmallVectorImpl<llvm::SDValue> const&, llvm::SDLoc const&, llvm::SelectionDAG&) const /home/k/llvm-debug/src/llvm-project/llvm/lib/Target/Sparc/SparcISelLowering.cpp:223:11
#11 0x00007f5610ce2cc8 llvm::SparcTargetLowering::LowerReturn(llvm::SDValue, unsigned int, bool, llvm::SmallVectorImpl<llvm::ISD::OutputArg> const&, llvm::SmallVectorImpl<llvm::SDValue> const&, llvm::SDLoc const&, llvm::SelectionDAG&) const /home/k/llvm-debug/src/llvm-project/llvm/lib/Target/Sparc/SparcISelLowering.cpp:202:10
#12 0x00007f560e1297aa llvm::SelectionDAGBuilder::visitRet(llvm::ReturnInst const&) /home/k/llvm-debug/src/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:2049:39
#13 0x00007f560e127da9 llvm::SelectionDAGBuilder::visit(unsigned int, llvm::User const&) /home/k/llvm-debug/src/llvm-project/llvm/include/llvm/IR/Instruction.def:127:1
#14 0x00007f560e1275ca llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) /home/k/llvm-debug/src/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:1128:8
#15 0x00007f560e222608 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, bool&) /home/k/llvm-debug/src/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:675:3
#16 0x00007f560e22214b llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/k/llvm-debug/src/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1591:11
#17 0x00007f560e21f6ca llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/k/llvm-debug/src/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:464:3
#18 0x00007f5610cdf7a5 (anonymous namespace)::SparcDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/k/llvm-debug/src/llvm-project/llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:40:5
#19 0x00007f560d9e5a47 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/k/llvm-debug/src/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:73:8
#20 0x00007f560d4ab76e llvm::FPPassManager::runOnFunction(llvm::Function&) /home/k/llvm-debug/src/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1430:23
#21 0x00007f560d4b05f2 llvm::FPPassManager::runOnModule(llvm::Module&) /home/k/llvm-debug/src/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1476:16
#22 0x00007f560d4ac059 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/k/llvm-debug/src/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1545:23
#23 0x00007f560d4abbcd llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/k/llvm-debug/src/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:535:16
#24 0x00007f560d4b08d1 llvm::legacy::PassManager::run(llvm::Module&) /home/k/llvm-debug/src/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1672:3
#25 0x000000000041916c compileModule(char**, llvm::LLVMContext&) /home/k/llvm-debug/src/llvm-project/llvm/tools/llc/llc.cpp:739:41
#26 0x00000000004174aa main /home/k/llvm-debug/src/llvm-project/llvm/tools/llc/llc.cpp:420:13
#27 0x00007f560b629290 (/usr/lib/libc.so.6+0x29290)
#28 0x00007f560b62934a __libc_start_main (/usr/lib/libc.so.6+0x2934a)
#29 0x0000000000416c95 _start /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:117:0
Aborted

@koachan
Copy link
Contributor

koachan commented Jul 15, 2022

Possibly related to bug 27161

Also, just want to comment that this bug now lives as #27535 here in github, in case someone wants to check.

@brad0
Copy link
Contributor

brad0 commented Nov 18, 2022

@koachan Can you please also re-check this one?

@koachan
Copy link
Contributor

koachan commented Nov 23, 2022

This (and #27535) seems to be fixed already in latest main.

https://godbolt.org/z/b3r8TYz6z

@brad0
Copy link
Contributor

brad0 commented Nov 24, 2022

I am going to close this as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:Sparc bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

4 participants