[PATCH] D144770: [SLP] Outline GEP chain cost modeling into new TTI interface - NFCI.

Valeriy Dmitriev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 1 08:34:22 PST 2023


vdmitrie added inline comments.


================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h:1029
+                                       TTI::TargetCostKind CostKind) {
+    InstructionCost Cost = TTI::TCC_Free;
+
----------------
ABataev wrote:
> Add an assert that all geps are from the same basic block?
will do


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:7161
+    // loads/stores are known to be from/to adjacent locations.
+    if (isa<LoadInst, StoreInst>(VL0)) {
+      // Case 2: estimate costs for pointer related costs when vectorizing to
----------------
ABataev wrote:
> What if it is scatter vectorize node? VL0 still should be LoadInst.
We do not call this routine for scatter vectorize loads node. We did that in the past but that was a bug (since we evaluated GEPs twice as the result). For scatter vectorize we evaluate GEPs only when calculating cost for tree node that correspond to pointer operands of the loads. The comment above explains exactly that distinction.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144770/new/

https://reviews.llvm.org/D144770



More information about the llvm-commits mailing list