================
@@ -587,10 +648,20 @@ bool
MipsDelaySlotFiller::runOnMachineBasicBlock(MachineBasicBlock &MBB) {
if (!hasUnoccupiedSlot(&*I))
continue;
- // Delay slot filling is disabled at -O0, or in microMIPS32R6.
- if (!DisableDelaySlotFiller &&
- (TM->getOptLevel() != CodeGenOptLevel::None) &&
- !(InMicroMipsMode && STI.hasMips32r6())) {
+ // R5900 short loop erratum fix: skip delay slot filling for short backward
+ // loops to avoid triggering a hardware bug where short loops may exit
+ // early. The fix can be controlled with -mfix-r5900 / -mno-fix-r5900.
+ if (STI.fixR5900() && isR5900ShortLoopBranch(&*I, MBB)) {
+ LLVM_DEBUG(dbgs() << DEBUG_TYPE ": skipping delay slot fill for R5900 "
+ "short loop branch.\n");
+ ++R5900ShortLoopNops;
+ // Fall through to insert NOP in delay slot
----------------
rickgaiser wrote:
Yes, that would make the code better readable. I'll change this.
https://github.com/llvm/llvm-project/pull/176666
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits