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

Crash in PowerPC codegen caused by 4742715eb7fbd90b2d7ca807980bdca7e552fcd2 #70208

Closed
tstellar opened this issue Oct 25, 2023 · 9 comments · Fixed by llvm/llvm-project-release-prs#763

Comments

@tstellar
Copy link
Collaborator

4742715 introduced a regression in the PowerPC backend. To reproduce, run:

llc -O2 opencv-reduced.ll.txt -o /dev/null
opencv-reduced.ll.txt

Backtrace:

WidenVectorOperand op #0: t52: v2i64 = zero_extend_vector_inreg t50

Do not know how to widen this operator's operand!
UNREACHABLE executed at /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:5937!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llvm-build/bin/llc -O2 opencv-reduced.ll -o /dev/null
1.      Running pass 'Function Pass Manager' on module 'opencv-reduced.ll'.
2.      Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@widget'
 #0 0x00007f01c2e882c1 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/fedora/llvm-project/llvm/lib/Support/Unix/Signals.inc:606:3
 #1 0x00007f01c2e8624b llvm::sys::RunSignalHandlers() /home/fedora/llvm-project/llvm/lib/Support/Signals.cpp:104:20
 #2 0x00007f01c2e863a6 SignalHandler(int) /home/fedora/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
 #3 0x00007f01c205fb20 __restore_rt (/lib64/libc.so.6+0x3cb20)
 #4 0x00007f01c20afe8c __pthread_kill_implementation (/lib64/libc.so.6+0x8ce8c)
 #5 0x00007f01c205fa76 gsignal (/lib64/libc.so.6+0x3ca76)
 #6 0x00007f01c20497fc abort (/lib64/libc.so.6+0x267fc)
 #7 0x00007f01c2dc85ba (/home/fedora/llvm-project/llvm-build/bin/../lib/libLLVM-17git.so+0x7c85ba)
 #8 0x00007f01c386764c llvm::DAGTypeLegalizer::WidenVectorOperand(llvm::SDNode*, unsigned int) /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:5937:5
 #9 0x00007f01c3819596 llvm::DAGTypeLegalizer::run() /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:350:17
#10 0x00007f01c381a406 llvm::SelectionDAG::LegalizeTypes() /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:1059:10
#11 0x00007f01c3973d69 llvm::TimeRegion::~TimeRegion() /home/fedora/llvm-project/llvm/include/llvm/Support/Timer.h:155:9
#12 0x00007f01c3973d69 llvm::NamedRegionTimer::~NamedRegionTimer() /home/fedora/llvm-project/llvm/include/llvm/Support/Timer.h:163:8
#13 0x00007f01c3973d69 llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:808:3
#14 0x00007f01c3977f97 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1705:33
#15 0x00007f01c3979d43 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:483:22
#16 0x00007f01c57fa7f7 (anonymous namespace)::PPCDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/fedora/llvm-project/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:174:5
#17 0x00007f01c334544e llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) /home/fedora/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:91:33
#18 0x00007f01c300a265 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/fedora/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1445:7
#19 0x00007f01c300a451 llvm::ilist_node_base<true>::getNext() const /home/fedora/llvm-project/llvm/include/llvm/ADT/ilist_node_base.h:43:45
#20 0x00007f01c300a451 llvm::ilist_node_impl<llvm::ilist_detail::node_options<llvm::Function, true, false, void>>::getNext() /home/fedora/llvm-project/llvm/include/llvm/ADT/ilist_node.h:67:66
#21 0x00007f01c300a451 llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Function, true, false, void>, false, false>::operator++() /home/fedora/llvm-project/llvm/include/llvm/ADT/ilist_iterator.h:157:25
#22 0x00007f01c300a451 llvm::FPPassManager::runOnModule(llvm::Module&) /home/fedora/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1480:22
#23 0x00007f01c300ace4 runOnModule /home/fedora/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1557:7
#24 0x00007f01c300ace4 llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/fedora/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:535:55
#25 0x0000000000414fc5 compileModule(char**, llvm::LLVMContext&) /home/fedora/llvm-project/llvm/tools/llc/llc.cpp:759:66
#26 0x000000000040a4b7 main /home/fedora/llvm-project/llvm/tools/llc/llc.cpp:420:35
#27 0x00007f01c204a510 __libc_start_call_main (/lib64/libc.so.6+0x27510)
#28 0x00007f01c204a5c9 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x275c9)
#29 0x000000000040ae25 _start (llvm-build/bin/llc+0x40ae25)

