[llvm] [TTI] Support scalable offsets in getScalingFactorCost (PR #88113)

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 04:43:26 PDT 2024


davemgreen wrote:

Hi. An AddrMode should be thought of as a formula - a sum of factors that make up the addressing mode.
```
  /// This represents an addressing mode of:
  ///    BaseGV + BaseOffs + BaseReg + Scale*ScaleReg + ScalableOffset*vscale
  /// If BaseGV is null,  there is no BaseGV.
  /// If BaseOffs is zero, there is no base offset.
  /// If HasBaseReg is false, there is no base register.
  /// If Scale is zero, there is no ScaleReg.  Scale of 1 indicates a reg with
  /// no scale.
  /// If ScalableOffset is zero, there is no scalable offset.
```
IMO the BaseOffset and ScalableOffset are separate quantities that should not be conflated. This isn't like TypeSize where it needs to be one value that is fixed or scalable, it is two values that can be treated separately. (Which has the added benefit that all the backend that don't care about scalable vectors can keep not caring about them, as ScalableOffset will always be 0 and they can treat BaseOffs as a simple integer).

#88124 has quite a lot going on though, it is not obvious to me what this would mean for LSR to treat BaseOffset and ScalableOffset separately throughout?

https://github.com/llvm/llvm-project/pull/88113


More information about the llvm-commits mailing list