[CostModel] Use cost of target trunc type when only it is the only use of a non-regis...
authorAndrew Litteken <andrew.litteken@gmail.com>
Thu, 6 Jan 2022 21:34:44 +0000 (15:34 -0600)
committerAndrew Litteken <andrew.litteken@gmail.com>
Thu, 13 Jan 2022 00:03:50 +0000 (18:03 -0600)
commit4ff4e7ea3033e8a5f21c5cbc4028255c0b6bae9f
treebbdaaa1eb925c0109f9b54aec8825af01cdc0841
parent0e811d3b66ff85c13629d80c483c5d706eb4d15f
[CostModel] Use cost of target trunc type when only it is the only use of a non-register sized load

The code size cost model for most targets uses the legalization cost for the type of the pointer of a load. If this load is followed directly by a trunc instruction, and is the only use of the result of the load, only one instruction is generated in the target assembly language. This adds a check for this case, and uses the target type of the trunc instruction if so.

This did not show any changes in CTMark code size benchmarks.

Reviewers: paquette, samparker, dmgreen

Differential Revision: https://reviews.llvm.org/D109388
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/test/Analysis/CostModel/AArch64/load-to-trunc.ll [new file with mode: 0644]
llvm/test/Analysis/CostModel/AMDGPU/load-to-trunc.ll [new file with mode: 0644]
llvm/test/Analysis/CostModel/ARM/load-to-trunc.ll [new file with mode: 0644]
llvm/test/Analysis/CostModel/PowerPC/load-to-trunc.ll [new file with mode: 0644]
llvm/test/Analysis/CostModel/RISCV/load-to-trunc.ll [new file with mode: 0644]
llvm/test/Analysis/CostModel/SystemZ/load-to-trunc.ll [new file with mode: 0644]
llvm/test/Analysis/CostModel/X86/load-to-trunc.ll [new file with mode: 0644]