[PATCH] D54585: [TTI] Reduction costs only need to include a single extract element cost

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 15 09:10:38 PST 2018


RKSimon created this revision.
RKSimon added reviewers: ABataev, spatel, fhahn, craig.topper, javed.absar.
Herald added a subscriber: zzheng.

We were adding the entire scalarization extraction cost for reductions, which returns the total cost of extracting every element of a vector type.

For reductions we don't need to do this - we just need to extract the 0'th element after the reduction pattern has completed.

Fixes PR37731


Repository:
  rL LLVM

https://reviews.llvm.org/D54585

Files:
  include/llvm/CodeGen/BasicTTIImpl.h
  test/Analysis/CostModel/AArch64/vector-reduce.ll
  test/Analysis/CostModel/X86/reduce-add.ll
  test/Analysis/CostModel/X86/reduce-and.ll
  test/Analysis/CostModel/X86/reduce-mul.ll
  test/Analysis/CostModel/X86/reduce-or.ll
  test/Analysis/CostModel/X86/reduce-smax.ll
  test/Analysis/CostModel/X86/reduce-smin.ll
  test/Analysis/CostModel/X86/reduce-umax.ll
  test/Analysis/CostModel/X86/reduce-umin.ll
  test/Analysis/CostModel/X86/reduce-xor.ll
  test/Analysis/CostModel/X86/reduction.ll
  test/Transforms/SLPVectorizer/X86/horizontal-minmax.ll
  test/Transforms/SLPVectorizer/X86/reduction_unrolled.ll
  test/Transforms/SLPVectorizer/X86/remark_horcost.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54585.174223.patch
Type: text/x-patch
Size: 453300 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181115/b3496bb6/attachment-0001.bin>


More information about the llvm-commits mailing list