[PATCH] D26924: [CodeGenPrepare] Rewrite a loop in terms of llvm::none_of. NFC.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 10:25:55 PST 2016


Looks good to me - seems reasonable for post-commit review, FWIW.

(you might need llvm::none_of, or it might get confused with std::none_of
(if AddrModeInsts is a standard container/from the std namespace ADL would
kick in, etc))

On Mon, Nov 21, 2016 at 10:23 AM Justin Lebar via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> jlebar created this revision.
> jlebar added a reviewer: arsenm.
> jlebar added a subscriber: llvm-commits.
> Herald added a subscriber: wdng.
>
> https://reviews.llvm.org/D26924
>
> Files:
>   llvm/lib/CodeGen/CodeGenPrepare.cpp
>
>
> Index: llvm/lib/CodeGen/CodeGenPrepare.cpp
> ===================================================================
> --- llvm/lib/CodeGen/CodeGenPrepare.cpp
> +++ llvm/lib/CodeGen/CodeGenPrepare.cpp
> @@ -3813,18 +3813,10 @@
>    }
>    TPT.commit();
>
> -  // Check to see if any of the instructions supersumed by this addr mode
> are
> -  // non-local to I's BB.
> -  bool AnyNonLocal = false;
> -  for (unsigned i = 0, e = AddrModeInsts.size(); i != e; ++i) {
> -    if (IsNonLocalValue(AddrModeInsts[i], MemoryInst->getParent())) {
> -      AnyNonLocal = true;
> -      break;
> -    }
> -  }
> -
>    // If all the instructions matched are already in this BB, don't do
> anything.
> -  if (!AnyNonLocal) {
> +  if (none_of(AddrModeInsts, [&](Value *V) {
> +        return IsNonLocalValue(V, MemoryInst->getParent());
> +      })) {
>      DEBUG(dbgs() << "CGP: Found      local addrmode: " << AddrMode <<
> "\n");
>      return false;
>    }
>
>
> _______________________________________________
> 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/20161121/89e11172/attachment.html>


More information about the llvm-commits mailing list