[all-commits] [llvm/llvm-project] b2ac96: [ARM] Alter t2DoLoopStart to define lr

David Green via All-commits all-commits at lists.llvm.org
Tue Nov 10 07:58:27 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b2ac9681a700c23508d44825d98467bcecaf2e92
      https://github.com/llvm/llvm-project/commit/b2ac9681a700c23508d44825d98467bcecaf2e92
  Author: David Green <david.green at arm.com>
  Date:   2020-11-10 (Tue, 10 Nov 2020)

  Changed paths:
    M llvm/docs/LangRef.rst
    M llvm/include/llvm/IR/Intrinsics.td
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/lib/CodeGen/HardwareLoops.cpp
    M llvm/lib/Target/ARM/ARMInstrThumb2.td
    M llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
    M llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
    M llvm/lib/Target/ARM/MVETailPredication.cpp
    M llvm/test/CodeGen/ARM/machine-outliner-unoutlinable.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/branch-targets.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/clear-maskedinsts.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/cmplx_cong.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/cond-mov.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/cond-vector-reduce-mve-codegen.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/ctlz-non-zeros.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/disjoint-vcmp.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/dont-ignore-vctp.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/dont-remove-loop-update.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/emptyblock.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/end-positive-offset.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/exitcount.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/extending-loads.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/extract-element.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/fast-fp-loops.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/incorrect-sub-16.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/incorrect-sub-32.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/incorrect-sub-8.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/inloop-vpnot-1.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/inloop-vpnot-2.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/inloop-vpnot-3.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/inloop-vpsel-1.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/inloop-vpsel-2.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/invariant-qreg.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/it-block-chain-store.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/it-block-chain.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/it-block-itercount.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/it-block-mov.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/it-block-random.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/iv-two-vcmp-reordered.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/iv-two-vcmp.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/iv-vcmp.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/livereg-no-loop-def.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/loop-dec-copy-chain.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/loop-dec-copy-prev-iteration.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/loop-dec-liveout.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/loop-guards.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/lstp-insertion-position.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/massive.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/matrix-debug.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/matrix.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/mov-after-dls.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/mov-after-dlstp.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/mov-lr-terminator.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/mov-operand.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/move-def-before-start.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/move-start-after-def.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/multi-block-cond-iter-count.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/multi-cond-iter-count.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/multiblock-massive.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/multiple-do-loops.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/mve-float-loops.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/mve-tail-data-types.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/nested.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/no-vpsel-liveout.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/non-masked-load.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/non-masked-store.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/predicated-invariant.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/reductions-vpt-liveout.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/reductions.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/remat-vctp.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/remove-elem-moves.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/revert-after-call.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/revert-after-read.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/revert-after-write.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/revert-non-header.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/safe-def-no-mov.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/safe-retaining.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/sibling-loops.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/size-limit.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/skip-debug.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/switch.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-basic.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-const.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-disabled-in-loloops.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-intrinsic-round.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-narrow.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-pattern-fail.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-reduce.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-widen.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/tp-multiple-vpst.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/unpredicated-max.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/unpredload.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/unrolled-and-vector.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/unsafe-cpsr-loop-def.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/unsafe-cpsr-loop-use.mir
    R llvm/test/CodeGen/Thumb2/LowOverheadLoops/unsafe-liveout.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/unsafe-retaining.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/unsafe-use-after.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/vaddv.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/varying-outer-2d-reduction.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/vcmp-vpst-combination.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/vctp-add-operand-liveout.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/vctp-in-vpt-2.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/vctp-in-vpt.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/vctp-subi3.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/vctp-subri.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/vctp-subri12.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/vctp16-reduce.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/vector-arith-codegen.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/vector-reduce-mve-tail.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/vector-unroll.ll
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/vpt-blocks.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/wrong-liveout-lsr-shift.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/wrong-vctp-opcode-liveout.mir
    M llvm/test/CodeGen/Thumb2/LowOverheadLoops/wrong-vctp-operand-liveout.mir
    M llvm/test/CodeGen/Thumb2/mve-float16regloops.ll
    M llvm/test/CodeGen/Thumb2/mve-float32regloops.ll
    M llvm/test/CodeGen/Thumb2/mve-fma-loops.ll
    M llvm/test/CodeGen/Thumb2/mve-fp16convertloops.ll
    M llvm/test/CodeGen/Thumb2/mve-gather-increment.ll
    M llvm/test/CodeGen/Thumb2/mve-gather-ptrs.ll
    M llvm/test/CodeGen/Thumb2/mve-gather-scatter-optimisation.ll
    M llvm/test/CodeGen/Thumb2/mve-gather-scatter-ptr-address.ll
    M llvm/test/CodeGen/Thumb2/mve-gather-scatter-tailpred.ll
    M llvm/test/CodeGen/Thumb2/mve-gather-tailpred.ll
    M llvm/test/CodeGen/Thumb2/mve-nounrolledremainder.ll
    M llvm/test/CodeGen/Thumb2/mve-postinc-dct.ll
    M llvm/test/CodeGen/Thumb2/mve-postinc-distribute.ll
    M llvm/test/CodeGen/Thumb2/mve-postinc-lsr.ll
    M llvm/test/CodeGen/Thumb2/mve-pred-threshold.ll
    M llvm/test/CodeGen/Thumb2/mve-pred-vctpvpsel.ll
    M llvm/test/CodeGen/Thumb2/mve-satmul-loops.ll
    M llvm/test/CodeGen/Thumb2/mve-scatter-increment.ll
    M llvm/test/CodeGen/Thumb2/mve-shifts-scalar.ll
    M llvm/test/CodeGen/Thumb2/mve-vecreduce-loops.ll
    M llvm/test/CodeGen/Thumb2/mve-vldshuffle.ll
    M llvm/test/CodeGen/Thumb2/mve-vldst4.ll
    M llvm/test/CodeGen/Thumb2/mve-vqdmulh.ll
    M llvm/test/Transforms/HardwareLoops/ARM/calls-codegen.ll
    M llvm/test/Transforms/HardwareLoops/ARM/calls.ll
    M llvm/test/Transforms/HardwareLoops/ARM/fp-emulation.ll
    M llvm/test/Transforms/HardwareLoops/ARM/simple-do.ll
    M llvm/test/Transforms/HardwareLoops/ARM/structure.ll
    M llvm/test/Transforms/HardwareLoops/loop-guards.ll
    M llvm/test/Transforms/HardwareLoops/scalar-while.ll

  Log Message:
  -----------
  [ARM] Alter t2DoLoopStart to define lr

