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

[fuzz] Crash in LLVM via eval_ir_main, target-independent node not lowered #1776

Open
cdleary opened this issue Dec 8, 2024 · 2 comments
Open
Labels
fuzz jit waiting-on-llvm E.g. for fuzz bugs waiting for resolution of LLVM issues.

Comments

@cdleary
Copy link
Collaborator

cdleary commented Dec 8, 2024

Describe the bug

IR is here: sample.ir.txt
Testevector is here: testvector.pbtxt.txt

✓ /tmp/crashers-2024-12-07/95cce86e  cdleary@vision 10:18:10
$ /home/cdleary/.cache/bazel/_bazel_cdleary/e3482f322694a8d1a6845914a1a3d787/execroot/com_google_xls/bazel-out/k8-dbg/bin/xls/tools/eval_ir_main --testvector_textproto=./testvector.pbtxt --use_llvm_jit ./sample.ir --logtostderr
t776: ch = <<Deleted Node!>>
This target-independent node should have been selected!
UNREACHABLE executed at external/llvm-project/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp:1247!
Aborted

Expected behavior
No LLVM crash

Environment (this can be helpful for troubleshooting):

  • OS: Ubuntu 24.04.1 LTS

Additional context
Was fuzzing overnight after #1774

@allight
Copy link
Collaborator

allight commented Dec 19, 2024

Odd configuring msan removes the error (though that does actually change the code the jit creates so its not impossible that would be expected). Running with asan points at LLVM X86DAGToDAGISel as the allocator of that node.

This could be an llvm issue.

