[PATCH] D29425: [SLP] Use SCEV to sort memory accesses

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 02:07:02 PST 2017


ABataev added inline comments.


================
Comment at: lib/Analysis/LoopAccessAnalysis.cpp:1064
+                           SmallVectorImpl<Value *> &Sorted) {
+  SmallVector<std::pair<const SCEV *, Value *>, 4> OffValPairs;
+  Value *Obj = nullptr;
----------------
You can make `OffValPairs.reserve(VL.size())` and `Sorted.reserve(VL.size())` to avoid possible resize


================
Comment at: lib/Analysis/LoopAccessAnalysis.cpp:1083
+
+    OffValPairs.push_back(std::make_pair(SE.getSCEV(Ptr), Val));
   }
----------------
Better to use `OffValPairs.emplace_back(SE.getSCEV(Ptr), Val);`


https://reviews.llvm.org/D29425





More information about the llvm-commits mailing list