[llvm] r270753 - Simplify std::all_of/any_of predicates by using llvm::all_of/any_of. NFCI.

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 14:17:26 PDT 2016


I don't think you need to use the llvm:: namespace specifier.

On Wed, May 25, 2016 at 1:41 PM, Simon Pilgrim via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rksimon
> Date: Wed May 25 15:41:11 2016
> New Revision: 270753
>
> URL: http://llvm.org/viewvc/llvm-project?rev=270753&view=rev
> Log:
> Simplify std::all_of/any_of predicates by using llvm::all_of/any_of. NFCI.
>
> Modified:
>     llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
>
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=270753&r1=270752&r2=270753&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed May 25 15:41:11 2016
> @@ -4987,8 +4987,7 @@ static bool getTargetShuffleMask(SDNode
>
>    // Check if we're getting a shuffle mask with zero'd elements.
>    if (!AllowSentinelZero)
> -    if (std::any_of(Mask.begin(), Mask.end(),
> -                    [](int M){ return M == SM_SentinelZero; }))
> +    if (llvm::any_of(Mask, [](int M) { return M == SM_SentinelZero; }))
>        return false;
>
>    // If we have a fake unary shuffle, the shuffle mask is spread across
> two
> @@ -9748,7 +9747,7 @@ static SDValue lowerV8I16VectorShuffle(S
>                                                       Subtarget, DAG);
>    }
>
> -  assert(std::any_of(Mask.begin(), Mask.end(), isV1) &&
> +  assert(llvm::any_of(Mask, isV1) &&
>           "All single-input shuffles should be canonicalized to be
> V1-input "
>           "shuffles.");
>
> @@ -10149,7 +10148,7 @@ static SDValue lowerV16I8VectorShuffle(S
>      // Use a mask to drop the high bytes.
>      VLoHalf = DAG.getBitcast(MVT::v8i16, V);
>      VLoHalf = DAG.getNode(ISD::AND, DL, MVT::v8i16, VLoHalf,
> -                     DAG.getConstant(0x00FF, DL, MVT::v8i16));
> +                          DAG.getConstant(0x00FF, DL, MVT::v8i16));
>
>      // This will be a single vector shuffle instead of a blend so nuke
> VHiHalf.
>      VHiHalf = DAG.getUNDEF(MVT::v8i16);
> @@ -24494,12 +24493,11 @@ static bool combineX86ShufflesRecursivel
>    }
>
>    // Handle the all undef/zero cases early.
> -  if (std::all_of(Mask.begin(), Mask.end(),
> -                  [](int Idx) { return Idx == SM_SentinelUndef; })) {
> +  if (llvm::all_of(Mask, [](int Idx) { return Idx == SM_SentinelUndef;
> })) {
>      DCI.CombineTo(Root.getNode(), DAG.getUNDEF(Root.getValueType()));
>      return true;
>    }
> -  if (std::all_of(Mask.begin(), Mask.end(), [](int Idx) { return Idx < 0;
> })) {
> +  if (llvm::all_of(Mask, [](int Idx) { return Idx < 0; })) {
>      // TODO - should we handle the mixed zero/undef case as well? Just
> returning
>      // a zero mask will lose information on undef elements possibly
> reducing
>      // future combine possibilities.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160525/51250f30/attachment.html>


More information about the llvm-commits mailing list