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

[llvm][Hexagon] Crash in llvm::DAGTypeLegalizer::PromoteFloatResult() for freeze half #117337

Open
alexrp opened this issue Nov 22, 2024 · 3 comments
Assignees
Labels
backend:Hexagon crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:SelectionDAG SelectionDAGISel as well

Comments

@alexrp
Copy link
Member

alexrp commented Nov 22, 2024

This is very similar to #107791.

define half @freeze_half_poison(half %maybe.poison) {
  %y1 = freeze half %maybe.poison
  %t1 = fadd half %y1, %y1
  ret half %t1
}
llc --version | head -n2
LLVM (http://llvm.org/):
  LLVM version 19.1.2llc test.ll -mtriple hexagon-linux
PromoteFloatResult #0: t5: f16 = freeze t4

LLVM ERROR: Do not know how to promote this operator's result!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc test.ll -mtriple hexagon-linux
1.      Running pass 'Function Pass Manager' on module 'test.ll'.
2.      Running pass 'Hexagon DAG->DAG Pattern Instruction Selection' on function '@freeze_half_poison'
 #0 0x00007c530544faa2 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/alexrp/Source/llvm-project/llvm/lib/Support/Unix/Signals.inc:727:3
 #1 0x00007c530544d40f llvm::sys::RunSignalHandlers() /home/alexrp/Source/llvm-project/llvm/lib/Support/Signals.cpp:105:20
 #2 0x00007c530544d7a6 SignalHandler(int) /home/alexrp/Source/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
 #3 0x00007c5303e42990 (/lib/x86_64-linux-gnu/libc.so.6+0x42990)
 #4 0x00007c5303e99a1b __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007c5303e99a1b __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x00007c5303e99a1b pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x00007c5303e428e6 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007c5303e268b7 abort ./stdlib/abort.c:81:7
 #9 0x00007c5305180c78 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>::_M_replace(unsigned long, unsigned long, char const*, unsigned long) /usr/include/c++/13/bits/basic_string.tcc:540:21
#10 0x00007c5305180c78 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>::assign(char const*) (.isra.0.cold) /usr/include/c++/13/bits/basic_string.h:1672:19
#11 0x00007c530536fa05 (/opt/llvm-19/bin/../lib/libLLVM.so.19.1+0xd6fa05)
#12 0x00007c5305e7cd2e llvm::DAGTypeLegalizer::PromoteFloatResult(llvm::SDNode*, unsigned int) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:2588:25
#13 0x00007c5305ebee8f llvm::DAGTypeLegalizer::run() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:291:14
#14 0x00007c5305ec00f4 llvm::SelectionDAG::LegalizeTypes() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:1057:10
#15 0x00007c5306031313 llvm::TimeRegion::~TimeRegion() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Timer.h:155:9
#16 0x00007c5306031313 llvm::NamedRegionTimer::~NamedRegionTimer() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Timer.h:163:8
#17 0x00007c5306031313 llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:954:3
#18 0x00007c5306035d20 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1868:33
#19 0x00007c53060375fc llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:632:22
#20 0x00007c5308bdca94 llvm::HexagonDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.h:47:17
#21 0x00007c5306022b77 llvm::OptLevelChanger::~OptLevelChanger() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:268:11
#22 0x00007c5306022b77 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:375:1
#23 0x00007c5306022b77 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:346:6
#24 0x00007c5305996e7f llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:94:33
#25 0x00007c530560d687 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1450:7
#26 0x00007c530560d8c1 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
#27 0x00007c530560d8c1 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
#28 0x00007c530560d8c1 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
#29 0x00007c530560d8c1 llvm::FPPassManager::runOnModule(llvm::Module&) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1485:22
#30 0x00007c530560e144 runOnModule /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1562:7
#31 0x00007c530560e144 llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:541:55
#32 0x0000595f1b31ca3c compileModule(char**, llvm::LLVMContext&) /home/alexrp/Source/llvm-project/llvm/tools/llc/llc.cpp:742:34
#33 0x0000595f1b310f77 main /home/alexrp/Source/llvm-project/llvm/tools/llc/llc.cpp:409:35
#34 0x00007c5303e28150 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#35 0x00007c5303e28209 call_init ./csu/../csu/libc-start.c:128:20
#36 0x00007c5303e28209 __libc_start_main ./csu/../csu/libc-start.c:347:5
#37 0x0000595f1b311cf5 _start (/opt/llvm-19/bin/llc+0x13cf5)
@EugeneZelenko EugeneZelenko added backend:Hexagon crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:SelectionDAG SelectionDAGISel as well and removed new issue labels Nov 22, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 22, 2024

@llvm/issue-subscribers-backend-hexagon

Author: Alex Rønne Petersen (alexrp)

This is very similar to #107791.
define half @<!-- -->freeze_half_poison(half %maybe.poison) {
  %y1 = freeze half %maybe.poison
  %t1 = fadd half %y1, %y1
  ret half %t1
}
llc --version | head -n2
LLVM (http://llvm.org/):
  LLVM version 19.1.2llc test.ll -mtriple hexagon-linux
PromoteFloatResult #<!-- -->0: t5: f16 = freeze t4

LLVM ERROR: Do not know how to promote this operator's result!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc test.ll -mtriple hexagon-linux
1.      Running pass 'Function Pass Manager' on module 'test.ll'.
2.      Running pass 'Hexagon DAG-&gt;DAG Pattern Instruction Selection' on function '@<!-- -->freeze_half_poison'
 #<!-- -->0 0x00007c530544faa2 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) /home/alexrp/Source/llvm-project/llvm/lib/Support/Unix/Signals.inc:727:3
 #<!-- -->1 0x00007c530544d40f llvm::sys::RunSignalHandlers() /home/alexrp/Source/llvm-project/llvm/lib/Support/Signals.cpp:105:20
 #<!-- -->2 0x00007c530544d7a6 SignalHandler(int) /home/alexrp/Source/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
 #<!-- -->3 0x00007c5303e42990 (/lib/x86_64-linux-gnu/libc.so.6+0x42990)
 #<!-- -->4 0x00007c5303e99a1b __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #<!-- -->5 0x00007c5303e99a1b __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #<!-- -->6 0x00007c5303e99a1b pthread_kill ./nptl/pthread_kill.c:89:10
 #<!-- -->7 0x00007c5303e428e6 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #<!-- -->8 0x00007c5303e268b7 abort ./stdlib/abort.c:81:7
 #<!-- -->9 0x00007c5305180c78 std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;::_M_replace(unsigned long, unsigned long, char const*, unsigned long) /usr/include/c++/13/bits/basic_string.tcc:540:21
#<!-- -->10 0x00007c5305180c78 std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;::assign(char const*) (.isra.0.cold) /usr/include/c++/13/bits/basic_string.h:1672:19
#<!-- -->11 0x00007c530536fa05 (/opt/llvm-19/bin/../lib/libLLVM.so.19.1+0xd6fa05)
#<!-- -->12 0x00007c5305e7cd2e llvm::DAGTypeLegalizer::PromoteFloatResult(llvm::SDNode*, unsigned int) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:2588:25
#<!-- -->13 0x00007c5305ebee8f llvm::DAGTypeLegalizer::run() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:291:14
#<!-- -->14 0x00007c5305ec00f4 llvm::SelectionDAG::LegalizeTypes() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:1057:10
#<!-- -->15 0x00007c5306031313 llvm::TimeRegion::~TimeRegion() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Timer.h:155:9
#<!-- -->16 0x00007c5306031313 llvm::NamedRegionTimer::~NamedRegionTimer() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Timer.h:163:8
#<!-- -->17 0x00007c5306031313 llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:954:3
#<!-- -->18 0x00007c5306035d20 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&amp;) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1868:33
#<!-- -->19 0x00007c53060375fc llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:632:22
#<!-- -->20 0x00007c5308bdca94 llvm::HexagonDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) /home/alexrp/Source/llvm-project/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.h:47:17
#<!-- -->21 0x00007c5306022b77 llvm::OptLevelChanger::~OptLevelChanger() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:268:11
#<!-- -->22 0x00007c5306022b77 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&amp;) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:375:1
#<!-- -->23 0x00007c5306022b77 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&amp;) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:346:6
#<!-- -->24 0x00007c5305996e7f llvm::MachineFunctionPass::runOnFunction(llvm::Function&amp;) (.part.0) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:94:33
#<!-- -->25 0x00007c530560d687 llvm::FPPassManager::runOnFunction(llvm::Function&amp;) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1450:7
#<!-- -->26 0x00007c530560d8c1 llvm::ilist_detail::node_base_prevnext&lt;llvm::ilist_node_base&lt;true, void&gt;, true&gt;::getNext() const /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/ilist_node_base.h:42:38
#<!-- -->27 0x00007c530560d8c1 llvm::ilist_node_impl&lt;llvm::ilist_detail::node_options&lt;llvm::Function, true, false, void, false, void&gt;&gt;::getNext() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/ilist_node.h:117:66
#<!-- -->28 0x00007c530560d8c1 llvm::ilist_iterator&lt;llvm::ilist_detail::node_options&lt;llvm::Function, true, false, void, false, void&gt;, false, false&gt;::operator++() /home/alexrp/Source/llvm-project/llvm/include/llvm/ADT/ilist_iterator.h:187:25
#<!-- -->29 0x00007c530560d8c1 llvm::FPPassManager::runOnModule(llvm::Module&amp;) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1485:22
#<!-- -->30 0x00007c530560e144 runOnModule /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1562:7
#<!-- -->31 0x00007c530560e144 llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:541:55
#<!-- -->32 0x0000595f1b31ca3c compileModule(char**, llvm::LLVMContext&amp;) /home/alexrp/Source/llvm-project/llvm/tools/llc/llc.cpp:742:34
#<!-- -->33 0x0000595f1b310f77 main /home/alexrp/Source/llvm-project/llvm/tools/llc/llc.cpp:409:35
#<!-- -->34 0x00007c5303e28150 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#<!-- -->35 0x00007c5303e28209 call_init ./csu/../csu/libc-start.c:128:20
#<!-- -->36 0x00007c5303e28209 __libc_start_main ./csu/../csu/libc-start.c:347:5
#<!-- -->37 0x0000595f1b311cf5 _start (/opt/llvm-19/bin/llc+0x13cf5)

@androm3da
Copy link
Member

@iajbar can you take a look at this? Maybe the loongarch resolution that Alex has referenced above will be a good guide for the hexagon fix.

@iajbar iajbar self-assigned this Nov 22, 2024
@iajbar
Copy link
Contributor

iajbar commented Nov 22, 2024

Thanks Brian. I am working on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:Hexagon crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:SelectionDAG SelectionDAGISel as well
Projects
None yet
Development

No branches or pull requests

5 participants