=================================================================
==3371915==ERROR: AddressSanitizer: use-after-poison on address 0x7d4b45e5a71c at pc 0x562956e26749 bp 0x7ffd1a242da0 sp 0x7ffd1a242d98
READ of size 4 at 0x7d4b45e5a71c thread T0
    #0 0x562956e26748 in getIROrder third_party/llvm/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:772:40
    #1 0x562956e26748 in (anonymous namespace)::RegReductionPQBase::getNodeOrdering(llvm::SUnit const*) const third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1804:27
    #2 0x562956e2c406 in (anonymous namespace)::src_ls_rr_sort::operator()(llvm::SUnit*, llvm::SUnit*) const third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:2658:26
    #3 0x562956e2c2e2 in popFromQueueImpl<(anonymous namespace)::src_ls_rr_sort> third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1853:9
    #4 0x562956e2c2e2 in llvm::SUnit* (anonymous namespace)::popFromQueue<(anonymous namespace)::src_ls_rr_sort>(std::__u::vector<llvm::SUnit*, std::__u::allocator<llvm::SUnit*>>&, (anonymous namespace)::src_ls_rr_sort&, llvm::ScheduleDAG*) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1871:10
    #5 0x562956e2c4db in (anonymous namespace)::RegReductionPriorityQueue<(anonymous namespace)::src_ls_rr_sort>::pop() third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1905:16
    #6 0x562956e1cc94 in (anonymous namespace)::ScheduleDAGRRList::PickNodeToScheduleBottomUp() third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1472:70
    #7 0x562956e1aaae in ListScheduleBottomUp third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1625:17
    #8 0x562956e1aaae in (anonymous namespace)::ScheduleDAGRRList::Schedule() third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:383:3
    #9 0x562956e30037 in llvm::ScheduleDAGSDNodes::Run(llvm::SelectionDAG*, llvm::MachineBasicBlock*) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp:64:3
    #10 0x562956dfdb44 in llvm::SelectionDAGISel::CodeGenAndEmitDAG() third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1135:16
    #11 0x562956dfb250 in llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true, llvm::BasicBlock>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true, llvm::BasicBlock>, false, true>, bool&) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:874:3
    #12 0x562956dfa88f in llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1897:7
    #13 0x562956df5dcb in llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:614:3
    #14 0x5629560fa5a5 in (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) third_party/llvm/llvm-project/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:189:32
    #15 0x562956df2d44 in llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:374:20
    #16 0x5629568daf48 in llvm::MachineFunctionPass::runOnFunction(llvm::Function&) third_party/llvm/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:94:13
    #17 0x562958bf0ea1 in llvm::FPPassManager::runOnFunction(llvm::Function&) third_party/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1406:27
    #18 0x562958bfb121 in llvm::FPPassManager::runOnModule(llvm::Module&) third_party/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1452:16
    #19 0x562958bf1a06 in runOnModule third_party/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1521:27
    #20 0x562958bf1a06 in llvm::legacy::PassManagerImpl::run(llvm::Module&) third_party/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:539:44
    #21 0x562958bfb88a in llvm::legacy::PassManager::run(llvm::Module&) third_party/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1648:14
    #22 0x562955ad84c9 in llvm::orc::SimpleCompiler::operator()(llvm::Module&) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp:50:8
    #23 0x562955b21103 in decltype(auto) llvm::orc::ThreadSafeModule::withModuleDo<llvm::orc::IRCompileLayer::IRCompiler&>(llvm::orc::IRCompileLayer::IRCompiler&) third_party/llvm/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h:136:12
    #24 0x562955b20c9f in llvm::orc::IRCompileLayer::emit(std::__u::unique_ptr<llvm::orc::MaterializationResponsibility, std::__u::default_delete<llvm::orc::MaterializationResponsibility>>, llvm::orc::ThreadSafeModule) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp:32:22
    #25 0x562955b21821 in llvm::orc::IRTransformLayer::emit(std::__u::unique_ptr<llvm::orc::MaterializationResponsibility, std::__u::default_delete<llvm::orc::MaterializationResponsibility>>, llvm::orc::ThreadSafeModule) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/IRTransformLayer.cpp:24:15
    #26 0x562955b25d76 in llvm::orc::BasicIRLayerMaterializationUnit::materialize(std::__u::unique_ptr<llvm::orc::MaterializationResponsibility, std::__u::default_delete<llvm::orc::MaterializationResponsibility>>) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Layer.cpp:158:5
    #27 0x562955aea971 in llvm::orc::MaterializationTask::run() third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:1584:39
    #28 0x562955b325a4 in llvm::orc::InPlaceTaskDispatcher::dispatch(std::__u::unique_ptr<llvm::orc::Task, std::__u::default_delete<llvm::orc::Task>>) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/TaskDispatch.cpp:23:68
    #29 0x562955adbc9b in llvm::orc::ExecutionSession::dispatchTask(std::__u::unique_ptr<llvm::orc::Task, std::__u::default_delete<llvm::orc::Task>>) third_party/llvm/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Core.h:1550:26
    #30 0x562955aec933 in llvm::orc::ExecutionSession::dispatchOutstandingMUs() third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:2174:5
    #31 0x562955aeffb4 in llvm::orc::ExecutionSession::OL_completeLookup(std::__u::unique_ptr<llvm::orc::InProgressLookupState, std::__u::default_delete<llvm::orc::InProgressLookupState>>, std::__u::shared_ptr<llvm::orc::AsynchronousSymbolQuery>, std::__u::function<void (llvm::DenseMap<llvm::orc::JITDylib*, llvm::DenseSet<llvm::orc::SymbolStringPtr, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>>, llvm::DenseMapInfo<llvm::orc::JITDylib*, void>, llvm::detail::DenseMapPair<llvm::orc::JITDylib*, llvm::DenseSet<llvm::orc::SymbolStringPtr, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>>>> const&)>) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:2793:3
    #32 0x562955b12383 in llvm::orc::InProgressFullLookupState::complete(std::__u::unique_ptr<llvm::orc::InProgressLookupState, std::__u::default_delete<llvm::orc::InProgressLookupState>>) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:578:8
    #33 0x562955adf258 in llvm::orc::ExecutionSession::OL_applyQueryPhase1(std::__u::unique_ptr<llvm::orc::InProgressLookupState, std::__u::default_delete<llvm::orc::InProgressLookupState>>, llvm::Error) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:2541:11
    #34 0x562955adb14b in llvm::orc::ExecutionSession::lookup(llvm::orc::LookupKind, std::__u::vector<std::__u::pair<llvm::orc::JITDylib*, llvm::orc::JITDylibLookupFlags>, std::__u::allocator<std::__u::pair<llvm::orc::JITDylib*, llvm::orc::JITDylibLookupFlags>>> const&, llvm::orc::SymbolLookupSet, llvm::orc::SymbolState, llvm::unique_function<void (llvm::Expected<llvm::DenseMap<llvm::orc::SymbolStringPtr, llvm::orc::ExecutorSymbolDef, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>, llvm::detail::DenseMapPair<llvm::orc::SymbolStringPtr, llvm::orc::ExecutorSymbolDef>>>)>, std::__u::function<void (llvm::DenseMap<llvm::orc::JITDylib*, llvm::DenseSet<llvm::orc::SymbolStringPtr, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>>, llvm::DenseMapInfo<llvm::orc::JITDylib*, void>, llvm::detail::DenseMapPair<llvm::orc::JITDylib*, llvm::DenseSet<llvm::orc::SymbolStringPtr, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>>>> const&)>) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:1814:3
    #35 0x562955aed0c5 in llvm::orc::ExecutionSession::lookup(std::__u::vector<std::__u::pair<llvm::orc::JITDylib*, llvm::orc::JITDylibLookupFlags>, std::__u::allocator<std::__u::pair<llvm::orc::JITDylib*, llvm::orc::JITDylibLookupFlags>>> const&, llvm::orc::SymbolLookupSet, llvm::orc::LookupKind, llvm::orc::SymbolState, std::__u::function<void (llvm::DenseMap<llvm::orc::JITDylib*, llvm::DenseSet<llvm::orc::SymbolStringPtr, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>>, llvm::DenseMapInfo<llvm::orc::JITDylib*, void>, llvm::detail::DenseMapPair<llvm::orc::JITDylib*, llvm::DenseSet<llvm::orc::SymbolStringPtr, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>>>> const&)>) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:1851:3
    #36 0x562955aed8c8 in llvm::orc::ExecutionSession::lookup(std::__u::vector<std::__u::pair<llvm::orc::JITDylib*, llvm::orc::JITDylibLookupFlags>, std::__u::allocator<std::__u::pair<llvm::orc::JITDylib*, llvm::orc::JITDylibLookupFlags>>> const&, llvm::orc::SymbolStringPtr, llvm::orc::SymbolState) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:1876:24
    #37 0x562955aedf76 in llvm::orc::ExecutionSession::lookup(llvm::ArrayRef<llvm::orc::JITDylib*>, llvm::orc::SymbolStringPtr, llvm::orc::SymbolState) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:1888:10
    #38 0x562955aee181 in llvm::orc::ExecutionSession::lookup(llvm::ArrayRef<llvm::orc::JITDylib*>, llvm::StringRef, llvm::orc::SymbolState) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:1894:10
    #39 0x562955acc813 in xls::OrcJit::LoadSymbol(std::__u::basic_string_view<char, std::__u::char_traits<char>>) third_party/xls/jit/orc_jit.cc:259:26
    #40 0x562955a4470e in xls::JittedFunctionBase::BuildInternal(xls::FunctionBase*, xls::JitBuilderContext&, bool) third_party/xls/jit/function_base_jit.cc:1336:5
    #41 0x562955a4d7f1 in xls::JittedFunctionBase::Build(xls::Function*, xls::LlvmCompiler&) third_party/xls/jit/function_base_jit.cc:1402:10
    #42 0x562955a369ae in xls::FunctionJit::CreateInternal(xls::Function*, long, bool, xls::JitObserver*) third_party/xls/jit/function_jit.cc:160:3
    #43 0x562955a3649d in xls::FunctionJit::Create(xls::Function*, long, bool, xls::JitObserver*) third_party/xls/jit/function_jit.cc:100:10
    #44 0x5629552a7d20 in xls::(anonymous namespace)::Eval(xls::Function*, absl::Span<xls::(anonymous namespace)::ArgSet const>, bool, std::__u::optional<xls::EvaluationObserver*>, std::__u::basic_string_view<char, std::__u::char_traits<char>>, std::__u::basic_string_view<char, std::__u::char_traits<char>>) third_party/xls/tools/eval_ir_main.cc:381:5
    #45 0x562955293dd2 in Run third_party/xls/tools/eval_ir_main.cc:509:3
    #46 0x562955293dd2 in xls::(anonymous namespace)::RealMain(std::__u::basic_string_view<char, std::__u::char_traits<char>>, std::__u::basic_string_view<char, std::__u::char_traits<char>>, absl::Span<std::__u::filesystem::path const>) third_party/xls/tools/eval_ir_main.cc:764:10
    #47 0x562955290b1b in main third_party/xls/tools/eval_ir_main.cc:792:7
    #48 0x7f3b4676b3d3 in __libc_start_main (/usr/grte/v5/lib64/libc.so.6+0x613d3) (BuildId: 9a996398ce14a94560b0c642eb4f6e94)
    #49 0x5629551b2329 in _start /usr/grte/v5/debug-src/src/csu/../sysdeps/x86_64/start.S:120

