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

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 8 10:16:05 PST 2023


ABataev added inline comments.


================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h:1032-1033
+        find_if(Ptrs, [](const Value *V) { return isa<GetElementPtrInst>(V); });
+    if (It == Ptrs.end())
+      return TTI::TCC_Free;
+    assert(all_of(Ptrs,
----------------
vdmitrie wrote:
> ABataev wrote:
> > Can it happen at all?
> Technically, yes. Ptrs is not prohibited to contain just single Base entry (which can be a value or a non-GEP instruction). How practical such use would be is the different kind of question.
> If we make the assertion stricter by adding add It != Ptrs.end()  we anyway have to add ugly fake use for "It" to avoid build time warning when assertions are suppressed. 
> 
> 
Can you add some extra asserts that if there is a single Base, other elements are Undefs/Poisons?


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:7201
+      if (PtrsRetainedInVecCode.size() == Ptrs.size())
+        VecCost = ScalarCost;
+      else
----------------
vdmitrie wrote:
> ABataev wrote:
> > Better just return here with diff 0.
> I'd like to not bypass the debug printer in this case.
> So here are couple of options:
> 1 - leave it as is
> 2 -add debug printer prior to the early re
> turn.
>  Pls let me know which way would you prefer.
Debug print and early exit


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