[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 8 10:10:05 PST 2023


vdmitrie 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,
----------------
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. 




================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:7201
+      if (PtrsRetainedInVecCode.size() == Ptrs.size())
+        VecCost = ScalarCost;
+      else
----------------
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.


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