This changes the definition of t2DoLoopStart from
t2DoLoopStart rGPR
to
GPRlr = t2DoLoopStart rGPR

This will hopefully mean that low overhead loops are more tied together,
and we can more reliably generate loops without reverting or being at
the whims of the register allocator.

This is a fairly simple change in itself, but leads to a number of other
required alterations.

 - The hardware loop pass, if UsePhi is set, now generates loops of the
   form:
       %start = llvm.start.loop.iterations(%N)
     loop:
       %p = phi [%start], [%dec]
       %dec = llvm.loop.decrement.reg(%p, 1)
       %c = icmp ne %dec, 0
       br %c, loop, exit
 - For this a new llvm.start.loop.iterations intrinsic was added, identical
   to llvm.set.loop.iterations but produces a value as seen above, gluing
   the loop together more through def-use chains.
 - This new instrinsic conceptually produces the same output as input,
   which is taught to SCEV so that the checks in MVETailPredication are not
   affected.
 - Some minor changes are needed to the ARMLowOverheadLoop pass, but it has
   been left mostly as before. We should now more reliably be able to tell
   that the t2DoLoopStart is correct without having to prove it, but
   t2WhileLoopStart and tail-predicated loops will remain the same.
 - And all the tests have been updated. There are a lot of them!

This patch on it's own might cause more trouble that it helps, with more
tail-predicated loops being reverted, but some additional patches can
hopefully improve upon that to get to something that is better overall.

Differential Revision: https://reviews.llvm.org/D89881




More information about the All-commits mailing list