[llvm] [AMDGPU] Fix end() iterator dereference in SILowerSGPRSpills (PR #88828)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 16 14:03:22 PDT 2024
================
@@ -278,7 +278,10 @@ void SILowerSGPRSpills::extendWWMVirtRegLiveness(MachineFunction &MF,
for (auto Reg : MFI->getSGPRSpillVGPRs()) {
for (MachineBasicBlock *SaveBlock : SaveBlocks) {
MachineBasicBlock::iterator InsertBefore = SaveBlock->begin();
- auto MIB = BuildMI(*SaveBlock, *InsertBefore, InsertBefore->getDebugLoc(),
+ DebugLoc DL = InsertBefore != SaveBlock->end()
+ ? InsertBefore->getDebugLoc()
+ : DebugLoc();
----------------
bcahoon wrote:
Thanks - findDebugLoc is much better.
https://github.com/llvm/llvm-project/pull/88828
More information about the llvm-commits
mailing list