[PATCH] D113856: [llvm-reduce] Move code to check chunk to lambda, to enable reuse (NFC).

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 14 11:23:53 PST 2021


dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.

Might even be worth pulling out as a named function - given how long the outer function is.



================
Comment at: llvm/tools/llvm-reduce/deltas/Delta.cpp:146-147
+    // modified module if the chunk resulted in a reduction.
+    auto CheckChunk = [&UninterestingChunks, &Test, &ExtractChunksFromModule,
+                       &ChunksStillConsideredInteresting](
+                          Chunk &ChunkToCheckForUninterestingness)
----------------
Usually I'd suggest any lambda that doesn't escape its scope should default capture by ref `[&]` rather than enumerating the captures (since it's like any other local scope - like a loop, etc - and should have access to all local variables without needing to declare them) - but given the intended direction involves parallelism, I'm with you here that it's good to enumerate the captures to avoid using some shared state accidentally that isn't thread safe.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113856/new/

https://reviews.llvm.org/D113856



More information about the llvm-commits mailing list