[llvm] Fix assert in SlotIndexes::getInstructionIndex in debug builds (PR #189370)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 30 06:02:32 PDT 2026


================
@@ -1174,12 +1174,15 @@ void SIWholeQuadMode::toExact(MachineBasicBlock &MBB,
                               Register SaveWQM) {
   assert(LiveMaskReg.isVirtual());
 
-  bool IsTerminator = Before == MBB.end();
+  auto MBBE = MBB.end();
+  bool IsTerminator = Before == MBBE;
   if (!IsTerminator) {
     auto FirstTerm = MBB.getFirstTerminator();
-    if (FirstTerm != MBB.end()) {
-      SlotIndex FirstTermIdx = LIS->getInstructionIndex(*FirstTerm);
-      SlotIndex BeforeIdx = LIS->getInstructionIndex(*Before);
+    auto FirstNonDbg = skipDebugInstructionsForward(FirstTerm, MBBE);
+    if (FirstNonDbg != MBBE) {
+      auto BeforeNonDbg = skipDebugInstructionsForward(Before, MBBE);
----------------
arsenm wrote:

No auto 

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


More information about the llvm-commits mailing list