[PATCH] D32422: LoopVectorizer: let target prefer scalar addressing computations (+ minor improvements in SystemZTTI)

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 04:53:40 PDT 2017


jonpa updated this revision to Diff 99270.
jonpa added a comment.
Herald added a subscriber: krytarowski.

(This patch also includes a modeling of costs of div by power of 2 for SystemZ, which is separate from the LoopVectorizer scalar addressing change.)

The scalar addressing generation is guarded by the target with a new hook: prefersVectorizedAddressing(), which defaults to true. Only SystemZ (which returns false), is affected by this patch.

A new set for each VF 'ForcedScalars' is used. The new code inserts address computing instructions here. This means that

- They are inserted into Scalars so that they get scalarized
- getInstructionCost() returns scalar cost * VF (scalarization overhead excluded)

I added a comment explaining that memory instructions bar the heuristic that at least one instruction must be vectorized in order to proceed with vectorization.

The search is done in setCostBasedWideningDecision(), because these instructions also include loads of addresses, and the widening of instruction of those loads must be set in that method.


https://reviews.llvm.org/D32422

Files:
  include/llvm/Analysis/TargetTransformInfo.h
  include/llvm/Analysis/TargetTransformInfoImpl.h
  lib/Analysis/TargetTransformInfo.cpp
  lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
  lib/Target/SystemZ/SystemZTargetTransformInfo.h
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Analysis/CostModel/SystemZ/div-pow2.ll
  test/Transforms/LoopVectorize/SystemZ/addressing.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32422.99270.patch
Type: text/x-patch
Size: 18002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170517/96e7df8f/attachment.bin>


More information about the llvm-commits mailing list