[PATCH] D100291: [AArch64] Use type-legalization cost for code size memop cost.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 12 02:22:49 PDT 2021


fhahn created this revision.
fhahn added reviewers: spatel, dmgreen, samparker, RKSimon.
Herald added subscribers: danielkiss, zzheng, hiraditya, kristof.beyls.
fhahn requested review of this revision.
Herald added a project: LLVM.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100291

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100291.336780.patch
Type: text/x-patch
Size: 10442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210412/92941a71/attachment.bin>


More information about the llvm-commits mailing list