[llvm] 918e343 - [SanitizerCoverage] Use llvm::all_of (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 16 21:47:09 PST 2020


Thanks. Fixed thus:

https://reviews.llvm.org/rG5935952c3108c99bd865411845c4b02a6234a1d5

On Mon, Nov 16, 2020 at 7:04 PM David Blaikie <dblaikie at gmail.com> wrote:

> On Sun, Nov 15, 2020 at 7:01 PM Kazu Hirata via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> >
> >
> > Author: Kazu Hirata
> > Date: 2020-11-15T19:01:20-08:00
> > New Revision: 918e3439e20d068b3336febf084d7e11baa48311
> >
> > URL:
> https://github.com/llvm/llvm-project/commit/918e3439e20d068b3336febf084d7e11baa48311
> > DIFF:
> https://github.com/llvm/llvm-project/commit/918e3439e20d068b3336febf084d7e11baa48311.diff
> >
> > LOG: [SanitizerCoverage] Use llvm::all_of (NFC)
> >
> > Added:
> >
> >
> > Modified:
> >     llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
> >
> > Removed:
> >
> >
> >
> >
> ################################################################################
> > diff  --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
> b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
> > index 7e2d5260fb6c..f4f94edd3ce2 100644
> > --- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
> > +++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
> > @@ -519,29 +519,23 @@ bool ModuleSanitizerCoverage::instrumentModule(
> >
> >  // True if block has successors and it dominates all of them.
> >  static bool isFullDominator(const BasicBlock *BB, const DominatorTree
> *DT) {
> > -  if (succ_begin(BB) == succ_end(BB))
> > +  if (succ_empty(BB))
> >      return false;
> >
> > -  for (const BasicBlock *SUCC : make_range(succ_begin(BB),
> succ_end(BB))) {
> > -    if (!DT->dominates(BB, SUCC))
> > -      return false;
> > -  }
> > -
> > -  return true;
> > +  return llvm::all_of(successors(BB), [BB, DT](const BasicBlock *SUCC) {
> > +    return DT->dominates(BB, SUCC);
> > +  });
> >  }
> >
> >  // True if block has predecessors and it postdominates all of them.
> >  static bool isFullPostDominator(const BasicBlock *BB,
> >                                  const PostDominatorTree *PDT) {
> > -  if (pred_begin(BB) == pred_end(BB))
> > +  if (pred_empty(BB))
> >      return false;
> >
> > -  for (const BasicBlock *PRED : make_range(pred_begin(BB),
> pred_end(BB))) {
> > -    if (!PDT->dominates(BB, PRED))
> > -      return false;
> > -  }
> > -
> > -  return true;
> > +  return llvm::all_of(predecessors(BB), [BB, PDT](const BasicBlock
> *PRED) {
>
> Generally for locally scoped lambdas (ones that aren't captured/escape
> their scope) I'd suggest using "[&]" for captures as it makes changes
> to the code simpler - there's no need to think about which variables
> are or are not captured.
>
> > +    return PDT->dominates(BB, PRED);
> > +  });
> >  }
> >
> >  static bool shouldInstrumentBlock(const Function &F, const BasicBlock
> *BB,
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > https://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/20201116/817fd4ac/attachment.html>


More information about the llvm-commits mailing list