-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[llvm][Hexagon] unable to allocate function argument
crash in llvm::HexagonTargetLowering::LowerFormalArguments()
#118879
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
Comments
FYI @androm3da |
unable to allocate function argument
in llvm::HexagonTargetLowering::LowerFormalArguments()
unable to allocate function argument
crash in llvm::HexagonTargetLowering::LowerFormalArguments()
@llvm/issue-subscribers-backend-hexagon Author: Alex Rønne Petersen (alexrp)
```llvm
target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
target triple = "hexagon-unknown-linux4.19.0-unknown"
define fastcc i16 @testing.expectEqualInner__anon_28689(ptr %0, <3 x i1> %1) {
|
Just |
/cherry-pick 8e11725 I'll reopen this issue since the commit above only mitigates the problem from this issue in some modes, and I think this issue would get auto-closed by the automation when spawning the cherry-pick PR. |
Failed to cherry-pick: 8e11725 https://github.com/llvm/llvm-project/actions/runs/13596437941 Please manually backport the fix and push it to your github fork. Once this is done, please create a pull request |
Whoops, sha was from the wrong repo. /cherry-pick 37559c8 |
/pull-request #129311 |
This commit updates the Hexagon backend to handle vxi1 call operands. It ensures compatibility for vector types of sizes 4, 8, 16, 32, 64, and 128 x i1 when HVX is enabled. ~Fixes llvm#59009 and llvm#118879~ (cherry picked from commit 37559c8)
@alexrp this particular reproducer seems to run w/o an |
Does it work without HVX enabled? |
I'm not sure what kind of codegen to expect in any case. But it doesn't As of ead2724:
|
Nice; then yeah, I would consider this solved. |
@androm3da unfortunately, we've hit another case in the Zig behavior tests: target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
target triple = "hexagon-unknown-linux4.19.0-unknown"
define fastcc i16 @testing.expectEqualInner__anon_86824(ptr %0, <2 x i1> %1) {
Entry:
ret i16 0
} ❯ llc --version | head -n2
LLVM (http://llvm.org/):
LLVM version 20.1.2
❯ llc reduced.ll
LLVM ERROR: unable to allocate function argument #1
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: llc reduced.ll
1. Running pass 'Function Pass Manager' on module 'reduced.ll'.
2. Running pass 'Hexagon DAG->DAG Pattern Instruction Selection' on function '@testing.expectEqualInner__anon_86824'
#0 0x000074cd87780e02 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/alexrp/Source/llvm-project/llvm/lib/Support/Unix/Signals.inc:803:3
#1 0x000074cd8777e7af llvm::sys::RunSignalHandlers() /home/alexrp/Source/llvm-project/llvm/lib/Support/Signals.cpp:105:20
#2 0x000074cd8777eb3d SignalHandler(int) /home/alexrp/Source/llvm-project/llvm/lib/Support/Unix/Signals.inc:415:1
#3 0x000074cd86045330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#4 0x000074cd8609eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x000074cd8609eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#6 0x000074cd8609eb2c pthread_kill ./nptl/pthread_kill.c:89:10
#7 0x000074cd8604527e raise ./signal/../sysdeps/posix/raise.c:27:6
#8 0x000074cd860288ff abort ./stdlib/abort.c:81:7
#9 0x000074cd87493cf9 (/opt/llvm-20/bin/../lib/libLLVM.so.20.1+0xc93cf9)
#10 0x000074cd87ad9ac5 llvm::CCState::AnalyzeFormalArguments(llvm::SmallVectorImpl<llvm::ISD::InputArg> const&, bool (*)(unsigned int, llvm::MVT, llvm::MVT, llvm::CCValAssign::LocInfo, llvm::ISD::ArgFlagsTy, llvm::CCState&)) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/CallingConvLower.cpp:95:1
#11 0x000074cd8b1f9b91 llvm::HexagonTargetLowering::LowerFormalArguments(llvm::SDValue, unsigned int, bool, llvm::SmallVectorImpl<llvm::ISD::InputArg> const&, llvm::SDLoc const&, llvm::SelectionDAG&, llvm::SmallVectorImpl<llvm::SDValue>&) const /home/alexrp/Source/llvm-project/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp:810:34
#12 0x000074cd882fe999 llvm::SelectionDAGISel::LowerArguments(llvm::Function const&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:11768:46
#13 0x000074cd883c1034 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1651:19
#14 0x000074cd883c1c19 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:616:22
#15 0x000074cd8b1cab34 llvm::HexagonDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.h:47:17
#16 0x000074cd883b2547 llvm::OptLevelChanger::~OptLevelChanger() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:269:11
#17 0x000074cd883b2547 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:376:1
#18 0x000074cd883b2547 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:347:6
#19 0x000074cd87cfa58f llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:94:33
#20 0x000074cd879453a4 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1416:7
#21 0x000074cd879455c1 llvm::ilist_detail::node_base_prevnext<llvm::ilist_node_base<true, void>, true>::getNext() const /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/ilist_node_base.h:42:38
#22 0x000074cd879455c1 llvm::ilist_node_impl<llvm::ilist_detail::node_options<llvm::Function, true, false, void, false, void>>::getNext() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/ilist_node.h:117:66
#23 0x000074cd879455c1 llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Function, true, false, void, false, void>, false, false>::operator++() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/ilist_iterator.h:187:25
#24 0x000074cd879455c1 llvm::FPPassManager::runOnModule(llvm::Module&) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1451:22
#25 0x000074cd87945e0d runOnModule /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1528:7
#26 0x000074cd87945e0d llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:539:55
#27 0x000063a94c3fb9df compileModule(char**, llvm::LLVMContext&) /home/alexrp/Source/llvm-project/llvm/tools/llc/llc.cpp:753:34
#28 0x000063a94c3f0057 main /home/alexrp/Source/llvm-project/llvm/tools/llc/llc.cpp:411:35
#29 0x000074cd8602a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#30 0x000074cd8602a28b call_init ./csu/../csu/libc-start.c:128:20
#31 0x000074cd8602a28b __libc_start_main ./csu/../csu/libc-start.c:347:5
#32 0x000063a94c3f0de5 _start (/opt/llvm-20/bin/llc+0x12de5) |
Aside: How common is HVX support in Hexagon hardware? Is it a situation that resembles x86 where SSE is basically considered baseline? |
Most of the failures are: * llvm/llvm-project#118879 * llvm/llvm-project#134659 But some are also miscompilations leading to wrong results. I'm not going to investigate the latter further until all the backend crashes have been resolved.
I think it's universal for compute DSPs. But it's definitely not like x86 in that regard: they still make modern Hexagon DSPs without HVX coprocs. In a typical SoC, out of 2-3 hexagon DSPs there'd probably be ~1 without HVX. |
We are currently working on fix for this case when HVX is disabled. |
Most of the failures are: * llvm/llvm-project#118879 * llvm/llvm-project#134659 But some are also miscompilations leading to wrong results. I'm not going to investigate the latter further until all the backend crashes have been resolved.
@iajbar for the sake of LLVM IR conformance, do we need support to lower arbitrary Related question -- can we use a tool like |
/cherry-pick 32c3909 |
/pull-request #135461 |
Thanks Brian. I am working on fixing other cases uncovered by llvm-stress. |
Fixes llvm#118879 (cherry picked from commit 32c3909)
The text was updated successfully, but these errors were encountered: