[PATCH] D71007: [ARM][LowOverheadLoops] Remove dead loop update instructions

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 05:11:37 PST 2019


SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: samparker, dmgreen, efriedma.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: LLVM.

After creating a low-overhead loop, the loop update instruction was still lingering around hurting performance. This removes dead loop update instructions (SUBS instructions).

To support this, some helper functions were added to MachineLoopUtils and ReachingDefAnalysis to analyse live-ins of loop exit blocks and find uses before a particular loop instruction, respectively.

This is a first version that removes a SUBS instruction when there are no other uses inside and outside the loop block, but there are some more interesting cases in `test/CodeGen/Thumb2/LowOverheadLoops/mve-tail-data-types.ll` which show that there is room for improvement. For example, we can't handle this case yet:

      
    ..
    dlstp.32  lr, r2
  .LBB0_1:
    mov r3, r2
    subs  r2, #4
    vldrh.u32 q2, [r1], #8
    vmov  q1, q0
    vmla.u32  q0, q2, r0
    letp  lr, .LBB0_1
  @ %bb.2:
    vctp.32 r3
    ..
      

which is a lot more tricky because `r2` is not only used by the `subs`, but also by the `mov` to `r3`, which is used outside the low-overhead loop by the `vctp` instruction.


https://reviews.llvm.org/D71007

Files:
  llvm/include/llvm/CodeGen/MachineLoopUtils.h
  llvm/include/llvm/CodeGen/ReachingDefAnalysis.h
  llvm/lib/CodeGen/MachineLoopUtils.cpp
  llvm/lib/CodeGen/ReachingDefAnalysis.cpp
  llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
  llvm/test/CodeGen/Thumb2/LowOverheadLoops/fast-fp-loops.ll
  llvm/test/CodeGen/Thumb2/LowOverheadLoops/mve-tail-data-types.ll
  llvm/test/CodeGen/Thumb2/LowOverheadLoops/vector-arith-codegen.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71007.232091.patch
Type: text/x-patch
Size: 10269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191204/24308f55/attachment.bin>


More information about the llvm-commits mailing list