[PATCH] D79100: [LV][TTI] Emit new IR intrinsic llvm.set.loop.elements

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 09:38:51 PDT 2020


SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: Ayal, fhahn, samparker, dmgreen, gilr.
Herald added subscribers: jdoerfert, rkruppe, hiraditya.
Herald added a reviewer: rengolin.
Herald added a project: LLVM.

Tail-predication is a new form of predication in MVE for vector loops that implicitely predicates the last vector loop iteration by implicitely setting active/inactive lanes, i.e. the tail loop is predicated. In order to set up a tail-predicated vector loop, we need to know the number of data elements processed by the vector loop, which corresponds the the tripcount of the scalar loop. We would like to propagate the scalar trip count to the backend, so that this can be picked up by the MVE tail-predication pass.

This follows the same approach as the generic HardwareLoop pass that communicates its information with IR intrinsics to target specific codegen passes. For example, it emits @llvm.set.loop.iterations which corresponds to the iteration count of the hardware loop. This change introduces @llvm.set.loop.elements, which similarly models the number of data elements processed by the vector/hardware loop.

The vectoriser emits this new intrinsic in the vector preheader block when new TII hook emitNumElementsVecLoop indicates that the target can lower this intrinsic and that it is desired to do so for this loop. For MVE, we do this when the loop is tail-folded, which is the very first step in tail-predicating a loop. For all the other targets, this intrinsic won't be emited as the default of the hook is of course not to do this.

This change will be followed up by MVE specific changes to lower this intrinsics.


https://reviews.llvm.org/D79100

Files:
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/include/llvm/CodeGen/BasicTTIImpl.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
  llvm/lib/Target/ARM/ARMTargetTransformInfo.h
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/ARM/tail-folding-counting-down.ll
  llvm/test/Transforms/LoopVectorize/ARM/tail-loop-folding.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79100.260940.patch
Type: text/x-patch
Size: 10509 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200429/323422a2/attachment-0001.bin>


More information about the llvm-commits mailing list