[llvm] r230965 - SLPVectorizer: Rewrite ArrayRef slice compare to be more idiomatic.

David Blaikie dblaikie at gmail.com
Mon Mar 2 10:43:17 PST 2015


On Mon, Mar 2, 2015 at 7:24 AM, Benjamin Kramer <benny.kra at googlemail.com>
wrote:

> Author: d0k
> Date: Mon Mar  2 09:24:36 2015
> New Revision: 230965
>
> URL: http://llvm.org/viewvc/llvm-project?rev=230965&view=rev
> Log:
> SLPVectorizer: Rewrite ArrayRef slice compare to be more idiomatic.
>
> NFC intended.
>
> Modified:
>     llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
>
> Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=230965&r1=230964&r2=230965&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
> +++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Mon Mar  2
> 09:24:36 2015
> @@ -3178,15 +3178,11 @@ private:
>  /// the WeakVH array.
>  /// Vectorization of part of the VL array may cause later values in the
> VL array
>  /// to become invalid. We track when this has happened in the WeakVH
> array.
> -static bool hasValueBeenRAUWed(ArrayRef<Value *> &VL,
> -                               SmallVectorImpl<WeakVH> &VH,
> -                               unsigned SliceBegin,
> -                               unsigned SliceSize) {
> -  for (unsigned i = SliceBegin; i < SliceBegin + SliceSize; ++i)
> -    if (VH[i] != VL[i])
> -      return true;
> -
> -  return false;
> +static bool hasValueBeenRAUWed(ArrayRef<Value *> VL, ArrayRef<WeakVH> VH,
> +                               unsigned SliceBegin, unsigned SliceSize) {
> +  VL = VL.slice(SliceBegin, SliceSize);
> +  VH = VH.slice(SliceBegin, SliceSize);
> +  return !std::equal(VL.begin(), VL.end(), VH.begin());
>

Can we not just "return VL == VH;" here?


>  }
>
>  bool SLPVectorizer::vectorizeStoreChain(ArrayRef<Value *> Chain,
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150302/e2eb385b/attachment.html>


More information about the llvm-commits mailing list