[all-commits] [llvm/llvm-project] 18eef1: [X86][Costmodel] Fix `X86TTIImpl::getGSScalarCost()`

Roman Lebedev via All-commits all-commits at lists.llvm.org
Wed Oct 13 12:39:50 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 18eef13dad225e5064e1b37cfb39c4bfea988249
      https://github.com/llvm/llvm-project/commit/18eef13dad225e5064e1b37cfb39c4bfea988249
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-10-13 (Wed, 13 Oct 2021)

  Changed paths:
    M llvm/lib/Target/X86/X86TargetTransformInfo.cpp
    M llvm/test/Analysis/CostModel/X86/gather-i32-with-i8-index.ll
    M llvm/test/Analysis/CostModel/X86/gather-i64-with-i8-index.ll
    M llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll
    M llvm/test/Analysis/CostModel/X86/masked-gather-i32-with-i8-index.ll
    M llvm/test/Analysis/CostModel/X86/masked-intrinsic-cost-inseltpoison.ll
    M llvm/test/Analysis/CostModel/X86/masked-intrinsic-cost.ll
    M llvm/test/Analysis/CostModel/X86/masked-scatter-i32-with-i8-index.ll
    M llvm/test/Analysis/CostModel/X86/scatter-i32-with-i8-index.ll
    M llvm/test/Analysis/CostModel/X86/scatter-i64-with-i8-index.ll
    M llvm/test/Transforms/LoopVectorize/X86/gather_scatter.ll

  Log Message:
  -----------
  [X86][Costmodel] Fix `X86TTIImpl::getGSScalarCost()`

`X86TTIImpl::getGSScalarCost()` has (at least) two issues:
* it naively computes the cost of sequence of `insertelement`/`extractelement`.
  If we are operating not on the XMM (but YMM/ZMM),
  this widely overestimates the cost of subvector insertions/extractions.
* Gather/scatter takes a vector of pointers, and scalarization results in us performing
  scalar memory operation for each of these pointers, but we never account for the cost
  of extracting these pointers out of the vector of pointers.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D111222




More information about the All-commits mailing list