[PATCH] D64700: [SLPVectorizer] [NFC] Avoid repetitive calls to getSameOpcode().

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 06:24:52 PDT 2019


ABataev added inline comments.


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:1283
+
+    void setOperations(InstructionsState *S) {
+      MainOp = S->MainOp;
----------------
ABataev wrote:
> const reference?
Not done.


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:1305
+
+    bool updateStateIfReorder() {
+      if (!ReorderIndices.empty()) {
----------------
ABataev wrote:
> Description?
Use `///` style of comments here


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:1356
   TreeEntry *newTreeEntry(ArrayRef<Value *> VL, bool Vectorized,
-                          const EdgeInfo &UserTreeIdx,
+                          InstructionsState *S, const EdgeInfo &UserTreeIdx,
                           ArrayRef<unsigned> ReuseShuffleIndices = None,
----------------
ABataev wrote:
> const reference?
Not done


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:2823
+  Instruction *VL0 = E->getMainOp();
+  unsigned ShuffleOrOp = E->isAltShuffle() ?
+               (unsigned) Instruction::ShuffleVector : E->getOpcode();
----------------
Seems to me, it is not formatted


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:3577
+  unsigned ShuffleOrOp = E->isAltShuffle() ?
+           (unsigned) Instruction::ShuffleVector : E->getOpcode();
   switch (ShuffleOrOp) {
----------------
Format?


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:3837
       if (IsReorder) {
-        S = getSameOpcode(E->Scalars, E->ReorderIndices.front());
-        VL0 = cast<Instruction>(S.OpValue);
+        E->updateStateIfReorder();
+        VL0 = E->getMainOp();
----------------
Why not:
```
bool IsReorder = E->updateStateIfReorder();
if (IsReorder)
....
```


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

https://reviews.llvm.org/D64700





More information about the llvm-commits mailing list