[PATCH] D114171: [SLP]Improve reductions analysis and emission, part 1.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 3 08:42:39 PST 2022


RKSimon added a comment.

A few minors



================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:8951
+        for (Value *V : Args)
+          ExtraArgs[TreeN] = V;
+        // Add reduction values. The values are sorted for better vectorization
----------------
This looks weird - as if we're reassigning different values to ExtraArgs[TreeN] - since we know Args.size()  < 2 - maybe something like this:
```
if (!Args.empty())
  ExtraArgs[TreeN] = Args[0];
```


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:9101
+          for (unsigned Cnt = 0, Sz = ReducedVals[I + 1].size(); Cnt < Sz;
+               ++Cnt) {
+            Value *RdxVal = TrackedVals.find(ReducedVals[I + 1][Cnt])->second;
----------------
for-range loop?


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:9263
+        for (unsigned Cnt = 0, NumReducedVals = Candidates.size();
+             Cnt < NumReducedVals; ++Cnt) {
+          Value *RdxVal = Candidates[Cnt];
----------------
Can we use a for-range loop here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114171



More information about the llvm-commits mailing list