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

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 07:36:33 PDT 2024


================
@@ -2571,14 +2571,15 @@ bool ARMTTIImpl::preferPredicatedReductionSelect(
 }
 
 InstructionCost ARMTTIImpl::getScalingFactorCost(Type *Ty, GlobalValue *BaseGV,
-                                                 int64_t BaseOffset,
+                                                 StackOffset BaseOffset,
                                                  bool HasBaseReg, int64_t Scale,
                                                  unsigned AddrSpace) const {
   TargetLoweringBase::AddrMode AM;
   AM.BaseGV = BaseGV;
-  AM.BaseOffs = BaseOffset;
+  AM.BaseOffs = BaseOffset.getFixed();
   AM.HasBaseReg = HasBaseReg;
   AM.Scale = Scale;
+  assert(!BaseOffset.getScalable() && "Scalable offsets unsupported");
----------------
paulwalker-arm wrote:

I'm not sure this is necessary.  I'd just assign `AM.ScalableOffset` as normal.  It's really up to the users of `AM` to assert `ScalableOffset` is zero.  This is essentially what would need to happen is `AM` used the correct types to start within.

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


More information about the llvm-commits mailing list