[LoopUnroll] Adjust CostKind query
authorSam Parker <sam.parker@arm.com>
Tue, 11 Aug 2020 13:19:35 +0000 (14:19 +0100)
committerSam Parker <sam.parker@arm.com>
Wed, 12 Aug 2020 11:56:09 +0000 (12:56 +0100)
commitea8448e3618a1581b5eca39d39bedaa55fede75d
tree64af4c5ae30563c1c856a08820d33471c7d708c6
parentcff880b0c9a07ff8275e91982c0d6e2293b537e7
[LoopUnroll] Adjust CostKind query

When TTI was updated to use an explicit cost, TCK_CodeSize was used
although the default implicit cost would have been the hand-wavey
cost of size and latency. So, revert back to this behaviour. This is
not expected to have (much) impact on targets since most (all?) of
them return the same value for SizeAndLatency and CodeSize.

When optimising for size, the logic has been changed to query
CodeSize costs instead of SizeAndLatency.

This patch also adds a testing option in the unroller so that
OptSize thresholds can be specified.

Differential Revision: https://reviews.llvm.org/D85723
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
llvm/test/Transforms/LoopUnroll/ARM/instr-size-costs.ll [new file with mode: 0644]
llvm/test/Transforms/LoopUnroll/ARM/unroll-optsize.ll [new file with mode: 0644]