[llvm] [SEH][CodeGen] Add test to track CFG optimization bug for SEH (PR #77441)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 9 02:48:01 PST 2024


HaohaiWen wrote:

```
$llc -mtriple=x86_64-pc-windows-msvc < llvm/test/CodeGen/X86/windows-seh-EHa-PreserveCFG.ll
        .text
        .def    @feat.00;
        .scl    3;
        .type   0;
        .endef
        .globl  @feat.00
.set @feat.00, 0
        .file   "<stdin>"
llc: /export/users2/haohaiwe/compilers/llvm-project/llvm/include/llvm/ADT/SmallVector.h:294: T& llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::operator[](llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::size_type) [with T =
LiveDebugValues::ValueIDNum; <template-parameter-1-2> = void; llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::reference = LiveDebugValues::ValueIDNum&; llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2> >::size_type = long unsigne
d int]: Assertion `idx < size()' 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 -mtriple=x86_64-pc-windows-msvc
1.      Running pass 'Function Pass Manager' on module '<stdin>'.
2.      Running pass 'Live DEBUG_VALUE analysis' on function '@main'
 #0 0x0000000001b056d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/Support/Unix/Signals.inc:727:3
 #1 0x0000000001b0318c llvm::sys::RunSignalHandlers() /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/Support/Signals.cpp:105:20
 #2 0x0000000001b034c6 SignalHandler(int) /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
 #3 0x00007fe7cc7b5db0 __restore_rt (/lib64/libc.so.6+0x59db0)
 #4 0x00007fe7cc80242c __pthread_kill_implementation (/lib64/libc.so.6+0xa642c)
 #5 0x00007fe7cc7b5d06 gsignal (/lib64/libc.so.6+0x59d06)
 #6 0x00007fe7cc7887d3 abort (/lib64/libc.so.6+0x2c7d3)
 #7 0x00007fe7cc7886fb _nl_load_domain.cold (/lib64/libc.so.6+0x2c6fb)
 #8 0x00007fe7cc7aec86 (/lib64/libc.so.6+0x52c86)
 #9 0x0000000001213b93 (/export/users2/haohaiwe/compilers/llvm-project/builds/bin/llc+0x1213b93)
#10 0x0000000001225b2b LiveDebugValues::MLocTracker::readMLoc(LiveDebugValues::LocIdx) /export/users2/haohaiwe/compilers/llvm-project/llvm/include/llvm/ADT/DenseMap.h:1278:5
#11 0x0000000001225b2b TransferTracker::transferMlocs(LiveDebugValues::LocIdx, LiveDebugValues::LocIdx, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>) /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefB
asedImpl.cpp:884:51
#12 0x0000000001231e3d operator() /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp:2058:32
#13 0x0000000001231e3d LiveDebugValues::InstrRefBasedLDV::transferSpillOrRestoreInst(llvm::MachineInstr&) (.part.0) /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp:2074:15
#14 0x00000000012448f3 LiveDebugValues::InstrRefBasedLDV::process(llvm::MachineInstr&, LiveDebugValues::FuncValueTable const*, LiveDebugValues::FuncValueTable const*) /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRe
fBasedImpl.cpp:2256:3
#15 0x00000000012448f3 LiveDebugValues::InstrRefBasedLDV::process(llvm::MachineInstr&, LiveDebugValues::FuncValueTable const*, LiveDebugValues::FuncValueTable const*) /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRe
fBasedImpl.cpp:2242:6
#16 0x0000000001244baa LiveDebugValues::InstrRefBasedLDV::depthFirstVLocAndEmit(unsigned int, llvm::DenseMap<llvm::LexicalScope const*, llvm::DILocation const*, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::Lexical
Scope const*, llvm::DILocation const*>> const&, llvm::DenseMap<llvm::LexicalScope const*, llvm::SmallSet<llvm::DebugVariable, 4u, std::less<llvm::DebugVariable>>, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::Lexic
alScope const*, llvm::SmallSet<llvm::DebugVariable, 4u, std::less<llvm::DebugVariable>>>> const&, llvm::DenseMap<llvm::LexicalScope const*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 4u>, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail
::DenseMapPair<llvm::LexicalScope const*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 4u>>>&, llvm::SmallVector<llvm::SmallVector<std::pair<llvm::DebugVariable, LiveDebugValues::DbgValue>, 8u>, 8u>&, LiveDebugValues::FuncValueTable&, LiveDebugValues::Fun
cValueTable&, llvm::SmallVectorImpl<LiveDebugValues::VLocTracker>&, llvm::MachineFunction&, llvm::DenseMap<llvm::DebugVariable, unsigned int, llvm::DenseMapInfo<llvm::DebugVariable, void>, llvm::detail::DenseMapPair<llvm::DebugVariable, unsigned int>>&,
llvm::TargetPassConfig const&)::'lambda'(llvm::MachineBasicBlock&)::operator()(llvm::MachineBasicBlock&) const /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp:3506:5
#17 0x0000000001245b68 llvm::SmallPtrSetIterator<llvm::MachineBasicBlock const*>::operator++() /export/users2/haohaiwe/compilers/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:296:5
#18 0x0000000001245b68 LiveDebugValues::InstrRefBasedLDV::depthFirstVLocAndEmit(unsigned int, llvm::DenseMap<llvm::LexicalScope const*, llvm::DILocation const*, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::Lexical
Scope const*, llvm::DILocation const*>> const&, llvm::DenseMap<llvm::LexicalScope const*, llvm::SmallSet<llvm::DebugVariable, 4u, std::less<llvm::DebugVariable>>, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::Lexic
alScope const*, llvm::SmallSet<llvm::DebugVariable, 4u, std::less<llvm::DebugVariable>>>> const&, llvm::DenseMap<llvm::LexicalScope const*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 4u>, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail
::DenseMapPair<llvm::LexicalScope const*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 4u>>>&, llvm::SmallVector<llvm::SmallVector<std::pair<llvm::DebugVariable, LiveDebugValues::DbgValue>, 8u>, 8u>&, LiveDebugValues::FuncValueTable&, LiveDebugValues::Fun
cValueTable&, llvm::SmallVectorImpl<LiveDebugValues::VLocTracker>&, llvm::MachineFunction&, llvm::DenseMap<llvm::DebugVariable, unsigned int, llvm::DenseMapInfo<llvm::DebugVariable, void>, llvm::detail::DenseMapPair<llvm::DebugVariable, unsigned int>>&,
llvm::TargetPassConfig const&) /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp:3571:30
#19 0x000000000124ad2c LiveDebugValues::InstrRefBasedLDV::ExtendRanges(llvm::MachineFunction&, llvm::MachineDominatorTree*, llvm::TargetPassConfig*, unsigned int, unsigned int) /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/CodeGen/LiveDebugValu
es/InstrRefBasedImpl.cpp:3786:36
#20 0x0000000000ef4397 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:93:33
#21 0x000000000143082e llvm::FPPassManager::runOnFunction(llvm::Function&) /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1453:7
#22 0x0000000001430a51 llvm::ilist_node_base<true>::getNext() const /export/users2/haohaiwe/compilers/llvm-project/llvm/include/llvm/ADT/ilist_node_base.h:43:45
#23 0x0000000001430a51 llvm::ilist_node_impl<llvm::ilist_detail::node_options<llvm::Function, true, false, void, false>>::getNext() /export/users2/haohaiwe/compilers/llvm-project/llvm/include/llvm/ADT/ilist_node.h:94:66
#24 0x0000000001430a51 llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Function, true, false, void, false>, false, false>::operator++() /export/users2/haohaiwe/compilers/llvm-project/llvm/include/llvm/ADT/ilist_iterator.h:157:25
#25 0x0000000001430a51 llvm::FPPassManager::runOnModule(llvm::Module&) /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1488:22
#26 0x000000000143129e runOnModule /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1565:7
#27 0x000000000143129e llvm::legacy::PassManagerImpl::run(llvm::Module&) /export/users2/haohaiwe/compilers/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:541:55
#28 0x00000000006c948d compileModule(char**, llvm::LLVMContext&) /export/users2/haohaiwe/compilers/llvm-project/llvm/tools/llc/llc.cpp:751:34
#29 0x0000000000652226 main /export/users2/haohaiwe/compilers/llvm-project/llvm/tools/llc/llc.cpp:425:35
#30 0x00007fe7cc7a0e50 __libc_start_call_main (/lib64/libc.so.6+0x44e50)
#31 0x00007fe7cc7a0efc __libc_start_main at GLIBC_2.2.5 (/lib64/libc.so.6+0x44efc)
#32 0x00000000006c09c5 _start (/export/users2/haohaiwe/compilers/llvm-project/builds/bin/llc+0x6c09c5)
Aborted (core dumped)

```

https://github.com/llvm/llvm-project/pull/77441


More information about the llvm-commits mailing list