Skip to content

Commit 0d44dea

Browse files
committed
Improve assert (and fix bug - FI needs to advance)
Covered by existings tests e.g. test/CodeGen/ARM/aes-erratum-fix.ll
1 parent c1ab54e commit 0d44dea

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/CodeGen/BranchFolding.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2091,12 +2091,14 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) {
20912091

20922092
// Get the next non-meta instruction in FBB.
20932093
FI = skipDebugInstructionsForward(FI, FE, false);
2094-
assert(FI != FE && "Expected non-debug lockstep");
2094+
assert(TI->isIdenticalTo(*FI, MachineInstr::CheckKillDead) &&
2095+
"Expected non-debug lockstep");
20952096

20962097
// Merge debug locs on hoisted instructions.
20972098
TI->setDebugLoc(
20982099
DILocation::getMergedLocation(TI->getDebugLoc(), FI->getDebugLoc()));
20992100
TI->moveBefore(&*Loc);
2101+
++FI;
21002102
}
21012103
}
21022104
FBB->erase(FBB->begin(), FIB);

0 commit comments

Comments
 (0)