r230949 - Replace loop with equivalent ArrayRef function. NFC.

David Blaikie dblaikie at gmail.com
Mon Mar 2 11:32:18 PST 2015


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

> Author: d0k
> Date: Mon Mar  2 05:57:06 2015
> New Revision: 230949
>
> URL: http://llvm.org/viewvc/llvm-project?rev=230949&view=rev
> Log:
> Replace loop with equivalent ArrayRef function. NFC.
>
> Modified:
>     cfe/trunk/lib/CodeGen/TargetInfo.cpp
>
> Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=230949&r1=230948&r2=230949&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon Mar  2 05:57:06 2015
> @@ -6131,12 +6131,7 @@ private:
>
>      // Check if Ty is a usable substitute for the coercion type.
>      bool isUsableType(llvm::StructType *Ty) const {
> -      if (Ty->getNumElements() != Elems.size())
> -        return false;
> -      for (unsigned i = 0, e = Elems.size(); i != e; ++i)
> -        if (Elems[i] != Ty->getElementType(i))
> -          return false;
> -      return true;
> +      return llvm::makeArrayRef(Elems) == Ty->elements();
>

Shouldn't this work without the makeArrayRef call? (the RHS is already an
ArrayRef, and the LHS can be implicitly converted to one)


>      }
>
>      // Get the coercion type as a literal struct type.
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150302/2c5e9f7a/attachment.html>


More information about the cfe-commits mailing list