[llvm] [TTI][CostModel] Add cost modeling for expandload and compressstore intrinsics (PR #122882)

Sergey Kachkov via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 04:39:23 PST 2025


================
@@ -1469,6 +1469,14 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
                                        true, CostKind);
   }
 
+  InstructionCost getConsecutiveMemoryOpCost(unsigned Opcode, Type *DataTy,
+                                             bool VariableMask, Align Alignment,
+                                             TTI::TargetCostKind CostKind,
+                                             const Instruction *I = nullptr) {
+    return getCommonMaskedMemoryOpCost(Opcode, DataTy, Alignment, VariableMask,
----------------
skachkov-sc wrote:

You are right, for now I've implemented cost of expandload/compressstore equivalently to masked gather/scatter. In fact, these intrinsics are processed slightly differently by scalarize-masked-mem-intrin pass (produced IR for both cases can be seen here: https://godbolt.org/z/734GvnG15), so we can teach getCommonMaskedMemoryOpCost this difference and use more precise estimation in future.

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


More information about the llvm-commits mailing list