[llvm] Fix assert in SlotIndexes::getInstructionIndex in debug builds (PR #189370)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 1 04:26:44 PDT 2026
================
@@ -1174,13 +1174,17 @@ void SIWholeQuadMode::toExact(MachineBasicBlock &MBB,
Register SaveWQM) {
assert(LiveMaskReg.isVirtual());
- bool IsTerminator = Before == MBB.end();
+ MachineBasicBlock::iterator 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);
- IsTerminator = BeforeIdx > FirstTermIdx;
+ if (FirstTerm != MBBE) {
+ MachineBasicBlock::iterator BeforeNonDbg = skipDebugInstructionsForward(Before, MBBE);
----------------
arsenm wrote:
Shouldn't need to introduce a new level of control nesting, unconditionally use skipDebugInstructionsForward above?
https://github.com/llvm/llvm-project/pull/189370
More information about the llvm-commits
mailing list