[PATCH] D80241: [SLP] PR45269 Fix getVectorElementSize() is slow

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 19 14:53:50 PDT 2020


ABataev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5355-5357
+    auto E = InstrElementSize.find(Inst);
+    if (E != InstrElementSize.end())
+      return E->second;
----------------
This code can be moved out of the if statement. Make `InstrElementSize` to use `Value *` as a key and check if `V` is processed already before the declaration of `Worklist` and `Visited` vars.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5387
         if (auto *J = dyn_cast<Instruction>(U.get()))
-          if (Visited.insert(J).second)
+          if (P == J->getParent() && Visited.insert(J).second)
             Worklist.push_back(J);
----------------
Why do you need this change? 


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

https://reviews.llvm.org/D80241





More information about the llvm-commits mailing list