[PATCH] D17191: [LoopVectorize] Annotate versioned loop with noalias metadata

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 13:02:56 PST 2016


mzolotukhin accepted this revision.
mzolotukhin added a reviewer: mzolotukhin.
This revision is now accepted and ready to land.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:449-455
@@ -447,2 +448,9 @@
 
+  /// \brief Propagate known metadata from one instruction to another.
+  void propagateMetadata(Instruction *To, const Instruction *From);
+
+  /// \brief Propagate known metadata from one instruction to a vector of
+  /// others.
+  void propagateMetadata(SmallVectorImpl<Value *> &To, const Instruction *From);
+
   /// This is a helper class that holds the vectorizer state. It maps scalar
----------------
anemet wrote:
> mzolotukhin wrote:
> > anemet wrote:
> > > mzolotukhin wrote:
> > > > These functions are generally useful, not only in LoopVectorizer - e.g. we have their duplicates in SLPVectorizer. While you're at it, could you please move them out to a common place (and commit as a separate change)?
> > > They are not really duplicates.  The one in LV copies from instruction to one/many.  The one in SLP copies many to one and merges them in the process in a metadata-specific way.
> > > 
> > > You can obviously still refactor the common parts or create a superset but I think that will probably be harder to read at the end.
> > > 
> > > What do you think?
> > That's true, but to me it looks like SLP version is just more general, where we need to merge several, potentially different sets of attributes. In LV case we can also think of such merging, but all the sets are the same, so the merge is trivial.
> > 
> > The reason I think it might be useful is that it's currently easy to forget to update both versions. E.g. when I added propagation of 'nontemporal' hints, I had to fix that in two very similar places.
> I would actually have a slight preference that for a new metadata each pass is carefully considered separately.  Look at the if-conversion comment in the LV version as an example.
> 
> But I don't feel very strongly about this, so if you want you can factor them out.
That sounds good to me.


http://reviews.llvm.org/D17191





More information about the llvm-commits mailing list