[llvm] [RISCV] Fix crash when trying to remove segment (PR #146524)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 2 16:48:39 PDT 2025


================
@@ -1768,8 +1768,9 @@ void RISCVInsertVSETVLI::insertReadVL(MachineBasicBlock &MBB) {
           SlotIndex NewDefSI =
               LIS->InsertMachineInstrInMaps(*ReadVLMI).getRegSlot();
           LiveInterval &DefLI = LIS->getInterval(VLOutput);
-          VNInfo *DefVNI = DefLI.getVNInfoAt(DefLI.beginIndex());
-          DefLI.removeSegment(DefLI.beginIndex(), NewDefSI);
+          const auto *DefSeg = DefLI.getSegmentContaining(NewDefSI);
----------------
lukel97 wrote:

Nit

```suggestion
          LiveRange::Segment *DefSeg = DefLI.getSegmentContaining(NewDefSI);
```

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


More information about the llvm-commits mailing list