[llvm] [AMDGPU] Fixed crash in getLastMIForRegion when the region is empty. (PR #168653)

Dhruva Chakrabarti via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 19 03:05:46 PST 2025


dhruvachak wrote:

For reference, here is the relevant part of the stack trace. 

```
llc: llvm-project/llvm/include/llvm/ADT/ilist_iterator.h:168: llvm::ilist_iterator<OptionsT, IsReverse, IsConst>::reference llvm::ilist_iterator<OptionsT, IsReverse, IsConst>::operator*() const [with OptionsT = llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void, false, void>; bool IsReverse = false; bool IsConst = false; llvm::ilist_iterator<OptionsT, IsReverse, IsConst>::reference = llvm::MachineInstr&]: Assertion `!NodePtr->isKnownSentinel()' failed.

#11 0x00007f14ff3b6a98 getLastMIForRegion(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>) GCNSchedStrategy.cpp:0:0
#12 0x00007f14ff3c402c llvm::GCNScheduleDAGMILive::getRegionLiveOutMap() const (lib/libLLVMAMDGPUCodeGen.so.22.0git+0x50202c)
#13 0x00007f14ff3c4415 llvm::RegionPressureMap::buildLiveRegMap() (lib/libLLVMAMDGPUCodeGen.so.22.0git+0x502415)
#14 0x00007f14ff3cc830 llvm::PreRARematStage::initGCNSchedStage() (lib/libLLVMAMDGPUCodeGen.so.22.0git+0x50a830)
#15 0x00007f14ff3c5868 llvm::GCNScheduleDAGMILive::runSchedStages() (lib/libLLVMAMDGPUCodeGen.so.22.0git+0x503868)
#16 0x00007f14fd20e54e llvm::impl_detail::MachineSchedulerImpl::run(llvm::MachineFunction&, llvm::TargetMachine const&, llvm::impl_detail::MachineSchedulerImpl::RequiredAnalyses const&) (lib/libLLVMCodeGen.so.22.0git+0x50654e)
#17 0x00007f14fd20f2c8 (anonymous namespace)::MachineSchedulerLegacy::runOnMachineFunction(llvm::MachineFunction&) MachineScheduler.cpp:0:0
#18 0x00007f14fd120d1b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
```

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


More information about the llvm-commits mailing list