[PATCH] D53865: [LoopVectorizer] Improve computation of scalarization overhead.

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 05:12:21 PDT 2018


jonpa created this revision.
jonpa added reviewers: uweigand, hfinkel, fhahn.
Herald added subscribers: jsji, kbarton, aheejin, jgravelle-google, sbc100, javed.absar, nhaehnle, jvesely, nemanjai, dschuff, arsenm, jholewinski.

I found loops that got a much overestimated costs of vectorization where two instructions were both scalarized. Since one was using the result of the other, the defining instruction does not need to do the inserts, and the user does not have to extract any elements.

I experimented with this patch that makes the LoopVectorizer collect any instructions that the target will scalarize (expand). This is then used to find these cases and passed (eventually) to getScalarizationOverhead() which then returns a reduced value.

I found so far in practice on SystemZ that this amounts to more float loops being vectorized, typically with the only benefit being vectorized memory operations. I am not sure hos beneficial this is.

This should easily be usable by other targets also, but sofar this is SystemZ only.

Is this useful enough to include in the loop vectorizer?


https://reviews.llvm.org/D53865

Files:
  include/llvm/Analysis/TargetTransformInfo.h
  include/llvm/Analysis/TargetTransformInfoImpl.h
  include/llvm/CodeGen/BasicTTIImpl.h
  lib/Analysis/TargetTransformInfo.cpp
  lib/Target/AArch64/AArch64TargetTransformInfo.cpp
  lib/Target/AArch64/AArch64TargetTransformInfo.h
  lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
  lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
  lib/Target/ARM/ARMTargetTransformInfo.cpp
  lib/Target/ARM/ARMTargetTransformInfo.h
  lib/Target/Hexagon/HexagonTargetTransformInfo.cpp
  lib/Target/Hexagon/HexagonTargetTransformInfo.h
  lib/Target/Lanai/LanaiTargetTransformInfo.h
  lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
  lib/Target/NVPTX/NVPTXTargetTransformInfo.h
  lib/Target/PowerPC/PPCTargetTransformInfo.cpp
  lib/Target/PowerPC/PPCTargetTransformInfo.h
  lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
  lib/Target/SystemZ/SystemZTargetTransformInfo.h
  lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
  lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
  lib/Target/X86/X86TargetTransformInfo.cpp
  lib/Target/X86/X86TargetTransformInfo.h
  lib/Transforms/Vectorize/LoopVectorize.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53865.171674.patch
Type: text/x-patch
Size: 46365 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/9e5e55bd/attachment.bin>


More information about the llvm-commits mailing list