[PATCH] D27919: [Loop Vectorizer] Interleave vs Gather - in some cases Gather is better.

Elena Demikhovsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 04:44:27 PST 2017


delena marked an inline comment as done.
delena added inline comments.


================
Comment at: ../lib/Transforms/Vectorize/LoopVectorize.cpp:7072-7080
+      InstWidening Decision;
+      if (InterleaveInstCost <= GatherScatterCost &&
+          InterleaveInstCost <= ScalarizationCost)
+        Decision = CM_DECISION_INTERLEAVE;
+      else if (GatherScatterCost < InterleaveInstCost &&
+               GatherScatterCost < ScalarizationCost)
+        Decision = CM_DECISION_GATHER_SCATTER;
----------------
mssimpso wrote:
> I think we're fairly consistent in other places where we compare costs, that we prefer the scalar version if there's no benefit for vectorization. So if the scalarization cost is <= the other costs, I think we should go with that.
Agree. I've changed the comparison.


================
Comment at: ../lib/Transforms/Vectorize/LoopVectorize.cpp:7255-7284
       auto Group = Legal->getInterleavedAccessGroup(I);
       assert(Group && "Fail to get an interleaved access group.");
 
       // Only calculate the cost once at the insert position.
       if (Group->getInsertPos() != I)
         return 0;
 
----------------
mssimpso wrote:
> Can't this all be replaced by a call to getInterleaveGroupCost()?
I reached the conclusion that we don't need to calculate the cost again. We can keep it together with widening decision.


Repository:
  rL LLVM

https://reviews.llvm.org/D27919





More information about the llvm-commits mailing list