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

Matthew Simpson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 07:54:50 PST 2017

mssimpso added inline comments.

Comment at: ../lib/Transforms/Vectorize/LoopVectorize.cpp:5556-5563
+bool LoopVectorizationCostModel::hasConsecutiveLikePtrOperand(Instruction *I,
+                                                              unsigned VF) {
+  if (VF > 1 && getWideningDecision(I, VF) == CM_DECISION_INTERLEAVE)
     return true;
   if (auto *Ptr = getPointerOperand(I))
-    return isConsecutivePtr(Ptr);
+    return Legal->isConsecutivePtr(Ptr);
   return false;
delena wrote:
> mssimpso wrote:
> > I don't think a see a real use for this function anymore. Please see my related comment about memoryAccessMustBeScalarized. This function was only ever used in collectLoopUniforms to help determine how a memory access would be vectorized. I think you can probably greatly simplify the logic in collectLoopUniforms and remove it. Now, we know what the vectorizer will do based the the cost model decision. 
> > 
> > For a GEP to remain uniform, I think we just need to know that all its users are CM_DECISION_INTERLEAVE or CM_DECISION_WIDEN. Is this right? If so, please work it into the GEP part of collectLoopUniforms.
> I removed mustBeScalarized(). (I suppose you meant this function, the lines are mixed up)
In this comment I was talking about hasConsecutiveLikePtrOperand. I don't think it's needed anymore and can probably be deleted. It's only used in collectLoopUniforms to help determine if a GEP will remain uniform. But can't we now determine that much easier by just checking the CM_DECISION of the accesses? Does that make sense?



More information about the llvm-commits mailing list