@llvmbot
Copy link
Member

llvmbot commented Oct 25, 2023

@llvm/issue-subscribers-backend-powerpc

Author: Tom Stellard (tstellar)

4742715 introduced a regression in the PowerPC backend. To reproduce, run:

llc -O2 opencv-reduced.ll.txt -o /dev/null
opencv-reduced.ll.txt

Backtrace:

WidenVectorOperand op #<!-- -->0: t52: v2i64 = zero_extend_vector_inreg t50

Do not know how to widen this operator's operand!
UNREACHABLE executed at /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:5937!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llvm-build/bin/llc -O2 opencv-reduced.ll -o /dev/null
1.      Running pass 'Function Pass Manager' on module 'opencv-reduced.ll'.
2.      Running pass 'PowerPC DAG-&gt;DAG Pattern Instruction Selection' on function '@<!-- -->widget'
 #<!-- -->0 0x00007f01c2e882c1 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) /home/fedora/llvm-project/llvm/lib/Support/Unix/Signals.inc:606:3
 #<!-- -->1 0x00007f01c2e8624b llvm::sys::RunSignalHandlers() /home/fedora/llvm-project/llvm/lib/Support/Signals.cpp:104:20
 #<!-- -->2 0x00007f01c2e863a6 SignalHandler(int) /home/fedora/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
 #<!-- -->3 0x00007f01c205fb20 __restore_rt (/lib64/libc.so.6+0x3cb20)
 #<!-- -->4 0x00007f01c20afe8c __pthread_kill_implementation (/lib64/libc.so.6+0x8ce8c)
 #<!-- -->5 0x00007f01c205fa76 gsignal (/lib64/libc.so.6+0x3ca76)
 #<!-- -->6 0x00007f01c20497fc abort (/lib64/libc.so.6+0x267fc)
 #<!-- -->7 0x00007f01c2dc85ba (/home/fedora/llvm-project/llvm-build/bin/../lib/libLLVM-17git.so+0x7c85ba)
 #<!-- -->8 0x00007f01c386764c llvm::DAGTypeLegalizer::WidenVectorOperand(llvm::SDNode*, unsigned int) /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:5937:5
 #<!-- -->9 0x00007f01c3819596 llvm::DAGTypeLegalizer::run() /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:350:17
