[all-commits] [llvm/llvm-project] b06c55: [X86][CostModel] Fix cost model for non-power-of-t...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Fri Apr 16 05:31:34 PDT 2021


  Branch: refs/heads/arcpatch-D100099
  Home:   https://github.com/llvm/llvm-project
  Commit: b06c55a6986e0e1d571663eec507664013b22f00
      https://github.com/llvm/llvm-project/commit/b06c55a6986e0e1d571663eec507664013b22f00
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-04-16 (Fri, 16 Apr 2021)

  Changed paths:
    M llvm/lib/Target/X86/X86TargetTransformInfo.cpp
    M llvm/test/Analysis/CostModel/X86/load_store.ll

  Log Message:
  -----------
  [X86][CostModel] Fix cost model for non-power-of-two vector load/stores

Sometimes LV has to produce really wide vectors,
and sometimes they end up being not powers of two.
As it can be seen from the diff, the cost computation
is currently completely non-sensical in those cases.

Instead of just scalarizing everything, split/factorize the wide vector
into a number of subvectors, each one having a power-of-two elements,
recurse to get the cost of op on this subvector. Also, check how we'd
legalize this subvector, and if the legalized type is scalar,
also account for the scalarization cost.

Note that for sub-vector loads, we might be able to do better,
when the vectors are properly aligned.

Reviewed By: RKSimon

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




More information about the All-commits mailing list