[PATCH] D45469: [SLP] Use getExtractWithExtendCost() to compute the scalar cost of extractelement/ext pair

Haicheng Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 13 12:39:20 PDT 2018


haicheng added inline comments.


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:2201
+                  all_of(Ext->users(),
+                         [](User *U) { return isa<GetElementPtrInst>(U); })) {
+                // Use getExtractWithExtendCost() to calculate the cost of
----------------
ABataev wrote:
> ABataev wrote:
> > I think you can use just `GetElementPtr::classof` here as a predicate. Also, it would be good to have negative test(s) for the situation where this should not work.
> No, I meant that instead of lambda you can just use `GetElementPtrInst::classof`
> ```
> llvm::all_of(Ext->users(), GetElementPtrInst::classof)
> ```
I tried, but I got this error when compiling

`llvm/ADT/STLExtras.h:846:6: note: candidate template ignored: couldn't infer template argument 'UnaryPredicate'`


Repository:
  rL LLVM

https://reviews.llvm.org/D45469





More information about the llvm-commits mailing list