Page MenuHomePhabricator

MipsDelaySlotFiller: Don't move BUNDLE instructions into the delay slot

Authored by arichardson on Dec 3 2019, 12:55 AM.



In our CHERI fork we use BUNDLE instructions to ensure that a
three-instruction sequence to generate a program-counter-relative value is
emitted without reordering or insertions (since that would break the 32-bit
offset computation). This sequence is created in MipsExpandPseudo and we use
finalizeBundle() to create the BUNDLE instruction.

However, the delay slot filler currently breaks this pattern since the BUNDLE
will be removed and so all instructions are moved into the delay slot.
Since the delay slot only executes the first instruction, this results in
incorrect computations (and run-time crashes) if the branch is taken.

The original test cases uses CHERI instructions, so for the test case here
I simple filled a BUNDLE with a no-op DADDiu $sp_64, -16 and DADDiu $sp_64, 16.

Diff Detail

Event Timeline

arichardson created this revision.Dec 3 2019, 12:55 AM

Build result: pass - 60402 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt, CMakeCache.txt

This revision is now accepted and ready to land.Dec 3 2019, 5:10 AM
Closed by commit rGb91f239485fb: MipsDelaySlotFiller: Don't move BUNDLE instructions into the delay slot (authored by Alex Richardson <>). · Explain WhyDec 4 2019, 3:39 AM
This revision was automatically updated to reflect the committed changes.