0x7d4b45e5a71c is located 2588 bytes inside of 4096-byte region [0x7d4b45e59d00,0x7d4b45e5ad00)
allocated by thread T0 here:
    #0 0x56295528c5c2 in operator new(unsigned long, std::align_val_t) third_party/llvm/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:98:3
    #1 0x562958ec07a8 in llvm::allocate_buffer(unsigned long, unsigned long) third_party/llvm/llvm-project/llvm/lib/Support/MemAlloc.cpp:16:10
    #2 0x562955b1ead7 in Allocate third_party/llvm/llvm-project/llvm/include/llvm/Support/AllocatorBase.h:92:12
    #3 0x562955b1ead7 in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::StartNewSlab() third_party/llvm/llvm-project/llvm/include/llvm/Support/Allocator.h:346:42
    #4 0x562955b1e91b in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::AllocateSlow(unsigned long, unsigned long, llvm::Align) third_party/llvm/llvm-project/llvm/include/llvm/Support/Allocator.h:202:5
    #5 0x562955b1e753 in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::Allocate(unsigned long, llvm::Align) third_party/llvm/llvm-project/llvm/include/llvm/Support/Allocator.h:178:12
    #6 0x562956d2686f in Allocate third_party/llvm/llvm-project/llvm/include/llvm/Support/Allocator.h:216:12
    #7 0x562956d2686f in Allocate<llvm::StoreSDNode, llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096UL, 4096UL, 128UL> > third_party/llvm/llvm-project/llvm/include/llvm/Support/Recycler.h:89:57
    #8 0x562956d2686f in Allocate<llvm::StoreSDNode> third_party/llvm/llvm-project/llvm/include/llvm/Support/RecyclingAllocator.h:43:47
    #9 0x562956d2686f in llvm::StoreSDNode* llvm::SelectionDAG::newSDNode<llvm::StoreSDNode, unsigned int, llvm::DebugLoc const&, llvm::SDVTList&, llvm::ISD::MemIndexedMode, bool, llvm::EVT&, llvm::MachineMemOperand*&>(unsigned int&&, llvm::DebugLoc const&, llvm::SDVTList&, llvm::ISD::MemIndexedMode&&, bool&&, llvm::EVT&, llvm::MachineMemOperand*&) third_party/llvm/llvm-project/llvm/include/llvm/CodeGen/SelectionDAG.h:413:40
    #10 0x562956d26315 in llvm::SelectionDAG::getStore(llvm::SDValue, llvm::SDLoc const&, llvm::SDValue, llvm::SDValue, llvm::MachineMemOperand*) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:9277:13
    #11 0x562956d2593a in llvm::SelectionDAG::getStore(llvm::SDValue, llvm::SDLoc const&, llvm::SDValue, llvm::SDValue, llvm::MachinePointerInfo, llvm::Align, llvm::MachineMemOperand::Flags, llvm::AAMDNodes const&) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:9254:10
    #12 0x562956d74736 in llvm::SelectionDAGBuilder::visitStore(llvm::StoreInst const&) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:4777:13
    #13 0x562956d6ab12 in llvm::SelectionDAGBuilder::visit(unsigned int, llvm::User const&) third_party/llvm/llvm-project/llvm/include/llvm/IR/Instruction.def:173:1
    #14 0x562956d697eb in llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:1341:3
    #15 0x562956dfb0a8 in llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true, llvm::BasicBlock>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true, llvm::BasicBlock>, false, true>, bool&) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:862:12
    #16 0x562956dfa88f in llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1897:7
    #17 0x562956df5dcb in llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:614:3
    #18 0x5629560fa5a5 in (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) third_party/llvm/llvm-project/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:189:32
    #19 0x562956df2d44 in llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:374:20
    #20 0x5629568daf48 in llvm::MachineFunctionPass::runOnFunction(llvm::Function&) third_party/llvm/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:94:13
    #21 0x562958bf0ea1 in llvm::FPPassManager::runOnFunction(llvm::Function&) third_party/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1406:27
    #22 0x562958bfb121 in llvm::FPPassManager::runOnModule(llvm::Module&) third_party/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1452:16
    #23 0x562958bf1a06 in runOnModule third_party/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1521:27
    #24 0x562958bf1a06 in llvm::legacy::PassManagerImpl::run(llvm::Module&) third_party/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:539:44
    #25 0x562958bfb88a in llvm::legacy::PassManager::run(llvm::Module&) third_party/llvm/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1648:14
    #26 0x562955ad84c9 in llvm::orc::SimpleCompiler::operator()(llvm::Module&) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp:50:8
    #27 0x562955b21103 in decltype(auto) llvm::orc::ThreadSafeModule::withModuleDo<llvm::orc::IRCompileLayer::IRCompiler&>(llvm::orc::IRCompileLayer::IRCompiler&) third_party/llvm/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h:136:12
    #28 0x562955b20c9f in llvm::orc::IRCompileLayer::emit(std::__u::unique_ptr<llvm::orc::MaterializationResponsibility, std::__u::default_delete<llvm::orc::MaterializationResponsibility>>, llvm::orc::ThreadSafeModule) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp:32:22
    #29 0x562955b21821 in llvm::orc::IRTransformLayer::emit(std::__u::unique_ptr<llvm::orc::MaterializationResponsibility, std::__u::default_delete<llvm::orc::MaterializationResponsibility>>, llvm::orc::ThreadSafeModule) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/IRTransformLayer.cpp:24:15
    #30 0x562955b25d76 in llvm::orc::BasicIRLayerMaterializationUnit::materialize(std::__u::unique_ptr<llvm::orc::MaterializationResponsibility, std::__u::default_delete<llvm::orc::MaterializationResponsibility>>) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Layer.cpp:158:5
    #31 0x562955aea971 in llvm::orc::MaterializationTask::run() third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:1584:39
    #32 0x562955b325a4 in llvm::orc::InPlaceTaskDispatcher::dispatch(std::__u::unique_ptr<llvm::orc::Task, std::__u::default_delete<llvm::orc::Task>>) third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/TaskDispatch.cpp:23:68
    #33 0x562955adbc9b in llvm::orc::ExecutionSession::dispatchTask(std::__u::unique_ptr<llvm::orc::Task, std::__u::default_delete<llvm::orc::Task>>) third_party/llvm/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Core.h:1550:26
    #34 0x562955aec933 in llvm::orc::ExecutionSession::dispatchOutstandingMUs() third_party/llvm/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:2174:5

@allight
Copy link
Collaborator

allight commented Dec 19, 2024

Yeah it seems to be an llvm bug in -O3 x64 codegen. I'll file a bug.

[1] % blaze run //third_party/xls/jit:aot_compiler_main -- --output_llvm_ir /tmp/sample.ir.ll --input $HOME/Downloads/sample.ir.txt --llvm_opt_level=0

[0] % blaze run //third_party/llvm/llvm-project/llvm:opt -- /tmp/sample.ir.ll -o /tmp/sample.ir.opt.ll -O3

[0] % blaze run //third_party/llvm/llvm-project/llvm:llc -- /tmp/sample.ir.opt.ll -o /tmp/a.out -O3
t802: ch = <<Deleted Node!>>
This target-independent node should have been selected!
UNREACHABLE executed at third_party/llvm/llvm-project/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp:1247!
PLEASE submit a bug report to http://go/llvm-crash-bug and include the crash backtrace.
Stack dump:
0.	Program arguments: /.../blaze-out/k8-fastbuild/bin/third_party/llvm/llvm-project/llvm/llc /tmp/sample.ir.opt.ll -o /tmp/a.out -O3
1.	Running pass 'Function Pass Manager' on module '/tmp/sample.ir.opt.ll'.
2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@____sample__main_partition_0'
[1]    3499202 IOT instruction  blaze run //third_party/llvm/llvm-project/llvm:llc -- /tmp/sample.ir.opt.ll -

sample.ir.ll

copybara-service bot pushed a commit that referenced this issue Dec 19, 2024
This can be useful if the llvm optimizer is crashing to aid in debugging.

Bug: #1776
PiperOrigin-RevId: 707988660
@allight allight added the waiting-on-llvm E.g. for fuzz bugs waiting for resolution of LLVM issues. label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fuzz jit waiting-on-llvm E.g. for fuzz bugs waiting for resolution of LLVM issues.
Projects
None yet
Development

No branches or pull requests

2 participants