[PATCH] D29900: [SLP] Fix for PR31879: vectorize repeated scalar ops that don't get put back into a vector

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 07:11:20 PST 2017


hfinkel accepted this revision.
hfinkel added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:1663
           Instruction *E = cast<Instruction>(VL[i]);
-          if (E->hasOneUse())
+          if (E->hasOneUse() ||
+              std::all_of(E->user_begin(), E->user_end(), [this](User *U) {
----------------
ABataev wrote:
> hfinkel wrote:
> > Why is the hasOneUse check still needed if we're checking the ScalarToTreeEntry map? Or is this just a microoptimization?
> > 
> Yes, it is a microoptimization. If we have only onlу user, this user will be vectorized/removed for sure
Okay, please add a comment explaining that. Otherwise, LGTM.


Repository:
  rL LLVM

https://reviews.llvm.org/D29900





More information about the llvm-commits mailing list