[PATCH] D149919: [SLP][NFC] Cleanup: Outline the code that vectorizes CmpInsts into a seaparate function.

Vasileios Porpodas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 09:23:10 PDT 2023


vporpo added inline comments.


================
Comment at: llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h:148
+  /// Tries to vectorize \p CmpInts. \Returns true on success.
+  bool vectorizeCmpInsts(const SmallVector<CmpInst *, 4> &CmpInsts,
+                         BasicBlock *BB, slpvectorizer::BoUpSLP &R);
----------------
ABataev wrote:
> ArrayRef<Value *>
Isn't it better to use `ArrayRef<CmpInst *>` instead of `ArrayRef<Value *>` ?


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:14417
+          return any_of(V->users(), [V](User *U) {
+            return isa<SelectInst>(U) && cast<SelectInst>(U)->getParent() !=
+                                             cast<Instruction>(V)->getParent();
----------------
ABataev wrote:
> try to replace with dyn_cast
What do you mean? Like this?
```
auto *Select = dyn_cast<SelectInst>(U);
return Select && Select->getParent() != cast<Instruction>(V)->getParent();
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149919



More information about the llvm-commits mailing list