[all-commits] [llvm/llvm-project] acd9cc: [AArch64] Use type-legalization cost for code size...

Florian Hahn via All-commits all-commits at lists.llvm.org
Thu Apr 15 02:11:34 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: acd9cc74957ba63967015946fc3349988ab200b1
      https://github.com/llvm/llvm-project/commit/acd9cc74957ba63967015946fc3349988ab200b1
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2021-04-15 (Thu, 15 Apr 2021)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
    M llvm/test/Analysis/CostModel/AArch64/store.ll
    M llvm/test/Transforms/LoopUnroll/AArch64/large-vector-ops.ll

  Log Message:
  -----------
  [AArch64] Use type-legalization cost for code size memop cost.

At the moment, getMemoryOpCost returns 1 for all inputs if CostKind is
CodeSize or SizeAndLatency. This fools LoopUnroll into thinking memory
operations on large vectors have a cost of one, even if they will get
expanded to a large number of memory operations in the backend.

This patch updates getMemoryOpCost to return the cost for the type
legalization for both CodeSize and SizeAndLatency. This should more
accurately reflect the number of memory operations required.

I am not sure how latency should properly be included in SizeAndLatency
from the description, but returning the size cost should be clearly more
accurate.

This does not cause any binary changes when building
MultiSource/SPEC2000/SPEC2006 with -O3 -flto for AArch64, likely because
large vector memops are not really formed by code emitted from Clang.
But using the C/C++ matrix extension can easily result in code with very
large vector operations directly from Clang, e.g.
https://clang.godbolt.org/z/6xzxcTGvb

Reviewed By: samparker

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




More information about the All-commits mailing list