[PATCH] D78216: [TTI] Add DemandedElts to getScalarizationOverhead

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 09:17:02 PDT 2020


RKSimon created this revision.
RKSimon added reviewers: craig.topper, ABataev, andreadb, spatel, lebedev.ri, thakis, vdmitrie.
Herald added a subscriber: hiraditya.
Herald added a reviewer: ctetreau.
Herald added a project: LLVM.

The improvements to the x86 vector insert/extract element costs in D74976 <https://reviews.llvm.org/D74976> resulted in the estimated costs for vector initialization and scalarization increasing higher than should be expected. This is particularly noticeable on pre-SSE4 targets where the available of legal INSERT_VECTOR_ELT ops is more limited.

This patch does 2 things:
1 - it implements X86TTIImpl::getScalarizationOverhead to more accurately represent the typical costs of a ISD::BUILD_VECTOR pattern.
2 - it adds a DemandedElts mask to getScalarizationOverhead to permit the SLP's BoUpSLP::getGatherCost to be rewritten to use it directly instead of accumulating raw vector insertion costs.

This fixes PR45418 where a v4i8 (zext'd to v4i32) was no longer vectorizing.

A future patch should extend X86TTIImpl::getScalarizationOverhead to tweak the EXTRACT_VECTOR_ELT scalarization costs as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78216

Files:
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/include/llvm/CodeGen/BasicTTIImpl.h
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp
  llvm/lib/Target/Hexagon/HexagonTargetTransformInfo.h
  llvm/lib/Target/X86/X86TargetTransformInfo.cpp
  llvm/lib/Target/X86/X86TargetTransformInfo.h
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
  llvm/test/Analysis/CostModel/X86/arith-fp.ll
  llvm/test/Analysis/CostModel/X86/fptosi.ll
  llvm/test/Analysis/CostModel/X86/fptoui.ll
  llvm/test/Analysis/CostModel/X86/fround.ll
  llvm/test/Analysis/CostModel/X86/intrinsic-cost.ll
  llvm/test/Analysis/CostModel/X86/load_store.ll
  llvm/test/Analysis/CostModel/X86/masked-intrinsic-cost.ll
  llvm/test/Analysis/CostModel/X86/sitofp.ll
  llvm/test/Transforms/SLPVectorizer/X86/minimum-sizes.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78216.257745.patch
Type: text/x-patch
Size: 73080 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/364bb0a8/attachment-0001.bin>


More information about the llvm-commits mailing list