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] Expected a SimpleValueType crash with vectors of large integers #118881

Closed
alexrp opened this issue Dec 5, 2024 · 8 comments · Fixed by #120654
Closed

[llvm][Hexagon] Expected a SimpleValueType crash with vectors of large integers #118881

alexrp opened this issue Dec 5, 2024 · 8 comments · Fixed by #120654
Assignees
Labels
backend:Hexagon crash Prefer [crash-on-valid] or [crash-on-invalid] release:backport

Comments

@alexrp
Copy link
Member

alexrp commented Dec 5, 2024

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 @"behavior.basic.test.arrays and vectors with big integers"() {
Entry:
  %0 = load <1 x i65528>, ptr null, align 8192
  %1 = insertelement <1 x i65528> %0, i65528 0, i32 0
  store <1 x i65528> %1, ptr null, align 8192
  ret i16 0
}
llc --version | head -n2
LLVM (http://llvm.org/):
  LLVM version 19.1.5llc reduced3.ll -mtriple hexagon-linux -O0
llc: /home/alexrp/Source/llvm-project/llvm/include/llvm/CodeGen/ValueTypes.h:307: llvm::MVT llvm::EVT::getSimpleVT() const: Assertion `isSimple() && "Expected a SimpleValueType!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc reduced3.ll -mtriple hexagon-linux -O0
1.      Running pass 'Function Pass Manager' on module 'reduced3.ll'.
2.      Running pass 'Hexagon DAG->DAG Pattern Instruction Selection' on function '@"behavior.basic.test.arrays and vectors with big integers"'
 #0 0x00007bbb4ea4fc22 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/alexrp/Source/llvm-project/llvm/lib/Support/Unix/Signals.inc:727:3
 #1 0x00007bbb4ea4d58f llvm::sys::RunSignalHandlers() /home/alexrp/Source/llvm-project/llvm/lib/Support/Signals.cpp:105:20
 #2 0x00007bbb4ea4d926 SignalHandler(int) /home/alexrp/Source/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
 #3 0x00007bbb4d442990 (/lib/x86_64-linux-gnu/libc.so.6+0x42990)
 #4 0x00007bbb4d499a1b __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007bbb4d499a1b __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x00007bbb4d499a1b pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x00007bbb4d4428e6 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007bbb4d4268b7 abort ./stdlib/abort.c:81:7
 #9 0x00007bbb4d4267db _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007bbb4d439206 (/lib/x86_64-linux-gnu/libc.so.6+0x39206)
#11 0x00007bbb521f3fe5 (/opt/llvm-19/bin/../lib/libLLVM.so.19.1+0x45f3fe5)
#12 0x00007bbb521f40af (/opt/llvm-19/bin/../lib/libLLVM.so.19.1+0x45f40af)
#13 0x00007bbb4f38c9b4 (anonymous namespace)::DAGCombiner::replaceStoreOfInsertLoad(llvm::StoreSDNode*) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:21383:40
#14 0x00007bbb4f40a938 (anonymous namespace)::DAGCombiner::visitSTORE(llvm::SDNode*) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:21563:3
#15 0x00007bbb4f41073b combine /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2004:8
#16 0x00007bbb4f41073b (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1998:9
#17 0x00007bbb4f411f88 Run /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1782:25
#18 0x00007bbb4f411f88 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults*, llvm::CodeGenOptLevel) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:28704:39
#19 0x00007bbb4f63126c llvm::TimeRegion::~TimeRegion() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Timer.h:155:9
#20 0x00007bbb4f63126c llvm::NamedRegionTimer::~NamedRegionTimer() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Timer.h:163:8
#21 0x00007bbb4f63126c llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:932:3
#22 0x00007bbb4f635d00 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1868:33
#23 0x00007bbb4f6375dc llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:632:22
#24 0x00007bbb521dd5e4 llvm::HexagonDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.h:47:17
#25 0x00007bbb4f622b57 llvm::OptLevelChanger::~OptLevelChanger() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:268:11
#26 0x00007bbb4f622b57 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:375:1
#27 0x00007bbb4f622b57 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:346:6
#28 0x00007bbb4ef96fdf llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:94:33
#29 0x00007bbb4ec0d807 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1450:7
#30 0x00007bbb4ec0da41 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
#31 0x00007bbb4ec0da41 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
#32 0x00007bbb4ec0da41 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
#33 0x00007bbb4ec0da41 llvm::FPPassManager::runOnModule(llvm::Module&) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1485:22
#34 0x00007bbb4ec0e2c4 runOnModule /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1562:7
#35 0x00007bbb4ec0e2c4 llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:541:55
#36 0x00005e9428cf5a3c compileModule(char**, llvm::LLVMContext&) /home/alexrp/Source/llvm-project/llvm/tools/llc/llc.cpp:742:34
#37 0x00005e9428ce9f77 main /home/alexrp/Source/llvm-project/llvm/tools/llc/llc.cpp:409:35
#38 0x00007bbb4d428150 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#39 0x00007bbb4d428209 call_init ./csu/../csu/libc-start.c:128:20
#40 0x00007bbb4d428209 __libc_start_main ./csu/../csu/libc-start.c:347:5
#41 0x00005e9428ceacf5 _start (/opt/llvm-19/bin/llc+0x13cf5)
@alexrp
Copy link
Member Author

alexrp commented Dec 5, 2024

FYI @androm3da

@androm3da
Copy link
Member

@iajbar note that this test case does not fail downstream.

@EugeneZelenko EugeneZelenko added backend:Hexagon crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:SelectionDAG SelectionDAGISel as well and removed new issue labels Dec 5, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 5, 2024

@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 @"behavior.basic.test.arrays and vectors with big integers"() {
Entry:
%0 = load <1 x i65528>, ptr null, align 8192
%1 = insertelement <1 x i65528> %0, i65528 0, i32 0
store <1 x i65528> %1, ptr null, align 8192
ret i16 0
}


```console
❯ llc --version | head -n2
LLVM (http://llvm.org/):
  LLVM version 19.1.5
❯ llc reduced3.ll -mtriple hexagon-linux -O0
llc: /home/alexrp/Source/llvm-project/llvm/include/llvm/CodeGen/ValueTypes.h:307: llvm::MVT llvm::EVT::getSimpleVT() const: Assertion `isSimple() &amp;&amp; "Expected a SimpleValueType!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc reduced3.ll -mtriple hexagon-linux -O0
1.      Running pass 'Function Pass Manager' on module 'reduced3.ll'.
2.      Running pass 'Hexagon DAG-&gt;DAG Pattern Instruction Selection' on function '@"behavior.basic.test.arrays and vectors with big integers"'
 #<!-- -->0 0x00007bbb4ea4fc22 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) /home/alexrp/Source/llvm-project/llvm/lib/Support/Unix/Signals.inc:727:3
 #<!-- -->1 0x00007bbb4ea4d58f llvm::sys::RunSignalHandlers() /home/alexrp/Source/llvm-project/llvm/lib/Support/Signals.cpp:105:20
 #<!-- -->2 0x00007bbb4ea4d926 SignalHandler(int) /home/alexrp/Source/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
 #<!-- -->3 0x00007bbb4d442990 (/lib/x86_64-linux-gnu/libc.so.6+0x42990)
 #<!-- -->4 0x00007bbb4d499a1b __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #<!-- -->5 0x00007bbb4d499a1b __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #<!-- -->6 0x00007bbb4d499a1b pthread_kill ./nptl/pthread_kill.c:89:10
 #<!-- -->7 0x00007bbb4d4428e6 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #<!-- -->8 0x00007bbb4d4268b7 abort ./stdlib/abort.c:81:7
 #<!-- -->9 0x00007bbb4d4267db _nl_load_domain ./intl/loadmsgcat.c:1177:9
#<!-- -->10 0x00007bbb4d439206 (/lib/x86_64-linux-gnu/libc.so.6+0x39206)
#<!-- -->11 0x00007bbb521f3fe5 (/opt/llvm-19/bin/../lib/libLLVM.so.19.1+0x45f3fe5)
#<!-- -->12 0x00007bbb521f40af (/opt/llvm-19/bin/../lib/libLLVM.so.19.1+0x45f40af)
#<!-- -->13 0x00007bbb4f38c9b4 (anonymous namespace)::DAGCombiner::replaceStoreOfInsertLoad(llvm::StoreSDNode*) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:21383:40
#<!-- -->14 0x00007bbb4f40a938 (anonymous namespace)::DAGCombiner::visitSTORE(llvm::SDNode*) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:21563:3
#<!-- -->15 0x00007bbb4f41073b combine /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2004:8
#<!-- -->16 0x00007bbb4f41073b (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1998:9
#<!-- -->17 0x00007bbb4f411f88 Run /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1782:25
#<!-- -->18 0x00007bbb4f411f88 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults*, llvm::CodeGenOptLevel) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:28704:39
#<!-- -->19 0x00007bbb4f63126c llvm::TimeRegion::~TimeRegion() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Timer.h:155:9
#<!-- -->20 0x00007bbb4f63126c llvm::NamedRegionTimer::~NamedRegionTimer() /home/alexrp/Source/llvm-project/llvm/include/llvm/Support/Timer.h:163:8
#<!-- -->21 0x00007bbb4f63126c llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:932:3
#<!-- -->22 0x00007bbb4f635d00 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&amp;) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1868:33
#<!-- -->23 0x00007bbb4f6375dc llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:632:22
#<!-- -->24 0x00007bbb521dd5e4 llvm::HexagonDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) /home/alexrp/Source/llvm-project/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.h:47:17
#<!-- -->25 0x00007bbb4f622b57 llvm::OptLevelChanger::~OptLevelChanger() /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:268:11
#<!-- -->26 0x00007bbb4f622b57 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&amp;) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:375:1
#<!-- -->27 0x00007bbb4f622b57 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&amp;) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:346:6
#<!-- -->28 0x00007bbb4ef96fdf llvm::MachineFunctionPass::runOnFunction(llvm::Function&amp;) (.part.0) /home/alexrp/Source/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:94:33
#<!-- -->29 0x00007bbb4ec0d807 llvm::FPPassManager::runOnFunction(llvm::Function&amp;) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1450:7
#<!-- -->30 0x00007bbb4ec0da41 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
#<!-- -->31 0x00007bbb4ec0da41 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
#<!-- -->32 0x00007bbb4ec0da41 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
#<!-- -->33 0x00007bbb4ec0da41 llvm::FPPassManager::runOnModule(llvm::Module&amp;) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1485:22
#<!-- -->34 0x00007bbb4ec0e2c4 runOnModule /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1562:7
#<!-- -->35 0x00007bbb4ec0e2c4 llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) /home/alexrp/Source/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:541:55
#<!-- -->36 0x00005e9428cf5a3c compileModule(char**, llvm::LLVMContext&amp;) /home/alexrp/Source/llvm-project/llvm/tools/llc/llc.cpp:742:34
#<!-- -->37 0x00005e9428ce9f77 main /home/alexrp/Source/llvm-project/llvm/tools/llc/llc.cpp:409:35
#<!-- -->38 0x00007bbb4d428150 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#<!-- -->39 0x00007bbb4d428209 call_init ./csu/../csu/libc-start.c:128:20
#<!-- -->40 0x00007bbb4d428209 __libc_start_main ./csu/../csu/libc-start.c:347:5
#<!-- -->41 0x00005e9428ceacf5 _start (/opt/llvm-19/bin/llc+0x13cf5)

@androm3da
Copy link
Member

This is apparently a regression.

This test would pass before 742fb8b.

iajbar added a commit to iajbar/llvm-project that referenced this issue Dec 20, 2024
The code was asserting because allowsMemoryAccess() was called with Extended
Value Type INVALID_SIMPLE_VALUE_TYPE in HexagonISelLowering.cpp.
Fixes llvm#118881
@iajbar iajbar closed this as completed in 8177bf5 Dec 20, 2024
@EugeneZelenko EugeneZelenko removed the llvm:SelectionDAG SelectionDAGISel as well label Dec 20, 2024
@androm3da
Copy link
Member

@alexrp do you want/need this and other bugs impacting zig cherry-picked to 19.x?

@alexrp
Copy link
Member Author

alexrp commented Dec 24, 2024

That would definitely be nice, although I'm not sure if they all fulfill the criteria for backporting.

@androm3da
Copy link
Member

/cherry-pick 8177bf5

@llvmbot
Copy link
Member

llvmbot commented Dec 24, 2024

/pull-request #121061

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] release:backport
Projects
Status: Needs Triage
Development

Successfully merging a pull request may close this issue.

5 participants