[all-commits] [llvm/llvm-project] 7d82c9: [RISCV][TTI] Account for constant materialization ...

Philip Reames via All-commits all-commits at lists.llvm.org
Wed Nov 30 07:21:06 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7d82c99403f615f6236334e698720bf979959704
      https://github.com/llvm/llvm-project/commit/7d82c99403f615f6236334e698720bf979959704
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2022-11-30 (Wed, 30 Nov 2022)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/lib/Target/RISCV/RISCVISelLowering.h
    M llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
    M llvm/test/Analysis/CostModel/RISCV/arith-int.ll

  Log Message:
  -----------
  [RISCV][TTI] Account for constant materialization cost when costing arithmetic operations

At the IR level, we generally assume that constants are free to materialize. However, for RISCV due to some quirks of the ISA, materializing arbitrary constants can be rather expensive. We frequently fallback to constant pool loads.

We've been slowly moving in the direction of modeling the cost of the remat as part of the instruction cost. This has the effect of disincentivizing vectorization - mostly SLP - when we'd have to materialize an expensive constant.

We need better modeling of which constants are expensive and not, but the moment let's be consistent with how we model arithmetic and memory instructions. The difference between the two is that arithmetic can sometimes fold a splat operation which stores can not.

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




More information about the All-commits mailing list