#<!-- -->10 0x00007f01c381a406 llvm::SelectionDAG::LegalizeTypes() /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:1059:10
#<!-- -->11 0x00007f01c3973d69 llvm::TimeRegion::~TimeRegion() /home/fedora/llvm-project/llvm/include/llvm/Support/Timer.h:155:9
#<!-- -->12 0x00007f01c3973d69 llvm::NamedRegionTimer::~NamedRegionTimer() /home/fedora/llvm-project/llvm/include/llvm/Support/Timer.h:163:8
#<!-- -->13 0x00007f01c3973d69 llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:808:3
#<!-- -->14 0x00007f01c3977f97 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&amp;) /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1705:33
#<!-- -->15 0x00007f01c3979d43 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) (.part.0) /home/fedora/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:483:22
#<!-- -->16 0x00007f01c57fa7f7 (anonymous namespace)::PPCDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) /home/fedora/llvm-project/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:174:5
#<!-- -->17 0x00007f01c334544e llvm::MachineFunctionPass::runOnFunction(llvm::Function&amp;) (.part.0) /home/fedora/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:91:33
#<!-- -->18 0x00007f01c300a265 llvm::FPPassManager::runOnFunction(llvm::Function&amp;) /home/fedora/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1445:7
#<!-- -->19 0x00007f01c300a451 llvm::ilist_node_base&lt;true&gt;::getNext() const /home/fedora/llvm-project/llvm/include/llvm/ADT/ilist_node_base.h:43:45
#<!-- -->20 0x00007f01c300a451 llvm::ilist_node_impl&lt;llvm::ilist_detail::node_options&lt;llvm::Function, true, false, void&gt;&gt;::getNext() /home/fedora/llvm-project/llvm/include/llvm/ADT/ilist_node.h:67:66
#<!-- -->21 0x00007f01c300a451 llvm::ilist_iterator&lt;llvm::ilist_detail::node_options&lt;llvm::Function, true, false, void&gt;, false, false&gt;::operator++() /home/fedora/llvm-project/llvm/include/llvm/ADT/ilist_iterator.h:157:25
#<!-- -->22 0x00007f01c300a451 llvm::FPPassManager::runOnModule(llvm::Module&amp;) /home/fedora/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1480:22
#<!-- -->23 0x00007f01c300ace4 runOnModule /home/fedora/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1557:7
#<!-- -->24 0x00007f01c300ace4 llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) /home/fedora/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:535:55
#<!-- -->25 0x0000000000414fc5 compileModule(char**, llvm::LLVMContext&amp;) /home/fedora/llvm-project/llvm/tools/llc/llc.cpp:759:66
#<!-- -->26 0x000000000040a4b7 main /home/fedora/llvm-project/llvm/tools/llc/llc.cpp:420:35
#<!-- -->27 0x00007f01c204a510 __libc_start_call_main (/lib64/libc.so.6+0x27510)
#<!-- -->28 0x00007f01c204a5c9 __libc_start_main@<!-- -->GLIBC_2.2.5 (/lib64/libc.so.6+0x275c9)
#<!-- -->29 0x000000000040ae25 _start (llvm-build/bin/llc+0x40ae25)

@tstellar tstellar added the llvm:SelectionDAG SelectionDAGISel as well label Oct 25, 2023
@RKSimon
Copy link
Collaborator

RKSimon commented Oct 25, 2023

Thanks @tstellar - I have a candidate fix, just trying to clean up the reduced test case

@RKSimon
Copy link
Collaborator

RKSimon commented Oct 25, 2023

@tstellar c9c9bf0 should address this in a reasonably self-contained manner - feel free to cherry pick if you're happy with it.

@RKSimon RKSimon removed their assignment Oct 25, 2023
@nikic
Copy link
Contributor

nikic commented Oct 30, 2023

/cherry-pick c9c9bf0

@llvmbot
Copy link
Member

llvmbot commented Oct 30, 2023

/branch llvm/llvm-project-release-prs/issue70208

@llvmbot
Copy link
Member

llvmbot commented Oct 30, 2023

/pull-request llvm/llvm-project-release-prs#759

@tru tru moved this from Needs Triage to Needs Review in LLVM Release Status Oct 31, 2023
nikic pushed a commit to nikic/llvm-project that referenced this issue Oct 31, 2023
@nikic
Copy link
Contributor

nikic commented Oct 31, 2023

/branch nikic/llvm-project/powerpc-backport-2

@llvmbot
Copy link
Member

llvmbot commented Oct 31, 2023

/pull-request llvm/llvm-project-release-prs#763

@tstellar
Copy link
Collaborator Author

tstellar commented Nov 3, 2023

I tested this with 373c343, and confirmed it fixes the original bug.

tru pushed a commit that referenced this issue Nov 13, 2023
@nikic nikic moved this from Needs Review to Done in LLVM Release Status Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
4 participants