[all-commits] [llvm/llvm-project] 4ff4e7: [CostModel] Use cost of target trunc type when onl...

Andrew Litteken via All-commits all-commits at lists.llvm.org
Wed Jan 12 16:04:32 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4ff4e7ea3033e8a5f21c5cbc4028255c0b6bae9f
      https://github.com/llvm/llvm-project/commit/4ff4e7ea3033e8a5f21c5cbc4028255c0b6bae9f
  Author: Andrew Litteken <andrew.litteken at gmail.com>
  Date:   2022-01-12 (Wed, 12 Jan 2022)

  Changed paths:
    M llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
    A llvm/test/Analysis/CostModel/AArch64/load-to-trunc.ll
    A llvm/test/Analysis/CostModel/AMDGPU/load-to-trunc.ll
    A llvm/test/Analysis/CostModel/ARM/load-to-trunc.ll
    A llvm/test/Analysis/CostModel/PowerPC/load-to-trunc.ll
    A llvm/test/Analysis/CostModel/RISCV/load-to-trunc.ll
    A llvm/test/Analysis/CostModel/SystemZ/load-to-trunc.ll
    A llvm/test/Analysis/CostModel/X86/load-to-trunc.ll

  Log Message:
  -----------
  [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




More information about the All-commits mailing list