[llvm] r230965 - SLPVectorizer: Rewrite ArrayRef slice compare to be more idiomatic.
Benjamin Kramer
benny.kra at gmail.com
Mon Mar 2 12:34:28 PST 2015
On Mon, Mar 2, 2015 at 7:43 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>
> 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?
Currently ArrayRef::operator== requires both sides to be of the same
type (here it's Value * and WeakVH which implicitly converts to Value
*). This could be solved by making it a template, but I'm not sure
about the implications of that.
- Ben
>
>>
>> }
>>
>> 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
>
>
More information about the llvm-commits
mailing list