[PATCH] D70944: MipsDelaySlotFiller: Don't move BUNDLE instructions into the delay slot

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 01:01:26 PST 2019


arichardson created this revision.
arichardson added a reviewer: atanasyan.
Herald added subscribers: llvm-commits, jrtc27, hiraditya, sdardis.
Herald added a project: LLVM.
arichardson added a parent revision: D70940: Add debug output to MipsDelaySlotFiller pass.
arichardson added a child revision: D70945: Handle BUNDLE instructions in MipsAsmPrinter.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70944

Files:
  llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp
  llvm/test/CodeGen/Mips/delay-slot-filler-bundled-insts.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70944.231840.patch
Type: text/x-patch
Size: 5631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191203/54582b7e/attachment.bin>


More information about the llvm-commits mailing list