[llvm] Fix assert in SlotIndexes::getInstructionIndex in debug builds (PR #189370)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 30 06:12:40 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);
----------------
MarcoCastorina wrote:
Happy to change it, I was just reusing similar code from another method: https://github.com/llvm/llvm-project/pull/189370/changes?diff=split#diff-b92873bbd6b9a3411641ce2c44214e520b9c3683e4076426c3f2d8567db675c1R1109
https://github.com/llvm/llvm-project/pull/189370
More information about the llvm-commits
mailing list